* [RFC PATCH] tests/tcg: better trap gdb failures
@ 2020-04-15 10:22 Alex Bennée
0 siblings, 0 replies; only message in thread
From: Alex Bennée @ 2020-04-15 10:22 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, open list:ARM TCG CPUs, Alex Bennée
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 <alex.bennee@linaro.org>
---
tests/guest-debug/run-test.py | 19 ++++++++++++++++++-
tests/tcg/aarch64/gdbstub/test-sve-ioctl.py | 1 -
tests/tcg/aarch64/gdbstub/test-sve.py | 1 -
3 files changed, 18 insertions(+), 3 deletions(-)
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 5824abe09ac..972cf73c315 100644
--- a/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py
+++ b/tests/tcg/aarch64/gdbstub/test-sve-ioctl.py
@@ -67,7 +67,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 90201d80094..b96bdbb99af 100644
--- a/tests/tcg/aarch64/gdbstub/test-sve.py
+++ b/tests/tcg/aarch64/gdbstub/test-sve.py
@@ -68,7 +68,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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-04-15 10:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-15 10:22 [RFC PATCH] tests/tcg: better trap gdb failures Alex Bennée
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).