diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2024-01-29 10:32:15 +0100 |
---|---|---|
committer | Richard Henderson <richard.henderson@linaro.org> | 2024-01-29 20:48:49 +1000 |
commit | 4d48c1bc079147a02ec1a3df9a41497c515d2e61 (patch) | |
tree | 6ec9659fd3c5df462a61e5a644d9081e85f0dee7 /tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py | |
parent | 87ab270429618c13a6bf6dfc90d5edf6a3fa99b9 (diff) | |
download | qemu-4d48c1bc079147a02ec1a3df9a41497c515d2e61.zip qemu-4d48c1bc079147a02ec1a3df9a41497c515d2e61.tar.gz qemu-4d48c1bc079147a02ec1a3df9a41497c515d2e61.tar.bz2 |
tests/tcg: Factor out gdbstub test functions
Both the report() function as well as the initial gdbstub test sequence
are copy-pasted into ~10 files with slight modifications. This
indicates that they are indeed generic, so factor them out. While
at it, add a few newlines to make the formatting closer to PEP-8.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20240129093410.3151-3-iii@linux.ibm.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py')
-rw-r--r-- | tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py | 37 |
1 files changed, 2 insertions, 35 deletions
diff --git a/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py b/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py index e57d2a8..4d6b6b9 100644 --- a/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py +++ b/tests/tcg/multiarch/gdbstub/test-thread-breakpoint.py @@ -6,18 +6,8 @@ from __future__ import print_function # import gdb -import sys +from test_gdbstub import main, report -failcount = 0 - -def report(cond, msg): - "Report success/fail of test" - if cond: - print ("PASS: %s" % (msg)) - else: - print ("FAIL: %s" % (msg)) - global failcount - failcount += 1 def run_test(): "Run through the tests one by one" @@ -29,28 +19,5 @@ def run_test(): frame = gdb.selected_frame() report(str(frame.function()) == "thread1_func", "break @ %s"%frame) -# -# This runs as the script it sourced (via -x, via run-test.py) -# -try: - inferior = gdb.selected_inferior() - arch = inferior.architecture() - print("ATTACHED: %s" % arch.name()) -except (gdb.error, AttributeError): - print("SKIPPING (not connected)", file=sys.stderr) - exit(0) - -if gdb.parse_and_eval('$pc') == 0: - print("SKIP: PC not set") - exit(0) - -try: - # Run the actual tests - run_test() -except (gdb.error): - print ("GDB Exception: %s" % (sys.exc_info()[0])) - failcount += 1 - pass -print("All tests complete: %d failures" % failcount) -exit(failcount) +main(run_test) |