[Piglit] [PATCH 1/2] framework/programs/run.py: On a new run clear results directory

Dylan Baker baker.dylan.c at gmail.com
Wed Jul 8 18:02:26 PDT 2015

A current source of confusion right now, is to run piglit, and setting a
results directory that already contains a partial result in it. If the
new run is shorter than the run it's overwriting, then when it
accumulates all of the tests together into a single file at the end of
the run, these extra tests from the previous run will be included.

To prevent that, this patch clears the contents of the directory (at an
implementation level it actually deletes and recreates the directory),
so that there is a clean working directory to work with.

Obviously this doesn't affect the resume path.

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

diff --git a/framework/programs/run.py b/framework/programs/run.py
index 2981ffa..313ea28 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,9 @@ def run(input_):
     # Change working directory to the root of the piglit directory
     piglit_dir = path.dirname(path.realpath(sys.argv[0]))
-    core.checkDir(args.results_path, False)
+    if os.path.exists(args.results_path):
+        shutil.rmtree(args.results_path)
+    os.mkdir(args.results_path)
     results = framework.results.TestrunResult()
     backends.set_meta(args.backend, results)

More information about the Piglit mailing list