[PATCH 04/12] test: qemu: Fix qemu monitor test utils to allow testing HMP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



qemu HMP commands sent by libvirt are terminated just by a '\r'. The
fake monitor used in tests wasn't prepared to handle this and the
communication would hang on an attempt to do a HMP conversation.

Add a special case for handling commands separated by \r in case HMP is
used.
---
 tests/qemumonitortestutils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index 8155a69..3d34942 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -251,7 +251,8 @@ qemuMonitorTestIO(virNetSocketPtr sock,
          * if so, handle that command
          */
         t1 = test->incoming;
-        while ((t2 = strstr(t1, "\n"))) {
+        while ((t2 = strstr(t1, "\n")) ||
+                (!test->json && (t2 = strstr(t1, "\r")))) {
             *t2 = '\0';

             if (qemuMonitorTestProcessCommand(test, t1) < 0) {
-- 
2.2.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]