Skip to content

Commit 44e8a9a

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 0f72ce1 commit 44e8a9a

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
@@ -3445,6 +3445,10 @@ impl<'test> TestCx<'test> {
34453445
}
34463446

34473447
fn delete_file(&self, file: &PathBuf) {
3448+
if !file.exists() {
3449+
// Deleting a nonexistant file would error.
3450+
return;
3451+
}
34483452
if let Err(e) = fs::remove_file(file) {
34493453
self.fatal(&format!("failed to delete `{}`: {}", file.display(), e,));
34503454
}
@@ -3507,7 +3511,7 @@ impl<'test> TestCx<'test> {
35073511
let examined_content =
35083512
self.load_expected_output_from_path(&examined_path).unwrap_or_else(|_| String::new());
35093513

3510-
if examined_path.exists() && canon_content == &examined_content {
3514+
if canon_content == &examined_content {
35113515
self.delete_file(&examined_path);
35123516
}
35133517
}

0 commit comments

Comments
 (0)