Skip to content

Commit 2c4a0a7

Browse files
authored
Rollup merge of rust-lang#45783 - kennytm:compiler-test-fixes, r=alexcrichton
Miscellaneous changes for CI, Docker and compiletest. This PR contains 7 independent commits that improves interaction with CI, Docker and compiletest. 1. a4e5c91 — Forces a newline every 100 dots when testing in quiet mode. Prevents spurious timeouts when abusing the CI to test Android jobs. 2. 1b5aaf2 — Use vault.centos.org for dist-powerpc64le-linux, see rust-lang#45744. 3. 33400fb — Modify `src/ci/docker/run.sh` so that the docker images can be run from Docker Toolbox for Windows on Windows 7. I haven't checked the behavior of the newer Docker for Windows on Windows 10. Also, "can run" does not mean all the test can pass successfully (the UDP tests failed last time I checked) 4. d517668 — Don't emit a real warning the linker segfault, which affects UI tests like rust-lang#45489 (comment). Log it instead. 5. 51e2247 — During run-pass, trim the output if stdout/stderr exceeds 416 KB (top 160 KB + bottom 256 KB). This is an attempt to avoid spurious failures like rust-lang#45384 (comment) 6. 9cfdaba — Force `gem update --system` before deploy. This is an attempt to prevent spurious error rust-lang#44159. 7. eee10cc — Tries to print the crash log on macOS on failure. This is an attempt to debug rust-lang#45230.
2 parents d5ff0e6 + eee10cc commit 2c4a0a7

File tree

12 files changed

+394
-28
lines changed

12 files changed

+394
-28
lines changed

.travis.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,14 @@ after_failure:
253253

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

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

290298
deploy:
291299
- provider: s3

src/Cargo.lock

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ci/docker/README.md

+46-4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,48 @@ Images will output artifacts in an `obj` dir at the root of a repository.
2222
- `scripts` contains files shared by docker images
2323
- `disabled` contains images that are not built on travis
2424

25+
## Docker Toolbox on Windows
26+
27+
For Windows before Windows 10, the docker images can be run on Windows via
28+
[Docker Toolbox]. There are several preparation needs to be made before running
29+
a Docker image.
30+
31+
1. Stop the virtual machine from the terminal with `docker-machine stop`
32+
33+
2. If your Rust source is placed outside of `C:\Users\**`, e.g. if you place the
34+
repository in the `E:\rust` folder, please add a shared folder from
35+
VirtualBox by:
36+
37+
1. Select the "default" virtual machine inside VirtualBox, then click
38+
"Settings"
39+
2. Go to "Shared Folders", click "Add shared foldrer" (the folder icon with
40+
a plus sign), fill in the following information, then click "OK":
41+
42+
* Folder path: `E:\rust`
43+
* Folder name: `e/rust`
44+
* Read-only: ☐ *unchecked*
45+
* Auto-mount: ☑ *checked*
46+
* Make Permanant: ☑ *checked*
47+
48+
3. VirtualBox might not support creating symbolic links inside a shared folder
49+
by default. You can enable it manually by running these from `cmd.exe`:
50+
51+
```bat
52+
cd "C:\Program Files\Oracle\VirtualBox"
53+
VBoxManage setextradata default VBoxInternal2/SharedFoldersEnableSymlinksCreate/e/rust 1
54+
:: ^~~~~~
55+
:: folder name
56+
```
57+
58+
4. Restart the virtual machine from terminal with `docker-machine start`.
59+
60+
To run the image,
61+
62+
1. Launch the "Docker Quickstart Terminal".
63+
2. Execute `./src/ci/docker/run.sh $image_name` as explained at the beginning.
64+
65+
[Docker Toolbox]: https://www.docker.com/products/docker-toolbox
66+
2567
## Cross toolchains
2668
2769
A number of these images take quite a long time to compile as they're building
@@ -137,7 +179,7 @@ For targets: `armv7-unknown-linux-gnueabihf`
137179
libraries like jemalloc. See the mk/cfg/arm(v7)-uknown-linux-gnueabi{,hf}.mk
138180
file in Rust's source code.
139181
140-
## `aarch64-linux-gnu.config`
182+
### `aarch64-linux-gnu.config`
141183
142184
For targets: `aarch64-unknown-linux-gnu`
143185
@@ -150,7 +192,7 @@ For targets: `aarch64-unknown-linux-gnu`
150192
- C compiler > gcc version = 5.2.0
151193
- C compiler > C++ = ENABLE -- to cross compile LLVM
152194
153-
## `powerpc-linux-gnu.config`
195+
### `powerpc-linux-gnu.config`
154196
155197
For targets: `powerpc-unknown-linux-gnu`
156198
@@ -165,7 +207,7 @@ For targets: `powerpc-unknown-linux-gnu`
165207
- C compiler > gcc version = 4.9.3
166208
- C compiler > C++ = ENABLE -- to cross compile LLVM
167209
168-
## `powerpc64-linux-gnu.config`
210+
### `powerpc64-linux-gnu.config`
169211
170212
For targets: `powerpc64-unknown-linux-gnu`
171213
@@ -184,7 +226,7 @@ For targets: `powerpc64-unknown-linux-gnu`
184226
185227
(+) These CPU options match the configuration of the toolchains in RHEL6.
186228
187-
## `s390x-linux-gnu.config`
229+
### `s390x-linux-gnu.config`
188230
189231
For targets: `s390x-unknown-linux-gnu`
190232

