770e77ad1e9c6621642e00811efdb1092d4a996c
9 class SmokeTest(unittest
.TestCase
):
11 self
.tmpf
= tempfile
.NamedTemporaryFile()
12 testlib
.compile("debug.c", self
.tmpf
.name
)
13 self
.spike
= testlib
.spike(self
.tmpf
.name
, halted
=False)
14 self
.gdb
= testlib
.Gdb()
15 self
.gdb
.command("file %s" % self
.tmpf
.name
)
16 self
.gdb
.command("target extended-remote localhost:9824")
17 self
.gdb
.command("p i=0");
23 def test_turbostep(self
):
24 """Single step until the program exits. TODO"""
27 self
.gdb
.command("stepi")
28 pc
= self
.gdb
.command("p $pc")
29 self
.assertNotEqual(last_pc
, pc
)
33 output
= self
.gdb
.command("c")
34 self
.assertIn("Continuing", output
)
35 self
.assertIn("Remote connection closed", output
)
37 def test_breakpoint(self
):
38 self
.gdb
.command("b print_row")
39 # The breakpoint should be hit exactly 10 times.
41 output
= self
.gdb
.command("c")
42 self
.assertIn("Continuing", output
)
43 self
.assertIn("Breakpoint 1", output
)
44 output
= self
.gdb
.command("c")
45 self
.assertIn("Continuing", output
)
46 self
.assertIn("Remote connection closed", output
)
48 def test_registers(self
):
49 output
= self
.gdb
.command("info all-registers")
50 self
.assertNotIn("Could not", output
)
51 for reg
in ('zero', 'ra', 'sp', 'gp', 'tp'):
52 self
.assertIn(reg
, output
)
53 # mcpuid is one of the few registers that should have the high bit set
55 self
.assertRegexpMatches(output
, ".*mcpuid *0x80")
57 # The time register should always be changing.
60 time
= self
.gdb
.command("p $time").split('=')[-1]
61 self
.assertNotEqual(time
, last_time
)
63 self
.gdb
.command("stepi")
65 if __name__
== '__main__':