[PATCH] tests: Report expected monitor command for simulated commands

Michal Privoznik posted 1 patch 2 years, 2 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/4e663c84f32ed73c5c05755c9a2a4ace8262d1e7.1641994936.git.mprivozn@redhat.com
tests/qemumonitortestutils.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH] tests: Report expected monitor command for simulated commands
Posted by Michal Privoznik 2 years, 2 months ago
There are two tests currently that simulate QMP talk:
qemucapabilitiestest and qemuhotplugtest. In both cases they
check whether currently executed command is the one for which
reply was provided. If not an error message is reported. However,
the error message contains only the actual command and not the
expected one. This makes it harder to navigate through .replies
files.

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

diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index f7a0a37685..073ae5d73a 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -648,7 +648,8 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTest *test,
         ret = qemuMonitorTestAddResponse(test, data->response);
     } else {
         if (data->cmderr) {
-            qemuMonitorTestError("%s: %s", data->cmderr, cmdstr);
+            qemuMonitorTestError("%s: %s expected %s",
+                                 data->cmderr, cmdstr, data->command_name);
         } else {
             qemuMonitorTestErrorInvalidCommand(data->command_name, cmdstr);
         }
-- 
2.34.1

Re: [PATCH] tests: Report expected monitor command for simulated commands
Posted by Ján Tomko 2 years, 2 months ago
On a Wednesday in 2022, Michal Privoznik wrote:
>There are two tests currently that simulate QMP talk:
>qemucapabilitiestest and qemuhotplugtest. In both cases they
>check whether currently executed command is the one for which
>reply was provided. If not an error message is reported. However,
>the error message contains only the actual command and not the
>expected one. This makes it harder to navigate through .replies
>files.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> tests/qemumonitortestutils.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>

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

Jano