target/alpha: Split out gen_goto_tb
[qemu/armbru.git] / tests / qtest / machine-none-test.c
blob05da7bc72dcc9b77ec4e49553869c25f9909a20a
1 /*
2 * Machine 'none' tests.
4 * Copyright (c) 2018 Red Hat Inc.
6 * Authors:
7 * Igor Mammedov <imammedo@redhat.com>,
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
13 #include "qemu/osdep.h"
15 #include "qemu/cutils.h"
16 #include "libqtest.h"
17 #include "qapi/qmp/qdict.h"
20 struct arch2cpu {
21 const char *arch;
22 const char *cpu_model;
25 static struct arch2cpu cpus_map[] = {
26 /* tested targets list */
27 { "arm", "cortex-a15" },
28 { "aarch64", "cortex-a57" },
29 { "avr", "avr6-avr-cpu" },
30 { "x86_64", "qemu64,apic-id=0" },
31 { "i386", "qemu32,apic-id=0" },
32 { "alpha", "ev67" },
33 { "cris", "crisv32" },
34 { "m68k", "m5206" },
35 { "microblaze", "any" },
36 { "microblazeel", "any" },
37 { "mips", "4Kc" },
38 { "mipsel", "I7200" },
39 { "mips64", "20Kc" },
40 { "mips64el", "I6500" },
41 { "or1k", "or1200" },
42 { "ppc", "604" },
43 { "ppc64", "power8e_v2.1" },
44 { "s390x", "qemu" },
45 { "sh4", "sh7750r" },
46 { "sh4eb", "sh7751r" },
47 { "sparc", "LEON2" },
48 { "sparc64", "Fujitsu Sparc64" },
49 { "tricore", "tc1796" },
50 { "xtensa", "dc233c" },
51 { "xtensaeb", "fsf" },
52 { "hppa", "hppa" },
53 { "riscv64", "rv64" },
54 { "riscv32", "rv32" },
55 { "rx", "rx62n" },
56 { "loongarch64", "la464"},
59 static const char *get_cpu_model_by_arch(const char *arch)
61 int i;
63 for (i = 0; i < ARRAY_SIZE(cpus_map); i++) {
64 if (!strcmp(arch, cpus_map[i].arch)) {
65 return cpus_map[i].cpu_model;
68 return NULL;
71 static void test_machine_cpu_cli(void)
73 QDict *response;
74 const char *arch = qtest_get_arch();
75 const char *cpu_model = get_cpu_model_by_arch(arch);
76 QTestState *qts;
78 if (!cpu_model) {
79 fprintf(stderr, "WARNING: cpu name for target '%s' isn't defined,"
80 " add it to cpus_map\n", arch);
81 return; /* TODO: die here to force all targets have a test */
83 qts = qtest_initf("-machine none -cpu \"%s\"", cpu_model);
85 response = qtest_qmp(qts, "{ 'execute': 'quit' }");
86 g_assert(qdict_haskey(response, "return"));
87 qobject_unref(response);
89 qtest_quit(qts);
92 int main(int argc, char **argv)
94 g_test_init(&argc, &argv, NULL);
96 qtest_add_func("machine/none/cpu_option", test_machine_cpu_cli);
98 return g_test_run();