src/ci/docker/dist-powerpc64le-linux/build-powerpc64le-toolchain.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ SYSROOT=/usr/local/$TARGET/sysroot
2323
mkdir -p $SYSROOT
2424
pushd $SYSROOT
2525

26-
centos_base=http://mirror.centos.org/altarch/7/os/ppc64le/Packages
27-
glibc_v=2.17-196.el7
28-
kernel_v=3.10.0-693.el7
26+
centos_base=http://vault.centos.org/altarch/7.3.1611/os/ppc64le/Packages/
27+
glibc_v=2.17-157.el7
28+
kernel_v=3.10.0-514.el7
2929
for package in glibc{,-devel,-headers}-$glibc_v kernel-headers-$kernel_v; do
3030
curl $centos_base/$package.ppc64le.rpm | \
3131
rpm2cpio - | cpio -idm

src/ci/docker/run.sh

+11-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
set -e
1313

14+
export MSYS_NO_PATHCONV=1
15+
1416
script=`cd $(dirname $0) && pwd`/`basename $0`
1517
image=$1
1618

@@ -25,12 +27,19 @@ travis_fold start build_docker
2527
travis_time_start
2628

2729
if [ -f "$docker_dir/$image/Dockerfile" ]; then
30+
dockerfile="$docker_dir/$image/Dockerfile"
31+
if [ -x /usr/bin/cygpath ]; then
32+
context="`cygpath -w $docker_dir`"
33+
dockerfile="`cygpath -w $dockerfile`"
34+
else
35+
context="$docker_dir"
36+
fi
2837
retry docker \
2938
build \
3039
--rm \
3140
-t rust-ci \
32-
-f "$docker_dir/$image/Dockerfile" \
33-
"$docker_dir"
41+
-f "$dockerfile" \
42+
"$context"
3443
elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
3544
if [ -n "$TRAVIS_OS_NAME" ]; then
3645
echo Cannot run disabled images on travis!

src/librustc_trans/back/link.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -671,11 +671,12 @@ fn link_natively(sess: &Session,
671671
break
672672
}
673673

674-
sess.struct_warn("looks like the linker segfaulted when we tried to \
675-
call it, automatically retrying again")
676-
.note(&format!("{:?}", cmd))
677-
.note(&out)
678-
.emit();
674+
warn!(
675+
"looks like the linker segfaulted when we tried to call it, \
676+
automatically retrying again. cmd = {:?}, out = {}.",
677+
cmd,
678+
out,
679+
);
679680
}
680681

681682
match prog {

src/libtest/lib.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ use std::thread;
7171
use std::time::{Instant, Duration};
7272

7373
const TEST_WARN_TIMEOUT_S: u64 = 60;
74+
const QUIET_MODE_MAX_COLUMN: usize = 100; // insert a '\n' after 100 tests in quiet mode
7475

7576
// to be used by rustc to compile tests in libtest
7677
pub mod test {
@@ -614,7 +615,14 @@ impl<T: Write> ConsoleTestState<T> {
614615
pub fn write_short_result(&mut self, verbose: &str, quiet: &str, color: term::color::Color)
615616
-> io::Result<()> {
616617
if self.quiet {
617-
self.write_pretty(quiet, color)
618+
self.write_pretty(quiet, color)?;
619+
if self.current_test_count() % QUIET_MODE_MAX_COLUMN == QUIET_MODE_MAX_COLUMN - 1 {
620+
// we insert a new line every 100 dots in order to flush the
621+
// screen when dealing with line-buffered output (e.g. piping to
622+
// `stamp` in the rust CI).
623+
self.write_plain("\n")?;
624+
}
625+
Ok(())
618626
} else {
619627
self.write_pretty(verbose, color)?;
620628
self.write_plain("\n")
@@ -771,9 +779,12 @@ impl<T: Write> ConsoleTestState<T> {
771779
Ok(())
772780
}
773781

782+
fn current_test_count(&self) -> usize {
783+
self.passed + self.failed + self.ignored + self.measured + self.allowed_fail
784+
}
785+
774786
pub fn write_run_finish(&mut self) -> io::Result<bool> {
775-
assert!(self.passed + self.failed + self.ignored + self.measured +
776-
self.allowed_fail == self.total);
787+
assert!(self.current_test_count() == self.total);
777788

778789
if self.options.display_output {
779790
self.write_outputs()?;

src/tools/compiletest/Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ getopts = "0.2"
1111
log = "0.3"
1212
rustc-serialize = "0.3"
1313
libc = "0.2"
14+
15+
[target.'cfg(windows)'.dependencies]
16+
miow = "0.2"
17+
winapi = "0.2"

src/tools/compiletest/src/main.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
#![crate_name = "compiletest"]
1212

1313
#![feature(test)]
14+
#![feature(slice_rotate)]
1415

1516
#![deny(warnings)]
1617

17-
#[cfg(any(target_os = "macos", target_os = "ios"))]
18+
#[cfg(unix)]
1819
extern crate libc;
1920
extern crate test;
2021
extern crate getopts;
@@ -47,6 +48,7 @@ pub mod runtest;
4748
pub mod common;
4849
pub mod errors;
4950
mod raise_fd_limit;
51+
mod read2;
5052

5153
fn main() {
5254
env_logger::init().unwrap();

0 commit comments

Comments
 (0)