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.
--- 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."""