Fail if simulator exits early.
[riscv-tests.git] / debug / testlib.py
index 86095e38c8fc88cd4f4889f2deb904c3adbd8801..3d08e9b33e172388433950d74f5de40cbb27d2fb 100644 (file)
@@ -132,6 +132,12 @@ class VcsSim(object):
                 stdout=logfile, stderr=logfile)
         done = False
         while not done:
+            # Fail if VCS exits early
+            exit_code = self.process.poll()
+            if exit_code is not None:
+                raise RuntimeError('VCS simulator exited early with status %d'
+                                   % exit_code)
+
             line = listenfile.readline()
             if not line:
                 time.sleep(1)
@@ -371,8 +377,9 @@ def run_all_tests(module, target, parsed):
     gdb_cmd = parsed.gdb
 
     todo = []
-    if (parsed.misa):
-        self.target.misa = parsed.misa
+    if (parsed.misaval):
+        target.misa = int(parsed.misaval, 16)
+        print "Assuming $MISA value of 0x%x. Skipping ExamineTarget." % target.misa
     else:
         todo.append(("ExamineTarget", ExamineTarget))
 
@@ -403,14 +410,15 @@ def run_all_tests(module, target, parsed):
     return result
 
 def add_test_run_options(parser):
+
     parser.add_argument("--fail-fast", "-f", action="store_true",
             help="Exit as soon as any test fails.")
     parser.add_argument("test", nargs='*',
             help="Run only tests that are named here.")
     parser.add_argument("--gdb",
             help="The command to use to start gdb.")
-    parser.add_argument("--misa", "-m",
-            help="Don't run ExamineTarget, just assume the misa which is specified.")
+    parser.add_argument("--misaval",
+            help="Don't run ExamineTarget, just assume the misa value which is specified.")
 
 def header(title, dash='-'):
     if title: