Skip to content

Add option to emit compiler stderr per bitwidth. #81817

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

Merged
merged 1 commit into from
Feb 8, 2021
Merged
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
11 changes: 11 additions & 0 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ pub struct TestProps {
pub assembly_output: Option<String>,
// If true, the test is expected to ICE
pub should_ice: bool,
// If true, the stderr is expected to be different across bit-widths.
pub stderr_per_bitwidth: bool,
}

impl TestProps {
Expand Down Expand Up @@ -372,6 +374,7 @@ impl TestProps {
rustfix_only_machine_applicable: false,
assembly_output: None,
should_ice: false,
stderr_per_bitwidth: false,
}
}

Expand Down Expand Up @@ -538,6 +541,10 @@ impl TestProps {
if self.assembly_output.is_none() {
self.assembly_output = config.parse_assembly_output(ln);
}

if !self.stderr_per_bitwidth {
self.stderr_per_bitwidth = config.parse_stderr_per_bitwidth(ln);
}
});
}

Expand Down Expand Up @@ -774,6 +781,10 @@ impl Config {
self.parse_name_directive(line, "ignore-pass")
}

fn parse_stderr_per_bitwidth(&self, line: &str) -> bool {
self.parse_name_directive(line, "stderr-per-bitwidth")
}

fn parse_assembly_output(&self, line: &str) -> Option<String> {
self.parse_name_value_directive(line, "assembly-output").map(|r| r.trim().to_string())
}
Expand Down
7 changes: 6 additions & 1 deletion src/tools/compiletest/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3124,7 +3124,12 @@ impl<'test> TestCx<'test> {
errors += self.compare_output("stdout", &normalized_stdout, &expected_stdout);
}
if !self.props.dont_check_compiler_stderr {
errors += self.compare_output("stderr", &normalized_stderr, &expected_stderr);
let kind = if self.props.stderr_per_bitwidth {
format!("{}bit.stderr", get_pointer_width(&self.config.target))
} else {
String::from("stderr")
};
errors += self.compare_output(&kind, &normalized_stderr, &expected_stderr);
}
}
TestOutput::Run => {
Expand Down