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[] = {
77 static const char *cris_machines[] = {
81 static const char *lm32_machines[] = {
87 static const char *m68k_machines[] = {
93 static const char *microblaze_machines[] = {
95 "petalogix-s3adsp1800",
98 static const char *mips_machines[] = {
106 static const char *moxie_machines[] = {
110 static const char *openrisc_machines[] = {
114 static const char *ppc_machines[] = {
122 static const char *ppc64_machines[] = {
126 static const char *ppc405_machines[] = {
131 static const char *ppc440_machines[] = {
136 static const char *s390_machines[] = {
141 static const char *superh_machines[] = {
146 static const char *sparc_machines[] = {
158 static const char *sparc64_machines[] = {
164 static const char *unicore32_machines[] = {
168 static const char *xtensa_machines[] = {
174 static void add_test_cases(const char *arch, const char *machine)
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 { \
183 for (i = 0; i < ARRAY_SIZE(array); i++) { \
184 add_test_cases((arch), (array)[i]); \
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) {
225 /* XXX Available in ppcemb but don't work */
226 ADD_MACHINE_TESTS(arch, ppc405_machines);
228 ADD_MACHINE_TESTS(arch, ppc440_machines);
229 } else if (strcmp(arch, "ppc") == 0) {
230 ADD_MACHINE_TESTS(arch, ppc405_machines);
231 ADD_MACHINE_TESTS(arch, ppc440_machines);
232 ADD_MACHINE_TESTS(arch, ppc_machines);
233 } else if (strcmp(arch, "ppc64") == 0) {
234 ADD_MACHINE_TESTS(arch, ppc405_machines);
235 ADD_MACHINE_TESTS(arch, ppc440_machines);
236 ADD_MACHINE_TESTS(arch, ppc_machines);
237 ADD_MACHINE_TESTS(arch, ppc64_machines);
238 } else if (strcmp(arch, "s390x") == 0) {
239 ADD_MACHINE_TESTS(arch, s390_machines);
240 } else if (strcmp(arch, "sh4") == 0 ||
241 strcmp(arch, "sh4eb") == 0) {
242 ADD_MACHINE_TESTS(arch, superh_machines);
243 } else if (strcmp(arch, "sparc") == 0) {
244 ADD_MACHINE_TESTS(arch, sparc_machines);
245 } else if (strcmp(arch, "sparc64") == 0) {
246 ADD_MACHINE_TESTS(arch, sparc64_machines);
247 } else if (strcmp(arch, "unicore32") == 0) {
248 ADD_MACHINE_TESTS(arch, unicore32_machines);
249 } else if (strcmp(arch, "xtensa") == 0 ||
250 strcmp(arch, "xtensaeb") == 0) {
251 ADD_MACHINE_TESTS(arch, xtensa_machines);