summary refs log tree commit diff stats
path: root/tests/guest-debug/test_gdbstub.py
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2024-10-22 13:37:11 +0200
committerAlex Bennée <alex.bennee@linaro.org>2024-11-18 15:54:34 +0000
commitcb241df412bce92440b08443f2f2ffa798e32086 (patch)
tree09ad7c154db1e7c0d5fc267f8d2e148f3ef72a13 /tests/guest-debug/test_gdbstub.py
parent0fbc798e4f51d6d2bc05f4965b0eae74ba204471 (diff)
downloadfocaccia-qemu-cb241df412bce92440b08443f2f2ffa798e32086.tar.gz
focaccia-qemu-cb241df412bce92440b08443f2f2ffa798e32086.zip
tests/tcg: Stop using exit() in the gdbstub testcases
GDB 15 does not like exit() anymore:

    (gdb) python exit(0)
    Python Exception <class 'SystemExit'>: 0
    Error occurred in Python: 0

Use the GDB's own exit command, like it's already done in a couple
places, everywhere. This is the same fix as commit 93a3048dcf45
("tests: Gently exit from GDB when tests complete"), but applied to
more places.

Acked-by: Gustavo Romero <gustavo.romero@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20241022113939.19989-1-iii@linux.ibm.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Diffstat (limited to 'tests/guest-debug/test_gdbstub.py')
-rw-r--r--tests/guest-debug/test_gdbstub.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/guest-debug/test_gdbstub.py b/tests/guest-debug/test_gdbstub.py
index a715c0e3f5..4f08089e6a 100644
--- a/tests/guest-debug/test_gdbstub.py
+++ b/tests/guest-debug/test_gdbstub.py
@@ -10,10 +10,16 @@ import traceback
 
 fail_count = 0
 
+
+def gdb_exit(status):
+    gdb.execute(f"exit {status}")
+
+
 class arg_parser(argparse.ArgumentParser):
     def exit(self, status=None, message=""):
         print("Wrong GDB script test argument! " + message)
-        gdb.execute("exit 1")
+        gdb_exit(1)
+
 
 def report(cond, msg):
     """Report success/fail of a test"""
@@ -38,11 +44,11 @@ def main(test, expected_arch=None):
                    "connected to {}".format(expected_arch))
     except (gdb.error, AttributeError):
         print("SKIP: not connected")
-        exit(0)
+        gdb_exit(0)
 
     if gdb.parse_and_eval("$pc") == 0:
         print("SKIP: PC not set")
-        exit(0)
+        gdb_exit(0)
 
     try:
         test()
@@ -62,4 +68,4 @@ def main(test, expected_arch=None):
         pass
 
     print("All tests complete: {} failures".format(fail_count))
-    gdb.execute(f"exit {fail_count}")
+    gdb_exit(fail_count)