sd/milkymist-memcard: Fix format string
[qemu/armbru.git] / tests / qtest / pvpanic-test.c
blobff9176adf3ce2ddb60ce7a44b56be6f67520d96f
1 /*
2 * QTest testcase for PV Panic
4 * Copyright (c) 2014 SUSE LINUX Products GmbH
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #include "qemu/osdep.h"
11 #include "libqtest.h"
12 #include "qapi/qmp/qdict.h"
14 static void test_panic(void)
16 uint8_t val;
17 QDict *response, *data;
18 QTestState *qts;
20 qts = qtest_init("-device pvpanic");
22 val = qtest_inb(qts, 0x505);
23 g_assert_cmpuint(val, ==, 1);
25 qtest_outb(qts, 0x505, 0x1);
27 response = qtest_qmp_receive(qts);
28 g_assert(qdict_haskey(response, "event"));
29 g_assert_cmpstr(qdict_get_str(response, "event"), ==, "GUEST_PANICKED");
30 g_assert(qdict_haskey(response, "data"));
31 data = qdict_get_qdict(response, "data");
32 g_assert(qdict_haskey(data, "action"));
33 g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause");
34 qobject_unref(response);
36 qtest_quit(qts);
39 int main(int argc, char **argv)
41 int ret;
43 g_test_init(&argc, &argv, NULL);
44 qtest_add_func("/pvpanic/panic", test_panic);
46 ret = g_test_run();
48 return ret;