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

Michal Privoznik posted 1 patch 1 year, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/ff3c614e311ec138beff76106501b9c9ef8299a1.1671702538.git.mprivozn@redhat.com
tests/qemumonitortestutils.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] qemumonitortestutils: Fix line counting in qemuMonitorTestProcessFileEntries()
Posted by Michal Privoznik 1 year, 4 months ago
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@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
Re: [PATCH] qemumonitortestutils: Fix line counting in qemuMonitorTestProcessFileEntries()
Posted by Ján Tomko 1 year, 4 months ago
On a Thursday in 2022, Michal Privoznik wrote:
>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:
>

s/:/./

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

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano