]> xenbits.xensource.com Git - libvirt.git/commitdiff
test: qemu: Fix qemu monitor test utils to allow testing HMP
authorPeter Krempa <pkrempa@redhat.com>
Tue, 10 Mar 2015 12:10:20 +0000 (13:10 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 11 Mar 2015 10:28:03 +0000 (11:28 +0100)
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

index 8155a69ddd8fe2b96d9514f6ced5f355aec7767a..3d34942b95af9c047be1e6fc3f6ae16baa4cca17 100644 (file)
@@ -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) {