From a450957b9aa4ee767cd8984a33120444ee74b839 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Fri, 15 May 2015 10:01:26 +0100 Subject: [PATCH] Fixing locally defined instruments erroneously propagating into global instrumentation --- wlauto/core/configuration.py | 3 ++- wlauto/tests/test_config.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/wlauto/core/configuration.py b/wlauto/core/configuration.py index 6b9a052e..33e55a85 100644 --- a/wlauto/core/configuration.py +++ b/wlauto/core/configuration.py @@ -686,7 +686,8 @@ class RunConfiguration(object): default_config = self.ext_loader.get_default_config(extname) ext_config[extname] = self._raw_config.get(identifier(extname), default_config) list_name = '_global_{}'.format(attr_name) - setattr(self, list_name, raw_list) + global_list = self._raw_config.get(list_name, []) + setattr(self, list_name, global_list) setattr(self, attr_name, ext_config) def _finalize_device_config(self): diff --git a/wlauto/tests/test_config.py b/wlauto/tests/test_config.py index 2c9f9ac3..40eac92b 100644 --- a/wlauto/tests/test_config.py +++ b/wlauto/tests/test_config.py @@ -42,6 +42,14 @@ workloads: - dhrystone """ +INSTRUMENTATION_AGENDA_TEXT = """ +config: + instrumentation: [execution_time] +workloads: + - dhrystone + - name: angrybirds + instrumentation: [fsp] +""" class MockExtensionLoader(object): @@ -167,6 +175,13 @@ class ConfigTest(TestCase): self.config.finalize() assert_equal(self.config.instrumentation['list_params']['param'], [0.1, 0.1, 0.1]) + def test_instrumentation_specification(self): + a = Agenda(INSTRUMENTATION_AGENDA_TEXT) + self.config.set_agenda(a) + self.config.finalize() + assert_equal(self.config.workload_specs[0].instrumentation, ['execution_time']) + assert_equal(self.config.workload_specs[1].instrumentation, ['fsp', 'execution_time']) + def test_remove_instrument(self): self.config.load_config({'instrumentation': ['list_params']}) a = Agenda('{config: {instrumentation: [~list_params] }}')