aboutsummaryrefslogtreecommitdiff
path: root/debug/testlib.py
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2019-03-11 08:43:14 -0700
committerGitHub <noreply@github.com>2019-03-11 08:43:14 -0700
commit4f784ca9b8d3536c16061518c1c2b66e3118cc5c (patch)
tree6d801e89c8836a84ab41646267b8c7170c3326eb /debug/testlib.py
parent26d821d126fd0e36bf286420452f5628c946e7cb (diff)
downloadriscv-tests-4f784ca9b8d3536c16061518c1c2b66e3118cc5c.zip
riscv-tests-4f784ca9b8d3536c16061518c1c2b66e3118cc5c.tar.gz
riscv-tests-4f784ca9b8d3536c16061518c1c2b66e3118cc5c.tar.bz2
Add SmpSimultaneousRunHalt test. (#181)
This test confirms that in SMP configurations OpenOCD halts the harts near-simulatenously. (It'll also check for resume, but that's not implemented yet so commented out for now.)
Diffstat (limited to 'debug/testlib.py')
-rw-r--r--debug/testlib.py30
1 files changed, 20 insertions, 10 deletions
diff --git a/debug/testlib.py b/debug/testlib.py
index 9c620b2..c4b785c 100644
--- a/debug/testlib.py
+++ b/debug/testlib.py
@@ -245,12 +245,12 @@ class Openocd(object):
]
if config:
- f = find_file(config)
- if f is None:
+ self.config_file = find_file(config)
+ if self.config_file is None:
print "Unable to read file " + config
exit(1)
- cmd += ["-f", f]
+ cmd += ["-f", self.config_file]
if debug:
cmd.append("-d")
@@ -318,6 +318,14 @@ class Openocd(object):
except (OSError, AttributeError):
pass
+ def smp(self):
+ """Return true iff OpenOCD internally sees the harts as part of an SMP
+ group."""
+ for line in file(self.config_file, "r"):
+ if "target smp" in line:
+ return True
+ return False
+
class OpenocdCli(object):
def __init__(self, port=4444):
self.child = pexpect.spawn(
@@ -967,9 +975,11 @@ class ExamineTarget(GdbTest):
print txt,
class TestFailed(Exception):
- def __init__(self, message):
+ def __init__(self, message, comment=None):
Exception.__init__(self)
self.message = message
+ if comment:
+ self.message += ": %s" % comment
class TestNotApplicable(Exception):
def __init__(self, message):
@@ -980,25 +990,25 @@ def assertEqual(a, b):
if a != b:
raise TestFailed("%r != %r" % (a, b))
-def assertNotEqual(a, b):
+def assertNotEqual(a, b, comment=None):
if a == b:
- raise TestFailed("%r == %r" % (a, b))
+ raise TestFailed("%r == %r" % (a, b), comment)
def assertIn(a, b):
if a not in b:
raise TestFailed("%r not in %r" % (a, b))
-def assertNotIn(a, b):
+def assertNotIn(a, b, comment=None):
if a in b:
- raise TestFailed("%r in %r" % (a, b))
+ raise TestFailed("%r in %r" % (a, b), comment)
def assertGreater(a, b):
if not a > b:
raise TestFailed("%r not greater than %r" % (a, b))
-def assertLess(a, b):
+def assertLess(a, b, comment=None):
if not a < b:
- raise TestFailed("%r not less than %r" % (a, b))
+ raise TestFailed("%r not less than %r" % (a, b), comment)
def assertTrue(a):
if not a: