]> Git Repo - qemu.git/blame - tests/tcg/aarch64/gdbstub/test-sve.py
tests/tcg: better trap gdb failures
[qemu.git] / tests / tcg / aarch64 / gdbstub / test-sve.py
CommitLineData
cf58773f
AB
1from __future__ import print_function
2#
3# Test the SVE registers are visable and changeable via gdbstub
4#
5# This is launched via tests/guest-debug/run-test.py
6#
7
8import gdb
9import sys
10
11MAGIC = 0xDEADBEEF
12
13failcount = 0
14
15def report(cond, msg):
16 "Report success/fail of test"
17 if cond:
18 print ("PASS: %s" % (msg))
19 else:
20 print ("FAIL: %s" % (msg))
21 global failcount
22 failcount += 1
23
24def run_test():
25 "Run through the tests one by one"
26
27 gdb.execute("info registers")
28 report(True, "info registers")
29
30 gdb.execute("info registers vector")
31 report(True, "info registers vector")
32
33 # Now all the zregs
34 frame = gdb.selected_frame()
35 for i in range(0, 32):
36 rname = "z%d" % (i)
37 zreg = frame.read_register(rname)
38 report(True, "Reading %s" % rname)
39 for j in range(0, 4):
40 cmd = "set $%s.q.u[%d] = 0x%x" % (rname, j, MAGIC)
41 gdb.execute(cmd)
42 report(True, "%s" % cmd)
43 for j in range(0, 4):
44 reg = "$%s.q.u[%d]" % (rname, j)
45 v = gdb.parse_and_eval(reg)
46 report(str(v.type) == "uint128_t", "size of %s" % (reg))
47 for j in range(0, 8):
48 cmd = "set $%s.d.u[%d] = 0x%x" % (rname, j, MAGIC)
49 gdb.execute(cmd)
50 report(True, "%s" % cmd)
51 for j in range(0, 8):
52 reg = "$%s.d.u[%d]" % (rname, j)
53 v = gdb.parse_and_eval(reg)
54 report(str(v.type) == "uint64_t", "size of %s" % (reg))
55 report(int(v) == MAGIC, "%s is 0x%x" % (reg, MAGIC))
56
57#
58# This runs as the script it sourced (via -x, via run-test.py)
59#
60try:
61 inferior = gdb.selected_inferior()
62 if inferior.was_attached == False:
63 print("SKIPPING (failed to attach)", file=sys.stderr)
64 exit(0)
65 arch = inferior.architecture()
66 report(arch.name() == "aarch64", "connected to aarch64")
67except (gdb.error, AttributeError):
68 print("SKIPPING (not connected)", file=sys.stderr)
69 exit(0)
70
71try:
72 # These are not very useful in scripts
73 gdb.execute("set pagination off")
cf58773f
AB
74
75 # Run the actual tests
76 run_test()
77except:
78 print ("GDB Exception: %s" % (sys.exc_info()[0]))
79 failcount += 1
80
81print("All tests complete: %d failures" % failcount)
82
83exit(failcount)
This page took 0.035894 seconds and 4 git commands to generate.