about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2020-03-16 14:53:22 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2020-04-23 13:00:23 +0200
commita135ced5ce76a842c85a9b62baccefc5e53fb31c (patch)
treeda8a7f783a2f44a31ccbcf839c5e843508ee3d48 /src/tools
parent66f7a5d92f5adb9053bf66e0bf8f6d31d404870d (diff)
downloadrust-a135ced5ce76a842c85a9b62baccefc5e53fb31c.tar.gz
rust-a135ced5ce76a842c85a9b62baccefc5e53fb31c.zip
Fix ui test blessing when a test has an empty stderr file after having had content there before the current changes
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/compiletest/src/runtest.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 61a7d8ee5c9..1dd5adb2209 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -3338,6 +3338,10 @@ impl<'test> TestCx<'test> {
     }
 
     fn delete_file(&self, file: &PathBuf) {
+        if !file.exists() {
+            // Deleting a nonexistant file would error.
+            return;
+        }
         if let Err(e) = fs::remove_file(file) {
             self.fatal(&format!("failed to delete `{}`: {}", file.display(), e,));
         }
@@ -3400,7 +3404,7 @@ impl<'test> TestCx<'test> {
         let examined_content =
             self.load_expected_output_from_path(&examined_path).unwrap_or_else(|_| String::new());
 
-        if examined_path.exists() && canon_content == &examined_content {
+        if canon_content == &examined_content {
             self.delete_file(&examined_path);
         }
     }