diff options
author | Alex Bennée <alex.bennee@linaro.org> | 2020-04-30 20:01:16 +0100 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2020-05-06 09:29:26 +0100 |
commit | d2fefdedd3a65eaf22d8546835c225c3661e23d8 (patch) | |
tree | bf13a26e6864b4944b29ccf37fbe47e5fc56fea2 /tests/guest-debug | |
parent | 38c1c09839c90317314be48f8758e9001ee40b91 (diff) |
tests/tcg: better trap gdb failures
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>
Message-Id: <20200430190122.4592-4-alex.bennee@linaro.org>
Diffstat (limited to 'tests/guest-debug')
-rwxr-xr-x | tests/guest-debug/run-test.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 8c49ee2f22..2bbb8fbaa3 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) |