make argv handling more flexible
authorJacob Lifshay <programmerjake@gmail.com>
Thu, 9 Dec 2021 03:49:42 +0000 (19:49 -0800)
committerJacob Lifshay <programmerjake@gmail.com>
Thu, 9 Dec 2021 03:50:20 +0000 (19:50 -0800)
src/soc/simple/test/test_issuer.py

index 11c16339a0c97a06c475f40c4c58b863dd6a38e7..5d22ca09d82a57c87200aca264d072c67e34bd31 100644 (file)
@@ -36,7 +36,7 @@ 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]
 
@@ -47,8 +47,10 @@ if __name__ == "__main__":
         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',