Patchwork [for-1.6?,v2,21/21] qtest: Prepare QOM machine tests

login
register
mail settings
Submitter Andreas Färber
Date Aug. 5, 2013, 1:27 p.m.
Message ID <1375709247-10002-22-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/264674/
State New
Headers show

Comments

Andreas Färber - Aug. 5, 2013, 1:27 p.m.
Instantiate all [*] machines per target, so that they get a bit of test
coverage at all. This has proven helpful during QOM refactorings.

[*] ppcemb target contains some non-working non-embedded machines, and
ppc405 CPUs are not available there either.
i386 and x86_64 do not cover pc*-x.y or xenfv.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/Makefile   |  26 ++++++
 tests/qom-test.c | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 306 insertions(+)
 create mode 100644 tests/qom-test.c
Alexander Graf - Aug. 25, 2013, 5:22 p.m.
On 05.08.2013, at 14:27, Andreas Färber wrote:

> Instantiate all [*] machines per target, so that they get a bit of test
> coverage at all. This has proven helpful during QOM refactorings.
> 
> [*] ppcemb target contains some non-working non-embedded machines, and
> ppc405 CPUs are not available there either.

So I just looked up the spec and ppc405 does support 1k TLB entries, so it is eligible for the ppcemb target. The fact that it doesn't work is a bug :).

