[Piglit] [PATCH v2 6/26] framework/programs/run: Remove use of TestrunResult

Dylan Baker dylan at pnwbakers.com
Thu Oct 27 21:31:34 UTC 2016


We basically only used it to set the name and the time elapsed. That's
silly, just do those things directly. It needs less code and doesn't
require creating a big object.

This is leftover from the days before atomic writes, when results were
all stored in memory until the end of the run.

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

diff --git a/framework/programs/run.py b/framework/programs/run.py
index 741a492..bf0cebe 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -305,20 +305,12 @@ def run(input_):
             'Cannot overwrite existing folder without the -o/--overwrite '
             'option being set.')
 
-    results = framework.results.TestrunResult()
-    backends.set_meta(args.backend, results)
-
-    # Set results.name
-    if args.name is not None:
-        results.name = args.name
-    else:
-        results.name = path.basename(args.results_path)
-
     backend = backends.get_backend(args.backend)(
         args.results_path,
         junit_suffix=args.junit_suffix,
         junit_subtests=args.junit_subtests)
-    backend.initialize(_create_metadata(args, results.name))
+    backend.initialize(_create_metadata(
+        args, args.name or path.basename(args.results_path)))
 
     profile = framework.profile.merge_test_profiles(args.test_profile)
     profile.results_dir = args.results_path
@@ -328,7 +320,6 @@ def run(input_):
             # Strip newlines
             profile.forced_test_list = list([t.strip() for t in test_list])
 
-    results.time_elapsed.start = time.time()
     # Set the dmesg type
     if args.dmesg:
         profile.dmesg = args.dmesg
@@ -336,10 +327,12 @@ def run(input_):
     if args.monitored:
         profile.monitoring = args.monitored
 
+    time_elapsed = framework.results.TimeAttribute(start=time.time())
+
     framework.profile.run(profile, args.log_level, backend, args.concurrent)
 
-    results.time_elapsed.end = time.time()
-    backend.finalize({'time_elapsed': results.time_elapsed.to_json()})
+    time_elapsed.end = time.time()
+    backend.finalize({'time_elapsed': time_elapsed.to_json()})
 
     print('Thank you for running Piglit!\n'
           'Results have been written to ' + args.results_path)
-- 
git-series 0.8.10


More information about the Piglit mailing list