@samitouri / QOSamiQemu / commits / 2cae1adc42

system/qtest: Support comments in input commands

Allow the qtest input to include comment lines, which start with '#'. This allows writing an input file for qtest which includes commentary, like this: # set up TCR in bank 0 write 0x1001000e 2 0 # TCR TXEN write 0x10010000 2 1 which can make hand-writing or annotating reproduce cases a bit more convenient. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20260226175700.1319767-1-peter.maydell@linaro.org

Peter Maydell committed Mar 6, 2026 at 09:01 UTC 2cae1adc42e0ec8f860056de725f35a7fdad4156
1 file changed +3 -2
system/qtest.c
+3 -2
@@ -71,6 +71,7 @@ static void *qtest_server_send_opaque;
71 *
72 * Extra ASCII space characters in command inputs are permitted and ignored.
73 * Lines containing only spaces are permitted and ignored.
74 + * Lines that start with a '#' character (comments) are permitted and ignored.
75 *
76 * Valid requests
77 * ^^^^^^^^^^^^^^
@@ -370,8 +371,8 @@ static void qtest_process_command(CharFrontend *chr, gchar **words)
371 fprintf(qtest_log_fp, "\n");
372 }
373
373 - if (!command) {
374 - /* Input line was blank: ignore it */
374 + if (!command || command[0] == '#') {
375 + /* Input line was blank or a comment: ignore it */
376 return;
377 }
378