> i386 and x86_64 do not cover pc*-x.y or xenfv.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
> tests/Makefile   |  26 ++++++
> tests/qom-test.c | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 306 insertions(+)
> create mode 100644 tests/qom-test.c
> 
> diff --git a/tests/Makefile b/tests/Makefile
> index d044908..a7e1319 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -63,25 +63,50 @@ check-qtest-i386-y += tests/boot-order-test$(EXESUF)
> check-qtest-i386-y += tests/rtc-test$(EXESUF)
> check-qtest-i386-y += tests/i440fx-test$(EXESUF)
> check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
> +check-qtest-i386-y += tests/qom-test$(EXESUF)
> check-qtest-x86_64-y = $(check-qtest-i386-y)
> gcov-files-i386-y += i386-softmmu/hw/mc146818rtc.c
> gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
> check-qtest-mips-y = tests/endianness-test$(EXESUF)
> check-qtest-mips64-y = tests/endianness-test$(EXESUF)
> check-qtest-mips64el-y = tests/endianness-test$(EXESUF)
> +check-qtest-mips-y += tests/qom-test$(EXESUF)
> +check-qtest-mipsel-y += tests/qom-test$(EXESUF)
> +check-qtest-mips64-y += tests/qom-test$(EXESUF)
> +check-qtest-mips64el-y += tests/qom-test$(EXESUF)
> check-qtest-ppc-y = tests/endianness-test$(EXESUF)
> check-qtest-ppc64-y = tests/endianness-test$(EXESUF)
> check-qtest-sh4-y = tests/endianness-test$(EXESUF)
> check-qtest-sh4eb-y = tests/endianness-test$(EXESUF)
> +check-qtest-sh4-y += tests/qom-test$(EXESUF)
> +check-qtest-sh4eb-y += tests/qom-test$(EXESUF)
> check-qtest-sparc64-y = tests/endianness-test$(EXESUF)
> #check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
> #check-qtest-sparc64-y += tests/m48t59-test$(EXESUF)
> gcov-files-sparc-y += hw/m48t59.c
> gcov-files-sparc64-y += hw/m48t59.c
> +check-qtest-sparc-y += tests/qom-test$(EXESUF)
> +check-qtest-sparc64-y += tests/qom-test$(EXESUF)
> check-qtest-arm-y = tests/tmp105-test$(EXESUF)
> gcov-files-arm-y += hw/tmp105.c
> +check-qtest-arm-y += tests/qom-test$(EXESUF)
> check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
> check-qtest-ppc64-y += tests/boot-order-test$(EXESUF)
> +check-qtest-ppc-y += tests/qom-test$(EXESUF)
> +check-qtest-ppc64-y += tests/qom-test$(EXESUF)
> +check-qtest-ppcemb-y += tests/qom-test$(EXESUF)
> +check-qtest-alpha-y += tests/qom-test$(EXESUF)
> +check-qtest-cris-y += tests/qom-test$(EXESUF)
> +check-qtest-lm32-y += tests/qom-test$(EXESUF)
> +check-qtest-m68k-y += tests/qom-test$(EXESUF)
> +check-qtest-microblaze-y += tests/qom-test$(EXESUF)
> +check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
> +check-qtest-moxie-y += tests/qom-test$(EXESUF)
> +check-qtest-or32-y += tests/qom-test$(EXESUF)
> +check-qtest-s390x-y += tests/qom-test$(EXESUF)
> +check-qtest-unicore32-y += tests/qom-test$(EXESUF)
> +check-qtest-xtensa-y += tests/qom-test$(EXESUF)
> +check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
> 
> check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
>         comments.json empty.json funny-char.json indented-expr.json \
> @@ -161,6 +186,7 @@ tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y)
> tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
> tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
> tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
> +tests/qom-test$(EXESUF): tests/qom-test.o
> 
> # QTest rules
> 
> diff --git a/tests/qom-test.c b/tests/qom-test.c
> new file mode 100644
> index 0000000..c9494e0
> --- /dev/null
> +++ b/tests/qom-test.c
> @@ -0,0 +1,280 @@
> +/*
> + * QTest testcase for QOM
> + *
> + * Copyright (c) 2013 SUSE LINUX Products GmbH
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +#include "libqtest.h"
> +
> +#include <glib.h>
> +#include <string.h>
> +#include "qemu/osdep.h"
> +
> +static void test_nop(gconstpointer data)
> +{
> +    QTestState *s;
> +    const char *machine = data;
> +    char *args;
> +
> +    args = g_strdup_printf("-display none -machine %s", machine);
> +    s = qtest_start(args);
> +    if (s) {
> +        qtest_quit(s);
> +    }
> +    g_free(args);
> +}
> +
> +static const char *x86_machines[] = {
> +    "pc",
> +    "isapc",
> +    "q35",
> +};
> +
> +static const char *alpha_machines[] = {
> +    "clipper",
> +};
> +
> +static const char *arm_machines[] = {
> +    "integratorcp",
> +    "versatilepb",
> +    "versatileab",
> +    "lm3s811evb",
> +    "lm3s6965evb",
> +    "collie",
> +    "akita",
> +    "spitz",
> +    "borzoi",
> +    "terrier",
> +    "tosa",
> +    "cheetah",
> +    "sx1-v1",
> +    "sx1",
> +    "realview-eb",
> +    "realview-eb-mpcore",
> +    "realview-pb-a8",
> +    "realview-pbx-a9",
> +    "musicpal",
> +    "mainstone",
> +    "connex",
> +    "verdex",
> +    "z2",
> +    "n800",
> +    "n810",
> +    "kzm",
> +    "vexpress-a9",
> +    "vexpress-a15",
> +    "smdkc210",
> +    "nuri",
> +    "xilinx-zynq-a9",
> +    "highbank",
> +    "midway",
> +};
> +
> +static const char *cris_machines[] = {
> +    "axis-dev88",
> +};
> +
> +static const char *lm32_machines[] = {
> +    "lm32-evr",
> +    "lm32-uclinux",
> +    "milkymist",
> +};
> +
> +static const char *m68k_machines[] = {
> +    "mcf5208evb",
> +    "an5206",
> +    "dummy",
> +};
> +
> +static const char *microblaze_machines[] = {
> +    "petalogix-ml605",
> +    "petalogix-s3adsp1800",
> +};
> +
> +static const char *mips_machines[] = {
> +    "malta",
> +    "magnum",
> +    "mips",
> +    "mipssim",
> +    "pica61",
> +};
> +
> +static const char *moxie_machines[] = {
> +    "moxiesim",
> +};
> +
> +static const char *openrisc_machines[] = {
> +    "or32-sim",
> +};
> +
> +static const char *ppc_machines[] = {
> +    "g3beige",
> +    "mac99",
> +    "prep",
> +    "mpc8544ds",
> +    "ppce500",
> +};
> +
> +static const char *ppc405_machines[] = {
> +    "ref405ep",
> +    "taihu",
> +};
> +
> +static const char *ppc440_machines[] = {
> +    "bamboo",
> +    "virtex-ml507",
> +};
> +
> +static const char *s390_machines[] = {
> +    "s390-virtio",
> +    "s390-ccw-virtio",
> +};
> +
> +static const char *superh_machines[] = {
> +    "r2d",
> +    "shix",
> +};
> +
> +static const char *sparc_machines[] = {
> +    "SS-4",
> +    "SS-5",
> +    "SS-10",
> +    "SS-20",
> +    "SS-600MP",
> +    "LX",
> +    "SPARCClassic",
> +    "SPARCbook",
> +    "leon3_generic",
> +};
> +
> +static const char *sparc64_machines[] = {
> +    "sun4u",
> +    "sun4v",
> +    "Niagara",
> +};
> +
> +static const char *unicore32_machines[] = {
> +    "puv3",
> +};
> +
> +static const char *xtensa_machines[] = {
> +    "sim",
> +    "lx60",
> +    "lx200",
> +};
> +
> +static void add_test_cases(const char *arch, const char *machine)
> +{
> +    char *path;
> +    path = g_strdup_printf("/%s/qom/%s", arch, machine);
> +    g_test_add_data_func(path, machine, test_nop);
> +}
> +
> +int main(int argc, char **argv)
> +{
> +    const char *arch = qtest_get_arch();
> +    int i;
> +
> +    g_test_init(&argc, &argv, NULL);
> +
> +    add_test_cases(arch, "none");
> +
> +    if (strcmp(arch, "i386") == 0 ||
> +        strcmp(arch, "x86_64") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(x86_machines); i++) {
> +            add_test_cases(arch, x86_machines[i]);
> +        }
> +    } else if (strcmp(arch, "alpha") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(alpha_machines); i++) {
> +            add_test_cases(arch, alpha_machines[i]);
> +        }
> +    } else if (strcmp(arch, "arm") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(arm_machines); i++) {
> +            add_test_cases(arch, arm_machines[i]);
> +        }
> +    } else if (strcmp(arch, "cris") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(cris_machines); i++) {
> +            add_test_cases(arch, cris_machines[i]);
> +        }
> +    } else if (strcmp(arch, "lm32") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(lm32_machines); i++) {
> +            add_test_cases(arch, lm32_machines[i]);
> +        }
> +    } else if (strcmp(arch, "m68k") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(m68k_machines); i++) {
> +            add_test_cases(arch, m68k_machines[i]);
> +        }
> +    } else if (strcmp(arch, "microblaze") == 0 ||
> +               strcmp(arch, "microblazeel") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(microblaze_machines); i++) {
> +            add_test_cases(arch, microblaze_machines[i]);
> +        }
> +    } else if (strcmp(arch, "mips") == 0 ||
> +               strcmp(arch, "mipsel") == 0 ||
> +               strcmp(arch, "mips64") == 0 ||
> +               strcmp(arch, "mips64el") == 0) {

strncmp?

> +        for (i = 0; i < ARRAY_SIZE(mips_machines); i++) {
> +            add_test_cases(arch, mips_machines[i]);
> +        }
> +        if (strcmp(arch, "mips64el") == 0) {
> +            add_test_cases(arch, "fulong2e");
> +        }
> +    } else if (strcmp(arch, "moxie") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(moxie_machines); i++) {
> +            add_test_cases(arch, moxie_machines[i]);
> +        }
> +    } else if (strcmp(arch, "or32") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(openrisc_machines); i++) {
> +            add_test_cases(arch, openrisc_machines[i]);
> +        }
> +    } else if (strcmp(arch, "ppc") == 0 ||
> +               strcmp(arch, "ppc64") == 0 ||
> +               strcmp(arch, "ppcemb") == 0) {

I think it's more readable to list the targets individually here in separate branches.

  ppcemb
	ppcemb_machines
  ppc
	ppcemb_machines
	ppc_machines
  ppc64
	ppcemb_machines
	ppc_machines
	ppc64_machines

with ppcemb_machines == ppc405_machines + ppc440_machines.

I think it would also make sense to create a macro for the for loops

#define MACHINES_ADD(array) for (i = 0; i < ARRAY_SIZE(array); i++) { \
		add_test_cases(arch, array[i]); \
	}

} else if(!strcmp(arch, "ppcemb")) {
    MACHINES_ADD(ppcemb_machines);
} else if(!strcmp(arch, "ppc")) {
    MACHINES_ADD(ppcemb_machines);
    MACHINES_ADD(ppc_machines);
} else if (!strcmp(arch, "ppc64")) {
    MACHINES_ADD(ppcemb_machines);
    MACHINES_ADD(ppc_machines);
    MACHINES_ADD(ppc64_machines);
}

> +        if (strcmp(arch, "ppcemb") != 0) {
> +            /* XXX Currently available in ppcemb but shouldn't be */
> +            for (i = 0; i < ARRAY_SIZE(ppc_machines); i++) {
> +                add_test_cases(arch, ppc_machines[i]);
> +            }
> +            /* XXX Currently available in ppcemb but don't work */
> +            for (i = 0; i < ARRAY_SIZE(ppc405_machines); i++) {
> +                add_test_cases(arch, ppc405_machines[i]);
> +            }
> +        }
> +        for (i = 0; i < ARRAY_SIZE(ppc440_machines); i++) {
> +            add_test_cases(arch, ppc440_machines[i]);
> +        }
> +        if (strcmp(arch, "ppc64") == 0) {
> +            add_test_cases(arch, "pseries");
> +        }
> +    } else if (strcmp(arch, "s390x") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(s390_machines); i++) {
> +            add_test_cases(arch, s390_machines[i]);
> +        }
> +    } else if (strcmp(arch, "sh4") == 0 ||
> +               strcmp(arch, "sh4eb") == 0) {

strncmp maybe?

> +        for (i = 0; i < ARRAY_SIZE(superh_machines); i++) {
> +            add_test_cases(arch, superh_machines[i]);
> +        }
> +    } else if (strcmp(arch, "sparc") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(sparc_machines); i++) {
> +            add_test_cases(arch, sparc_machines[i]);
> +        }
> +    } else if (strcmp(arch, "sparc64") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(sparc64_machines); i++) {
> +            add_test_cases(arch, sparc64_machines[i]);
> +        }
> +    } else if (strcmp(arch, "unicore32") == 0) {
> +        for (i = 0; i < ARRAY_SIZE(unicore32_machines); i++) {
> +            add_test_cases(arch, unicore32_machines[i]);
> +        }
> +    } else if (strcmp(arch, "xtensa") == 0 ||
> +               strcmp(arch, "xtensaeb") == 0) {

strncmp?


Alex

> +        for (i = 0; i < ARRAY_SIZE(xtensa_machines); i++) {
> +            add_test_cases(arch, xtensa_machines[i]);
> +        }
> +    }
> +
> +    return g_test_run();
> +}
> -- 
> 1.8.1.4
> 
>
Peter Maydell - Aug. 25, 2013, 5:33 p.m.
On 5 August 2013 14:27, Andreas Färber <afaerber@suse.de> wrote:
> +static const char *arm_machines[] = {
> +    "integratorcp",
> +    "versatilepb",
> +    "versatileab",
> +    "lm3s811evb",
> +    "lm3s6965evb",
> +    "collie",

[etc]

I'd rather have these tests than not have them, but can't we autodetect
the list of machines (by parsing the output of -M help, or otherwise)?

-- PMM
Andreas Färber - Aug. 25, 2013, 5:34 p.m.
Am 25.08.2013 19:22, schrieb Alexander Graf:
> 
> On 05.08.2013, at 14:27, Andreas Färber wrote:
> 
>> Instantiate all [*] machines per target, so that they get a bit of test
>> coverage at all. This has proven helpful during QOM refactorings.
>>
>> [*] ppcemb target contains some non-working non-embedded machines, and
>> ppc405 CPUs are not available there either.
> 
> So I just looked up the spec and ppc405 does support 1k TLB entries, so it is eligible for the ppcemb target. The fact that it doesn't work is a bug :).

Thanks for clarifying!

>> i386 and x86_64 do not cover pc*-x.y or xenfv.
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> ---
>> tests/Makefile   |  26 ++++++
>> tests/qom-test.c | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 306 insertions(+)
>> create mode 100644 tests/qom-test.c
>>
>> diff --git a/tests/Makefile b/tests/Makefile
>> index d044908..a7e1319 100644
>> --- a/tests/Makefile
>> +++ b/tests/Makefile
>> @@ -63,25 +63,50 @@ check-qtest-i386-y += tests/boot-order-test$(EXESUF)
>> check-qtest-i386-y += tests/rtc-test$(EXESUF)
>> check-qtest-i386-y += tests/i440fx-test$(EXESUF)
>> check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
>> +check-qtest-i386-y += tests/qom-test$(EXESUF)
>> check-qtest-x86_64-y = $(check-qtest-i386-y)
>> gcov-files-i386-y += i386-softmmu/hw/mc146818rtc.c
>> gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
>> check-qtest-mips-y = tests/endianness-test$(EXESUF)
>> check-qtest-mips64-y = tests/endianness-test$(EXESUF)
>> check-qtest-mips64el-y = tests/endianness-test$(EXESUF)
>> +check-qtest-mips-y += tests/qom-test$(EXESUF)
>> +check-qtest-mipsel-y += tests/qom-test$(EXESUF)
>> +check-qtest-mips64-y += tests/qom-test$(EXESUF)
>> +check-qtest-mips64el-y += tests/qom-test$(EXESUF)
>> check-qtest-ppc-y = tests/endianness-test$(EXESUF)
>> check-qtest-ppc64-y = tests/endianness-test$(EXESUF)
>> check-qtest-sh4-y = tests/endianness-test$(EXESUF)
>> check-qtest-sh4eb-y = tests/endianness-test$(EXESUF)
>> +check-qtest-sh4-y += tests/qom-test$(EXESUF)
>> +check-qtest-sh4eb-y += tests/qom-test$(EXESUF)
>> check-qtest-sparc64-y = tests/endianness-test$(EXESUF)
>> #check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
>> #check-qtest-sparc64-y += tests/m48t59-test$(EXESUF)
>> gcov-files-sparc-y += hw/m48t59.c
>> gcov-files-sparc64-y += hw/m48t59.c
>> +check-qtest-sparc-y += tests/qom-test$(EXESUF)
>> +check-qtest-sparc64-y += tests/qom-test$(EXESUF)
>> check-qtest-arm-y = tests/tmp105-test$(EXESUF)
>> gcov-files-arm-y += hw/tmp105.c
>> +check-qtest-arm-y += tests/qom-test$(EXESUF)
>> check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
>> check-qtest-ppc64-y += tests/boot-order-test$(EXESUF)
>> +check-qtest-ppc-y += tests/qom-test$(EXESUF)
>> +check-qtest-ppc64-y += tests/qom-test$(EXESUF)
>> +check-qtest-ppcemb-y += tests/qom-test$(EXESUF)
>> +check-qtest-alpha-y += tests/qom-test$(EXESUF)
>> +check-qtest-cris-y += tests/qom-test$(EXESUF)
>> +check-qtest-lm32-y += tests/qom-test$(EXESUF)
>> +check-qtest-m68k-y += tests/qom-test$(EXESUF)
>> +check-qtest-microblaze-y += tests/qom-test$(EXESUF)
>> +check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
>> +check-qtest-moxie-y += tests/qom-test$(EXESUF)
>> +check-qtest-or32-y += tests/qom-test$(EXESUF)
>> +check-qtest-s390x-y += tests/qom-test$(EXESUF)
>> +check-qtest-unicore32-y += tests/qom-test$(EXESUF)
>> +check-qtest-xtensa-y += tests/qom-test$(EXESUF)
>> +check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
>>
>> check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
>>         comments.json empty.json funny-char.json indented-expr.json \
>> @@ -161,6 +186,7 @@ tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y)
>> tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
>> tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
>> tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
>> +tests/qom-test$(EXESUF): tests/qom-test.o
>>
>> # QTest rules
>>
>> diff --git a/tests/qom-test.c b/tests/qom-test.c
>> new file mode 100644
>> index 0000000..c9494e0
>> --- /dev/null
>> +++ b/tests/qom-test.c
>> @@ -0,0 +1,280 @@
>> +/*
>> + * QTest testcase for QOM
>> + *
>> + * Copyright (c) 2013 SUSE LINUX Products GmbH
>> + *
>> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
>> + * See the COPYING file in the top-level directory.
>> + */
>> +#include "libqtest.h"
>> +
>> +#include <glib.h>
>> +#include <string.h>
>> +#include "qemu/osdep.h"
>> +
>> +static void test_nop(gconstpointer data)
>> +{
>> +    QTestState *s;
>> +    const char *machine = data;
>> +    char *args;
>> +
>> +    args = g_strdup_printf("-display none -machine %s", machine);
>> +    s = qtest_start(args);
>> +    if (s) {
>> +        qtest_quit(s);
>> +    }
>> +    g_free(args);
>> +}
>> +
>> +static const char *x86_machines[] = {
>> +    "pc",
>> +    "isapc",
>> +    "q35",
>> +};
>> +
>> +static const char *alpha_machines[] = {
>> +    "clipper",
>> +};
>> +
>> +static const char *arm_machines[] = {
>> +    "integratorcp",
>> +    "versatilepb",
>> +    "versatileab",
>> +    "lm3s811evb",
>> +    "lm3s6965evb",
>> +    "collie",
>> +    "akita",
>> +    "spitz",
>> +    "borzoi",
>> +    "terrier",
>> +    "tosa",
>> +    "cheetah",
>> +    "sx1-v1",
>> +    "sx1",
>> +    "realview-eb",
>> +    "realview-eb-mpcore",
>> +    "realview-pb-a8",
>> +    "realview-pbx-a9",
>> +    "musicpal",
>> +    "mainstone",
>> +    "connex",
>> +    "verdex",
>> +    "z2",
>> +    "n800",
>> +    "n810",
>> +    "kzm",
>> +    "vexpress-a9",
>> +    "vexpress-a15",
>> +    "smdkc210",
>> +    "nuri",
>> +    "xilinx-zynq-a9",
>> +    "highbank",
>> +    "midway",
>> +};
>> +
>> +static const char *cris_machines[] = {
>> +    "axis-dev88",
>> +};
>> +
>> +static const char *lm32_machines[] = {
>> +    "lm32-evr",
>> +    "lm32-uclinux",
>> +    "milkymist",
>> +};
>> +
>> +static const char *m68k_machines[] = {
>> +    "mcf5208evb",
>> +    "an5206",
>> +    "dummy",
>> +};
>> +
>> +static const char *microblaze_machines[] = {
>> +    "petalogix-ml605",
>> +    "petalogix-s3adsp1800",
>> +};
>> +
>> +static const char *mips_machines[] = {
>> +    "malta",
>> +    "magnum",
>> +    "mips",
>> +    "mipssim",
>> +    "pica61",
>> +};
>> +
>> +static const char *moxie_machines[] = {
>> +    "moxiesim",
>> +};
>> +
>> +static const char *openrisc_machines[] = {
>> +    "or32-sim",
>> +};
>> +
>> +static const char *ppc_machines[] = {
>> +    "g3beige",
>> +    "mac99",
>> +    "prep",
>> +    "mpc8544ds",
>> +    "ppce500",
>> +};
>> +
>> +static const char *ppc405_machines[] = {
>> +    "ref405ep",
>> +    "taihu",
>> +};
>> +
>> +static const char *ppc440_machines[] = {
>> +    "bamboo",
>> +    "virtex-ml507",
>> +};
>> +
>> +static const char *s390_machines[] = {
>> +    "s390-virtio",
>> +    "s390-ccw-virtio",
>> +};
>> +
>> +static const char *superh_machines[] = {
>> +    "r2d",
>> +    "shix",
>> +};
>> +
>> +static const char *sparc_machines[] = {
>> +    "SS-4",
>> +    "SS-5",
>> +    "SS-10",
>> +    "SS-20",
>> +    "SS-600MP",
>> +    "LX",
>> +    "SPARCClassic",
>> +    "SPARCbook",
>> +    "leon3_generic",
>> +};
>> +
>> +static const char *sparc64_machines[] = {
>> +    "sun4u",
>> +    "sun4v",
>> +    "Niagara",
>> +};
>> +
>> +static const char *unicore32_machines[] = {
>> +    "puv3",
>> +};
>> +
>> +static const char *xtensa_machines[] = {
>> +    "sim",
>> +    "lx60",
>> +    "lx200",
>> +};
>> +
>> +static void add_test_cases(const char *arch, const char *machine)
>> +{
>> +    char *path;
>> +    path = g_strdup_printf("/%s/qom/%s", arch, machine);
>> +    g_test_add_data_func(path, machine, test_nop);
>> +}
>> +
>> +int main(int argc, char **argv)
>> +{
>> +    const char *arch = qtest_get_arch();
>> +    int i;
>> +
>> +    g_test_init(&argc, &argv, NULL);
>> +
>> +    add_test_cases(arch, "none");
>> +
>> +    if (strcmp(arch, "i386") == 0 ||
>> +        strcmp(arch, "x86_64") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(x86_machines); i++) {
>> +            add_test_cases(arch, x86_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "alpha") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(alpha_machines); i++) {
>> +            add_test_cases(arch, alpha_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "arm") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(arm_machines); i++) {
>> +            add_test_cases(arch, arm_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "cris") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(cris_machines); i++) {
>> +            add_test_cases(arch, cris_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "lm32") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(lm32_machines); i++) {
>> +            add_test_cases(arch, lm32_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "m68k") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(m68k_machines); i++) {
>> +            add_test_cases(arch, m68k_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "microblaze") == 0 ||
>> +               strcmp(arch, "microblazeel") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(microblaze_machines); i++) {
>> +            add_test_cases(arch, microblaze_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "mips") == 0 ||
>> +               strcmp(arch, "mipsel") == 0 ||
>> +               strcmp(arch, "mips64") == 0 ||
>> +               strcmp(arch, "mips64el") == 0) {
> 
> strncmp?

I don't like the idea of allowing trailing junk so much...

>> +        for (i = 0; i < ARRAY_SIZE(mips_machines); i++) {
>> +            add_test_cases(arch, mips_machines[i]);
>> +        }
>> +        if (strcmp(arch, "mips64el") == 0) {
>> +            add_test_cases(arch, "fulong2e");
>> +        }
>> +    } else if (strcmp(arch, "moxie") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(moxie_machines); i++) {
>> +            add_test_cases(arch, moxie_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "or32") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(openrisc_machines); i++) {
>> +            add_test_cases(arch, openrisc_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "ppc") == 0 ||
>> +               strcmp(arch, "ppc64") == 0 ||
>> +               strcmp(arch, "ppcemb") == 0) {
> 
> I think it's more readable to list the targets individually here in separate branches.
> 
>   ppcemb
> 	ppcemb_machines
>   ppc
> 	ppcemb_machines
> 	ppc_machines
>   ppc64
> 	ppcemb_machines
> 	ppc_machines
> 	ppc64_machines
> 
> with ppcemb_machines == ppc405_machines + ppc440_machines.
> 
> I think it would also make sense to create a macro for the for loops
> 
> #define MACHINES_ADD(array) for (i = 0; i < ARRAY_SIZE(array); i++) { \
> 		add_test_cases(arch, array[i]); \
> 	}
> 
> } else if(!strcmp(arch, "ppcemb")) {
>     MACHINES_ADD(ppcemb_machines);
> } else if(!strcmp(arch, "ppc")) {
>     MACHINES_ADD(ppcemb_machines);
>     MACHINES_ADD(ppc_machines);
> } else if (!strcmp(arch, "ppc64")) {
>     MACHINES_ADD(ppcemb_machines);
>     MACHINES_ADD(ppc_machines);
>     MACHINES_ADD(ppc64_machines);
> }

