]> git.cworth.org Git - apitrace-tests/blobdiff - driver.py
Ensure trace are cleaned up.
[apitrace-tests] / driver.py
index 660a1f9b0c70c58e863ec9ebdc2b1b3572c2cce6..7799b6587693f7d1db058c83a1fcaf5bd684e286 100755 (executable)
--- a/driver.py
+++ b/driver.py
@@ -84,6 +84,12 @@ class TestCase:
     def trace(self):
         if self.trace_file is None:
             self.trace_file = os.path.abspath(os.path.join(self.results, self.name + '.trace'))
+        if os.path.exists(self.trace_file):
+            os.remove(self.trace_file)
+        else:
+            trace_dir = os.path.dirname(self.trace_file)
+            if not os.path.exists(trace_dir):
+                os.makedirs(trace_dir)
 
         env = os.environ.copy()