Fix race when making logs directory
authorTim Newsome <tim@sifive.com>
Tue, 24 Apr 2018 18:21:27 +0000 (11:21 -0700)
committerTim Newsome <tim@sifive.com>
Tue, 24 Apr 2018 18:21:27 +0000 (11:21 -0700)
debug/testlib.py

index 38ae33beb8d308822858a1047b5b0cb0149a576e..0fe0322726a30ce0216ae81a2951bce4b9115948 100644 (file)
@@ -594,8 +594,12 @@ class PrivateState(object):
         self.gdb.pop_state()
 
 def run_all_tests(module, target, parsed):
-    if not os.path.exists(parsed.logs):
+    try:
         os.makedirs(parsed.logs)
+    except OSError:
+        # There's a race where multiple instances of the test program might
+        # decide to create the logs directory at the same time.
+        pass
 
     overall_start = time.time()