Good idea!

Thanks,
Andreas

> 
>> +        if (strcmp(arch, "ppcemb") != 0) {
>> +            /* XXX Currently available in ppcemb but shouldn't be */
>> +            for (i = 0; i < ARRAY_SIZE(ppc_machines); i++) {
>> +                add_test_cases(arch, ppc_machines[i]);
>> +            }
>> +            /* XXX Currently available in ppcemb but don't work */
>> +            for (i = 0; i < ARRAY_SIZE(ppc405_machines); i++) {
>> +                add_test_cases(arch, ppc405_machines[i]);
>> +            }
>> +        }
>> +        for (i = 0; i < ARRAY_SIZE(ppc440_machines); i++) {
>> +            add_test_cases(arch, ppc440_machines[i]);
>> +        }
>> +        if (strcmp(arch, "ppc64") == 0) {
>> +            add_test_cases(arch, "pseries");
>> +        }
>> +    } else if (strcmp(arch, "s390x") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(s390_machines); i++) {
>> +            add_test_cases(arch, s390_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "sh4") == 0 ||
>> +               strcmp(arch, "sh4eb") == 0) {
> 
> strncmp maybe?
> 
>> +        for (i = 0; i < ARRAY_SIZE(superh_machines); i++) {
>> +            add_test_cases(arch, superh_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "sparc") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(sparc_machines); i++) {
>> +            add_test_cases(arch, sparc_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "sparc64") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(sparc64_machines); i++) {
>> +            add_test_cases(arch, sparc64_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "unicore32") == 0) {
>> +        for (i = 0; i < ARRAY_SIZE(unicore32_machines); i++) {
>> +            add_test_cases(arch, unicore32_machines[i]);
>> +        }
>> +    } else if (strcmp(arch, "xtensa") == 0 ||
>> +               strcmp(arch, "xtensaeb") == 0) {
> 
> strncmp?
> 
> 
> Alex
> 
>> +        for (i = 0; i < ARRAY_SIZE(xtensa_machines); i++) {
>> +            add_test_cases(arch, xtensa_machines[i]);
>> +        }
>> +    }
>> +
>> +    return g_test_run();
>> +}
>> -- 
>> 1.8.1.4
>>
>>
>
Andreas Färber - Aug. 25, 2013, 5:42 p.m.
Am 25.08.2013 19:33, schrieb Peter Maydell:
> On 5 August 2013 14:27, Andreas Färber <afaerber@suse.de> wrote:
>> +static const char *arm_machines[] = {
>> +    "integratorcp",
>> +    "versatilepb",
>> +    "versatileab",
>> +    "lm3s811evb",
>> +    "lm3s6965evb",
>> +    "collie",
> 
> [etc]
> 
> I'd rather have these tests than not have them, but can't we autodetect
> the list of machines (by parsing the output of -M help, or otherwise)?

If you want to implement that, feel free to. :) We neither have working
QMP parsing nor a QMP method for obtaining machines that I'm aware of.

My opinion is that if I merge a complete but fixed list today and
afterwards someone adds a new machine and forgets to cover it with
custom or this generic qtest, then it's their fault if I unknowingly
break their machine.

Andreas
Luiz Capitulino - Aug. 26, 2013, 1:19 p.m.
On Sun, 25 Aug 2013 19:42:56 +0200
Andreas Färber <afaerber@suse.de> wrote:

> Am 25.08.2013 19:33, schrieb Peter Maydell:
> > On 5 August 2013 14:27, Andreas Färber <afaerber@suse.de> wrote:
> >> +static const char *arm_machines[] = {
> >> +    "integratorcp",
> >> +    "versatilepb",
> >> +    "versatileab",
> >> +    "lm3s811evb",
> >> +    "lm3s6965evb",
> >> +    "collie",
> > 
> > [etc]
> > 
> > I'd rather have these tests than not have them, but can't we autodetect
> > the list of machines (by parsing the output of -M help, or otherwise)?
> 
> If you want to implement that, feel free to. :) We neither have working
> QMP parsing nor a QMP method for obtaining machines that I'm aware of.

Not sure what the context is here, but we have query-machines. It's a
bit simple though. We also have query-cpu-definitions.

Patch

diff --git a/tests/Makefile b/tests/Makefile
index d044908..a7e1319 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -63,25 +63,50 @@  check-qtest-i386-y += tests/boot-order-test$(EXESUF)
 check-qtest-i386-y += tests/rtc-test$(EXESUF)
 check-qtest-i386-y += tests/i440fx-test$(EXESUF)
 check-qtest-i386-y += tests/fw_cfg-test$(EXESUF)
