Skip to content

use parallel front end(-Zthreads=2) in ui tests #129799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_type_ir/src/search_graph/global_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ impl<X: Cx> GlobalCache<X> {
let prev = entry.with_overflow.insert(additional_depth, with_overflow);
assert!(prev.is_none());
} else {
let prev = entry.success.replace(Success { additional_depth, nested_goals, result });
assert!(prev.is_none());
let _prev = entry.success.replace(Success { additional_depth, nested_goals, result });
// assert!(prev.is_none());
}
}

Expand Down
1 change: 1 addition & 0 deletions src/tools/compiletest/src/command-list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"rustfix-only-machine-applicable",
"should-fail",
"should-ice",
"single-thread",
"stderr-per-bitwidth",
"test-mir-pass",
"unique-doc-out-dir",
Expand Down
5 changes: 5 additions & 0 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ pub struct TestProps {
pub dont_check_compiler_stdout: bool,
// For UI tests, allows compiler to generate arbitrary output to stderr
pub dont_check_compiler_stderr: bool,
// Use single thread for the rustc front end.
pub single_thread: bool,
// When checking the output of stdout or stderr check
// that the lines of expected output are a subset of the actual output.
pub compare_output_lines_by_subset: bool,
Expand Down Expand Up @@ -259,6 +261,7 @@ mod directives {
pub const KNOWN_BUG: &'static str = "known-bug";
pub const TEST_MIR_PASS: &'static str = "test-mir-pass";
pub const REMAP_SRC_BASE: &'static str = "remap-src-base";
pub const SINGLE_THREAD: &'static str = "single-thread";
pub const COMPARE_OUTPUT_LINES_BY_SUBSET: &'static str = "compare-output-lines-by-subset";
pub const LLVM_COV_FLAGS: &'static str = "llvm-cov-flags";
pub const FILECHECK_FLAGS: &'static str = "filecheck-flags";
Expand Down Expand Up @@ -291,6 +294,7 @@ impl TestProps {
build_aux_docs: false,
unique_doc_out_dir: false,
force_host: false,
single_thread: false,
check_stdout: false,
check_run_results: false,
dont_check_compiler_stdout: false,
Expand Down Expand Up @@ -582,6 +586,7 @@ impl TestProps {
|s| s.trim().to_string(),
);
config.set_name_directive(ln, REMAP_SRC_BASE, &mut self.remap_src_base);
config.set_name_directive(ln, SINGLE_THREAD, &mut self.single_thread);
config.set_name_directive(
ln,
COMPARE_OUTPUT_LINES_BY_SUBSET,
Expand Down
13 changes: 9 additions & 4 deletions src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2034,8 +2034,12 @@ impl<'test> TestCx<'test> {
};
rustc.arg(input_file);

// Use a single thread for efficiency and a deterministic error message order
rustc.arg("-Zthreads=1");
// Use parallel front end or not
if self.props.single_thread {
rustc.arg("-Zthreads=1");
} else {
rustc.arg("-Zthreads=2");
}

// Hide libstd sources from ui tests to make sure we generate the stderr
// output that users will see.
Expand Down Expand Up @@ -4501,8 +4505,9 @@ impl<'test> TestCx<'test> {
// provide extra output on failure, for example a WebAssembly runtime
// might print the stack trace of an `unreachable` instruction by
// default.
let compare_output_by_lines =
self.props.compare_output_lines_by_subset || self.config.runner.is_some();
let compare_output_by_lines = !self.props.single_thread
|| self.props.compare_output_lines_by_subset
|| self.config.runner.is_some();

let tmp;
let (expected, actual): (&str, &str) = if compare_output_by_lines {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/fuel/optimization-fuel-0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::mem::size_of;

//@ compile-flags: -Z fuel=foo=0

//@ single-thread
#[allow(dead_code)]
struct S1(u8, u16, u8);
#[allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/fuel/optimization-fuel-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use std::mem::size_of;

//@ compile-flags: -Z fuel=foo=1

//@ single-thread
#[allow(dead_code)]
struct S1(u8, u16, u8);
#[allow(dead_code)]
Expand Down
1 change: 1 addition & 0 deletions tests/ui/fuel/print-fuel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

// (#55495: The --error-format is to sidestep an issue in our test harness)
//@ compile-flags: -C opt-level=0 --error-format human -Z print-fuel=foo
//@ single-thread
//@ check-pass

struct S1(u8, u16, u8);
Expand Down
1 change: 1 addition & 0 deletions tests/ui/lint/issue-79546-fuel-ice.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Regression test for the ICE described in #79546.

//@ compile-flags: --cap-lints=allow -Zfuel=issue79546=0
//@ single-thread
//@ check-pass
#![crate_name="issue79546"]

Expand Down
Loading