On 10/28/2026 11:25 AM, Philippe Mathieu-Daudé wrote:
> In system mode the binary is appended to the QEMU arguments, which
> must end with an option taking it, such as -kernel. Machines without
> -kernel, like 'none', load it with the generic loader device, where
> the path is part of an option value.
> 
> Replace @BINARY@ in the arguments by the binary path if present,
> otherwise keep appending it.
> 
> Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
> ---
>  tests/guest-debug/run-test.py | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py
> index 9fdf05b55d31..e6911300e8d0 100755
> --- a/tests/guest-debug/run-test.py
> +++ b/tests/guest-debug/run-test.py
> @@ -87,9 +87,14 @@ def format_cmd(cmd):
>  
>      if "system" in args.qemu:
>          # for system mode we assume qargs has set-up for binary if
> -        # indeed we have set one.
> +        # indeed we have set one, either ending with an option taking
> +        # it (e.g. -kernel) or using the @BINARY@ placeholder.
>          if args.binary:
> -            qemu_cmd.append(args.binary)
> +            if any("@BINARY@" in arg for arg in qemu_cmd):
> +                qemu_cmd = [arg.replace("@BINARY@", args.binary)
> +                            for arg in qemu_cmd]
> +            else:
> +                qemu_cmd.append(args.binary)
>          if not args.no_suspend:
>              qemu_cmd.append("-S")
>          qemu_cmd.extend(["-gdb", f"unix:path={socket_name},server=on"])

A bit implicit, but good for me.

Reviewed-by: Pierrick Bouvier <[email protected]>

Regards,
Pierrick

Reply via email to