@@ -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("OK\r\n", "drive_add 0 if=none,id=drive0");
qtest_end();
}