aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2017-09-29 15:41:30 -0700
committerTim Newsome <tim@sifive.com>2017-09-29 15:41:30 -0700
commit76029e5a96545c6cc97bce17b69f99dcb51c5f6c (patch)
treeb7c30375e0ee50750ae3c3b1a6beed04b6d2199b
parent35c41f1391b51d4d9c4e0ab40fdfc45dbea346b2 (diff)
downloadriscv-tests-76029e5a96545c6cc97bce17b69f99dcb51c5f6c.zip
riscv-tests-76029e5a96545c6cc97bce17b69f99dcb51c5f6c.tar.gz
riscv-tests-76029e5a96545c6cc97bce17b69f99dcb51c5f6c.tar.bz2
Make ExamineTarget multi-core aware.
Now on multi-core targets it only runs once, wasting less time.
-rw-r--r--debug/testlib.py41
1 files changed, 23 insertions, 18 deletions
diff --git a/debug/testlib.py b/debug/testlib.py
index 996c188..94694a0 100644
--- a/debug/testlib.py
+++ b/debug/testlib.py
@@ -447,14 +447,16 @@ def run_all_tests(module, target, parsed):
gdb_cmd = parsed.gdb
todo = []
+ examine_added = False
for hart in target.harts:
if parsed.misaval:
hart.misa = int(parsed.misaval, 16)
print "Using $misa from command line: 0x%x" % hart.misa
elif hart.misa:
print "Using $misa from hart definition: 0x%x" % hart.misa
- else:
- todo.append(("ExamineTarget", ExamineTarget, hart))
+ elif not examine_added:
+ todo.append(("ExamineTarget", ExamineTarget, None))
+ examine_added = True
for name in dir(module):
definition = getattr(module, name)
@@ -699,23 +701,26 @@ class GdbSingleHartTest(GdbTest):
class ExamineTarget(GdbTest):
def test(self):
- self.hart.misa = self.gdb.p("$misa")
-
- txt = "RV"
- if (self.hart.misa >> 30) == 1:
- txt += "32"
- elif (self.hart.misa >> 62) == 2:
- txt += "64"
- elif (self.hart.misa >> 126) == 3:
- txt += "128"
- else:
- raise TestFailed("Couldn't determine XLEN from $misa (0x%x)" %
- self.hart.misa)
+ for hart in self.target.harts:
+ self.gdb.select_hart(hart)
+
+ hart.misa = self.gdb.p("$misa")
+
+ txt = "RV"
+ if (hart.misa >> 30) == 1:
+ txt += "32"
+ elif (hart.misa >> 62) == 2:
+ txt += "64"
+ elif (hart.misa >> 126) == 3:
+ txt += "128"
+ else:
+ raise TestFailed("Couldn't determine XLEN from $misa (0x%x)" %
+ self.hart.misa)
- for i in range(26):
- if self.hart.misa & (1<<i):
- txt += chr(i + ord('A'))
- print txt,
+ for i in range(26):
+ if hart.misa & (1<<i):
+ txt += chr(i + ord('A'))
+ print txt,
class TestFailed(Exception):
def __init__(self, message):