master
py 35 lines 905 Bytes
Raw
1
2 #
3 # Test that signals and debugging mix well together on s390x.
4 #
5 # This is launched via tests/guest-debug/run-test.py
6 #
7
8 import gdb
9 from test_gdbstub import main, report
10
11
12 def run_test():
13 """Run through the tests one by one"""
14 illegal_op = gdb.Breakpoint("illegal_op")
15 stg = gdb.Breakpoint("stg")
16 mvc_8 = gdb.Breakpoint("mvc_8")
17
18 # Expect the following events:
19 # 1x illegal_op breakpoint
20 # 2x stg breakpoint, segv, breakpoint
21 # 2x mvc_8 breakpoint, segv, breakpoint
22 for _ in range(14):
23 gdb.execute("c")
24 report(illegal_op.hit_count == 1, "illegal_op.hit_count == 1")
25 report(stg.hit_count == 4, "stg.hit_count == 4")
26 report(mvc_8.hit_count == 4, "mvc_8.hit_count == 4")
27
28 # The test must succeed.
29 gdb.Breakpoint("_exit")
30 gdb.execute("c")
31 status = int(gdb.parse_and_eval("$r2"))
32 report(status == 0, "status == 0")
33
34
35 main(run_test)