Skip to content

Commit ead39df

Browse files
committed
Add parallel-front-end directive.
1 parent 8e77954 commit ead39df

11 files changed

+42
-17
lines changed

src/tools/compiletest/src/directives.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ pub struct TestProps {
205205
pub dont_require_annotations: HashSet<ErrorKind>,
206206
/// Whether pretty printers should be disabled in gdb.
207207
pub disable_gdb_pretty_printers: bool,
208+
/// Whether to use the parallel front end.
209+
pub parallel_front_end: bool,
208210
}
209211

210212
mod directives {
@@ -254,6 +256,7 @@ mod directives {
254256
// This isn't a real directive, just one that is probably mistyped often
255257
pub const INCORRECT_COMPILER_FLAGS: &'static str = "compiler-flags";
256258
pub const DISABLE_GDB_PRETTY_PRINTERS: &'static str = "disable-gdb-pretty-printers";
259+
pub const PARALLEL_FRONT_END: &'static str = "parallel-front-end";
257260
}
258261

259262
impl TestProps {
@@ -310,6 +313,7 @@ impl TestProps {
310313
add_core_stubs: false,
311314
dont_require_annotations: Default::default(),
312315
disable_gdb_pretty_printers: false,
316+
parallel_front_end: false,
313317
}
314318
}
315319

@@ -664,6 +668,7 @@ impl TestProps {
664668
DISABLE_GDB_PRETTY_PRINTERS,
665669
&mut self.disable_gdb_pretty_printers,
666670
);
671+
config.set_name_directive(ln, PARALLEL_FRONT_END, &mut self.parallel_front_end);
667672
},
668673
);
669674

src/tools/compiletest/src/directives/directive_names.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
239239
"only-x86_64-pc-windows-gnu",
240240
"only-x86_64-pc-windows-msvc",
241241
"only-x86_64-unknown-linux-gnu",
242+
"parallel-front-end",
242243
"pp-exact",
243244
"pretty-compare-only",
244245
"pretty-mode",

src/tools/compiletest/src/runtest.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,8 +1520,10 @@ impl<'test> TestCx<'test> {
15201520
};
15211521
rustc.arg(input_file);
15221522

1523-
// Use a single thread for efficiency and a deterministic error message order
1524-
rustc.arg("-Zthreads=1");
1523+
if !self.props.parallel_front_end {
1524+
// Use a single thread for efficiency and a deterministic error message order
1525+
rustc.arg("-Zthreads=1");
1526+
}
15251527

15261528
// Hide libstd sources from ui tests to make sure we generate the stderr
15271529
// output that users will see.
@@ -2749,7 +2751,7 @@ impl<'test> TestCx<'test> {
27492751
// Wrapper tools set by `runner` might provide extra output on failure,
27502752
// for example a WebAssembly runtime might print the stack trace of an
27512753
// `unreachable` instruction by default.
2752-
let compare_output_by_lines = self.config.runner.is_some();
2754+
let compare_output_by_lines = self.props.parallel_front_end || self.config.runner.is_some();
27532755

27542756
let tmp;
27552757
let (expected, actual): (&str, &str) = if compare_output_by_lines {
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1+
// Test for #111528, the ice issue cause waiting on a query that panicked
2+
//
13
//@ compile-flags: -Z threads=16
24
//@ build-fail
5+
//@ parallel-front-end
36

4-
#![crate_type="rlib"]
7+
#![crate_type = "rlib"]
58
#![allow(warnings)]
69

7-
#[export_name="fail"]
8-
pub fn a() {
9-
}
10+
#[export_name = "fail"]
11+
pub fn a() {}
1012

11-
#[export_name="fail"]
13+
#[export_name = "fail"]
1214
pub fn b() {
13-
//~^ ERROR symbol `fail` is already defined
15+
//~^ ERROR symbol `fail` is already defined
1416
}
1517

1618
fn main() {}

tests/ui/parallel-rustc/cache-after-waiting-issue-111528.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: symbol `fail` is already defined
2-
--> $DIR/cache-after-waiting-issue-111528.rs:12:1
2+
--> $DIR/cache-after-waiting-issue-111528.rs:14:1
33
|
44
LL | pub fn b() {
55
| ^^^^^^^^^^
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@ compile-flags: -Z threads=2
2+
//@ check-fail
3+
//@ parallel-front-end
24

3-
const FOO: usize = FOO; //~ERROR cycle detected when simplifying constant for the type system `FOO`
5+
const FOO: usize = FOO; //~ ERROR cycle detected when simplifying constant for the type system `FOO`
46

57
fn main() {}

tests/ui/parallel-rustc/cycle_crash.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error[E0391]: cycle detected when simplifying constant for the type system `FOO`
2-
--> $DIR/cycle_crash.rs:3:1
2+
--> $DIR/cycle_crash.rs:5:1
33
|
44
LL | const FOO: usize = FOO;
55
| ^^^^^^^^^^^^^^^^
66
|
77
note: ...which requires const-evaluating + checking `FOO`...
8-
--> $DIR/cycle_crash.rs:3:20
8+
--> $DIR/cycle_crash.rs:5:20
99
|
1010
LL | const FOO: usize = FOO;
1111
| ^^^

tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205-2.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
// Test for #118205, which causes a deadlock bug
2+
//
13
//@ compile-flags:-C extra-filename=-1 -Z threads=16
24
//@ no-prefer-dynamic
35
//@ build-pass
6+
//@ parallel-front-end
7+
48
#![crate_name = "crateresolve1"]
59
#![crate_type = "lib"]
610

tests/ui/parallel-rustc/export-symbols-deadlock-issue-118205.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
// Test for #118205, which causes a deadlock bug
2+
//
13
//@ compile-flags: -Z threads=16
24
//@ build-pass
5+
//@ parallel-front-end
36

47
pub static GLOBAL: isize = 3;
58

tests/ui/parallel-rustc/hello_world.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
// Test for the basic function of parallel front end
2+
//
13
//@ compile-flags: -Z threads=8
24
//@ run-pass
5+
//@ parallel-front-end
36

47
fn main() {
58
println!("Hello world!");

0 commit comments

Comments
 (0)