[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 08/14] tests/tcg: better trap gdb failures
From: |
Alex Bennée |
Subject: |
[PULL 08/14] tests/tcg: better trap gdb failures |
Date: |
Wed, 6 May 2020 13:05:23 +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 <address@hidden>
Message-Id: <address@hidden>
diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py
index 8c49ee2f225..2bbb8fbaa38 100755
--- a/tests/guest-debug/run-test.py
+++ b/tests/guest-debug/run-test.py
@@ -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)
diff --git a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py
b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py
index 984fbeb277e..387b2fc20aa 100644
--- a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py
+++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py
@@ -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()
diff --git a/tests/tcg/aarch64/gdbstub/test-sve.py
b/tests/tcg/aarch64/gdbstub/test-sve.py
index dbe7f2aa932..5995689625e 100644
--- a/tests/tcg/aarch64/gdbstub/test-sve.py
+++ b/tests/tcg/aarch64/gdbstub/test-sve.py
@@ -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()
--
2.20.1
- [PULL 00/14] testing and gdbstub updates, Alex Bennée, 2020/05/06
- [PULL 02/14] .travis.yml: drop MacOSX, Alex Bennée, 2020/05/06
- [PULL 05/14] .travis.yml: reduce the load on [ppc64] GCC check-tcg, Alex Bennée, 2020/05/06
- [PULL 03/14] .cirrus.yml: bump FreeBSD to the current stable release, Alex Bennée, 2020/05/06
- [PULL 06/14] configure: favour gdb-multiarch if we have it, Alex Bennée, 2020/05/06
- [PULL 01/14] .travis.yml: show free disk space at end of run, Alex Bennée, 2020/05/06
- [PULL 04/14] .cirrus.yml: bootstrap pkg unconditionally, Alex Bennée, 2020/05/06
- [PULL 08/14] tests/tcg: better trap gdb failures,
Alex Bennée <=
- [PULL 07/14] gdbstub: Introduce gdb_get_float64() to get 64-bit float registers, Alex Bennée, 2020/05/06
- [PULL 10/14] gdbstub: eliminate gdbserver_fd global, Alex Bennée, 2020/05/06
- [PULL 09/14] tests/tcg: drop inferior.was_attached() test, Alex Bennée, 2020/05/06
- [PULL 11/14] gdbstub/linux-user: support debugging over a unix socket, Alex Bennée, 2020/05/06
- [PULL 12/14] tests/guest-debug: use the unix socket for linux-user tests, Alex Bennée, 2020/05/06
- [PULL 14/14] target/m68k: fix gdb for m68xxx, Alex Bennée, 2020/05/06
- [PULL 13/14] tests/tcg: add a multiarch linux-user gdb test, Alex Bennée, 2020/05/06
- Re: [PULL 00/14] testing and gdbstub updates, Peter Maydell, 2020/05/06