debug: output some more useful info into the post-mortem data
[riscv-tests.git] / debug / testlib.py
index 38ae33beb8d308822858a1047b5b0cb0149a576e..09baf1bec6bb522fb7d85631f2112c61dd1270de 100644 (file)
@@ -549,6 +549,8 @@ class Gdb(object):
         output = self.command("load", ops=1000)
         assert "failed" not in  output
         assert "Transfer rate" in output
+        output = self.command("compare-sections", ops=1000)
+        assert "MIS" not in output
 
     def b(self, location):
         output = self.command("b %s" % location, ops=5)
@@ -594,8 +596,12 @@ class PrivateState(object):
         self.gdb.pop_state()
 
 def run_all_tests(module, target, parsed):
-    if not os.path.exists(parsed.logs):
+    try:
         os.makedirs(parsed.logs)
+    except OSError:
+        # There's a race where multiple instances of the test program might
+        # decide to create the logs directory at the same time.
+        pass
 
     overall_start = time.time()
 
@@ -848,6 +854,8 @@ class GdbTest(BaseTest):
         self.gdb.interrupt()
         self.gdb.command("disassemble", ops=20)
         self.gdb.command("info registers all", ops=100)
+        self.gdb.command("flush regs")
+        self.gdb.command("info threads", ops=100)
 
     def classTeardown(self):
         del self.gdb
@@ -862,6 +870,7 @@ class GdbSingleHartTest(GdbTest):
             if hart != self.hart:
                 self.gdb.select_hart(hart)
                 self.gdb.p("$pc=loop_forever")
+
         self.gdb.select_hart(self.hart)
 
 class ExamineTarget(GdbTest):