This commit adds a new option to run-test.py, --test-args, which can be used to pass arguments to the GDB test script specified by the --test option. The arguments passed are in the key=value form, and multiple pairs can be passed, separated by a space. For example:
run-test.py [...] --test <GDB_TEST_SCRIPT> --test-args v0="string" v1=10 The 'v0' and 'v1' variables will then be available in the GDB test script, like this: print(v0) print(v1) Signed-off-by: Gustavo Romero <gustavo.rom...@linaro.org> --- tests/guest-debug/run-test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 368ff8a890..63b55fb8bd 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -27,6 +27,7 @@ def get_args(): parser.add_argument("--binary", help="Binary to debug", required=True) parser.add_argument("--test", help="GDB test script") + parser.add_argument("--test-args", help="Arguments to GDB test script") parser.add_argument("--gdb", help="The gdb binary to use", default=None) parser.add_argument("--gdb-args", help="Additional gdb arguments") @@ -91,6 +92,9 @@ def log(output, msg): gdb_cmd += " -ex 'target remote %s'" % (socket_name) # finally the test script itself if args.test: + if args.test_args: + test_args = args.test_args.replace(" ",";") + gdb_cmd += f" -ex 'py {test_args}'" gdb_cmd += " -x %s" % (args.test) -- 2.34.1