diff --git a/src/config.rs b/src/config.rs index 2e2567f3..71d57ba4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -85,7 +85,7 @@ impl AbortCheck { } /// Function that performs the actual output conflict handling. -pub type OutputConflictHandling = fn(&Path, Vec, &mut Errors, &Config); +pub type OutputConflictHandling = fn(&Path, Vec, &[u8], &mut Errors, &Config); impl Config { /// Create a blank configuration that doesn't do anything interesting @@ -484,15 +484,16 @@ impl Config { /// test. pub fn error_on_output_conflict( path: &Path, - actual: Vec, + normalized: Vec, + output: &[u8], errors: &mut Errors, config: &Config, ) { let expected = std::fs::read(path).unwrap_or_default(); - if actual != expected { + if normalized != expected { errors.push(Error::OutputDiffers { path: path.to_path_buf(), - actual, + actual: output.to_vec(), expected, bless_command: config.bless_command.clone(), }); @@ -503,6 +504,7 @@ pub fn error_on_output_conflict( pub fn ignore_output_conflict( _path: &Path, _actual: Vec, + _output: &[u8], _errors: &mut Errors, _config: &Config, ) { @@ -510,7 +512,13 @@ pub fn ignore_output_conflict( /// Instead of erroring if the stderr/stdout differs from the expected /// automatically replace it with the found output (after applying filters). -pub fn bless_output_files(path: &Path, actual: Vec, _errors: &mut Errors, _config: &Config) { +pub fn bless_output_files( + path: &Path, + actual: Vec, + _output: &[u8], + _errors: &mut Errors, + _config: &Config, +) { if actual.is_empty() { let _ = std::fs::remove_file(path); } else { diff --git a/src/per_test_config.rs b/src/per_test_config.rs index 4b3c0f39..bbf3281b 100644 --- a/src/per_test_config.rs +++ b/src/per_test_config.rs @@ -186,9 +186,9 @@ impl TestConfig { } pub(crate) fn check_output(&self, output: &[u8], errors: &mut Errors, kind: &str) -> PathBuf { - let output = self.normalize(output, kind); + let normalized = self.normalize(output, kind); let path = self.output_path(kind); - (self.config.output_conflict_handling)(&path, output, errors, &self.config); + (self.config.output_conflict_handling)(&path, normalized, output, errors, &self.config); path } diff --git a/tests/integrations/basic-fail/Cargo.stdout b/tests/integrations/basic-fail/Cargo.stdout index 93ccfe54..7056e795 100644 --- a/tests/integrations/basic-fail/Cargo.stdout +++ b/tests/integrations/basic-fail/Cargo.stdout @@ -30,7 +30,13 @@ Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/ba +++ error[E0308]: mismatched types --> tests/actual_tests/bad_pattern.rs:4:9 -... 10 lines skipped ... +... 5 lines skipped ... + | + note: function defined here +- --> $DIR/tests/integrations/basic-fail/src/lib.rs:LL:CC ++ --> $DIR/tests/integrations/basic-fail/src/lib.rs:LL:CC + | + 1 | pub fn add(left: usize, right: usize) -> usize { | ^^^ -error: aborting due to previous error @@ -227,7 +233,13 @@ Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/fo +++ error[E0308]: mismatched types --> tests/actual_tests/foomp2.rs:4:9 -... 10 lines skipped ... +... 5 lines skipped ... + | + note: function defined here +- --> $DIR/tests/integrations/basic-fail/src/lib.rs:LL:CC ++ --> $DIR/tests/integrations/basic-fail/src/lib.rs:LL:CC + | + 1 | pub fn add(left: usize, right: usize) -> usize { | ^^^ -error: aborting due to previous error @@ -1429,7 +1441,8 @@ Execute `DO NOT BLESS. These are meant to fail` to update `tests/actual_tests/ru - | --- ^^^^ expected `usize`, found `&str` + | ^^^^^^^^^^ use of undeclared crate or module `basic_fail` - thread 'rustc' panicked +-thread 'rustc' panicked ++thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs: error: `mismatched types` not found in diagnostics on line 8