[Piglit] [PATCH] resume: use the previously-set test-list when resuming

Martin Peres martin.peres at linux.intel.com
Wed Jan 11 15:45:48 UTC 2017


Previously, the test-list was not saved when running and resuming a run
would ignore the test-list and execute the entire test set.

This patch tries to follow Dylan's proposal[0].

[0] https://patchwork.freedesktop.org/patch/122189/

Cc: Rami Ben Hassine <ramix.ben.hassine at intel.com>
Cc: Olivier Berthier <olivierx.berthier at intel.com>
Cc: Julian Dumez <julian.dumez at intel.com>
Cc: Dylan Baker <dylan at pnwbakers.com>
Reported-by: Rami Ben Hassine <ramix.ben.hassine at intel.com>
Signed-off-by: Martin Peres <martin.peres at linux.intel.com>
---
 framework/programs/run.py | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/framework/programs/run.py b/framework/programs/run.py
index e5d55837a..177bd535c 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -220,7 +220,7 @@ def _run_parser(input_):
     return parser.parse_args(unparsed)
 
 
-def _create_metadata(args, name):
+def _create_metadata(args, name, forced_test_list):
     """Create and return a metadata dict for Backend.initialize()."""
     opts = dict(options.OPTIONS)
     opts['profile'] = args.test_profile
@@ -232,6 +232,7 @@ def _create_metadata(args, name):
     opts['monitoring'] = args.monitored
     if args.platform:
         opts['platform'] = args.platform
+    opts['forced_test_list'] = forced_test_list
 
     metadata = {'options': opts}
     metadata['name'] = name
@@ -308,26 +309,31 @@ def run(input_):
             'Cannot overwrite existing folder without the -o/--overwrite '
             'option being set.')
 
+    # If a test list is provided then set the forced_test_list value.
+    forced_test_list = None
+    if args.test_list:
+        if len(args.test_profile) != 1:
+            raise exceptions.PiglitFatalError(
+                'Unable to force a test list with more than one profile')
+
+        with open(args.test_list) as test_list:
+            # Strip newlines
+            forced_test_list = [t.strip() for t in test_list]
+
     backend = backends.get_backend(args.backend)(
         args.results_path,
         junit_suffix=args.junit_suffix,
         junit_subtests=args.junit_subtests)
     backend.initialize(_create_metadata(
-        args, args.name or path.basename(args.results_path)))
+        args, args.name or path.basename(args.results_path), forced_test_list))
 
     profiles = [profile.load_test_profile(p) for p in args.test_profile]
     for p in profiles:
         p.results_dir = args.results_path
 
-    # If a test list is provided then set the forced_test_list value.
-    if args.test_list:
-        if len(args.test_profile) != 1:
-            raise exceptions.PiglitFatalError(
-                'Unable to force a test list with more than one profile')
-
-        with open(args.test_list) as test_list:
-            # Strip newlines
-            profiles[0].forced_test_list = [t.strip() for t in test_list]
+    # Set the forced_test_list, if applicable
+    if forced_test_list:
+        profiles[0].forced_test_list = forced_test_list
 
     # Set the dmesg type
     if args.dmesg:
@@ -424,6 +430,9 @@ def resume(input_):
             p.filters.append(
                 profile.RegexFilter(results.options['include_filter']))
 
+        if results.options['forced_test_list']:
+            p.forced_test_list = results.options['forced_test_list']
+
     # This is resumed, don't bother with time since it won't be accurate anyway
     profile.run(
         profiles,
-- 
2.11.0



More information about the Piglit mailing list