Skip to content

Commit ecccfb7

Browse files
committed
change compiler test suit to support parallel front end robustness test
1 parent 86d69c7 commit ecccfb7

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
205205
"only-x86_64-pc-windows-gnu",
206206
"only-x86_64-pc-windows-msvc",
207207
"only-x86_64-unknown-linux-gnu",
208+
"parallel-front-end-robustness",
208209
"pp-exact",
209210
"pretty-compare-only",
210211
"pretty-expanded",

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
@@ -213,6 +216,7 @@ mod directives {
213216
pub const CHECK_RUN_RESULTS: &'static str = "check-run-results";
214217
pub const DONT_CHECK_COMPILER_STDOUT: &'static str = "dont-check-compiler-stdout";
215218
pub const DONT_CHECK_COMPILER_STDERR: &'static str = "dont-check-compiler-stderr";
219+
pub const PARALLEL_FRONT_END_ROBUTNESS: &'static str = "parallel-front-end-robustness";
216220
pub const NO_PREFER_DYNAMIC: &'static str = "no-prefer-dynamic";
217221
pub const PRETTY_EXPANDED: &'static str = "pretty-expanded";
218222
pub const PRETTY_MODE: &'static str = "pretty-mode";
@@ -273,6 +277,7 @@ impl TestProps {
273277
dont_check_compiler_stderr: false,
274278
compare_output_lines_by_subset: false,
275279
no_prefer_dynamic: false,
280+
parallel_front_end_robustness: false,
276281
pretty_expanded: false,
277282
pretty_mode: "normal".to_string(),
278283
pretty_compare_only: false,
@@ -494,6 +499,11 @@ impl TestProps {
494499
DONT_CHECK_FAILURE_STATUS,
495500
&mut self.dont_check_failure_status,
496501
);
502+
config.set_name_directive(
503+
ln,
504+
PARALLEL_FRONT_END_ROBUTNESS,
505+
&mut self.parallel_front_end_robustness,
506+
);
497507

498508
config.set_name_directive(ln, RUN_RUSTFIX, &mut self.run_rustfix);
499509
config.set_name_directive(

src/tools/compiletest/src/runtest.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1349,9 +1349,6 @@ impl<'test> TestCx<'test> {
13491349
};
13501350
rustc.arg(input_file);
13511351

1352-
// Use a single thread for efficiency and a deterministic error message order
1353-
rustc.arg("-Zthreads=1");
1354-
13551352
// Hide libstd sources from ui tests to make sure we generate the stderr
13561353
// output that users will see.
13571354
// 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)