target-arm: A64: provide skeleton for a64 insn decoding
[qemu-kvm.git] / tests / blockdev-test.c
blobc940e006908d2fa47cfd2387fe0aa8b103873ce9
1 /*
2 * blockdev.c test cases
4 * Copyright (C) 2013 Red Hat Inc.
6 * Authors:
7 * Stefan Hajnoczi <stefanha@redhat.com>
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
13 #include <glib.h>
14 #include <string.h>
15 #include "libqtest.h"
17 static void test_drive_add_empty(void)
19 QDict *response;
20 const char *response_return;
22 /* Start with an empty drive */
23 qtest_start("-drive if=none,id=drive0");
25 /* Delete the drive */
26 response = qmp("{\"execute\": \"human-monitor-command\","
27 " \"arguments\": {"
28 " \"command-line\": \"drive_del drive0\""
29 "}}");
30 g_assert(response);
31 response_return = qdict_get_try_str(response, "return");
32 g_assert(response_return);
33 g_assert(strcmp(response_return, "") == 0);
34 QDECREF(response);
36 /* Ensure re-adding the drive works - there should be no duplicate ID error
37 * because the old drive must be gone.
39 response = qmp("{\"execute\": \"human-monitor-command\","
40 " \"arguments\": {"
41 " \"command-line\": \"drive_add 0 if=none,id=drive0\""
42 "}}");
43 g_assert(response);
44 response_return = qdict_get_try_str(response, "return");
45 g_assert(response_return);
46 g_assert(strcmp(response_return, "OK\r\n") == 0);
47 QDECREF(response);
49 qtest_end();
52 int main(int argc, char **argv)
54 g_test_init(&argc, &argv, NULL);
56 qtest_add_func("/qmp/drive_add_empty", test_drive_add_empty);
58 return g_test_run();