Lines Matching +full:test +full:- +full:path

3 # Run a gdbstub test case
10 # See the COPYING file in the top-level directory.
12 # SPDX-License-Identifier: GPL-2.0-or-later
23 parser = argparse.ArgumentParser(description="A gdbstub test runner")
24 parser.add_argument("--qemu", help="Qemu binary for test",
26 parser.add_argument("--qargs", help="Qemu arguments for test")
27 parser.add_argument("--binary", help="Binary to debug",
29 parser.add_argument("--test", help="GDB test script")
31 help="Additional args for GDB test script. "
32 "The args should be preceded by -- to avoid confusion "
34 parser.add_argument("--gdb", help="The gdb binary to use",
36 parser.add_argument("--gdb-args", help="Additional gdb arguments")
37 parser.add_argument("--output", help="A file to redirect output to")
38 parser.add_argument("--stderr", help="A file to redirect stderr to")
39 parser.add_argument("--no-suspend", action="store_true",
58 args.gdb = shutil.which("gdb-multiarch")
62 print("We need gdb to run the test")
63 exit(-1)
73 socket_dir = TemporaryDirectory("qemu-gdbstub")
74 socket_name = os.path.join(socket_dir.name, "gdbstub.socket")
81 suspend = ' -S'
83 f'{suspend} -gdb unix:path={socket_name},server=on'
89 cmd = f'{args.qemu} {args.qargs} -g {socket_name}{suspend}' \
95 # Now launch gdb with our test and collect the result
100 gdb_cmd += " -q -n -batch"
102 gdb_cmd += " -ex 'set pagination off'"
104 gdb_cmd += " -ex 'set confirm off'"
106 gdb_cmd += " -ex 'target remote %s'" % (socket_name)
107 # finally the test script itself
108 if args.test:
110 gdb_cmd += f" -ex \"py sys.argv={args.test_args}\""
111 gdb_cmd += " -x %s" % (args.test)
119 gdb_pythonpath.append(os.path.dirname(os.path.realpath(__file__)))
126 # not the test so we force a return of 0 so we don't fail the test on
129 log(output, "GDB crashed? (%d, %d) SKIPPING" % (result, result - 128))