]>
Commit | Line | Data |
---|---|---|
abc53733 AF |
1 | /* |
2 | * QTest testcase for PV Panic | |
3 | * | |
4 | * Copyright (c) 2014 SUSE LINUX Products GmbH | |
5 | * | |
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 | */ | |
9 | ||
10 | #include <glib.h> | |
11 | #include <string.h> | |
12 | #include "libqtest.h" | |
13 | #include "qemu/osdep.h" | |
14 | ||
15 | static void test_panic(void) | |
16 | { | |
17 | uint8_t val; | |
627b1a17 | 18 | QDict *response, *data; |
abc53733 AF |
19 | |
20 | val = inb(0x505); | |
21 | g_assert_cmpuint(val, ==, 1); | |
22 | ||
23 | outb(0x505, 0x1); | |
627b1a17 AF |
24 | |
25 | response = qmp_receive(); | |
26 | g_assert(qdict_haskey(response, "event")); | |
27 | g_assert_cmpstr(qdict_get_str(response, "event"), ==, "GUEST_PANICKED"); | |
28 | g_assert(qdict_haskey(response, "data")); | |
29 | data = qdict_get_qdict(response, "data"); | |
30 | g_assert(qdict_haskey(data, "action")); | |
31 | g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause"); | |
abc53733 AF |
32 | } |
33 | ||
34 | int main(int argc, char **argv) | |
35 | { | |
36 | int ret; | |
37 | ||
38 | g_test_init(&argc, &argv, NULL); | |
39 | qtest_add_func("/pvpanic/panic", test_panic); | |
40 | ||
41 | qtest_start("-device pvpanic"); | |
42 | ret = g_test_run(); | |
43 | ||
44 | qtest_end(); | |
45 | ||
46 | return ret; | |
47 | } |