Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miscellaneous changes for CI, Docker and compiletest. #45783

Merged
merged 7 commits into from
Nov 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,14 @@ after_failure:

# Random attempt at debugging currently. Just poking around in here to see if
# anything shows up.
- ls $HOME/Library/Logs/DiagnosticReports/
- ls -lat $HOME/Library/Logs/DiagnosticReports/
- find $HOME/Library/Logs/DiagnosticReports/ ! \(
-name '*.stage2-*.crash'
-name 'com.apple.CoreSimulator.CoreSimulatorService-*.crash'
\)
-exec echo -e travis_fold":start:crashlog\n\033[31;1m" {} "\033[0m" \;
-exec head -750 {} \;
-exec echo travis_fold":"end:crashlog \;

# attempt to debug anything killed by the oom killer on linux, just to see if
# it happened
Expand Down Expand Up @@ -286,6 +293,7 @@ before_deploy:
rm -rf obj/build/dist/doc &&
cp -r obj/build/dist/* deploy/$TRAVIS_COMMIT;
fi
- travis_retry gem update --system

deploy:
- provider: s3
Expand Down
2 changes: 2 additions & 0 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 46 additions & 4 deletions src/ci/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,48 @@ Images will output artifacts in an `obj` dir at the root of a repository.
- `scripts` contains files shared by docker images
- `disabled` contains images that are not built on travis

## Docker Toolbox on Windows

For Windows before Windows 10, the docker images can be run on Windows via
[Docker Toolbox]. There are several preparation needs to be made before running
a Docker image.

1. Stop the virtual machine from the terminal with `docker-machine stop`

2. If your Rust source is placed outside of `C:\Users\**`, e.g. if you place the
repository in the `E:\rust` folder, please add a shared folder from
VirtualBox by:

1. Select the "default" virtual machine inside VirtualBox, then click
"Settings"
2. Go to "Shared Folders", click "Add shared foldrer" (the folder icon with
a plus sign), fill in the following information, then click "OK":

* Folder path: `E:\rust`
* Folder name: `e/rust`
* Read-only: ☐ *unchecked*
* Auto-mount: ☑ *checked*
* Make Permanant: ☑ *checked*

3. VirtualBox might not support creating symbolic links inside a shared folder
by default. You can enable it manually by running these from `cmd.exe`:

```bat
cd "C:\Program Files\Oracle\VirtualBox"
VBoxManage setextradata default VBoxInternal2/SharedFoldersEnableSymlinksCreate/e/rust 1
:: ^~~~~~
:: folder name
```

4. Restart the virtual machine from terminal with `docker-machine start`.

To run the image,

1. Launch the "Docker Quickstart Terminal".
2. Execute `./src/ci/docker/run.sh $image_name` as explained at the beginning.

[Docker Toolbox]: https://www.docker.com/products/docker-toolbox

## Cross toolchains

A number of these images take quite a long time to compile as they're building
Expand Down Expand Up @@ -137,7 +179,7 @@ For targets: `armv7-unknown-linux-gnueabihf`
libraries like jemalloc. See the mk/cfg/arm(v7)-uknown-linux-gnueabi{,hf}.mk
file in Rust's source code.

## `aarch64-linux-gnu.config`
### `aarch64-linux-gnu.config`

For targets: `aarch64-unknown-linux-gnu`

Expand All @@ -150,7 +192,7 @@ For targets: `aarch64-unknown-linux-gnu`
- C compiler > gcc version = 5.2.0
- C compiler > C++ = ENABLE -- to cross compile LLVM

## `powerpc-linux-gnu.config`
### `powerpc-linux-gnu.config`

For targets: `powerpc-unknown-linux-gnu`

Expand All @@ -165,7 +207,7 @@ For targets: `powerpc-unknown-linux-gnu`
- C compiler > gcc version = 4.9.3
- C compiler > C++ = ENABLE -- to cross compile LLVM

## `powerpc64-linux-gnu.config`
### `powerpc64-linux-gnu.config`

For targets: `powerpc64-unknown-linux-gnu`

Expand All @@ -184,7 +226,7 @@ For targets: `powerpc64-unknown-linux-gnu`

(+) These CPU options match the configuration of the toolchains in RHEL6.

## `s390x-linux-gnu.config`
### `s390x-linux-gnu.config`

For targets: `s390x-unknown-linux-gnu`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ SYSROOT=/usr/local/$TARGET/sysroot
mkdir -p $SYSROOT
pushd $SYSROOT

centos_base=http://mirror.centos.org/altarch/7/os/ppc64le/Packages
glibc_v=2.17-196.el7
kernel_v=3.10.0-693.el7
centos_base=http://vault.centos.org/altarch/7.3.1611/os/ppc64le/Packages/
glibc_v=2.17-157.el7
kernel_v=3.10.0-514.el7
for package in glibc{,-devel,-headers}-$glibc_v kernel-headers-$kernel_v; do
curl $centos_base/$package.ppc64le.rpm | \
rpm2cpio - | cpio -idm
Expand Down
13 changes: 11 additions & 2 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

set -e

export MSYS_NO_PATHCONV=1

script=`cd $(dirname $0) && pwd`/`basename $0`
image=$1

Expand All @@ -25,12 +27,19 @@ travis_fold start build_docker
travis_time_start

if [ -f "$docker_dir/$image/Dockerfile" ]; then
dockerfile="$docker_dir/$image/Dockerfile"
if [ -x /usr/bin/cygpath ]; then
context="`cygpath -w $docker_dir`"
dockerfile="`cygpath -w $dockerfile`"
else
context="$docker_dir"
fi
retry docker \
build \
--rm \
-t rust-ci \
-f "$docker_dir/$image/Dockerfile" \
"$docker_dir"
-f "$dockerfile" \
"$context"
elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
if [ -n "$TRAVIS_OS_NAME" ]; then
echo Cannot run disabled images on travis!
Expand Down
11 changes: 6 additions & 5 deletions src/librustc_trans/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,12 @@ fn link_natively(sess: &Session,
break
}

sess.struct_warn("looks like the linker segfaulted when we tried to \
call it, automatically retrying again")
.note(&format!("{:?}", cmd))
.note(&out)
.emit();
warn!(
"looks like the linker segfaulted when we tried to call it, \
automatically retrying again. cmd = {:?}, out = {}.",
cmd,
out,
);
}

match prog {
Expand Down
17 changes: 14 additions & 3 deletions src/libtest/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ use std::thread;
use std::time::{Instant, Duration};

const TEST_WARN_TIMEOUT_S: u64 = 60;
const QUIET_MODE_MAX_COLUMN: usize = 100; // insert a '\n' after 100 tests in quiet mode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, I thought we printed "test xxx has run longer than 60s..." and that'd flush stdout, right? Or is that not getting printed in quiet mode?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcrichton The problem is that in quiet mode all dots were in a single line. We have >2000 run-pass tests, and only 30 minutes to spend, which means every test must complete within <0.9s to not to trigger Travis.

(Alternatively, we could fix stamp to output the dot immediately, instead of waiting for a \n.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh dear that's a good point! Sounds like we should definitely keep this.

I'd also be ok changing stamp though if you'd prefer. I'd imagine that we could basically print the timestamp for the first byte of each line instead of for the newline character of each line.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought of updating stamp too, but that would require total rewrite in nonblocking mode I think.

Printing the timestamp when seeing the first byte of a line doesn't work, because Travis will still need to wait for the second to the last byte of the line. So stamp actually needs to do something like

loop {
    let output = await!(stdin.read_as_much_as_possible());
    if output.is_eof() { break; }
    println!("{}", output.text().replace("\n", timestamp));
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm I'll send a PR, I don't think we'll have to do this but I'll see if I can game it out.


// to be used by rustc to compile tests in libtest
pub mod test {
Expand Down Expand Up @@ -614,7 +615,14 @@ impl<T: Write> ConsoleTestState<T> {
pub fn write_short_result(&mut self, verbose: &str, quiet: &str, color: term::color::Color)
-> io::Result<()> {
if self.quiet {
self.write_pretty(quiet, color)
self.write_pretty(quiet, color)?;
if self.current_test_count() % QUIET_MODE_MAX_COLUMN == QUIET_MODE_MAX_COLUMN - 1 {
// we insert a new line every 100 dots in order to flush the
// screen when dealing with line-buffered output (e.g. piping to
// `stamp` in the rust CI).
self.write_plain("\n")?;
}
Ok(())
} else {
self.write_pretty(verbose, color)?;
self.write_plain("\n")
Expand Down Expand Up @@ -771,9 +779,12 @@ impl<T: Write> ConsoleTestState<T> {
Ok(())
}

fn current_test_count(&self) -> usize {
self.passed + self.failed + self.ignored + self.measured + self.allowed_fail
}

pub fn write_run_finish(&mut self) -> io::Result<bool> {
assert!(self.passed + self.failed + self.ignored + self.measured +
self.allowed_fail == self.total);
assert!(self.current_test_count() == self.total);

if self.options.display_output {
self.write_outputs()?;
Expand Down
4 changes: 4 additions & 0 deletions src/tools/compiletest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ getopts = "0.2"
log = "0.3"
rustc-serialize = "0.3"
libc = "0.2"

[target.'cfg(windows)'.dependencies]
miow = "0.2"
winapi = "0.2"
4 changes: 3 additions & 1 deletion src/tools/compiletest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@
#![crate_name = "compiletest"]

#![feature(test)]
#![feature(slice_rotate)]

#![deny(warnings)]

#[cfg(any(target_os = "macos", target_os = "ios"))]
#[cfg(unix)]
extern crate libc;
extern crate test;
extern crate getopts;
Expand Down Expand Up @@ -47,6 +48,7 @@ pub mod runtest;
pub mod common;
pub mod errors;
mod raise_fd_limit;
mod read2;

fn main() {
env_logger::init().unwrap();
Expand Down
Loading