diff options
| author | Hameer Abbasi <einstein.edison@gmail.com> | 2021-02-06 06:33:07 +0000 |
|---|---|---|
| committer | Hameer Abbasi <einstein.edison@gmail.com> | 2021-02-06 13:43:55 +0000 |
| commit | b700878eb23aae3cf228e4ef7d2a74d2fa79358e (patch) | |
| tree | 0a1a500834cb92ef1dd30bd10ba29f774f41b029 | |
| parent | 16b805713c4cdb967263b9d59634fddea4372b65 (diff) | |
| download | rust-b700878eb23aae3cf228e4ef7d2a74d2fa79358e.tar.gz rust-b700878eb23aae3cf228e4ef7d2a74d2fa79358e.zip | |
Add option to emit compiler stderr per bitwidth.
See rust-lang/compiler-team#365
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 11 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 7 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 2eba91fd1f4..429a8c98cd5 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -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 { @@ -372,6 +374,7 @@ impl TestProps { rustfix_only_machine_applicable: false, assembly_output: None, should_ice: false, + stderr_per_bitwidth: false, } } @@ -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); + } }); } @@ -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()) } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 52aed57fc76..1ec32184d98 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -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 => { |
