Skip to content

Commit a135ced

Browse files
committed
Fix ui test blessing when a test has an empty stderr file after having had content there before the current changes
1 parent 66f7a5d commit a135ced

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3338,6 +3338,10 @@ impl<'test> TestCx<'test> {
33383338
}
33393339

33403340
fn delete_file(&self, file: &PathBuf) {
3341+
if !file.exists() {
3342+
// Deleting a nonexistant file would error.
3343+
return;
3344+
}
33413345
if let Err(e) = fs::remove_file(file) {
33423346
self.fatal(&format!("failed to delete `{}`: {}", file.display(), e,));
33433347
}
@@ -3400,7 +3404,7 @@ impl<'test> TestCx<'test> {
34003404
let examined_content =
34013405
self.load_expected_output_from_path(&examined_path).unwrap_or_else(|_| String::new());
34023406

3403-
if examined_path.exists() && canon_content == &examined_content {
3407+
if canon_content == &examined_content {
34043408
self.delete_file(&examined_path);
34053409
}
34063410
}

0 commit comments

Comments
 (0)