diff options
| author | Nathan <nathan.whitaker01@gmail.com> | 2019-08-22 19:02:13 -0400 |
|---|---|---|
| committer | Nathan <nathan.whitaker01@gmail.com> | 2019-08-22 19:06:23 -0400 |
| commit | 0c379dff2919321944440cfe7c306c2d35bffaaa (patch) | |
| tree | 32b2c5ec1e10284a59f619bca52bc08bc389db3c | |
| parent | 54f80a5b7c254d1df302680eac6552665b4c8945 (diff) | |
| download | rust-0c379dff2919321944440cfe7c306c2d35bffaaa.tar.gz rust-0c379dff2919321944440cfe7c306c2d35bffaaa.zip | |
Extract loading and comparison of compiletest outputs to new fn
Moved into ```fn load_compare_outputs(&self, proc_res: &ProcRes, explicit_format: bool) -> usize```
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 3da6be74129..86c5e4ac89d 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2934,33 +2934,20 @@ impl<'test> TestCx<'test> { } } - fn run_ui_test(&self) { - // if the user specified a format in the ui test - // print the output to the stderr file, otherwise extract - // the rendered error messages from json and print them - let explicit = self - .props - .compile_flags - .iter() - .any(|s| s.contains("--error-format")); - let proc_res = self.compile_test(); - self.check_if_test_should_compile(&proc_res); - + fn load_compare_outputs(&self, proc_res: &ProcRes, explicit_format: bool) -> usize { let expected_stderr = self.load_expected_output(UI_STDERR); let expected_stdout = self.load_expected_output(UI_STDOUT); - let expected_fixed = self.load_expected_output(UI_FIXED); let normalized_stdout = self.normalize_output(&proc_res.stdout, &self.props.normalize_stdout); - let stderr = if explicit { + let stderr = if explicit_format { proc_res.stderr.clone() } else { json::extract_rendered(&proc_res.stderr) }; let normalized_stderr = self.normalize_output(&stderr, &self.props.normalize_stderr); - let mut errors = 0; if !self.props.dont_check_compiler_stdout { errors += self.compare_output("stdout", &normalized_stdout, &expected_stdout); @@ -2968,10 +2955,28 @@ impl<'test> TestCx<'test> { if !self.props.dont_check_compiler_stderr { errors += self.compare_output("stderr", &normalized_stderr, &expected_stderr); } + errors + } + + fn run_ui_test(&self) { + // if the user specified a format in the ui test + // print the output to the stderr file, otherwise extract + // the rendered error messages from json and print them + let explicit = self + .props + .compile_flags + .iter() + .any(|s| s.contains("--error-format")); + let proc_res = self.compile_test(); + self.check_if_test_should_compile(&proc_res); + + let expected_fixed = self.load_expected_output(UI_FIXED); let modes_to_prune = vec![CompareMode::Nll]; self.prune_duplicate_outputs(&modes_to_prune); + let mut errors = self.load_compare_outputs(&proc_res, explicit); + if self.config.compare_mode.is_some() { // don't test rustfix with nll right now } else if self.config.rustfix_coverage { |
