acpi: make bios_linker_loader_add_checksum() API offset based
[qemu/ar7.git] / tests / pvpanic-test.c
blobd435833f79763dd3afd34d173f050087d6196354
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 <glib.h>
12 #include "libqtest.h"
14 static void test_panic(void)
16 uint8_t val;
17 QDict *response, *data;
19 val = inb(0x505);
20 g_assert_cmpuint(val, ==, 1);
22 outb(0x505, 0x1);
24 response = qmp_receive();
25 g_assert(qdict_haskey(response, "event"));
26 g_assert_cmpstr(qdict_get_str(response, "event"), ==, "GUEST_PANICKED");
27 g_assert(qdict_haskey(response, "data"));
28 data = qdict_get_qdict(response, "data");
29 g_assert(qdict_haskey(data, "action"));
30 g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause");
33 int main(int argc, char **argv)
35 int ret;
37 g_test_init(&argc, &argv, NULL);
38 qtest_add_func("/pvpanic/panic", test_panic);
40 qtest_start("-device pvpanic");
41 ret = g_test_run();
43 qtest_end();
45 return ret;