+check-qtest-i386-y += tests/qom-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)
 gcov-files-i386-y += i386-softmmu/hw/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
 check-qtest-mips-y = tests/endianness-test$(EXESUF)
 check-qtest-mips64-y = tests/endianness-test$(EXESUF)
 check-qtest-mips64el-y = tests/endianness-test$(EXESUF)
+check-qtest-mips-y += tests/qom-test$(EXESUF)
+check-qtest-mipsel-y += tests/qom-test$(EXESUF)
+check-qtest-mips64-y += tests/qom-test$(EXESUF)
+check-qtest-mips64el-y += tests/qom-test$(EXESUF)
 check-qtest-ppc-y = tests/endianness-test$(EXESUF)
 check-qtest-ppc64-y = tests/endianness-test$(EXESUF)
 check-qtest-sh4-y = tests/endianness-test$(EXESUF)
 check-qtest-sh4eb-y = tests/endianness-test$(EXESUF)
+check-qtest-sh4-y += tests/qom-test$(EXESUF)
+check-qtest-sh4eb-y += tests/qom-test$(EXESUF)
 check-qtest-sparc64-y = tests/endianness-test$(EXESUF)
 #check-qtest-sparc-y = tests/m48t59-test$(EXESUF)
 #check-qtest-sparc64-y += tests/m48t59-test$(EXESUF)
 gcov-files-sparc-y += hw/m48t59.c
 gcov-files-sparc64-y += hw/m48t59.c
