Skip to content

Commit 2786870

Browse files
committed
reduce threads spawned by ui-tests
the test harness already spawns enough tests for all cores, individual tests should keep their own threading to a minimum to avoid context switch overhead some tests fail with 1 CGU, so explicit compile flags have been added to keep their old behavior
1 parent aef1140 commit 2786870

10 files changed

+19
-5
lines changed

src/bootstrap/test.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1156,13 +1156,15 @@ note: if you're sure you want to do this, please open an issue as to why. In the
11561156
hostflags.push(format!("-Lnative={}", builder.test_helpers_out(compiler.host).display()));
11571157
if builder.is_fuse_ld_lld(compiler.host) {
11581158
hostflags.push("-Clink-args=-fuse-ld=lld".to_string());
1159+
hostflags.push("-Clink-arg=-Wl,--threads=1".to_string());
11591160
}
11601161
cmd.arg("--host-rustcflags").arg(hostflags.join(" "));
11611162

11621163
let mut targetflags = flags;
11631164
targetflags.push(format!("-Lnative={}", builder.test_helpers_out(target).display()));
11641165
if builder.is_fuse_ld_lld(target) {
11651166
targetflags.push("-Clink-args=-fuse-ld=lld".to_string());
1167+
targetflags.push("-Clink-arg=-Wl,--threads=1".to_string());
11661168
}
11671169
cmd.arg("--target-rustcflags").arg(targetflags.join(" "));
11681170

src/test/ui/asm/sym.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
// min-llvm-version: 10.0.1
2+
// FIXME(#84025): codegen-units=1 leads to linkage errors
3+
// compile-flags: -C codegen-units=2
24
// only-x86_64
35
// only-linux
46
// run-pass

src/test/ui/extern/issue-64655-allow-unwind-when-calling-panic-directly.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919

2020
// revisions: no thin fat
2121
//[no]compile-flags: -C lto=no
22-
//[thin]compile-flags: -C lto=thin
22+
// FIXME(#83854) running this revision with 1 CGU triggers llvm assert in register allocator
23+
// when executed in i686-gnu-nopt runner.
24+
//[thin]compile-flags: -C lto=thin -Ccodegen-units=2
2325
//[fat]compile-flags: -C lto=fat
2426

2527
#![feature(core_panic)]

src/test/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
//[no1]compile-flags: -C opt-level=1 -C lto=no
4141
//[no2]compile-flags: -C opt-level=2 -C lto=no
4242
//[no3]compile-flags: -C opt-level=3 -C lto=no
43-
//[thin0]compile-flags: -C opt-level=0 -C lto=thin
43+
// FIXME(#83854) running this revision with 1 CGU triggers llvm assert in register allocator
44+
// when executed in dist-i586-gnu-i586-i686-musl runner.
45+
//[thin0]compile-flags: -C opt-level=0 -C lto=thin -Ccodegen-units=2
4446
//[thin1]compile-flags: -C opt-level=1 -C lto=thin
4547
//[thin2]compile-flags: -C opt-level=2 -C lto=thin
4648
//[thin3]compile-flags: -C opt-level=3 -C lto=thin

src/test/ui/issues/issue-69225-SCEVAddExpr-wrap-flag.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// run-fail
22
// compile-flags: -C opt-level=3
3+
// min-llvm-version: 11.0
34
// error-pattern: index out of bounds: the len is 0 but the index is 16777216
45
// ignore-wasm no panic or subprocess support
56
// ignore-emscripten no panic or subprocess support

src/test/ui/linkage-attr/linkage-detect-extern-generated-name-collision.rs

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// build-fail
66
// aux-build:def_colliding_external.rs
7+
// FIXME(#83838) codegen-units=1 triggers llvm asserts
8+
// compile-flags: -Ccodegen-units=16
79

810
extern crate def_colliding_external as dep1;
911

src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// build-fail
2-
2+
// FIXME(#83838) codegen-units=1 triggers llvm asserts
3+
// compile-flags: -Ccodegen-units=16
34
#![feature(linkage)]
45

56
mod dep1 {

src/test/ui/linkage-attr/linkage-detect-local-generated-name-collision.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: symbol `collision` is already defined
2-
--> $DIR/linkage-detect-local-generated-name-collision.rs:9:9
2+
--> $DIR/linkage-detect-local-generated-name-collision.rs:10:9
33
|
44
LL | pub static collision: *const i32;
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

src/test/ui/sanitize/hwaddress.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// needs-sanitizer-support
22
// needs-sanitizer-hwaddress
33
//
4-
// compile-flags: -Z sanitizer=hwaddress -O -g
4+
// FIXME(#83989): codegen-units=1 triggers linker errors on aarch64-gnu
5+
// compile-flags: -Z sanitizer=hwaddress -O -g -C codegen-units=16
56
//
67
// run-fail
78
// error-pattern: HWAddressSanitizer: tag-mismatch

src/tools/compiletest/src/runtest.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1952,6 +1952,7 @@ impl<'test> TestCx<'test> {
19521952
if !self.props.compile_flags.iter().any(|s| s.starts_with("--error-format")) {
19531953
rustc.args(&["--error-format", "json"]);
19541954
}
1955+
rustc.arg("-Ccodegen-units=1");
19551956
rustc.arg("-Zui-testing");
19561957
rustc.arg("-Zdeduplicate-diagnostics=no");
19571958
rustc.arg("-Zemit-future-incompat-report");

0 commit comments

Comments
 (0)