qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 1/9] qtest: Allow and ignore blank lines in input
Date: Tue, 25 Nov 2025 22:47:53 +0100	[thread overview]
Message-ID: <20251125214802.1929-2-philmd@linaro.org> (raw)
In-Reply-To: <20251125214802.1929-1-philmd@linaro.org>

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

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>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Message-ID: <20251106151959.1088095-1-peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 system/qtest.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/system/qtest.c b/system/qtest.c
index cbeb7f37728..67e2385f4b0 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;
-- 
2.51.0



  reply	other threads:[~2025-11-25 21:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-25 21:47 [PULL 0/9] Misc HW patches for 2025-11-25 Philippe Mathieu-Daudé
2025-11-25 21:47 ` Philippe Mathieu-Daudé [this message]
2025-11-25 21:47 ` [PULL 2/9] hw/pci: Make msix_init take a uint32_t for nentries Philippe Mathieu-Daudé
2025-11-25 21:47 ` [PULL 3/9] docs/deprecated: Remove undeprecated SMP description Philippe Mathieu-Daudé
2025-11-25 21:47 ` [PULL 4/9] hw/usb: Convert to qemu_create() for a better error message Philippe Mathieu-Daudé
2025-11-25 21:47 ` [PULL 5/9] hw/scsi: Use error_setg_file_open() " Philippe Mathieu-Daudé
2025-11-25 21:47 ` [PULL 6/9] hw/virtio: " Philippe Mathieu-Daudé
2025-11-25 21:47 ` [PULL 7/9] replay: Improve assert in replay_char_read_all_load() Philippe Mathieu-Daudé
2025-11-25 21:48 ` [PULL 8/9] hw/core/machine: Provide a description for aux-ram-share property Philippe Mathieu-Daudé
2025-11-25 21:48 ` [PULL 9/9] hw/aspeed/{xdma, rtc, sdhci}: Fix endianness to DEVICE_LITTLE_ENDIAN Philippe Mathieu-Daudé
2025-11-25 23:23 ` [PULL 0/9] Misc HW patches for 2025-11-25 Richard Henderson

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=20251125214802.1929-2-philmd@linaro.org \
    --to=philmd@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).