diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/options.py | 4 | ||||
-rw-r--r-- | framework/profile.py | 48 | ||||
-rw-r--r-- | framework/programs/run.py | 21 | ||||
-rw-r--r-- | framework/test/base.py | 31 |
4 files changed, 34 insertions, 70 deletions
diff --git a/framework/options.py b/framework/options.py index db4bf7633..211159a45 100644 --- a/framework/options.py +++ b/framework/options.py @@ -48,8 +48,6 @@ class _Options(object): # pylint: disable=too-many-instance-attributes Options are as follows: execute -- False for dry run valgrind -- True if valgrind is to be used - dmesg -- True if dmesg checking is desired. This forces concurrency off - monitored -- True if monitoring is desired. This forces concurrency off env -- environment variables set for each test before run deqp_mustpass -- True to enable the use of the deqp mustpass list feature. """ @@ -57,8 +55,6 @@ class _Options(object): # pylint: disable=too-many-instance-attributes def __init__(self): self.execute = True self.valgrind = False - self.dmesg = False - self.monitored = False self.sync = False self.deqp_mustpass = False self.process_isolation = True diff --git a/framework/profile.py b/framework/profile.py index 8449e7afc..1bde8fb6a 100644 --- a/framework/profile.py +++ b/framework/profile.py @@ -211,42 +211,10 @@ class TestProfile(object): self.test_list = TestDict() self.forced_test_list = [] self.filters = [] - # Sets a default of a Dummy - self._dmesg = None - self.dmesg = False - self.results_dir = None - self._monitoring = None - self.monitoring = False - - @property - def dmesg(self): - """ Return dmesg """ - return self._dmesg - - @dmesg.setter - def dmesg(self, not_dummy): - """Use dmesg. - - Arguments: - not_dummy -- Get a platform dependent Dmesg class if True, otherwise - get a DummyDmesg. - """ - self._dmesg = get_dmesg(not_dummy) - - @property - def monitoring(self): - """ Return monitoring """ - return self._monitoring - - @monitoring.setter - def monitoring(self, monitored): - """Set monitoring. - - Arguments: - monitored -- if Truthy Monitoring will enable monitoring according the - defined rules - """ - self._monitoring = Monitoring(monitored) + self.options = { + 'dmesg': get_dmesg(False), + 'monitor': Monitoring(False), + } @contextlib.contextmanager def group_manager(self, test_class, group, prefix=None, **default_args): @@ -431,9 +399,9 @@ def run(profiles, logger, backend, concurrency): def test(name, test, profile, this_pool=None): """Function to call test.execute from map""" with backend.write_test(name) as w: - test.execute(name, log.get(), profile.dmesg, profile.monitoring) + test.execute(name, log.get(), profile.options) w(test.result) - if profile.monitoring.abort_needed: + if profile.options['monitor'].abort_needed: this_pool.terminate() def run_threads(pool, profile, test_list, filterby=None): @@ -484,5 +452,5 @@ def run(profiles, logger, backend, concurrency): log.get().summary() for p, _ in profiles: - if p.monitoring.abort_needed: - raise exceptions.PiglitAbort(p.monitoring.error_message) + if p.options['monitor'].abort_needed: + raise exceptions.PiglitAbort(p.options['monitor'].error_message) diff --git a/framework/programs/run.py b/framework/programs/run.py index 2ef3b4ecd..9d9538f58 100644 --- a/framework/programs/run.py +++ b/framework/programs/run.py @@ -34,6 +34,8 @@ import time import six from framework import core, backends, exceptions, options +from framework import dmesg +from framework import monitoring from framework import profile from framework.results import TimeAttribute from . import parsers @@ -226,6 +228,8 @@ def _create_metadata(args, name): opts['concurrent'] = args.concurrency opts['include_filter'] = args.include_tests opts['exclude_filter'] = args.exclude_tests + opts['dmesg'] = args.dmesg + opts['monitoring'] = args.monitored if args.platform: opts['platform'] = args.platform @@ -282,8 +286,6 @@ def run(input_): # Pass arguments into Options options.OPTIONS.execute = args.execute options.OPTIONS.valgrind = args.valgrind - options.OPTIONS.dmesg = args.dmesg - options.OPTIONS.monitored = args.monitored options.OPTIONS.sync = args.sync options.OPTIONS.deqp_mustpass = args.deqp_mustpass options.OPTIONS.process_isolation = args.process_isolation @@ -330,11 +332,11 @@ def run(input_): # Set the dmesg type if args.dmesg: for p in profiles: - p.dmesg = args.dmesg + p.options['dmesg'] = dmesg.get_dmesg(args.dmesg) if args.monitored: for p in profiles: - p.monitoring = args.monitored + p.options['monitor'] = monitoring.Monitoring(args.monitored) for p in profiles: if args.exclude_tests: @@ -376,8 +378,6 @@ def resume(input_): results = backends.load(args.results_path) options.OPTIONS.execute = results.options['execute'] options.OPTIONS.valgrind = results.options['valgrind'] - options.OPTIONS.dmesg = results.options['dmesg'] - options.OPTIONS.monitored = results.options['monitored'] options.OPTIONS.sync = results.options['sync'] options.OPTIONS.deqp_mustpass = results.options['deqp_mustpass'] options.OPTIONS.proces_isolation = results.options['process_isolation'] @@ -407,11 +407,12 @@ def resume(input_): for p in profiles: p.results_dir = args.results_path - if options.OPTIONS.dmesg: - p.dmesg = options.OPTIONS.dmesg + if results.options['dmesg']: + p.dmesg = dmesg.get_dmesg(results.options['dmesg']) - if options.OPTIONS.monitored: - p.monitoring = options.OPTIONS.monitored + if results.options['monitoring']: + p.options['monitor'] = monitoring.Monitoring( + results.options['monitoring']) if exclude_tests: p.filters.append(lambda n, _: n not in exclude_tests) diff --git a/framework/test/base.py b/framework/test/base.py index 5f0491dfe..6b7cab658 100644 --- a/framework/test/base.py +++ b/framework/test/base.py @@ -39,8 +39,9 @@ import warnings import six from six.moves import range -from framework import exceptions, options +from framework import exceptions from framework import status +from framework.options import OPTIONS from framework.results import TestResult # We're doing some special crazy here to make timeouts work on python 2. pylint @@ -186,30 +187,28 @@ class Test(object): assert isinstance(timeout, int) self.timeout = timeout - def execute(self, path, log, dmesg, monitoring): + def execute(self, path, log, options): """ Run a test Run a test, but with features. This times the test, uses dmesg checking (if requested), and runs the logger. Arguments: - path -- the name of the test - log -- a log.Log instance - dmesg -- a dmesg.BaseDmesg derived class - monitoring -- a monitoring.Monitoring instance - + path -- the name of the test + log -- a log.Log instance + options -- a dictionary containing dmesg and monitoring objects """ log.start(path) # Run the test - if options.OPTIONS.execute: + if OPTIONS.execute: try: self.result.time.start = time.time() - dmesg.update_dmesg() - monitoring.update_monitoring() + options['dmesg'].update_dmesg() + options['monitor'].update_monitoring() self.run() self.result.time.end = time.time() - self.result = dmesg.update_result(self.result) - monitoring.check_monitoring() + self.result = options['dmesg'].update_result(self.result) + options['monitor'].check_monitoring() # This is a rare case where a bare exception is okay, since we're # using it to log exceptions except: @@ -254,7 +253,7 @@ class Test(object): self.result.command = ' '.join(self.command) self.result.environment = " ".join( '{0}="{1}"'.format(k, v) for k, v in itertools.chain( - six.iteritems(options.OPTIONS.env), six.iteritems(self.env))) + six.iteritems(OPTIONS.env), six.iteritems(self.env))) try: self.is_skip() @@ -319,7 +318,7 @@ class Test(object): else: f = six.text_type _base = itertools.chain(six.iteritems(os.environ), - six.iteritems(options.OPTIONS.env), + six.iteritems(OPTIONS.env), six.iteritems(self.env)) fullenv = {f(k): f(v) for k, v in _base} @@ -419,7 +418,7 @@ class ValgrindMixin(object): @Test.command.getter def command(self): command = super(ValgrindMixin, self).command - if options.OPTIONS.valgrind: + if OPTIONS.valgrind: return ['valgrind', '--quiet', '--error-exitcode=1', '--tool=memcheck'] + command else: @@ -436,7 +435,7 @@ class ValgrindMixin(object): """ super(ValgrindMixin, self).interpret_result() - if options.OPTIONS.valgrind: + if OPTIONS.valgrind: # If the underlying test failed, simply report # 'skip' for this valgrind test. if self.result.result != 'pass' and ( |