diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-10-01 10:59:55 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-10-09 15:25:57 +0200 |
commit | 5fb48d9673b76fc53507a0e717a12968e57d846e (patch) | |
tree | f6db5219a6874465f6a9556544b33fd7442ba30f /tests/drive_del-test.c | |
parent | 82b15c7bdbda6207d1fee2ec824432e64af3ecb4 (diff) | |
download | qemu-5fb48d9673b76fc53507a0e717a12968e57d846e.tar.gz qemu-5fb48d9673b76fc53507a0e717a12968e57d846e.tar.bz2 qemu-5fb48d9673b76fc53507a0e717a12968e57d846e.zip |
libqtest: New hmp() & friends
New convenience function hmp() to facilitate use of
human-monitor-command in tests. Use it to simplify its existing uses.
To blend into existing libqtest code, also add qtest_hmpv() and
qtest_hmp(). That, and the egregiously verbose GTK-Doc comment format
make this patch look bigger than it is.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1443689999-12182-7-git-send-email-armbru@redhat.com>
Diffstat (limited to 'tests/drive_del-test.c')
-rw-r--r-- | tests/drive_del-test.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/tests/drive_del-test.c b/tests/drive_del-test.c index 8951f6f610..33909469f1 100644 --- a/tests/drive_del-test.c +++ b/tests/drive_del-test.c @@ -16,28 +16,18 @@ static void drive_add(void) { - QDict *response; + char *resp = hmp("drive_add 0 if=none,id=drive0"); - response = qmp("{'execute': 'human-monitor-command'," - " 'arguments': {" - " 'command-line': 'drive_add 0 if=none,id=drive0'" - "}}"); - g_assert(response); - g_assert_cmpstr(qdict_get_try_str(response, "return"), ==, "OK\r\n"); - QDECREF(response); + g_assert_cmpstr(resp, ==, "OK\r\n"); + g_free(resp); } static void drive_del(void) { - QDict *response; + char *resp = hmp("drive_del drive0"); - response = qmp("{'execute': 'human-monitor-command'," - " 'arguments': {" - " 'command-line': 'drive_del drive0'" - "}}"); - g_assert(response); - g_assert_cmpstr(qdict_get_try_str(response, "return"), ==, ""); - QDECREF(response); + g_assert_cmpstr(resp, ==, ""); + g_free(resp); } static void device_del(void) |