qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PULL 19/58] qtest: Prepare QOM machine tests
Date: Tue,  8 Oct 2013 19:44:17 +0200	[thread overview]
Message-ID: <1381254296-3203-20-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1381254296-3203-1-git-send-email-afaerber@suse.de>

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 | 253 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 279 insertions(+)
 create mode 100644 tests/qom-test.c

diff --git a/tests/Makefile b/tests/Makefile
index 994fef1..53a5c09 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -67,25 +67,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 \
@@ -174,6 +199,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
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 
 # QTest rules
diff --git a/tests/qom-test.c b/tests/qom-test.c
new file mode 100644
index 0000000..6ed23c5
--- /dev/null
+++ b/tests/qom-test.c
@@ -0,0 +1,253 @@
+/*
+ * 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 *ppc64_machines[] = {
+    "pseries",
+};
+
+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);
+}
+
+#define ADD_MACHINE_TESTS(arch, array) do { \
+    int i; \
+    for (i = 0; i < ARRAY_SIZE(array); i++) { \
+        add_test_cases((arch), (array)[i]); \
+    } \
+} while (false)
+
+int main(int argc, char **argv)
+{
+    const char *arch = qtest_get_arch();
+
+    g_test_init(&argc, &argv, NULL);
+
+    add_test_cases(arch, "none");
+
+    if (strcmp(arch, "i386") == 0 ||
+        strcmp(arch, "x86_64") == 0) {
+        ADD_MACHINE_TESTS(arch, x86_machines);
+    } else if (strcmp(arch, "alpha") == 0) {
+        ADD_MACHINE_TESTS(arch, alpha_machines);
+    } else if (strcmp(arch, "arm") == 0) {
+        ADD_MACHINE_TESTS(arch, arm_machines);
+    } else if (strcmp(arch, "cris") == 0) {
+        ADD_MACHINE_TESTS(arch, cris_machines);
+    } else if (strcmp(arch, "lm32") == 0) {
+        ADD_MACHINE_TESTS(arch, lm32_machines);
+    } else if (strcmp(arch, "m68k") == 0) {
+        ADD_MACHINE_TESTS(arch, m68k_machines);
+    } else if (strcmp(arch, "microblaze") == 0 ||
+               strcmp(arch, "microblazeel") == 0) {
+        ADD_MACHINE_TESTS(arch, microblaze_machines);
+    } else if (strcmp(arch, "mips") == 0 ||
+               strcmp(arch, "mipsel") == 0 ||
+               strcmp(arch, "mips64") == 0) {
+        ADD_MACHINE_TESTS(arch, mips_machines);
+    } else if (strcmp(arch, "mips64el") == 0) {
+        ADD_MACHINE_TESTS(arch, mips_machines);
+        add_test_cases(arch, "fulong2e");
+    } else if (strcmp(arch, "moxie") == 0) {
+        ADD_MACHINE_TESTS(arch, moxie_machines);
+    } else if (strcmp(arch, "or32") == 0) {
+        ADD_MACHINE_TESTS(arch, openrisc_machines);
+    } else if (strcmp(arch, "ppcemb") == 0) {
+#if 0
+        /* XXX Available in ppcemb but don't work */
+        ADD_MACHINE_TESTS(arch, ppc405_machines);
+#endif
+        ADD_MACHINE_TESTS(arch, ppc440_machines);
+    } else if (strcmp(arch, "ppc") == 0) {
+        ADD_MACHINE_TESTS(arch, ppc405_machines);
+        ADD_MACHINE_TESTS(arch, ppc440_machines);
+        ADD_MACHINE_TESTS(arch, ppc_machines);
+    } else if (strcmp(arch, "ppc64") == 0) {
+        ADD_MACHINE_TESTS(arch, ppc405_machines);
+        ADD_MACHINE_TESTS(arch, ppc440_machines);
+        ADD_MACHINE_TESTS(arch, ppc_machines);
+        ADD_MACHINE_TESTS(arch, ppc64_machines);
+    } else if (strcmp(arch, "s390x") == 0) {
+        ADD_MACHINE_TESTS(arch, s390_machines);
+    } else if (strcmp(arch, "sh4") == 0 ||
+               strcmp(arch, "sh4eb") == 0) {
+        ADD_MACHINE_TESTS(arch, superh_machines);
+    } else if (strcmp(arch, "sparc") == 0) {
+        ADD_MACHINE_TESTS(arch, sparc_machines);
+    } else if (strcmp(arch, "sparc64") == 0) {
+        ADD_MACHINE_TESTS(arch, sparc64_machines);
+    } else if (strcmp(arch, "unicore32") == 0) {
+        ADD_MACHINE_TESTS(arch, unicore32_machines);
+    } else if (strcmp(arch, "xtensa") == 0 ||
+               strcmp(arch, "xtensaeb") == 0) {
+        ADD_MACHINE_TESTS(arch, xtensa_machines);
+    }
+
+    return g_test_run();
+}
-- 
1.8.1.4

  parent reply	other threads:[~2013-10-08 18:05 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-08 17:43 [Qemu-devel] [PULL 00/58] QOM devices patch queue 2013-10-08 Andreas Färber
2013-10-08 17:43 ` [Qemu-devel] [PULL 01/58] hw/arm/boot: Make user not specifying a kernel not an error Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 02/58] hw/arm: Tidy up conditional calls to arm_load_kernel() Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 03/58] mips_mipssim: Silence BIOS loading warning for qtest Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 04/58] puv3: Turn puv3_load_kernel() into a no-op for qtest without -kernel Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 05/58] mainstone: Don't enforce use of -pflash for qtest Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 06/58] gumstix: " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 07/58] z2: " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 08/58] palm: Don't enforce loading ROM or kernel " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 09/58] omap_sx1: Don't enforce use of kernel or flash " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 10/58] exynos4_boards: Silence lack of -smp 2 warning " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 11/58] armv7m: Don't enforce use of kernel " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 12/58] axis_dev88: " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 13/58] mcf5208: " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 14/58] an5206: " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 15/58] milkymist: Suppress -kernel/-bios/-drive error " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 16/58] shix: Drop debug output Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 17/58] shix: Don't require firmware presence for qtest Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 18/58] leon3: Don't enforce use of -bios with qtest Andreas Färber
2013-10-08 17:44 ` Andreas Färber [this message]
2013-10-08 17:44 ` [Qemu-devel] [PULL 20/58] milkymist-uart: Use Device::realize instead of SysBusDevice::init Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 21/58] a9mpcore: Split off instance_init Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 22/58] arm_gic: Extract headers hw/intc/arm_gic{, _common}.h Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 23/58] a9mpcore: Embed GICState Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 24/58] a9scu: QOM cleanups Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 25/58] a9mpcore: Embed A9SCUState Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 26/58] arm_mptimer: Convert to QOM realize Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 27/58] a9mpcore: Embed ARMMPTimerState Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 28/58] a9mpcore: Convert to QOM realize Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 29/58] a9mpcore: Prepare for QOM embedding Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 30/58] a15mpcore: Split off instance_init Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 31/58] a15mpcore: Embed GICState Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 32/58] a15mpcore: Convert to QOM realize Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 33/58] a15mpcore: Prepare for QOM embedding Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 34/58] a9scu: Build only once Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 35/58] arm11mpcore: Fix typo in MemoryRegion name Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 36/58] arm11mpcore: Drop unused fields Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 37/58] arm11mpcore: Create container MemoryRegion in instance_init Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 38/58] arm11mpcore: Split off SCU device Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 39/58] arm11mpcore: Convert ARM11MPCorePriveState to QOM realize Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 40/58] realview_gic: Convert " Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 41/58] realview_gic: Prepare for QOM embedding Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 42/58] arm11mpcore: Convert mpcore_rirq_state to QOM realize Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 43/58] arm11mpcore: Prepare for QOM embedding Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 44/58] arm11mpcore: Split off RealView MPCore Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 45/58] qdev-monitor: Clean up qdev_device_add() variable naming Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 46/58] qdev-monitor: Fix crash when device_add is called with abstract driver Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 47/58] qdev-monitor: Unref device when device_add fails Andreas Färber
2013-11-18 12:29   ` Amos Kong
2013-11-18 14:35     ` Andreas Färber
2013-11-19  8:31       ` Amos Kong
2013-11-19 10:25         ` Paolo Bonzini
2013-10-08 17:44 ` [Qemu-devel] [PULL 48/58] qdev: Drop misleading qdev_free() function Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 49/58] qdev-monitor: Avoid qdev as variable name Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 50/58] qdev-monitor: Inline qdev_init() for device_add Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 51/58] qom: Include error.h directly in object.h Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 52/58] qom: Clean up struct Error references Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 53/58] qom: Add pointer to int property helpers Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 54/58] pxa: Fix typo "dettach" Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 55/58] pcmcia: QOM'ify PCMCIACardState and MicroDriveState Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 56/58] microdrive: Coding Style cleanups Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 57/58] ide: Drop ide_init2_with_non_qdev_drives() Andreas Färber
2013-10-08 17:44 ` [Qemu-devel] [PULL 58/58] pcmcia/pxa2xx: QOM'ify PXA2xxPCMCIAState Andreas Färber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1381254296-3203-20-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).