[PATCH] qemumonitortestutils: Fix line counting in qemuMonitorTestProcessFileEntries()

Michal Privoznik mprivozn at redhat.com
Thu Dec 22 09:48:58 UTC 2022


It just so happens that our JSON snippets in
qemucapabilitiesdata/*.replies files are separated by an empty
line. These empty lines are then overwritten to make a single
line JSON. Nevertheless, the line counter @line is not
incremented which then leads to a misleading numbers in errors:

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 tests/qemumonitortestutils.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 46791931b0..4e99c4b54e 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -1302,6 +1302,9 @@ qemuMonitorTestProcessFileEntries(char *inputstr,
             continue;
         }
 
+        /* We've seen a new line, increment the counter */
+        line++;
+
         /* Cut off a single reply. */
         *(tmp + 1) = '\0';
 
-- 
2.38.2



More information about the libvir-list mailing list