]> xenbits.xensource.com Git - people/dariof/libvirt.git/commitdiff
qemuagenttest: Fix checking of shutdown mode
authorPeter Krempa <pkrempa@redhat.com>
Thu, 1 Aug 2013 14:19:09 +0000 (16:19 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 2 Aug 2013 10:28:50 +0000 (12:28 +0200)
Coverity complained about unused variable that contains the shutdown
mode. The original intention was to check it against the requested mode.

Also the fixed check revealed a mistake in the expected shutdown mode.

Reported by John Ferlan.

tests/qemuagenttest.c

index cabd5b7ca0c622275f63743c7a8c068cc4243c75..91ea4e11f37abc85e21527698ec9e7ae2127e64f 100644 (file)
@@ -251,6 +251,13 @@ qemuAgentShutdownTestMonitorHandler(qemuMonitorTestPtr test,
         goto cleanup;
     }
 
+    if (STRNEQ(mode, data->mode)) {
+        ret = qemuMonitorReportError(test,
+                                     "expected shutdown mode '%s' got '%s'",
+                                     data->mode, mode);
+        goto cleanup;
+    }
+
     /* now don't reply but return a qemu agent event */
     qemuAgentNotifyEvent(qemuMonitorTestGetAgent(test),
                          data->event);
@@ -279,7 +286,7 @@ testQemuAgentShutdown(const void *data)
         goto cleanup;
 
     priv.event = QEMU_AGENT_EVENT_SHUTDOWN;
-    priv.mode = "shutdown";
+    priv.mode = "halt";
 
     if (qemuMonitorTestAddHandler(test, qemuAgentShutdownTestMonitorHandler,
                                   &priv, NULL) < 0)