Skip to content

Commit

Permalink
Rollup merge of #81817 - hameerabbasi:mcp-635, r=oli-obk
Browse files Browse the repository at this point in the history
Add option to emit compiler stderr per bitwidth.

See rust-lang/compiler-team#365

r? `@oli-obk`
  • Loading branch information
m-ou-se authored Feb 8, 2021
2 parents b263981 + b700878 commit 480865d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
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

0 comments on commit 480865d

Please sign in to comment.