+check-qtest-sparc-y += tests/qom-test$(EXESUF)
+check-qtest-sparc64-y += tests/qom-test$(EXESUF)
 check-qtest-arm-y = tests/tmp105-test$(EXESUF)
 gcov-files-arm-y += hw/tmp105.c
+check-qtest-arm-y += tests/qom-test$(EXESUF)
 check-qtest-ppc-y += tests/boot-order-test$(EXESUF)
 check-qtest-ppc64-y += tests/boot-order-test$(EXESUF)
+check-qtest-ppc-y += tests/qom-test$(EXESUF)
+check-qtest-ppc64-y += tests/qom-test$(EXESUF)
+check-qtest-ppcemb-y += tests/qom-test$(EXESUF)
+check-qtest-alpha-y += tests/qom-test$(EXESUF)
+check-qtest-cris-y += tests/qom-test$(EXESUF)
+check-qtest-lm32-y += tests/qom-test$(EXESUF)
+check-qtest-m68k-y += tests/qom-test$(EXESUF)
+check-qtest-microblaze-y += tests/qom-test$(EXESUF)
+check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
+check-qtest-moxie-y += tests/qom-test$(EXESUF)
+check-qtest-or32-y += tests/qom-test$(EXESUF)
+check-qtest-s390x-y += tests/qom-test$(EXESUF)
+check-qtest-unicore32-y += tests/qom-test$(EXESUF)
+check-qtest-xtensa-y += tests/qom-test$(EXESUF)
+check-qtest-xtensaeb-y = $(check-qtest-xtensa-y)
 
 check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
         comments.json empty.json funny-char.json indented-expr.json \
