changeset 24332:9612b96730d7

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.
author Augie Fackler <augie@google.com>
date Fri, 13 Mar 2015 13:03:55 -0400
parents d3bdd8c7174f
children 5da0eb641881
files tests/run-tests.py
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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."""