From 3f5b065c42fb9a547829941b4173ac41a3f3cebc Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 25 Sep 2021 19:03:05 +0100 Subject: [PATCH] add factory-function for StateRunner --- src/openpower/test/state.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/openpower/test/state.py b/src/openpower/test/state.py index 6274ba47..3cba30ee 100644 --- a/src/openpower/test/state.py +++ b/src/openpower/test/state.py @@ -25,13 +25,24 @@ methods, the use of yield from/yield is required. from openpower.decoder.power_enums import XER_bits from openpower.util import log +global staterunner_factory +staterunner_factory = {} + + +def staterunner_add(name, kls): + log("staterunner_add", name, kls) + staterunner_factory[name] = kls + + # TBD an Abstract Base Class class StateRunner: """StateRunner: an Abstract Base Class for preparing and running "State". near-identical in concept to python unittest.TestCase """ - def __init__(self, dut, **kwargs): pass + def __init__(self, name, kls): + staterunner_add(name, kls) + def setup_for_test(self): if False: yield def setup_during_test(self): @@ -48,6 +59,7 @@ class StateRunner: class SimRunner(StateRunner): def __init__(self, dut, **kwargs): + super().__init__("sim", SimRunner) self.pspec = kwargs['pspec'] self.m = kwargs['m'] -- 2.30.2