When passing kernel arguments to QEMU with --append we need to take
care that things are properly escaped. It's easier if we get the run
script to do it for us that constructed the nested escaped --qargs.

Reviewed-by: Marc-André Lureau <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>

---
v3
  - fix merge with array
---
 tests/guest-debug/run-test.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py
index d5ffaaa9ffc..782c0c5da19 100755
--- a/tests/guest-debug/run-test.py
+++ b/tests/guest-debug/run-test.py
@@ -25,6 +25,7 @@ def get_args():
                         required=True)
     parser.add_argument("--qargs", help="Qemu arguments for test")
     parser.add_argument("--pargs", help="Program arguments for test")
+    parser.add_argument("--kargs", help="Kernel args to --append")
     parser.add_argument("--binary", help="Binary to debug",
                         required=True)
     parser.add_argument("--test", help="GDB test script")
@@ -89,6 +90,10 @@ def format_cmd(cmd):
         if not args.no_suspend:
             qemu_cmd.append("-S")
         qemu_cmd.extend(["-gdb", f"unix:path={socket_name},server=on"])
+
+        if args.kargs:
+            qemu_cmd.extend(["--append", args.kargs])
+
         # There is no guest program command-line in system mode.
         assert not args.pargs
     else:
@@ -98,6 +103,9 @@ def format_cmd(cmd):
         else:
             qemu_cmd.append(f"{socket_name}")
 
+        # There are no appended args in user-mode
+        assert not args.kargs
+
         # for user mode binary and args always go at the end
         qemu_cmd.append(args.binary)
         if args.pargs:
-- 
2.47.3


Reply via email to