Currently piglit will run if a directory already exists, or die in a fire if the results_directory is pointed at a file.
Both are bad, in the fist case if there are already X+Y tests in the 'tests' directory, and the current run only writes X tests, then Y-X tests from the previous run will be included (which can overwrite tests depending on the order that they were written). This clears those out, solving the problem. Signed-off-by: Dylan Baker <[email protected]> --- 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 328e0b0..1cc1b4a 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, options import framework.results @@ -247,7 +248,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) + + # Clear results directory, completely remove it and recreate it whether + # it's a directory or a file. + if os.path.isdir(args.results_path): + shutil.rmtree(args.results_path) + else: + os.unlink(args.results_path) + os.makedirs(args.results_path) results = framework.results.TestrunResult() backends.set_meta(args.backend, results) -- 2.7.0 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
