From 211ef036611d5eefb151ab32843e5bfeb65b036e Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sat, 18 Sep 2021 16:35:59 +0100 Subject: [PATCH] allow individual unit tests to be named in test_issuer.py --- src/soc/simple/test/test_issuer.py | 44 ++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/soc/simple/test/test_issuer.py b/src/soc/simple/test/test_issuer.py index ebc529fc..2b6fa3e9 100644 --- a/src/soc/simple/test/test_issuer.py +++ b/src/soc/simple/test/test_issuer.py @@ -25,10 +25,10 @@ from openpower.test.logical.logical_cases import LogicalTestCase from openpower.test.shift_rot.shift_rot_cases import ShiftRotTestCase from openpower.test.cr.cr_cases import CRTestCase from openpower.test.branch.branch_cases import BranchTestCase -# from soc.fu.spr.test.test_pipe_caller import SPRTestCase +from soc.fu.spr.test.test_pipe_caller import SPRTestCase from openpower.test.ldst.ldst_cases import LDSTTestCase from openpower.simulator.test_sim import (GeneralTestCases, AttnTestCase) -# from openpower.simulator.test_helloworld_sim import HelloTestCases +from openpower.simulator.test_helloworld_sim import HelloTestCases if __name__ == "__main__": @@ -38,21 +38,37 @@ if __name__ == "__main__": svp64 = False sys.argv.pop() - print ("SVP64 test mode enabled", svp64) + # allow list of testing to be selected by command-line + testing = sys.argv[1:] + sys.argv = sys.argv[:1] + + if not testing: + testing = ['general', 'ldst', 'cr', 'shiftrot', 'logical', 'alu', + 'branch', 'div'] + + print ("SVP64 test mode enabled", svp64, testing) unittest.main(exit=False) suite = unittest.TestSuite() - # suite.addTest(TestRunner(HelloTestCases.test_data, svp64=svp64)) - suite.addTest(TestRunner(DivTestCases().test_data, svp64=svp64)) - # suite.addTest(TestRunner(AttnTestCase.test_data, svp64=svp64)) - suite.addTest(TestRunner(GeneralTestCases.test_data, svp64=svp64)) - suite.addTest(TestRunner(LDSTTestCase().test_data, svp64=svp64)) - suite.addTest(TestRunner(CRTestCase().test_data, svp64=svp64)) - suite.addTest(TestRunner(ShiftRotTestCase().test_data, svp64=svp64)) - suite.addTest(TestRunner(LogicalTestCase().test_data, svp64=svp64)) - suite.addTest(TestRunner(ALUTestCase().test_data, svp64=svp64)) - suite.addTest(TestRunner(BranchTestCase().test_data, svp64=svp64)) - # suite.addTest(TestRunner(SPRTestCase.test_data, svp64=svp64)) + + # dictionary of data for tests + tests = {'hello': HelloTestCases.test_data, + 'div': DivTestCases().test_data, + 'attn': AttnTestCase.test_data, + 'general': GeneralTestCases.test_data, + 'ldst': LDSTTestCase().test_data, + 'cr': CRTestCase().test_data, + 'shiftrot': ShiftRotTestCase().test_data, + 'logical': LogicalTestCase().test_data, + 'alu': ALUTestCase().test_data, + 'branch': BranchTestCase().test_data, + 'spr': SPRTestCase().test_data + } + + # walk through all tests, those requested get added + for tname, data in tests.items(): + if tname in testing: + suite.addTest(TestRunner(data, svp64=svp64)) runner = unittest.TextTestRunner() runner.run(suite) -- 2.30.2