]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/guest-debug/run-test.py
3 # Run a gdbstub test case
5 # Copyright (c) 2019 Linaro
7 # Author: Alex Bennée <alex.bennee@linaro.org>
9 # This work is licensed under the terms of the GNU GPL, version 2 or later.
10 # See the COPYING file in the top-level directory.
12 # SPDX-License-Identifier: GPL-2.0-or-later
20 parser
= argparse
.ArgumentParser(description
="A gdbstub test runner")
21 parser
.add_argument("--qemu", help="Qemu binary for test",
23 parser
.add_argument("--qargs", help="Qemu arguments for test")
24 parser
.add_argument("--binary", help="Binary to debug",
26 parser
.add_argument("--test", help="GDB test script",
28 parser
.add_argument("--gdb", help="The gdb binary to use", default
=None)
30 return parser
.parse_args()
32 if __name__
== '__main__':
35 # Search for a gdb we can use
37 args
.gdb
= shutil
.which("gdb-multiarch")
39 args
.gdb
= shutil
.which("gdb")
41 print("We need gdb to run the test")
44 # Launch QEMU with binary
45 if "system" in args
.qemu
:
46 cmd
= "%s %s %s -s -S" % (args
.qemu
, args
.qargs
, args
.binary
)
48 cmd
= "%s %s -g 1234 %s" % (args
.qemu
, args
.qargs
, args
.binary
)
50 inferior
= subprocess
.Popen(shlex
.split(cmd
))
52 # Now launch gdb with our test and collect the result
53 gdb_cmd
= "%s %s -ex 'target remote localhost:1234' -x %s" % (args
.gdb
, args
.binary
, args
.test
)
55 result
= subprocess
.call(gdb_cmd
, shell
=True);