Rollup merge of #81817 - hameerabbasi:mcp-635, r=oli-obk

Add option to emit compiler stderr per bitwidth.

See rust-lang/compiler-team#365

r? `@oli-obk`
This commit is contained in:
Mara Bos 2021-02-08 19:28:18 +01:00 committed by GitHub
commit 480865d595
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View file

@ -333,6 +333,8 @@ pub struct TestProps {
pub assembly_output: Option<String>, pub assembly_output: Option<String>,
// If true, the test is expected to ICE // If true, the test is expected to ICE
pub should_ice: bool, pub should_ice: bool,
// If true, the stderr is expected to be different across bit-widths.
pub stderr_per_bitwidth: bool,
} }
impl TestProps { impl TestProps {
@ -372,6 +374,7 @@ impl TestProps {
rustfix_only_machine_applicable: false, rustfix_only_machine_applicable: false,
assembly_output: None, assembly_output: None,
should_ice: false, should_ice: false,
stderr_per_bitwidth: false,
} }
} }
@ -538,6 +541,10 @@ impl TestProps {
if self.assembly_output.is_none() { if self.assembly_output.is_none() {
self.assembly_output = config.parse_assembly_output(ln); self.assembly_output = config.parse_assembly_output(ln);
} }
if !self.stderr_per_bitwidth {
self.stderr_per_bitwidth = config.parse_stderr_per_bitwidth(ln);
}
}); });
} }
@ -774,6 +781,10 @@ impl Config {
self.parse_name_directive(line, "ignore-pass") 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> { fn parse_assembly_output(&self, line: &str) -> Option<String> {
self.parse_name_value_directive(line, "assembly-output").map(|r| r.trim().to_string()) self.parse_name_value_directive(line, "assembly-output").map(|r| r.trim().to_string())
} }

View file

@ -3124,7 +3124,12 @@ impl<'test> TestCx<'test> {
errors += self.compare_output("stdout", &normalized_stdout, &expected_stdout); errors += self.compare_output("stdout", &normalized_stdout, &expected_stdout);
} }
if !self.props.dont_check_compiler_stderr { 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 => { TestOutput::Run => {