1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-01 10:52:33 +01:00

Adding instrument_is_enabled function

As instrumentation can be enabled/disabled for a specfic workload
execution, it is sometimes not enough to verify that an instrument has
been installed for the run; one might need to check whether it is
currently enabled.
This commit is contained in:
Sergei Trofimov
2015-05-28 10:13:50 +01:00
parent a254a44f0e
commit 777003ed51
3 changed files with 31 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ from nose.tools import assert_equal, raises, assert_true, assert_false
from wlauto import Instrument
from wlauto.core import signal, instrumentation
from wlauto.instrumentation import instrument_is_installed, clear_instrumentation
from wlauto.instrumentation import instrument_is_installed, instrument_is_enabled, clear_instrumentation
class MockInstrument(Instrument):
@@ -178,6 +178,16 @@ class InstrumentationTest(TestCase):
assert_equal(instrument2.after, 1)
assert_equal(instrument2.result, 1)
def test_check_enabled(self):
instrument = _instantiate(MockInstrument)
instrumentation.install(instrument)
instrumentation.enable(instrument)
assert_true(instrument_is_enabled(instrument))
assert_true(instrument_is_enabled(instrument.name))
instrumentation.disable(instrument)
assert_false(instrument_is_enabled(instrument))
assert_false(instrument_is_enabled(instrument.name))
def test_local_instrument(self):
global counter
counter = 0