run-tests: ignore ENOENT failures when removing old .err results
authorAugie Fackler <augie@google.com>
Fri, 13 Mar 2015 13:03:55 -0400
changeset 24332 9612b96730d7
parent 24331 d3bdd8c7174f
child 24333 5da0eb641881
run-tests: ignore ENOENT failures when removing old .err results When the same test runs in multiple threads and the previous run was a failure, the threads can race to delete the error output. This fixes that.
tests/run-tests.py
--- a/tests/run-tests.py	Fri Mar 13 12:50:53 2015 -0400
+++ b/tests/run-tests.py	Fri Mar 13 13:03:55 2015 -0400
@@ -461,7 +461,14 @@
 
         # Remove any previous output files.
         if os.path.exists(self.errpath):
-            os.remove(self.errpath)
+            try:
+                os.remove(self.errpath)
+            except OSError, e:
+                # We might have raced another test to clean up a .err
+                # file, so ignore ENOENT when removing a previous .err
+                # file.
+                if e.errno != errno.ENOENT:
+                    raise
 
     def run(self, result):
         """Run this test and report results against a TestResult instance."""