All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabiano Rosas <farosas@suse.de>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH] qtest: Allow and ignore blank lines in input
Date: Fri, 21 Nov 2025 15:38:17 -0300	[thread overview]
Message-ID: <87zf8fdyee.fsf@suse.de> (raw)
In-Reply-To: <20251106151959.1088095-1-peter.maydell@linaro.org>

Peter Maydell <peter.maydell@linaro.org> writes:

> Currently the code that reads the qtest protocol commands insists
> that every input line has a command.  If it receives a line with
> nothing but whitespace it will trip an assertion in
> qtest_process_command().
>
> This is a little awkward for the case where we are feeding qtest a
> set of bug-reproduction commands via standard input or a file,
> because it means you need to be careful not to leave a blank line at
> the start or the end when cutting and pasting the command sequence
> from a bug report.
>
> Change the code to allow and ignore blank lines in the input.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  system/qtest.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/system/qtest.c b/system/qtest.c
> index e4d1cd75daa..baef06d4d1b 100644
> --- a/system/qtest.c
> +++ b/system/qtest.c
> @@ -69,6 +69,9 @@ static void *qtest_server_send_opaque;
>   * so clients should always handle many async messages before the response
>   * comes in.
>   *
> + * Extra ASCII space characters in command inputs are permitted and ignored.
> + * Lines containing only spaces are permitted and ignored.
> + *
>   * Valid requests
>   * ^^^^^^^^^^^^^^
>   *
> @@ -367,7 +370,11 @@ static void qtest_process_command(CharFrontend *chr, gchar **words)
>          fprintf(qtest_log_fp, "\n");
>      }
>  
> -    g_assert(command);
> +    if (!command) {
> +        /* Input line was blank: ignore it */
> +        return;
> +    }
> +
>      if (strcmp(words[0], "irq_intercept_out") == 0
>          || strcmp(words[0], "irq_intercept_in") == 0) {
>          DeviceState *dev;

Reviewed-by: Fabiano Rosas <farosas@suse.de>

Queued


  reply	other threads:[~2025-11-22  3:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-06 15:19 [PATCH] qtest: Allow and ignore blank lines in input Peter Maydell
2025-11-21 18:38 ` Fabiano Rosas [this message]
2025-11-25 21:50 ` Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zf8fdyee.fsf@suse.de \
    --to=farosas@suse.de \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.