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.
13 #include "qemu/osdep.h"
15 static void test_nop(gconstpointer data
)
18 const char *machine
= data
;
21 args
= g_strdup_printf("-machine %s", machine
);
22 s
= qtest_start(args
);
29 static const char *x86_machines
[] = {
35 static const char *alpha_machines
[] = {
39 static const char *arm_machines
[] = {
75 static const char *cris_machines
[] = {
79 static const char *lm32_machines
[] = {
85 static const char *m68k_machines
[] = {
91 static const char *microblaze_machines
[] = {
93 "petalogix-s3adsp1800",
96 static const char *mips_machines
[] = {
104 static const char *moxie_machines
[] = {
108 static const char *openrisc_machines
[] = {
112 static const char *ppc_machines
[] = {
120 static const char *ppc64_machines
[] = {
124 static const char *ppc405_machines
[] = {
129 static const char *ppc440_machines
[] = {
134 static const char *s390_machines
[] = {
139 static const char *superh_machines
[] = {
144 static const char *sparc_machines
[] = {
156 static const char *sparc64_machines
[] = {
162 static const char *unicore32_machines
[] = {
166 static const char *xtensa_machines
[] = {
172 static void add_test_cases(const char *arch
, const char *machine
)
175 path
= g_strdup_printf("/%s/qom/%s", arch
, machine
);
176 g_test_add_data_func(path
, machine
, test_nop
);
179 #define ADD_MACHINE_TESTS(arch, array) do { \
181 for (i = 0; i < ARRAY_SIZE(array); i++) { \
182 add_test_cases((arch), (array)[i]); \
186 int main(int argc
, char **argv
)
188 const char *arch
= qtest_get_arch();
190 g_test_init(&argc
, &argv
, NULL
);
192 add_test_cases(arch
, "none");
194 if (strcmp(arch
, "i386") == 0 ||
195 strcmp(arch
, "x86_64") == 0) {
196 ADD_MACHINE_TESTS(arch
, x86_machines
);
197 } else if (strcmp(arch
, "alpha") == 0) {
198 ADD_MACHINE_TESTS(arch
, alpha_machines
);
199 } else if (strcmp(arch
, "arm") == 0) {
200 ADD_MACHINE_TESTS(arch
, arm_machines
);
201 } else if (strcmp(arch
, "cris") == 0) {
202 ADD_MACHINE_TESTS(arch
, cris_machines
);
203 } else if (strcmp(arch
, "lm32") == 0) {
204 ADD_MACHINE_TESTS(arch
, lm32_machines
);
205 } else if (strcmp(arch
, "m68k") == 0) {
206 ADD_MACHINE_TESTS(arch
, m68k_machines
);
207 } else if (strcmp(arch
, "microblaze") == 0 ||
208 strcmp(arch
, "microblazeel") == 0) {
209 ADD_MACHINE_TESTS(arch
, microblaze_machines
);
210 } else if (strcmp(arch
, "mips") == 0 ||
211 strcmp(arch
, "mipsel") == 0 ||
212 strcmp(arch
, "mips64") == 0) {
213 ADD_MACHINE_TESTS(arch
, mips_machines
);
214 } else if (strcmp(arch
, "mips64el") == 0) {
215 ADD_MACHINE_TESTS(arch
, mips_machines
);
216 add_test_cases(arch
, "fulong2e");
217 } else if (strcmp(arch
, "moxie") == 0) {
218 ADD_MACHINE_TESTS(arch
, moxie_machines
);
219 } else if (strcmp(arch
, "or32") == 0) {
220 ADD_MACHINE_TESTS(arch
, openrisc_machines
);
221 } else if (strcmp(arch
, "ppcemb") == 0) {
223 /* XXX Available in ppcemb but don't work */
224 ADD_MACHINE_TESTS(arch
, ppc405_machines
);
226 ADD_MACHINE_TESTS(arch
, ppc440_machines
);
227 } else if (strcmp(arch
, "ppc") == 0) {
228 ADD_MACHINE_TESTS(arch
, ppc405_machines
);
229 ADD_MACHINE_TESTS(arch
, ppc440_machines
);
230 ADD_MACHINE_TESTS(arch
, ppc_machines
);
231 } else if (strcmp(arch
, "ppc64") == 0) {
232 ADD_MACHINE_TESTS(arch
, ppc405_machines
);
233 ADD_MACHINE_TESTS(arch
, ppc440_machines
);
234 ADD_MACHINE_TESTS(arch
, ppc_machines
);
235 ADD_MACHINE_TESTS(arch
, ppc64_machines
);
236 } else if (strcmp(arch
, "s390x") == 0) {
237 ADD_MACHINE_TESTS(arch
, s390_machines
);
238 } else if (strcmp(arch
, "sh4") == 0 ||
239 strcmp(arch
, "sh4eb") == 0) {
240 ADD_MACHINE_TESTS(arch
, superh_machines
);
241 } else if (strcmp(arch
, "sparc") == 0) {
242 ADD_MACHINE_TESTS(arch
, sparc_machines
);
243 } else if (strcmp(arch
, "sparc64") == 0) {
244 ADD_MACHINE_TESTS(arch
, sparc64_machines
);
245 } else if (strcmp(arch
, "unicore32") == 0) {
246 ADD_MACHINE_TESTS(arch
, unicore32_machines
);
247 } else if (strcmp(arch
, "xtensa") == 0 ||
248 strcmp(arch
, "xtensaeb") == 0) {
249 ADD_MACHINE_TESTS(arch
, xtensa_machines
);