diff options
author | Tim Newsome <tim@sifive.com> | 2016-03-13 15:39:08 -0700 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2016-05-23 12:12:10 -0700 |
commit | 64f7d791b703cc81a8f678de37f42185129b6456 (patch) | |
tree | 1944a4dd633e0a9e0d4f37be031b5578319a151c /tests | |
parent | 651ad043cee90de1c80d07b70a12c81d26b48c95 (diff) | |
download | spike-64f7d791b703cc81a8f678de37f42185129b6456.zip spike-64f7d791b703cc81a8f678de37f42185129b6456.tar.gz spike-64f7d791b703cc81a8f678de37f42185129b6456.tar.bz2 |
Implement reading of CSRs.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/gdbserver-smoke.py | 18 | ||||
-rw-r--r-- | tests/testlib.py | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/tests/gdbserver-smoke.py b/tests/gdbserver-smoke.py index d9eae92..9cdac06 100755 --- a/tests/gdbserver-smoke.py +++ b/tests/gdbserver-smoke.py @@ -14,7 +14,6 @@ class SmokeTest(unittest.TestCase): self.gdb = testlib.Gdb() self.gdb.command("file %s" % self.tmpf.name) self.gdb.command("target extended-remote localhost:9824") - self.gdb.command("p i"); self.gdb.command("p i=0"); def cleanUp(self): @@ -45,5 +44,22 @@ class SmokeTest(unittest.TestCase): self.assertIn("Continuing", output) self.assertIn("Remote connection closed", output) + def test_registers(self): + output = self.gdb.command("info all-registers") + self.assertNotIn("Could not", output) + for reg in ('zero', 'ra', 'sp', 'gp', 'tp'): + self.assertIn(reg, output) + # mcpuid is one of the few registers that should have the high bit set + # (for rv64). + self.assertRegexpMatches(output, ".*mcpuid *0x80") + + # The time register should always be changing. + last_time = None + for _ in range(5): + time = self.gdb.command("p $time").split('=')[-1] + self.assertNotEqual(time, last_time) + last_time = time + self.gdb.command("stepi") + if __name__ == '__main__': unittest.main() diff --git a/tests/testlib.py b/tests/testlib.py index 274ba6c..1f60ce6 100644 --- a/tests/testlib.py +++ b/tests/testlib.py @@ -34,6 +34,8 @@ class Gdb(object): self.child = pexpect.spawn(path) self.child.logfile = file("gdb.log", "w") self.wait() + self.command("set width 0") + self.command("set height 0") def wait(self): """Wait for prompt.""" |