xref: /openbmc/qemu/tests/qtest/modules-test.c (revision 0ce46ab5)
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_CURL
20         "block-", "curl",
21 #endif
22 #ifdef CONFIG_GLUSTERFS
23         "block-", "gluster",
24 #endif
25 #ifdef CONFIG_LIBISCSI
26         "block-", "iscsi",
27 #endif
28 #ifdef CONFIG_LIBNFS
29         "block-", "nfs",
30 #endif
31 #ifdef CONFIG_LIBSSH
32         "block-", "ssh",
33 #endif
34 #ifdef CONFIG_RBD
35         "block-", "rbd",
36 #endif
37 #ifdef CONFIG_AUDIO_ALSA
38         "audio-", "alsa",
39 #endif
40 #ifdef CONFIG_AUDIO_OSS
41         "audio-", "oss",
42 #endif
43 #ifdef CONFIG_AUDIO_PA
44         "audio-", "pa",
45 #endif
46 #ifdef CONFIG_AUDIO_SDL
47         "audio-", "sdl",
48 #endif
49 #ifdef CONFIG_CURSES
50         "ui-", "curses",
51 #endif
52 #if defined(CONFIG_GTK) && defined(CONFIG_VTE)
53         "ui-", "gtk",
54 #endif
55 #ifdef CONFIG_SDL
56         "ui-", "sdl",
57 #endif
58 #if defined(CONFIG_SPICE) && defined(CONFIG_GIO)
59         "ui-", "spice-app",
60 #endif
61     };
62     int i;
63 
64     g_test_init(&argc, &argv, NULL);
65 
66     for (i = 0; i < G_N_ELEMENTS(modules); i += 2) {
67         char *testname = g_strdup_printf("/module/load/%s%s",
68                                          modules[i], modules[i + 1]);
69         qtest_add_data_func(testname, modules + i, test_modules_load);
70         g_free(testname);
71     }
72 
73     return g_test_run();
74 }
75