tests: Fix gcov paths for relocated device sources
[qemu/qmp-unstable.git] / tests / qom-test.c
blob4dd23f8ad001cb628087c127188537e1a398258e
1 /*
2 * QTest testcase for QOM
4 * Copyright (c) 2013 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 */
9 #include "libqtest.h"
11 #include <glib.h>
12 #include <string.h>
13 #include "qemu/osdep.h"
15 static void test_nop(gconstpointer data)
17 QTestState *s;
18 const char *machine = data;
19 char *args;
21 args = g_strdup_printf("-machine %s", machine);
22 s = qtest_start(args);
23 if (s) {
24 qtest_quit(s);
26 g_free(args);
29 static const char *x86_machines[] = {
30 "pc",
31 "isapc",
32 "q35",
35 static const char *alpha_machines[] = {
36 "clipper",
39 static const char *arm_machines[] = {
40 "integratorcp",
41 "versatilepb",
42 "versatileab",
43 "lm3s811evb",
44 "lm3s6965evb",
45 "collie",
46 "akita",
47 "spitz",
48 "borzoi",
49 "terrier",
50 "tosa",
51 "cheetah",
52 "sx1-v1",
53 "sx1",
54 "realview-eb",
55 "realview-eb-mpcore",
56 "realview-pb-a8",
57 "realview-pbx-a9",
58 "musicpal",
59 "mainstone",
60 "connex",
61 "verdex",
62 "z2",
63 "n800",
64 "n810",
65 "kzm",
66 "vexpress-a9",
67 "vexpress-a15",
68 "smdkc210",
69 "nuri",
70 "xilinx-zynq-a9",
71 "highbank",
72 "midway",
73 "canon-a1100",
74 "cubieboard",
77 static const char *cris_machines[] = {
78 "axis-dev88",
81 static const char *lm32_machines[] = {
82 "lm32-evr",
83 "lm32-uclinux",
84 "milkymist",
87 static const char *m68k_machines[] = {
88 "mcf5208evb",
89 "an5206",
90 "dummy",
93 static const char *microblaze_machines[] = {
94 "petalogix-ml605",
95 "petalogix-s3adsp1800",
98 static const char *mips_machines[] = {
99 "malta",
100 "magnum",
101 "mips",
102 "mipssim",
103 "pica61",
106 static const char *moxie_machines[] = {
107 "moxiesim",
110 static const char *openrisc_machines[] = {
111 "or32-sim",
114 static const char *ppc_machines[] = {
115 "g3beige",
116 "mac99",
117 "prep",
118 "mpc8544ds",
119 "ppce500",
122 static const char *ppc64_machines[] = {
123 "pseries",
126 static const char *ppc405_machines[] = {
127 "ref405ep",
128 "taihu",
131 static const char *ppc440_machines[] = {
132 "bamboo",
133 "virtex-ml507",
136 static const char *s390_machines[] = {
137 "s390-virtio",
138 "s390-ccw-virtio",
141 static const char *superh_machines[] = {
142 "r2d",
143 "shix",
146 static const char *sparc_machines[] = {
147 "SS-4",
148 "SS-5",
149 "SS-10",
150 "SS-20",
151 "SS-600MP",
152 "LX",
153 "SPARCClassic",
154 "SPARCbook",
155 "leon3_generic",
158 static const char *sparc64_machines[] = {
159 "sun4u",
160 "sun4v",
161 "Niagara",
164 static const char *unicore32_machines[] = {
165 "puv3",
168 static const char *xtensa_machines[] = {
169 "sim",
170 "lx60",
171 "lx200",
174 static void add_test_cases(const char *arch, const char *machine)
176 char *path;
177 path = g_strdup_printf("/%s/qom/%s", arch, machine);
178 g_test_add_data_func(path, machine, test_nop);
181 #define ADD_MACHINE_TESTS(arch, array) do { \
182 int i; \
183 for (i = 0; i < ARRAY_SIZE(array); i++) { \
184 add_test_cases((arch), (array)[i]); \
186 } while (false)
188 int main(int argc, char **argv)
190 const char *arch = qtest_get_arch();
192 g_test_init(&argc, &argv, NULL);
194 add_test_cases(arch, "none");
196 if (strcmp(arch, "i386") == 0 ||
197 strcmp(arch, "x86_64") == 0) {
198 ADD_MACHINE_TESTS(arch, x86_machines);
199 } else if (strcmp(arch, "alpha") == 0) {
200 ADD_MACHINE_TESTS(arch, alpha_machines);
201 } else if (strcmp(arch, "arm") == 0) {
202 ADD_MACHINE_TESTS(arch, arm_machines);
203 } else if (strcmp(arch, "cris") == 0) {
204 ADD_MACHINE_TESTS(arch, cris_machines);
205 } else if (strcmp(arch, "lm32") == 0) {
206 ADD_MACHINE_TESTS(arch, lm32_machines);
207 } else if (strcmp(arch, "m68k") == 0) {
208 ADD_MACHINE_TESTS(arch, m68k_machines);
209 } else if (strcmp(arch, "microblaze") == 0 ||
210 strcmp(arch, "microblazeel") == 0) {
211 ADD_MACHINE_TESTS(arch, microblaze_machines);
212 } else if (strcmp(arch, "mips") == 0 ||
213 strcmp(arch, "mipsel") == 0 ||
214 strcmp(arch, "mips64") == 0) {
215 ADD_MACHINE_TESTS(arch, mips_machines);
216 } else if (strcmp(arch, "mips64el") == 0) {
217 ADD_MACHINE_TESTS(arch, mips_machines);
218 add_test_cases(arch, "fulong2e");
219 } else if (strcmp(arch, "moxie") == 0) {
220 ADD_MACHINE_TESTS(arch, moxie_machines);
221 } else if (strcmp(arch, "or32") == 0) {
222 ADD_MACHINE_TESTS(arch, openrisc_machines);
223 } else if (strcmp(arch, "ppcemb") == 0) {
224 ADD_MACHINE_TESTS(arch, ppc405_machines);
225 ADD_MACHINE_TESTS(arch, ppc440_machines);
226 } else if (strcmp(arch, "ppc") == 0) {
227 ADD_MACHINE_TESTS(arch, ppc405_machines);
228 ADD_MACHINE_TESTS(arch, ppc440_machines);
229 ADD_MACHINE_TESTS(arch, ppc_machines);
230 } else if (strcmp(arch, "ppc64") == 0) {
231 ADD_MACHINE_TESTS(arch, ppc405_machines);
232 ADD_MACHINE_TESTS(arch, ppc440_machines);
233 ADD_MACHINE_TESTS(arch, ppc_machines);
234 ADD_MACHINE_TESTS(arch, ppc64_machines);
235 } else if (strcmp(arch, "s390x") == 0) {
236 ADD_MACHINE_TESTS(arch, s390_machines);
237 } else if (strcmp(arch, "sh4") == 0 ||
238 strcmp(arch, "sh4eb") == 0) {
239 ADD_MACHINE_TESTS(arch, superh_machines);
240 } else if (strcmp(arch, "sparc") == 0) {
241 ADD_MACHINE_TESTS(arch, sparc_machines);
242 } else if (strcmp(arch, "sparc64") == 0) {
243 ADD_MACHINE_TESTS(arch, sparc64_machines);
244 } else if (strcmp(arch, "unicore32") == 0) {
245 ADD_MACHINE_TESTS(arch, unicore32_machines);
246 } else if (strcmp(arch, "xtensa") == 0 ||
247 strcmp(arch, "xtensaeb") == 0) {
248 ADD_MACHINE_TESTS(arch, xtensa_machines);
251 return g_test_run();