提交 d28c5baf 编写于 作者: F Felix S. Klock II

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.)
上级 ae0a53a3
......@@ -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 @@ pub fn new() -> Self {
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 @@ fn load_from(&mut self, testfile: &Path, cfg: Option<&str>, config: &Config) {
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 @@ fn parse_check_stdout(&self, line: &str) -> bool {
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")
}
......
......@@ -2654,8 +2654,12 @@ fn run_ui_test(&self) {
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册