From 775bdd10f61d75c9130a14f4e4b4ec36c47af7f9 Mon Sep 17 00:00:00 2001 From: klehman Date: Sun, 26 Sep 2021 07:47:12 -0400 Subject: [PATCH] add a state list for method calling --- src/soc/simple/test/test_runner.py | 32 +++++++++++------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/soc/simple/test/test_runner.py b/src/soc/simple/test/test_runner.py index 84674450..096bb88c 100644 --- a/src/soc/simple/test/test_runner.py +++ b/src/soc/simple/test/test_runner.py @@ -373,12 +373,16 @@ class TestRunner(FHDLTestCase): ###### SETUP PHASE ####### # StateRunner.setup_for_test() + state_list = [] + # TODO https://bugs.libre-soc.org/show_bug.cgi?id=686#c73 if self.run_hdl: hdlrun = HDLRunner(self, m, pspec) + state_list.append(hdlrun) if self.run_sim: simrun = SimRunner(self, m, pspec) + state_list.append(simrun) # run core clock at same rate as test clock # XXX this has to stay here! TODO, work out why, @@ -400,11 +404,8 @@ class TestRunner(FHDLTestCase): # dummy "yield" functions so if they're not provided at least # there is a fallback which can be "yielded". - if self.run_sim: - yield from simrun.setup_during_test() # TODO, some arguments? - - if self.run_hdl: - yield from hdlrun.setup_during_test() + for runner in state_list: + yield from runner.setup_during_test() # get each test, completely reset the core, and run it @@ -416,11 +417,8 @@ class TestRunner(FHDLTestCase): # StateRunner.prepare_for_test() # TODO https://bugs.libre-soc.org/show_bug.cgi?id=686#c73 - if self.run_sim: - yield from simrun.prepare_for_test(test) - - if self.run_hdl: - yield from hdlrun.prepare_for_test(test) + for runner in state_list: + yield from runner.prepare_for_test(test) print(test.name) program = test.program @@ -511,21 +509,15 @@ class TestRunner(FHDLTestCase): # StateRunner.end_test() # TODO https://bugs.libre-soc.org/show_bug.cgi?id=686#c73 - if self.run_sim: - yield from simrun.end_test() # TODO, some arguments? - - if self.run_hdl: - yield from hdlrun.end_test() + for runner in state_list: + yield from runner.end_test() # TODO, some arguments? ###### END OF EVERYTHING (but none needs doing, still call fn) #### # StateRunner.cleanup() # TODO https://bugs.libre-soc.org/show_bug.cgi?id=686#c73 - if self.run_sim: - yield from simrun.cleanup() # TODO, some arguments? - - if self.run_hdl: - yield from hdlrun.cleanup() + for runner in state_list: + yield from runner.cleanup() # TODO, some arguments? styles = { 'dec': {'base': 'dec'}, -- 2.30.2