diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-09-14 12:18:02 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-09-21 16:21:37 +0200 |
| commit | d28c5bafff12f5b9f6ba96c427e975f860599303 (patch) | |
| tree | 431ccc17dba2e546a04f57ef00330805b274b6d7 | |
| parent | ae0a53a39b29ed0fb138b05ef8015702b91d8b00 (diff) | |
| download | rust-d28c5bafff12f5b9f6ba96c427e975f860599303.tar.gz rust-d28c5bafff12f5b9f6ba96c427e975f860599303.zip | |
Provide way for ui tests to opt out of having their output checked.
Namely, this adds support for: * `// dont-check-compiler-stdout`, and * `// dont-check-compiler-stderr`. Obviously almost all ui tests wont want to opt into these, since the whole point of a ui test is to check the compiler ui. However, since this PR is converting run-pass into (another set of) ui tests, these header options make sense in that context. (Also this puts us into a better position for eventually turning *every* test suite into a ui test suite, by making ui-ness the default and forcing tests to opt out explicitly.)
| -rw-r--r-- | src/tools/compiletest/src/header.rs | 22 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 8 |
2 files changed, 28 insertions, 2 deletions
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index db856a1dcf9..8829d880836 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -199,6 +199,10 @@ pub struct TestProps { pub force_host: bool, // Check stdout for error-pattern output as well as stderr pub check_stdout: bool, + // For UI tests, allows compiler to generate arbitrary output to stdout + pub dont_check_compiler_stdout: bool, + // For UI tests, allows compiler to generate arbitrary output to stderr + pub dont_check_compiler_stderr: bool, // Don't force a --crate-type=dylib flag on the command line pub no_prefer_dynamic: bool, // Run --pretty expanded when running pretty printing tests @@ -249,6 +253,8 @@ impl TestProps { build_aux_docs: false, force_host: false, check_stdout: false, + dont_check_compiler_stdout: false, + dont_check_compiler_stderr: false, no_prefer_dynamic: false, pretty_expanded: false, pretty_mode: "normal".to_string(), @@ -327,6 +333,14 @@ impl TestProps { self.check_stdout = config.parse_check_stdout(ln); } + if !self.dont_check_compiler_stdout { + self.dont_check_compiler_stdout = config.parse_dont_check_compiler_stdout(ln); + } + + if !self.dont_check_compiler_stderr { + self.dont_check_compiler_stderr = config.parse_dont_check_compiler_stderr(ln); + } + if !self.no_prefer_dynamic { self.no_prefer_dynamic = config.parse_no_prefer_dynamic(ln); } @@ -510,6 +524,14 @@ impl Config { self.parse_name_directive(line, "check-stdout") } + fn parse_dont_check_compiler_stdout(&self, line: &str) -> bool { + self.parse_name_directive(line, "dont-check-compiler-stdout") + } + + fn parse_dont_check_compiler_stderr(&self, line: &str) -> bool { + self.parse_name_directive(line, "dont-check-compiler-stderr") + } + fn parse_no_prefer_dynamic(&self, line: &str) -> bool { self.parse_name_directive(line, "no-prefer-dynamic") } diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 1d06f116dec..3f0e4cd4cc4 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2654,8 +2654,12 @@ impl<'test> TestCx<'test> { let normalized_stderr = self.normalize_output(&stderr, &self.props.normalize_stderr); let mut errors = 0; - errors += self.compare_output("stdout", &normalized_stdout, &expected_stdout); - errors += self.compare_output("stderr", &normalized_stderr, &expected_stderr); + if !self.props.dont_check_compiler_stdout { + 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 modes_to_prune = vec![CompareMode::Nll]; self.prune_duplicate_outputs(&modes_to_prune); |
