Skip to content

Commit a6bd739

Browse files
committed
change compiler test suit to support parallel front end robustness test
1 parent ce36a96 commit a6bd739

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

src/tools/compiletest/src/directive-list.rs

+1
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
221221
"only-x86_64-pc-windows-gnu",
222222
"only-x86_64-pc-windows-msvc",
223223
"only-x86_64-unknown-linux-gnu",
224+
"parallel-front-end-robustness",
224225
"pp-exact",
225226
"pretty-compare-only",
226227
"pretty-mode",

src/tools/compiletest/src/header.rs

+10
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ pub struct TestProps {
108108
pub force_host: bool,
109109
// Check stdout for error-pattern output as well as stderr
110110
pub check_stdout: bool,
111+
// For parallel front end, use repeated tests to ensure
112+
// there is no deadlock or other ice problems.
113+
pub parallel_front_end_robustness: bool,
111114
// Check stdout & stderr for output of run-pass test
112115
pub check_run_results: bool,
113116
// For UI tests, allows compiler to generate arbitrary output to stdout
@@ -211,6 +214,7 @@ mod directives {
211214
pub const CHECK_RUN_RESULTS: &'static str = "check-run-results";
212215
pub const DONT_CHECK_COMPILER_STDOUT: &'static str = "dont-check-compiler-stdout";
213216
pub const DONT_CHECK_COMPILER_STDERR: &'static str = "dont-check-compiler-stderr";
217+
pub const PARALLEL_FRONT_END_ROBUTNESS: &'static str = "parallel-front-end-robustness";
214218
pub const NO_PREFER_DYNAMIC: &'static str = "no-prefer-dynamic";
215219
pub const PRETTY_MODE: &'static str = "pretty-mode";
216220
pub const PRETTY_COMPARE_ONLY: &'static str = "pretty-compare-only";
@@ -270,6 +274,7 @@ impl TestProps {
270274
dont_check_compiler_stdout: false,
271275
dont_check_compiler_stderr: false,
272276
no_prefer_dynamic: false,
277+
parallel_front_end_robustness: false,
273278
pretty_mode: "normal".to_string(),
274279
pretty_compare_only: false,
275280
forbid_output: vec![],
@@ -503,6 +508,11 @@ impl TestProps {
503508
DONT_CHECK_FAILURE_STATUS,
504509
&mut self.dont_check_failure_status,
505510
);
511+
config.set_name_directive(
512+
ln,
513+
PARALLEL_FRONT_END_ROBUTNESS,
514+
&mut self.parallel_front_end_robustness,
515+
);
506516

507517
config.set_name_directive(ln, RUN_RUSTFIX, &mut self.run_rustfix);
508518
config.set_name_directive(

src/tools/compiletest/src/runtest.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1446,9 +1446,6 @@ impl<'test> TestCx<'test> {
14461446
};
14471447
rustc.arg(input_file);
14481448

1449-
// Use a single thread for efficiency and a deterministic error message order
1450-
rustc.arg("-Zthreads=1");
1451-
14521449
// Hide libstd sources from ui tests to make sure we generate the stderr
14531450
// output that users will see.
14541451
// Without this, we may be producing good diagnostics in-tree but users

src/tools/compiletest/src/runtest/ui.rs

+18-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,24 @@ impl TestCx<'_> {
2424
let pm = self.pass_mode();
2525
let should_run = self.should_run(pm);
2626
let emit_metadata = self.should_emit_metadata(pm);
27-
let proc_res = self.compile_test(should_run, emit_metadata);
27+
let mut proc_res = self.compile_test(should_run, emit_metadata);
28+
29+
if self.props.parallel_front_end_robustness {
30+
// Ensure there is no ice during parallel front end.
31+
self.check_no_compiler_crash(&proc_res, false);
32+
33+
// Repeated testing due to instability in multithreaded environments.
34+
for _ in 0..50 {
35+
proc_res = self.compile_test(should_run, emit_metadata);
36+
self.check_no_compiler_crash(&proc_res, false);
37+
}
38+
39+
// For the parallel front end, we are currently only concerned with whether
40+
// deadlock or other ice problems occur. The correctness of the output is
41+
// guaranteed by other compiler tests.
42+
return;
43+
}
44+
2845
self.check_if_test_should_compile(self.props.fail_mode, pm, &proc_res);
2946
if matches!(proc_res.truncated, Truncated::Yes)
3047
&& !self.props.dont_check_compiler_stdout

0 commit comments

Comments
 (0)