[Piglit] [PATCH] framework: Check that all results exist before deleting the output

Dylan Baker baker.dylan.c at gmail.com
Thu Apr 7 18:29:11 UTC 2016


Since it's rather easy to get the arguments to summary wrong, and
summary with overwrite will clear output argument, which may not have
been what you wanted

cc: Kristian Høgsberg <krh at bitplanet.net>
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/programs/summary.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/framework/programs/summary.py b/framework/programs/summary.py
index 3a00ffd..02e4471 100644
--- a/framework/programs/summary.py
+++ b/framework/programs/summary.py
@@ -95,6 +95,14 @@ def html(input_):
             args.exclude_details = frozenset(
                 status.status_lookup(i) for i in args.exclude_details)
 
+    # Check that all of the results dirs exist before clearing the summary dir,
+    # this protects users from putting their arguments in the wrong order
+    # losing their results.
+    for result in args.resultsFiles:
+        if not os.path.exists(result):
+            raise exceptions.PiglitFatalError(
+                "Results directory {} doesn't exist. Did you specify the "
+                "output directory first, and results after that?".format(result))
 
     # if overwrite is requested delete the output directory
     if path.exists(args.summaryDir) and args.overwrite:
-- 
2.8.0



More information about the Piglit mailing list