From: Luke Kenneth Casson Leighton Date: Sat, 25 Sep 2021 18:03:05 +0000 (+0100) Subject: add factory-function for StateRunner X-Git-Tag: sv_maxu_works-initial~829 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3f5b065c42fb9a547829941b4173ac41a3f3cebc;p=openpower-isa.git add factory-function for StateRunner --- 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']