Add an --inorder option to test_issuer.py
[soc.git] / src / soc / simple / test / test_issuer.py
index 4f5d2c6a0eebfe0e00fc1f3ec3358ca833c493df..b5799ecf1bc7af30f8f41b8a155f4138fa5bd1ef 100644 (file)
@@ -36,27 +36,35 @@ from openpower.simulator.test_helloworld_sim import HelloTestCases
 
 if __name__ == "__main__":
     svp64 = True
-    if sys.argv[1] == 'nosvp64':
+    if len(sys.argv) > 1 and sys.argv[1] == 'nosvp64':
         svp64 = False
         del sys.argv[1]
 
     # detect overlap case
     allow_overlap = False
-    if sys.argv[1] == '--allow-overlap':
+    if len(sys.argv) >= 2 and sys.argv[1] == '--allow-overlap':
         allow_overlap = True
         del sys.argv[1]
 
+    # use in-order issuer, instead of the original FSM based one
+    inorder = False
+    if len(sys.argv) >= 2 and sys.argv[1] == '--inorder':
+        inorder = True
+        del sys.argv[1]
+
     # allow list of testing to be selected by command-line
-    testing = sys.argv[1:]
-    sys.argv = sys.argv[:1]
+    testing = []
+    for i in reversed(range(1, len(sys.argv))):
+        if not sys.argv[i].startswith('-'):
+            testing.append(sys.argv.pop(i))
 
     if not testing:
         testing = ['general', 'ldst', 'cr', 'shiftrot', 'shiftrot2',
                    'logical', 'alu',
                    'branch', 'div', 'mul', 'hazard']
 
-    print ("SVP64 test mode enabled", svp64, "overlap",
-                                      allow_overlap, "testing", testing)
+    print("SVP64 test mode enabled", svp64, "overlap",
+          allow_overlap, "in-order", inorder, "testing", testing)
 
     unittest.main(exit=False)
     suite = unittest.TestSuite()
@@ -76,12 +84,12 @@ if __name__ == "__main__":
              '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,
+            suite.addTest(TestRunner(data, svp64=svp64, inorder=inorder,
                                      allow_overlap=allow_overlap))
 
     runner = unittest.TextTestRunner()