qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v2 4/4] qtest: use qmp_exec_hmp_cmd() in blockdev-te


From: Amos Kong
Subject: [Qemu-devel] [PATCH v2 4/4] qtest: use qmp_exec_hmp_cmd() in blockdev-test
Date: Thu, 5 Jun 2014 13:45:18 +0800

Signed-off-by: Amos Kong <address@hidden>
---
 tests/blockdev-test.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/tests/blockdev-test.c b/tests/blockdev-test.c
index c940e00..a84345c 100644
--- a/tests/blockdev-test.c
+++ b/tests/blockdev-test.c
@@ -16,35 +16,16 @@
 
 static void test_drive_add_empty(void)
 {
-    QDict *response;
-    const char *response_return;
-
     /* Start with an empty drive */
     qtest_start("-drive if=none,id=drive0");
 
     /* Delete the drive */
-    response = qmp("{\"execute\": \"human-monitor-command\","
-                   " \"arguments\": {"
-                   "   \"command-line\": \"drive_del drive0\""
-                   "}}");
-    g_assert(response);
-    response_return = qdict_get_try_str(response, "return");
-    g_assert(response_return);
-    g_assert(strcmp(response_return, "") == 0);
-    QDECREF(response);
+    qmp_exec_hmp_cmd("drive_del drive0", "");
 
     /* Ensure re-adding the drive works - there should be no duplicate ID error
      * because the old drive must be gone.
      */
-    response = qmp("{\"execute\": \"human-monitor-command\","
-                   " \"arguments\": {"
-                   "   \"command-line\": \"drive_add 0 if=none,id=drive0\""
-                   "}}");
-    g_assert(response);
-    response_return = qdict_get_try_str(response, "return");
-    g_assert(response_return);
-    g_assert(strcmp(response_return, "OK\r\n") == 0);
-    QDECREF(response);
+    qmp_exec_hmp_cmd("drive_add 0 if=none,id=drive0", "OK\r\n");
 
     qtest_end();
 }
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]