[Piglit] [PATCH 1/2] framework/programs/run.py: Delete tests directory if it exists

Dylan Baker baker.dylan.c at gmail.com
Mon Aug 3 16:46:22 PDT 2015


This prevents piglit from aggregating tests from a previous run into the
new run by deleting the old tests directory before starting.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/programs/run.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/framework/programs/run.py b/framework/programs/run.py
index 2981ffa..6465750 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -28,6 +28,7 @@ import os.path as path
 import time
 import ConfigParser
 import ctypes
+import shutil
 
 from framework import core, backends, exceptions
 import framework.results
@@ -265,7 +266,14 @@ def run(input_):
     # Change working directory to the root of the piglit directory
     piglit_dir = path.dirname(path.realpath(sys.argv[0]))
     os.chdir(piglit_dir)
-    core.checkDir(args.results_path, False)
+    if os.path.exists(args.results_path):
+        try:
+            shutil.rmtree(os.path.join(args.results_path, 'tests'))
+        except OSError:
+            pass
+    else:
+        os.makedirs(args.results_path)
+
 
     results = framework.results.TestrunResult()
     backends.set_meta(args.backend, results)
-- 
2.5.0



More information about the Piglit mailing list