]> Git Repo - qemu.git/commitdiff
tests/tcg: better trap gdb failures
authorAlex Bennée <[email protected]>
Thu, 30 Apr 2020 19:01:16 +0000 (20:01 +0100)
committerAlex Bennée <[email protected]>
Wed, 6 May 2020 08:29:26 +0000 (09:29 +0100)
It seems older and non-multiarach aware GDBs might not fail gracefully
when faced with something they don't know. For example when faced with
a target XML for s390x the Ubuntu 18.04 gdb will generate an internal
fault and prompt for a core dump.

Work around this by invoking GDB in a more batch orientated way and
then trying to filter out between test failures and gdb failures.

Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <20200430190122[email protected]>

tests/guest-debug/run-test.py
tests/tcg/aarch64/gdbstub/test-sve-ioctl.py
tests/tcg/aarch64/gdbstub/test-sve.py

index 8c49ee2f2255d183b75dae7b367fb31866c2cdb7..2bbb8fbaa387447cb8d1d6cd17558bd6d0377a3c 100755 (executable)
@@ -50,8 +50,25 @@ if __name__ == '__main__':
     inferior = subprocess.Popen(shlex.split(cmd))
 
     # Now launch gdb with our test and collect the result
-    gdb_cmd = "%s %s -ex 'target remote localhost:1234' -x %s" % (args.gdb, args.binary, args.test)
+    gdb_cmd = "%s %s" % (args.gdb, args.binary)
+    # run quietly and ignore .gdbinit
+    gdb_cmd += " -q -n -batch"
+    # disable prompts in case of crash
+    gdb_cmd += " -ex 'set confirm off'"
+    # connect to remote
+    gdb_cmd += " -ex 'target remote localhost:1234'"
+    # finally the test script itself
+    gdb_cmd += " -x %s" % (args.test)
+
+    print("GDB CMD: %s" % (gdb_cmd))
 
     result = subprocess.call(gdb_cmd, shell=True);
 
+    # A negative result is the result of an internal gdb failure like
+    # a crash. We force a return of 0 so we don't fail the test on
+    # account of broken external tools.
+    if result < 0:
+        print("GDB crashed? SKIPPING")
+        exit(0)
+
     exit(result)
index 984fbeb277ee7e1a2902b1420cdd49fb49849230..387b2fc20aa0fe7c4e87fe28e7901a8bf11ec62e 100644 (file)
@@ -70,7 +70,6 @@ except (gdb.error, AttributeError):
 try:
     # These are not very useful in scripts
     gdb.execute("set pagination off")
-    gdb.execute("set confirm off")
 
     # Run the actual tests
     run_test()
index dbe7f2aa932f895ee7ee6c79afa89d64b13a4a9d..5995689625e8c4eb240bfee907454c998b0ec393 100644 (file)
@@ -71,7 +71,6 @@ except (gdb.error, AttributeError):
 try:
     # These are not very useful in scripts
     gdb.execute("set pagination off")
-    gdb.execute("set confirm off")
 
     # Run the actual tests
     run_test()
This page took 0.031365 seconds and 4 git commands to generate.