From 5cde484f5bded377ca859164aa6919b0cbe3e7d8 Mon Sep 17 00:00:00 2001
From: =?utf8?q?Jos=C3=A9=20Fonseca?= <jose.r.fonseca@gmail.com>
Date: Sat, 29 Oct 2011 21:53:10 +0100
Subject: [PATCH] Ensure trace are cleaned up.

---
 driver.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/driver.py b/driver.py
index 660a1f9..7799b65 100755
--- 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()
         
-- 
2.45.2