]> git.cworth.org Git - apitrace-tests/commitdiff
Ensure trace are cleaned up.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 29 Oct 2011 20:53:10 +0000 (21:53 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 29 Oct 2011 20:54:11 +0000 (21:54 +0100)
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()