@@ -161,6 +186,7 @@  tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y)
 tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
 tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
 tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
+tests/qom-test$(EXESUF): tests/qom-test.o
 
 # QTest rules
 
diff --git a/tests/qom-test.c b/tests/qom-test.c
new file mode 100644
index 0000000..c9494e0
--- /dev/null
+++ b/tests/qom-test.c
@@ -0,0 +1,280 @@ 
+/*
+ * QTest testcase for QOM
+ *
+ * Copyright (c) 2013 SUSE LINUX Products GmbH
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#include "libqtest.h"
+
+#include <glib.h>
+#include <string.h>
+#include "qemu/osdep.h"
+
+static void test_nop(gconstpointer data)
+{
+    QTestState *s;
+    const char *machine = data;
+    char *args;
+
+    args = g_strdup_printf("-display none -machine %s", machine);
+    s = qtest_start(args);
+    if (s) {
+        qtest_quit(s);
+    }
+    g_free(args);
+}
+
+static const char *x86_machines[] = {
+    "pc",
+    "isapc",
+    "q35",
+};
+
+static const char *alpha_machines[] = {
+    "clipper",
+};
+
+static const char *arm_machines[] = {
+    "integratorcp",
+    "versatilepb",
+    "versatileab",
+    "lm3s811evb",
+    "lm3s6965evb",
+    "collie",
+    "akita",
+    "spitz",
+    "borzoi",
+    "terrier",
+    "tosa",
+    "cheetah",
+    "sx1-v1",
+    "sx1",
+    "realview-eb",
+    "realview-eb-mpcore",
+    "realview-pb-a8",
+    "realview-pbx-a9",
+    "musicpal",
+    "mainstone",
+    "connex",
+    "verdex",
+    "z2",
+    "n800",
+    "n810",
+    "kzm",
+    "vexpress-a9",
+    "vexpress-a15",
+    "smdkc210",
+    "nuri",
+    "xilinx-zynq-a9",
+    "highbank",
+    "midway",
+};
+
+static const char *cris_machines[] = {
+    "axis-dev88",
+};
+
+static const char *lm32_machines[] = {
+    "lm32-evr",
+    "lm32-uclinux",
+    "milkymist",
+};
+
+static const char *m68k_machines[] = {
+    "mcf5208evb",
+    "an5206",
+    "dummy",
+};
+
+static const char *microblaze_machines[] = {
+    "petalogix-ml605",
+    "petalogix-s3adsp1800",
+};
+
+static const char *mips_machines[] = {
+    "malta",
+    "magnum",
+    "mips",
+    "mipssim",
+    "pica61",
+};
+
+static const char *moxie_machines[] = {
+    "moxiesim",
+};
+
+static const char *openrisc_machines[] = {
+    "or32-sim",
+};
+
+static const char *ppc_machines[] = {
+    "g3beige",
+    "mac99",
+    "prep",
+    "mpc8544ds",
+    "ppce500",
+};
+
+static const char *ppc405_machines[] = {
+    "ref405ep",
+    "taihu",
+};
+
+static const char *ppc440_machines[] = {
+    "bamboo",
+    "virtex-ml507",
+};
+
+static const char *s390_machines[] = {
+    "s390-virtio",
+    "s390-ccw-virtio",
+};
+
+static const char *superh_machines[] = {
+    "r2d",
+    "shix",
+};
+
+static const char *sparc_machines[] = {
+    "SS-4",
+    "SS-5",
+    "SS-10",
+    "SS-20",
+    "SS-600MP",
+    "LX",
+    "SPARCClassic",
+    "SPARCbook",
+    "leon3_generic",
+};
+
+static const char *sparc64_machines[] = {
+    "sun4u",
+    "sun4v",
+    "Niagara",
+};
+
+static const char *unicore32_machines[] = {
+    "puv3",
+};
+
+static const char *xtensa_machines[] = {
+    "sim",
+    "lx60",
+    "lx200",
+};
+
+static void add_test_cases(const char *arch, const char *machine)
+{
+    char *path;
+    path = g_strdup_printf("/%s/qom/%s", arch, machine);
+    g_test_add_data_func(path, machine, test_nop);
+}
+
+int main(int argc, char **argv)
+{
+    const char *arch = qtest_get_arch();
+    int i;
+
+    g_test_init(&argc, &argv, NULL);
+
+    add_test_cases(arch, "none");
+
+    if (strcmp(arch, "i386") == 0 ||
+        strcmp(arch, "x86_64") == 0) {
+        for (i = 0; i < ARRAY_SIZE(x86_machines); i++) {
+            add_test_cases(arch, x86_machines[i]);
+        }
+    } else if (strcmp(arch, "alpha") == 0) {
+        for (i = 0; i < ARRAY_SIZE(alpha_machines); i++) {
+            add_test_cases(arch, alpha_machines[i]);
+        }
+    } else if (strcmp(arch, "arm") == 0) {
+        for (i = 0; i < ARRAY_SIZE(arm_machines); i++) {
+            add_test_cases(arch, arm_machines[i]);
+        }
+    } else if (strcmp(arch, "cris") == 0) {
+        for (i = 0; i < ARRAY_SIZE(cris_machines); i++) {
+            add_test_cases(arch, cris_machines[i]);
+        }
+    } else if (strcmp(arch, "lm32") == 0) {
+        for (i = 0; i < ARRAY_SIZE(lm32_machines); i++) {
+            add_test_cases(arch, lm32_machines[i]);
+        }
+    } else if (strcmp(arch, "m68k") == 0) {
+        for (i = 0; i < ARRAY_SIZE(m68k_machines); i++) {
+            add_test_cases(arch, m68k_machines[i]);
+        }
+    } else if (strcmp(arch, "microblaze") == 0 ||
+               strcmp(arch, "microblazeel") == 0) {
+        for (i = 0; i < ARRAY_SIZE(microblaze_machines); i++) {
+            add_test_cases(arch, microblaze_machines[i]);
+        }
+    } else if (strcmp(arch, "mips") == 0 ||
+               strcmp(arch, "mipsel") == 0 ||
+               strcmp(arch, "mips64") == 0 ||
+               strcmp(arch, "mips64el") == 0) {
+        for (i = 0; i < ARRAY_SIZE(mips_machines); i++) {
+            add_test_cases(arch, mips_machines[i]);
+        }
+        if (strcmp(arch, "mips64el") == 0) {
+            add_test_cases(arch, "fulong2e");
+        }
+    } else if (strcmp(arch, "moxie") == 0) {
+        for (i = 0; i < ARRAY_SIZE(moxie_machines); i++) {
+            add_test_cases(arch, moxie_machines[i]);
+        }
+    } else if (strcmp(arch, "or32") == 0) {
+        for (i = 0; i < ARRAY_SIZE(openrisc_machines); i++) {
+            add_test_cases(arch, openrisc_machines[i]);
+        }
+    } else if (strcmp(arch, "ppc") == 0 ||
+               strcmp(arch, "ppc64") == 0 ||
+               strcmp(arch, "ppcemb") == 0) {
+        if (strcmp(arch, "ppcemb") != 0) {
+            /* XXX Currently available in ppcemb but shouldn't be */
+            for (i = 0; i < ARRAY_SIZE(ppc_machines); i++) {
+                add_test_cases(arch, ppc_machines[i]);
+            }
+            /* XXX Currently available in ppcemb but don't work */
+            for (i = 0; i < ARRAY_SIZE(ppc405_machines); i++) {
+                add_test_cases(arch, ppc405_machines[i]);
+            }
+        }
+        for (i = 0; i < ARRAY_SIZE(ppc440_machines); i++) {
+            add_test_cases(arch, ppc440_machines[i]);
+        }
+        if (strcmp(arch, "ppc64") == 0) {
+            add_test_cases(arch, "pseries");
+        }
+    } else if (strcmp(arch, "s390x") == 0) {
+        for (i = 0; i < ARRAY_SIZE(s390_machines); i++) {
+            add_test_cases(arch, s390_machines[i]);
+        }
+    } else if (strcmp(arch, "sh4") == 0 ||
+               strcmp(arch, "sh4eb") == 0) {
+        for (i = 0; i < ARRAY_SIZE(superh_machines); i++) {
+            add_test_cases(arch, superh_machines[i]);
+        }
+    } else if (strcmp(arch, "sparc") == 0) {
+        for (i = 0; i < ARRAY_SIZE(sparc_machines); i++) {
+            add_test_cases(arch, sparc_machines[i]);
+        }
+    } else if (strcmp(arch, "sparc64") == 0) {
+        for (i = 0; i < ARRAY_SIZE(sparc64_machines); i++) {
+            add_test_cases(arch, sparc64_machines[i]);
+        }
+    } else if (strcmp(arch, "unicore32") == 0) {
+        for (i = 0; i < ARRAY_SIZE(unicore32_machines); i++) {
+            add_test_cases(arch, unicore32_machines[i]);
+        }
+    } else if (strcmp(arch, "xtensa") == 0 ||
+               strcmp(arch, "xtensaeb") == 0) {
+        for (i = 0; i < ARRAY_SIZE(xtensa_machines); i++) {
+            add_test_cases(arch, xtensa_machines[i]);
+        }
+    }
+
+    return g_test_run();
+}