xref: /openbmc/qemu/tests/qtest/modules-test.c (revision 2e1cacfb)
1 #include "qemu/osdep.h"
2 #include "libqtest.h"
3 
4 const char common_args[] = "-nodefaults -machine none";
5 
6 static void test_modules_load(const void *data)
7 {
8     QTestState *qts;
9     const char **args = (const char **)data;
10 
11     qts = qtest_init(common_args);
12     qtest_module_load(qts, args[0], args[1]);
13     qtest_quit(qts);
14 }
15 
16 int main(int argc, char *argv[])
17 {
18     const char *modules[] = {
19 #ifdef CONFIG_BLKIO
20         "block-", "blkio",
21 #endif
22 #ifdef CONFIG_CURL
23         "block-", "curl",
24 #endif
25 #ifdef CONFIG_GLUSTERFS
26         "block-", "gluster",
27 #endif
28 #ifdef CONFIG_LIBISCSI
29         "block-", "iscsi",
30 #endif
31 #ifdef CONFIG_LIBNFS
32         "block-", "nfs",
33 #endif
34 #ifdef CONFIG_LIBSSH
35         "block-", "ssh",
36 #endif
37 #ifdef CONFIG_RBD
38         "block-", "rbd",
39 #endif
40 #ifdef CONFIG_AUDIO_ALSA
41         "audio-", "alsa",
42 #endif
43 #ifdef CONFIG_AUDIO_OSS
44         "audio-", "oss",
45 #endif
46 #ifdef CONFIG_AUDIO_PA
47         "audio-", "pa",
48 #endif
49 #ifdef CONFIG_AUDIO_SDL
50         "audio-", "sdl",
51 #endif
52 #ifdef CONFIG_CURSES
53         "ui-", "curses",
54 #endif
55 #if defined(CONFIG_GTK) && defined(CONFIG_VTE)
56         "ui-", "gtk",
57 #endif
58 #ifdef CONFIG_SDL
59         "ui-", "sdl",
60 #endif
61 #if defined(CONFIG_SPICE) && defined(CONFIG_GIO)
62         "ui-", "spice-app",
63 #endif
64     };
65     int i;
66 
67     g_test_init(&argc, &argv, NULL);
68 
69     for (i = 0; i < G_N_ELEMENTS(modules); i += 2) {
70         char *testname = g_strdup_printf("/module/load/%s%s",
71                                          modules[i], modules[i + 1]);
72         qtest_add_data_func(testname, modules + i, test_modules_load);
73         g_free(testname);
74     }
75 
76     return g_test_run();
77 }
78