[5/27] framework: remove concurrent from OPTIONS, pass directly to profile

Submitted by Dylan Baker on Oct. 24, 2016, 7:54 p.m.

Details

Message ID 6a96bfc6fed6ced27073212d88b421cacb4d2a2a.1477338764.git-series.dylan@pnwbakers.com
State New
Headers show
Series "Various cleanups for profiles" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Dylan Baker Oct. 24, 2016, 7:54 p.m.
This removes a value out of the global OPTIONS, which is nice. It's very
trivial to pass this instead of putting it in options.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
---
 framework/options.py      |  2 --
 framework/profile.py      |  2 +-
 framework/programs/run.py | 11 +++++++----
 3 files changed, 8 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/framework/options.py b/framework/options.py
index 5cb88aa..46e37ee 100644
--- a/framework/options.py
+++ b/framework/options.py
@@ -171,7 +171,6 @@  class _Options(object):  # pylint: disable=too-many-instance-attributes
     the configuration file.
 
     Options are as follows:
-    concurrent -- one of: ["all", "some", "none"]. Default: "some"
     execute -- False for dry run
     include_filter -- list of compiled regex which include exclusively tests
                       that match
@@ -187,7 +186,6 @@  class _Options(object):  # pylint: disable=too-many-instance-attributes
     exclude_filter = _ReListDescriptor('_exclude_filter', type_=_FilterReList)
 
     def __init__(self):
-        self.concurrent = "some"
         self.execute = True
         self._include_filter = _ReList()
         self._exclude_filter = _ReList()
diff --git a/framework/profile.py b/framework/profile.py
index b10f817..821a630 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -442,7 +442,7 @@  def merge_test_profiles(profiles):
     return profile
 
 
-def run(profile, logger, backend):
+def run(profile, logger, backend, concurrency):
     """Runs all tests using Thread pool.
 
     When called this method will flatten out self.tests into self.test_list,
diff --git a/framework/programs/run.py b/framework/programs/run.py
index ba8437d..be4d75d 100644
--- a/framework/programs/run.py
+++ b/framework/programs/run.py
@@ -222,6 +222,7 @@  def _create_metadata(args, name):
     opts = dict(options.OPTIONS)
     opts['profile'] = args.test_profile
     opts['log_level'] = args.log_level
+    opts['concurrent'] = args.concurrent
     if args.platform:
         opts['platform'] = args.platform
 
@@ -276,7 +277,6 @@  def run(input_):
         args.concurrency = "none"
 
     # Pass arguments into Options
-    options.OPTIONS.concurrent = args.concurrency
     options.OPTIONS.exclude_filter = args.exclude_tests
     options.OPTIONS.include_filter = args.include_tests
     options.OPTIONS.execute = args.execute
@@ -336,7 +336,7 @@  def run(input_):
     if args.monitored:
         profile.monitoring = args.monitored
 
-    framework.profile.run(profile, args.log_level, backend)
+    framework.profile.run(profile, args.log_level, backend, args.concurrent)
 
     results.time_elapsed.end = time.time()
     backend.finalize({'time_elapsed': results.time_elapsed})
@@ -365,7 +365,6 @@  def resume(input_):
     _disable_windows_exception_messages()
 
     results = backends.load(args.results_path)
-    options.OPTIONS.concurrent = results.options['concurrent']
     options.OPTIONS.exclude_filter = results.options['exclude_filter']
     options.OPTIONS.include_filter = results.options['include_filter']
     options.OPTIONS.execute = results.options['execute']
@@ -404,7 +403,11 @@  def resume(input_):
         profile.monitoring = options.OPTIONS.monitored
 
     # This is resumed, don't bother with time since it won't be accurate anyway
-    framework.profile.run(profile, results.options['log_level'], backend)
+    framework.profile.run(
+        profile,
+        results.options['log_level'],
+        backend,
+        results.options['concurrent'])
 
     backend.finalize()