[Piglit] [PATCH 2/2] results.py: Allow partially completed runs to be summarized

Dylan Baker baker.dylan.c at gmail.com
Thu Nov 13 15:26:05 PST 2014

This restores the ability to create a summary from a partial set of
runs by using the same functionality as resume.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
cc: airlied at gmail.com
 framework/results.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/framework/results.py b/framework/results.py
index 175a386..6ab22b1 100644
--- a/framework/results.py
+++ b/framework/results.py
@@ -190,6 +190,19 @@ def load_results(filename):
     # file descriptors
     if not os.path.isdir(filename):
         filepath = filename
+    elif os.path.exists(os.path.join(filename, 'metadata.json')):
+        # If the test is still running we need to use the resume code, since
+        # there will not be a results.json file.
+        # We want to return here since the results are known current (there's
+        # an assert in TestrunResult.load), and there is no filepath
+        # to pass to update_results
+        # XXX: This needs to be run before searching for a results.json file so
+        #      that if the new run is overwriting an old one we load the
+        #      partial and not the original. It might be better to just delete
+        #      the contents of the folder if there is anything in it.
+        # XXX: What happens if the tests folder gets deleted in the middle of
+        #      this?
+        return TestrunResult.resume(filename)
         # If there are both old and new results in a directory pick the new
         # ones first

More information about the Piglit mailing list