diff options
| author | Oneirical <manchot@videotron.ca> | 2024-07-04 16:02:45 -0400 |
|---|---|---|
| committer | Oneirical <manchot@videotron.ca> | 2024-07-05 10:06:27 -0400 |
| commit | 4a15fe44e3574040c469dd8ed66f26ca4d2d09c5 (patch) | |
| tree | 5b7577063f6bf8df0d048f629eb45062f92de298 /src | |
| parent | f77d5d2b351f4a86e0c6ead5db83ef0fb3d22d40 (diff) | |
| download | rust-4a15fe44e3574040c469dd8ed66f26ca4d2d09c5.tar.gz rust-4a15fe44e3574040c469dd8ed66f26ca4d2d09c5.zip | |
rewrite emit-path-unhashed to rmake
Diffstat (limited to 'src')
| -rw-r--r-- | src/tools/run-make-support/src/diff/mod.rs | 34 | ||||
| -rw-r--r-- | src/tools/tidy/src/allowed_run_make_makefiles.txt | 1 |
2 files changed, 31 insertions, 4 deletions
diff --git a/src/tools/run-make-support/src/diff/mod.rs b/src/tools/run-make-support/src/diff/mod.rs index 3e0bdc1c6f6..24fa88af82e 100644 --- a/src/tools/run-make-support/src/diff/mod.rs +++ b/src/tools/run-make-support/src/diff/mod.rs @@ -87,9 +87,7 @@ impl Diff { self } - #[track_caller] - pub fn run(&mut self) { - self.drop_bomb.defuse(); + fn run_common(&self) -> (&str, &str, String, String) { let expected = self.expected.as_ref().expect("expected text not set"); let mut actual = self.actual.as_ref().expect("actual text not set").to_string(); let expected_name = self.expected_name.as_ref().unwrap(); @@ -104,6 +102,14 @@ impl Diff { .header(expected_name, actual_name) .to_string(); + (expected_name, actual_name, output, actual) + } + + #[track_caller] + pub fn run(&mut self) { + self.drop_bomb.defuse(); + let (expected_name, actual_name, output, actual) = self.run_common(); + if !output.is_empty() { // If we can bless (meaning we have a file to write into and the `RUSTC_BLESS_TEST` // environment variable set), then we write into the file and return. @@ -120,4 +126,26 @@ impl Diff { ) } } + + #[track_caller] + pub fn run_fail(&mut self) { + self.drop_bomb.defuse(); + let (expected_name, actual_name, output, actual) = self.run_common(); + + if output.is_empty() { + // If we can bless (meaning we have a file to write into and the `RUSTC_BLESS_TEST` + // environment variable set), then we write into the file and return. + if let Some(ref expected_file) = self.expected_file { + if std::env::var("RUSTC_BLESS_TEST").is_ok() { + println!("Blessing `{}`", expected_file.display()); + fs_wrapper::write(expected_file, actual); + return; + } + } + panic!( + "test failed: `{}` is not different from `{}`\n\n{}", + expected_name, actual_name, output + ) + } + } } diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt index 73d6af50ea0..13fe75aac0f 100644 --- a/src/tools/tidy/src/allowed_run_make_makefiles.txt +++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt @@ -23,7 +23,6 @@ run-make/dep-info-spaces/Makefile run-make/dep-info/Makefile run-make/dump-ice-to-disk/Makefile run-make/dump-mono-stats/Makefile -run-make/emit-path-unhashed/Makefile run-make/emit-to-stdout/Makefile run-make/env-dep-info/Makefile run-make/export-executable-symbols/Makefile |
