Skip to contentSkip to conversation

qtest: Test all targets

PATCH Applied Andreas Färber 8 participants 38 messages Aug 5, 2013 – Aug 26, 2013 Arm Samsung Exynos

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover qtest: Test all targets

Hello Anthony/Aurélien,

This series extends test coverage to all 16 targets.
For now it tests that QOM type changes do not lead to QOM cast assertions.

v2 extends it to cover virtually all machines (except Xen and pc*-x.y). Where an fprintf() is touched, use error_report() instead.

Regards,
Andreas

v1 -> v2:
* gumstix, z2: Avoided conditionalizing use of pflash device in favor of NULL bdrv.
* puv3: Limited qtest workaround to a NULL kernel_filename.
* Added error workarounds for milkymist, ppc405, shix and leon3.
* Cleaned up debug output for ppc405 and shix.
* Extended qom-test to cover virtually all machines, including n800 and pc.
* Moved machine names to arrays wherever sensible, to aid with extensibility.
* Adopted error_report() for armv7m, too.

Cc Anthony Liguori <[email protected]>
Cc Aurélien Jarno <[email protected]>
Cc Peter Maydell <[email protected]>

Andreas Färber (21):
mips_mipssim: Silence BIOS loading warning for qtest arm/boot: Turn arm_load_kernel() into no-op for qtest without -kernel
puv3: Turn puv3_load_kernel() into a no-op for qtest without -kernel
mainstone: Don't enforce use of -pflash for qtest
gumstix: Don't enforce use of -pflash for qtest
z2: Don't enforce use of -pflash for qtest
palm: Don't enforce loading ROM or kernel for qtest
omap_sx1: Don't enforce use of kernel or flash for qtest
exynos4_boards: Silence lack of -smp 2 warning for qtest
armv7m: Don't enforce use of kernel for qtest
axis_dev88: Don't enforce use of kernel for qtest
mcf5208: Don't enforce use of kernel for qtest
an5206: Don't enforce use of kernel for qtest
milkymist: Suppress -kernel/-bios/-drive error for qtest
ppc405_boards: Disable debug output
ppc405_uc: Disable debug output
ppc405_boards: Don't enforce presence of firmware for qtest
shix: Drop debug output
shix: Don't require firmware presence for qtest
leon3: Don't enforce use of -bios with qtest
qtest: Prepare QOM machine tests

 hw/arm/armv7m.c         |  25 +++--
 hw/arm/boot.c           |   4 +
 hw/arm/exynos4_boards.c |   3 +-
 hw/arm/gumstix.c        |  11 +-
 hw/arm/mainstone.c      |   5 +-
 hw/arm/omap_sx1.c       |   3 +-
 hw/arm/palm.c           |   3 +-
 hw/arm/z2.c             |   5 +-
 hw/block/tc58128.c      |  10 +-
 hw/cris/axis_dev88.c    |  11 +-
 hw/lm32/milkymist.c     |   3 +-
 hw/m68k/an5206.c        |   4 +
 hw/m68k/mcf5208.c       |   4 +
 hw/mips/mips_mipssim.c  |   4 +-
 hw/ppc/ppc405_boards.c  |  39 ++++---
 hw/ppc/ppc405_uc.c      |  16 +--
 hw/sh4/shix.c           |  16 +--
 hw/sparc/leon3.c        |   3 +-
 hw/unicore32/puv3.c     |   4 +
 tests/Makefile          |  26 +++++
 tests/qom-test.c        | 280 ++++++++++++++++++++++++++++++++++++++++++++++++
 21 files changed, 410 insertions(+), 69 deletions(-)
 create mode 100644 tests/qom-test.c
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH v2 1/21 mips_mipssim: Silence BIOS loading warning for qtest

---
 hw/mips/mips_mipssim.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/mips/mips_mipssim.c +3 -1
index fea1a15..d8c4347 100644
@@ -37,6 +37,7 @@
 #include "elf.h"
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
+#include "sysemu/qtest.h"
 
 static struct _loaderparams {
     int ram_size;
@@ -189,7 +190,8 @@ mips_mipssim_init(QEMUMachineInitArgs *args)
     } else {
         bios_size = -1;
     }
-    if ((bios_size < 0 || bios_size > BIOS_SIZE) && !kernel_filename) {
+    if ((bios_size < 0 || bios_size > BIOS_SIZE) &&
+        !kernel_filename && !qtest_enabled()) {
         /* Bail out if we have neither a kernel image nor boot vector code. */
         fprintf(stderr,
                 "qemu: Warning, could not load MIPS bios '%s', and no -kernel argument was specified\n",
Signature · 1 line
1.8.1.4
Reviewed-by on v2 1/21
#2 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 01/21] mips_mipssim: Silence BIOS loading warning for qtest

Quoted 18 lines · Andreas Färber
---
 hw/mips/mips_mipssim.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
hw/mips/mips_mipssim.c +1 -0
index fea1a15..d8c4347 100644
@@ -37,6 +37,7 @@
 #include "elf.h"
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
+#include "sysemu/qtest.h"
 
 static struct _loaderparams {
     int ram_size;

hw/mips/mips_mipssim.c mips_mipssim_init(QEMUMachineInitArgs *args) · line 197

Quoted 9 lines
hw/mips/mips_mipssim.c +2 -1
@@ -189,7 +190,8 @@ mips_mipssim_init(QEMUMachineInitArgs *args)
     } else {
         bios_size = -1;
     }
-    if ((bios_size < 0 || bios_size > BIOS_SIZE) && !kernel_filename) {
+    if ((bios_size < 0 || bios_size > BIOS_SIZE) &&
+        !kernel_filename && !qtest_enabled()) {
         /* Bail out if we have neither a kernel image nor boot vector code. */
         fprintf(stderr,
                 "qemu: Warning, could not load MIPS bios '%s', and no -kernel argument was specified\n",
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#3 lore raw

PATCH v2 2/21 arm/boot: Turn arm_load_kernel() into no-op for qtest without -kernel

In reply to Andreas Färber
---
 hw/arm/boot.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/arm/boot.c +4 -0
index 2cbeefd..0c6d611 100644
@@ -15,6 +15,7 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "sysemu/device_tree.h"
+#include "sysemu/qtest.h"
 #include "qemu/config-file.h"
 
 #define KERNEL_ARGS_ADDR 0x100
@@ -354,6 +355,9 @@ void arm_load_kernel(ARMCPU *cpu, struct arm_boot_info *info)
 
     /* Load the kernel.  */
     if (!info->kernel_filename) {
+        if (qtest_enabled()) {
+            return;
+        }
         fprintf(stderr, "Kernel image must be specified\n");
         exit(1);
     }
Signature · 1 line
1.8.1.4
#4 lore raw

PATCH v2 3/21 puv3: Turn puv3_load_kernel() into a no-op for qtest without -kernel

In reply to Andreas Färber

Replacing the assert() with more user-friendly error handling is left for a follow-up.

---
 hw/unicore32/puv3.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/unicore32/puv3.c +4 -0
index 5ff0dc9..0d84cd9 100644
@@ -17,6 +17,7 @@
 #include "hw/boards.h"
 #include "hw/loader.h"
 #include "hw/i386/pc.h"
+#include "sysemu/qtest.h"
 
 #undef DEBUG_PUV3
 #include "hw/unicore32/puv3.h"
@@ -84,6 +85,9 @@ static void puv3_load_kernel(const char *kernel_filename)
 {
     int size;
 
+    if (kernel_filename == NULL && qtest_enabled()) {
+        return;
+    }
     assert(kernel_filename != NULL);
 
     /* only zImage format supported */
Signature · 1 line
1.8.1.4
#5 lore raw

PATCH v2 4/21 mainstone: Don't enforce use of -pflash for qtest

In reply to Andreas Färber

Simply skip flash setup for now.

Also drop useless debug output.

---
 hw/arm/mainstone.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
hw/arm/mainstone.c +4 -1
index 8e5fc26..e9d4b98 100644
@@ -21,6 +21,7 @@
 #include "sysemu/blockdev.h"
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
+#include "sysemu/qtest.h"
 
 /* Device addresses */
 #define MST_FPGA_PHYS	0x08000000
@@ -127,6 +128,9 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
     for (i = 0; i < 2; i ++) {
         dinfo = drive_get(IF_PFLASH, 0, i);
         if (!dinfo) {
+            if (qtest_enabled()) {
+                break;
+            }
             fprintf(stderr, "Two flash images must be given with the "
                     "'pflash' parameter\n");
             exit(1);
@@ -147,7 +151,6 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
                     qdev_get_gpio_in(mpu->gpio, 0));
 
     /* setup keypad */
-    printf("map addr %p\n", &map);
     pxa27x_register_keypad(mpu->kp, map, 0xe0);
 
     /* MMC/SD host */
Signature · 1 line
1.8.1.4
#6 lore raw

PATCH v2 5/21 gumstix: Don't enforce use of -pflash for qtest

In reply to Andreas Färber
---
 hw/arm/gumstix.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
hw/arm/gumstix.c +7 -4
index b8cab10..a9015ed 100644
@@ -42,6 +42,7 @@
 #include "hw/boards.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
+#include "sysemu/qtest.h"
 
 static const int sector_len = 128 * 1024;
 
@@ -58,7 +59,7 @@ static void connex_init(QEMUMachineInitArgs *args)
     cpu = pxa255_init(address_space_mem, connex_ram);
 
     dinfo = drive_get(IF_PFLASH, 0, 0);
-    if (!dinfo) {
+    if (!dinfo && !qtest_enabled()) {
         fprintf(stderr, "A flash image must be given with the "
                 "'pflash' parameter\n");
         exit(1);
@@ -70,7 +71,8 @@ static void connex_init(QEMUMachineInitArgs *args)
     be = 0;
 #endif
     if (!pflash_cfi01_register(0x00000000, NULL, "connext.rom", connex_rom,
-                               dinfo->bdrv, sector_len, connex_rom / sector_len,
+                               dinfo ? dinfo->bdrv : NULL,
+                               sector_len, connex_rom / sector_len,
                                2, 0, 0, 0, 0, be)) {
         fprintf(stderr, "qemu: Error registering flash memory.\n");
         exit(1);
@@ -95,7 +97,7 @@ static void verdex_init(QEMUMachineInitArgs *args)
     cpu = pxa270_init(address_space_mem, verdex_ram, cpu_model ?: "pxa270-c0");
 
     dinfo = drive_get(IF_PFLASH, 0, 0);
-    if (!dinfo) {
+    if (!dinfo && !qtest_enabled()) {
         fprintf(stderr, "A flash image must be given with the "
                 "'pflash' parameter\n");
         exit(1);
@@ -107,7 +109,8 @@ static void verdex_init(QEMUMachineInitArgs *args)
     be = 0;
 #endif
     if (!pflash_cfi01_register(0x00000000, NULL, "verdex.rom", verdex_rom,
-                               dinfo->bdrv, sector_len, verdex_rom / sector_len,
+                               dinfo ? dinfo->bdrv : NULL,
+                               sector_len, verdex_rom / sector_len,
                                2, 0, 0, 0, 0, be)) {
         fprintf(stderr, "qemu: Error registering flash memory.\n");
         exit(1);
Signature · 1 line
1.8.1.4
#7 lore raw

PATCH v2 6/21 z2: Don't enforce use of -pflash for qtest

In reply to Andreas Färber
---
 hw/arm/z2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
hw/arm/z2.c +3 -2
index 07a127b..a4cbaeb 100644
@@ -24,6 +24,7 @@
 #include "ui/console.h"
 #include "audio/audio.h"
 #include "exec/address-spaces.h"
+#include "sysemu/qtest.h"
 
 #ifdef DEBUG_Z2
 #define DPRINTF(fmt, ...) \
@@ -323,7 +324,7 @@ static void z2_init(QEMUMachineInitArgs *args)
     be = 0;
 #endif
     dinfo = drive_get(IF_PFLASH, 0, 0);
-    if (!dinfo) {
+    if (!dinfo && !qtest_enabled()) {
         fprintf(stderr, "Flash image must be given with the "
                 "'pflash' parameter\n");
         exit(1);
@@ -331,7 +332,7 @@ static void z2_init(QEMUMachineInitArgs *args)
 
     if (!pflash_cfi01_register(Z2_FLASH_BASE,
                                NULL, "z2.flash0", Z2_FLASH_SIZE,
-                               dinfo->bdrv, sector_len,
+                               dinfo ? dinfo->bdrv : NULL, sector_len,
                                Z2_FLASH_SIZE / sector_len, 4, 0, 0, 0, 0,
                                be)) {
         fprintf(stderr, "qemu: Error registering flash memory.\n");
Signature · 1 line
1.8.1.4
#8 lore raw

PATCH v2 7/21 palm: Don't enforce loading ROM or kernel for qtest

In reply to Andreas Färber
---
 hw/arm/palm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/palm.c +2 -1
index cdc3c3a..dc4bbcd 100644
@@ -19,6 +19,7 @@
 #include "hw/hw.h"
 #include "audio/audio.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
 #include "ui/console.h"
 #include "hw/arm/omap.h"
 #include "hw/boards.h"
@@ -255,7 +256,7 @@ static void palmte_init(QEMUMachineInitArgs *args)
         }
     }
 
-    if (!rom_loaded && !kernel_filename) {
+    if (!rom_loaded && !kernel_filename && !qtest_enabled()) {
         fprintf(stderr, "Kernel or ROM image must be specified\n");
         exit(1);
     }
Signature · 1 line
1.8.1.4
#9 lore raw

PATCH v2 8/21 omap_sx1: Don't enforce use of kernel or flash for qtest

In reply to Andreas Färber
---
 hw/arm/omap_sx1.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/omap_sx1.c +2 -1
index 05b0353..d9bd8d6 100644
@@ -32,6 +32,7 @@
 #include "hw/arm/arm.h"
 #include "hw/block/flash.h"
 #include "sysemu/blockdev.h"
+#include "sysemu/qtest.h"
 #include "exec/address-spaces.h"
 
 /*****************************************************************************/
@@ -188,7 +189,7 @@ static void sx1_init(QEMUMachineInitArgs *args, const int version)
                                 OMAP_CS1_BASE, &cs[1]);
     }
 
-    if (!args->kernel_filename && !fl_idx) {
+    if (!args->kernel_filename && !fl_idx && !qtest_enabled()) {
         fprintf(stderr, "Kernel or Flash image must be specified\n");
         exit(1);
     }
Signature · 1 line
1.8.1.4
#10 lore raw

PATCH v2 9/21 exynos4_boards: Silence lack of -smp 2 warning for qtest

In reply to Andreas Färber
---
 hw/arm/exynos4_boards.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/arm/exynos4_boards.c +2 -1
index 7c90b2d..0be5f8c 100644
@@ -22,6 +22,7 @@
  */
 
 #include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
 #include "hw/sysbus.h"
 #include "net/net.h"
 #include "hw/arm/arm.h"
@@ -96,7 +97,7 @@ static void lan9215_init(uint32_t base, qemu_irq irq)
 static Exynos4210State *exynos4_boards_init_common(QEMUMachineInitArgs *args,
                                                    Exynos4BoardType board_type)
 {
-    if (smp_cpus != EXYNOS4210_NCPUS) {
+    if (smp_cpus != EXYNOS4210_NCPUS && !qtest_enabled()) {
         fprintf(stderr, "%s board supports only %d CPU cores. Ignoring smp_cpus"
                 " value.\n",
                 exynos4_machines[board_type].name,
Signature · 1 line
1.8.1.4
#11 lore raw

PATCH v2 10/21 armv7m: Don't enforce use of kernel for qtest

In reply to Andreas Färber

Adopt error_report().

---
 hw/arm/armv7m.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)
hw/arm/armv7m.c +14 -11
index 82d36fb..ddbaf8c 100644
@@ -11,6 +11,8 @@
 #include "hw/arm/arm.h"
 #include "hw/loader.h"
 #include "elf.h"
+#include "sysemu/qtest.h"
+#include "qemu/error-report.h"
 
 /* Bitbanded IO.  Each word corresponds to a single bit.  */
 
@@ -233,21 +235,22 @@ qemu_irq *armv7m_init(MemoryRegion *address_space_mem,
     big_endian = 0;
 #endif
 
-    if (!kernel_filename) {
+    if (!kernel_filename && !qtest_enabled()) {
         fprintf(stderr, "Guest image must be specified (using -kernel)\n");
         exit(1);
     }
 
-    image_size = load_elf(kernel_filename, NULL, NULL, &entry, &lowaddr,
-                          NULL, big_endian, ELF_MACHINE, 1);
-    if (image_size < 0) {
-        image_size = load_image_targphys(kernel_filename, 0, flash_size);
-	lowaddr = 0;
-    }
-    if (image_size < 0) {
-        fprintf(stderr, "qemu: could not load kernel '%s'\n",
-                kernel_filename);
-        exit(1);
+    if (kernel_filename) {
+        image_size = load_elf(kernel_filename, NULL, NULL, &entry, &lowaddr,
+                              NULL, big_endian, ELF_MACHINE, 1);
+        if (image_size < 0) {
+            image_size = load_image_targphys(kernel_filename, 0, flash_size);
+            lowaddr = 0;
+        }
+        if (image_size < 0) {
+            error_report("Could not load kernel '%s'", kernel_filename);
+            exit(1);
+        }
     }
 
     /* Hack to map an additional page of ram at the top of the address
Signature · 1 line
1.8.1.4
#12 lore raw

PATCH v2 11/21 axis_dev88: Don't enforce use of kernel for qtest

In reply to Andreas Färber
---
 hw/cris/axis_dev88.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
hw/cris/axis_dev88.c +6 -5
index 9104d61..6673c66 100644
@@ -32,6 +32,7 @@
 #include "boot.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
+#include "sysemu/qtest.h"
 
 #define D(x)
 #define DNAND(x)
@@ -340,14 +341,14 @@ void axisdev88_init(QEMUMachineInitArgs *args)
                              irq[0x14 + i]);
     }
 
-    if (!kernel_filename) {
+    if (kernel_filename) {
+        li.image_filename = kernel_filename;
+        li.cmdline = kernel_cmdline;
+        cris_load_image(cpu, &li);
+    } else if (!qtest_enabled()) {
         fprintf(stderr, "Kernel image must be specified\n");
         exit(1);
     }
-
-    li.image_filename = kernel_filename;
-    li.cmdline = kernel_cmdline;
-    cris_load_image(cpu, &li);
 }
 
 static QEMUMachine axisdev88_machine = {
Signature · 1 line
1.8.1.4
#13 lore raw

PATCH v2 12/21 mcf5208: Don't enforce use of kernel for qtest

In reply to Andreas Färber
---
 hw/m68k/mcf5208.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/m68k/mcf5208.c +4 -0
index 9cf000f..14fecc4 100644
@@ -10,6 +10,7 @@
 #include "qemu/timer.h"
 #include "hw/ptimer.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
 #include "net/net.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
@@ -267,6 +268,9 @@ static void mcf5208evb_init(QEMUMachineInitArgs *args)
 
     /* Load kernel.  */
     if (!kernel_filename) {
+        if (qtest_enabled()) {
+            return;
+        }
         fprintf(stderr, "Kernel image must be specified\n");
         exit(1);
     }
Signature · 1 line
1.8.1.4
#14 lore raw

PATCH v2 13/21 an5206: Don't enforce use of kernel for qtest

In reply to Andreas Färber
---
 hw/m68k/an5206.c | 4 ++++
 1 file changed, 4 insertions(+)
hw/m68k/an5206.c +4 -0
index 0c03a87..abf7d1c 100644
@@ -12,6 +12,7 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "exec/address-spaces.h"
+#include "sysemu/qtest.h"
 
 #define KERNEL_LOAD_ADDR 0x10000
 #define AN5206_MBAR_ADDR 0x10000000
@@ -62,6 +63,9 @@ static void an5206_init(QEMUMachineInitArgs *args)
 
     /* Load kernel.  */
     if (!kernel_filename) {
+        if (qtest_enabled()) {
+            return;
+        }
         fprintf(stderr, "Kernel image must be specified\n");
         exit(1);
     }
Signature · 1 line
1.8.1.4
#15 lore raw

PATCH v2 14/21 milkymist: Suppress -kernel/-bios/-drive error for qtest

In reply to Andreas Färber
---
 hw/lm32/milkymist.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/lm32/milkymist.c +2 -1
index 7ceedb8..a8e7230 100644
@@ -21,6 +21,7 @@
 #include "hw/hw.h"
 #include "hw/block/flash.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
 #include "hw/devices.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
@@ -143,7 +144,7 @@ milkymist_init(QEMUMachineInitArgs *args)
     reset_info->bootstrap_pc = BIOS_OFFSET;
 
     /* if no kernel is given no valid bios rom is a fatal error */
-    if (!kernel_filename && !dinfo && !bios_filename) {
+    if (!kernel_filename && !dinfo && !bios_filename && !qtest_enabled()) {
         fprintf(stderr, "qemu: could not load Milkymist One bios '%s'\n",
                 bios_name);
         exit(1);
Signature · 1 line
1.8.1.4
Acked-by on v2 14/21
#16 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 14/21] milkymist: Suppress -kernel/-bios/-drive error for qtest

Am 2013-08-05 15:27, schrieb Andreas Färber:

Quoted 1 line
Quoted 27 lines
---
 hw/lm32/milkymist.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/lm32/milkymist.c +2 -1
index 7ceedb8..a8e7230 100644
@@ -21,6 +21,7 @@
 #include "hw/hw.h"
 #include "hw/block/flash.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
 #include "hw/devices.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
@@ -143,7 +144,7 @@ milkymist_init(QEMUMachineInitArgs *args)
     reset_info->bootstrap_pc = BIOS_OFFSET;
 
     /* if no kernel is given no valid bios rom is a fatal error */
-    if (!kernel_filename && !dinfo && !bios_filename) {
+    if (!kernel_filename && !dinfo && !bios_filename && 
 !qtest_enabled()) {
         fprintf(stderr, "qemu: could not load Milkymist One bios 
 '%s'\n",
                 bios_name);
         exit(1);
#17 lore raw

PATCH v2 15/21 ppc405_boards: Disable debug output

In reply to Andreas Färber

Also move one stray debug output into an #ifdef.

---
 hw/ppc/ppc405_boards.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/ppc/ppc405_boards.c +2 -2
index f74e5e5..807ada0 100644
@@ -42,7 +42,7 @@
 
 #define USE_FLASH_BIOS
 
-#define DEBUG_BOARD_INIT
+//#define DEBUG_BOARD_INIT
 
 /*****************************************************************************/
 /* PPC405EP reference board (IBM) */
@@ -353,9 +353,9 @@ static void ref405ep_init(QEMUMachineInitArgs *args)
         bdloc = 0;
     }
 #ifdef DEBUG_BOARD_INIT
+    printf("bdloc " RAM_ADDR_FMT "\n", bdloc);
     printf("%s: Done\n", __func__);
 #endif
-    printf("bdloc " RAM_ADDR_FMT "\n", bdloc);
 }
 
 static QEMUMachine ref405ep_machine = {
Signature · 1 line
1.8.1.4
#18 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 15/21] ppc405_boards: Disable debug output

Quoted 3 lines · Andreas Färber

Also move one stray debug output into an #ifdef.

Thanks, applied to ppc-next.

Alex

#19 lore raw

PATCH v2 16/21 ppc405_uc: Disable debug output

In reply to Andreas Färber
---
 hw/ppc/ppc405_uc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
hw/ppc/ppc405_uc.c +8 -8
index 290f71a..5fc330b 100644
@@ -30,15 +30,15 @@
 #include "qemu/log.h"
 #include "exec/address-spaces.h"
 
-#define DEBUG_OPBA
-#define DEBUG_SDRAM
-#define DEBUG_GPIO
-#define DEBUG_SERIAL
-#define DEBUG_OCM
+//#define DEBUG_OPBA
+//#define DEBUG_SDRAM
+//#define DEBUG_GPIO
+//#define DEBUG_SERIAL
+//#define DEBUG_OCM
 //#define DEBUG_I2C
-#define DEBUG_GPT
-#define DEBUG_MAL
-#define DEBUG_CLOCKS
+//#define DEBUG_GPT
+//#define DEBUG_MAL
+//#define DEBUG_CLOCKS
 //#define DEBUG_CLOCKS_LL
 
 ram_addr_t ppc405_set_bootinfo (CPUPPCState *env, ppc4xx_bd_info_t *bd,
Signature · 1 line
1.8.1.4
#21 lore raw

PATCH v2 17/21 ppc405_boards: Don't enforce presence of firmware for qtest

In reply to Andreas Färber

Adopt error_report() while at it.

---
 hw/ppc/ppc405_boards.c | 35 ++++++++++++++++++++---------------
 1 file changed, 20 insertions(+), 15 deletions(-)
hw/ppc/ppc405_boards.c +20 -15
index 807ada0..75b2177 100644
@@ -27,9 +27,11 @@
 #include "hw/timer/m48t59.h"
 #include "hw/block/flash.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
 #include "block/block.h"
 #include "hw/boards.h"
 #include "qemu/log.h"
+#include "qemu/error-report.h"
 #include "hw/loader.h"
 #include "sysemu/blockdev.h"
 #include "exec/address-spaces.h"
@@ -252,17 +254,20 @@ static void ref405ep_init(QEMUMachineInitArgs *args)
         if (filename) {
             bios_size = load_image(filename, memory_region_get_ram_ptr(bios));
             g_free(filename);
+            if (bios_size < 0 || bios_size > BIOS_SIZE) {
+                error_report("Could not load PowerPC BIOS '%s'", bios_name);
+                exit(1);
+            }
+            bios_size = (bios_size + 0xfff) & ~0xfff;
+            memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios);
+        } else if (!qtest_enabled() || kernel_filename != NULL) {
+            error_report("Could not load PowerPC BIOS '%s'", bios_name);
+            exit(1);
         } else {
+            /* Avoid an uninitialized variable warning */
             bios_size = -1;
         }
-        if (bios_size < 0 || bios_size > BIOS_SIZE) {
-            fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n",
-                    bios_name);
-            exit(1);
-        }
-        bios_size = (bios_size + 0xfff) & ~0xfff;
         memory_region_set_readonly(bios, true);
-        memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios);
     }
     /* Register FPGA */
 #ifdef DEBUG_BOARD_INIT
@@ -569,17 +574,17 @@ static void taihu_405ep_init(QEMUMachineInitArgs *args)
         if (filename) {
             bios_size = load_image(filename, memory_region_get_ram_ptr(bios));
             g_free(filename);
-        } else {
-            bios_size = -1;
-        }
-        if (bios_size < 0 || bios_size > BIOS_SIZE) {
-            fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n",
-                    bios_name);
+            if (bios_size < 0 || bios_size > BIOS_SIZE) {
+                error_report("Could not load PowerPC BIOS '%s'", bios_name);
+                exit(1);
+            }
+            bios_size = (bios_size + 0xfff) & ~0xfff;
+            memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios);
+        } else if (!qtest_enabled()) {
+            error_report("Could not load PowerPC BIOS '%s'", bios_name);
             exit(1);
         }
-        bios_size = (bios_size + 0xfff) & ~0xfff;
         memory_region_set_readonly(bios, true);
-        memory_region_add_subregion(sysmem, (uint32_t)(-bios_size), bios);
     }
     /* Register Linux flash */
     dinfo = drive_get(IF_PFLASH, 0, fl_idx);
Signature · 1 line
1.8.1.4
#22 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 17/21] ppc405_boards: Don't enforce presence of firmware for qtest

Quoted 3 lines · Andreas Färber

Adopt error_report() while at it.

Thanks, applied to ppc-next.

Alex

#23 lore raw

PATCH v2 18/21 shix: Drop debug output

In reply to Andreas Färber
---
 hw/sh4/shix.c | 7 -------
 1 file changed, 7 deletions(-)
hw/sh4/shix.c +0 -7
index 84dd666..66cbea4 100644
@@ -50,7 +50,6 @@ static void shix_init(QEMUMachineInitArgs *args)
     if (!cpu_model)
         cpu_model = "any";
 
-    printf("Initializing CPU\n");
     cpu = cpu_sh4_init(cpu_model);
     if (cpu == NULL) {
         fprintf(stderr, "Unable to find CPU definition\n");
@@ -58,16 +57,13 @@ static void shix_init(QEMUMachineInitArgs *args)
     }
 
     /* Allocate memory space */
-    printf("Allocating ROM\n");
     memory_region_init_ram(rom, NULL, "shix.rom", 0x4000);
     vmstate_register_ram_global(rom);
     memory_region_set_readonly(rom, true);
     memory_region_add_subregion(sysmem, 0x00000000, rom);
-    printf("Allocating SDRAM 1\n");
     memory_region_init_ram(&sdram[0], NULL, "shix.sdram1", 0x01000000);
     vmstate_register_ram_global(&sdram[0]);
     memory_region_add_subregion(sysmem, 0x08000000, &sdram[0]);
-    printf("Allocating SDRAM 2\n");
     memory_region_init_ram(&sdram[1], NULL, "shix.sdram2", 0x01000000);
     vmstate_register_ram_global(&sdram[1]);
     memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]);
@@ -75,10 +71,8 @@ static void shix_init(QEMUMachineInitArgs *args)
     /* Load BIOS in 0 (and access it through P2, 0xA0000000) */
     if (bios_name == NULL)
         bios_name = BIOS_FILENAME;
-    printf("%s: load BIOS '%s'\n", __func__, bios_name);
     ret = load_image_targphys(bios_name, 0, 0x4000);
     if (ret < 0) {		/* Check bios size */
-	fprintf(stderr, "ret=%d\n", ret);
 	fprintf(stderr, "qemu: could not load SHIX bios '%s'\n",
 		bios_name);
 	exit(1);
@@ -88,7 +82,6 @@ static void shix_init(QEMUMachineInitArgs *args)
     s = sh7750_init(cpu, sysmem);
     /* XXXXX Check success */
     tc58128_init(s, "shix_linux_nand.bin", NULL);
-    fprintf(stderr, "initialization terminated\n");
 }
 
 static QEMUMachine shix_machine = {
Signature · 1 line
1.8.1.4
Reviewed-by on v2 18/21
#24 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 18/21] shix: Drop debug output

Quoted 46 lines · Andreas Färber
---
 hw/sh4/shix.c | 7 -------
 1 file changed, 7 deletions(-)
hw/sh4/shix.c +0 -6
index 84dd666..66cbea4 100644
@@ -50,7 +50,6 @@ static void shix_init(QEMUMachineInitArgs *args)
     if (!cpu_model)
         cpu_model = "any";
 
-    printf("Initializing CPU\n");
     cpu = cpu_sh4_init(cpu_model);
     if (cpu == NULL) {
         fprintf(stderr, "Unable to find CPU definition\n");
@@ -58,16 +57,13 @@ static void shix_init(QEMUMachineInitArgs *args)
     }
 
     /* Allocate memory space */
-    printf("Allocating ROM\n");
     memory_region_init_ram(rom, NULL, "shix.rom", 0x4000);
     vmstate_register_ram_global(rom);
     memory_region_set_readonly(rom, true);
     memory_region_add_subregion(sysmem, 0x00000000, rom);
-    printf("Allocating SDRAM 1\n");
     memory_region_init_ram(&sdram[0], NULL, "shix.sdram1", 0x01000000);
     vmstate_register_ram_global(&sdram[0]);
     memory_region_add_subregion(sysmem, 0x08000000, &sdram[0]);
-    printf("Allocating SDRAM 2\n");
     memory_region_init_ram(&sdram[1], NULL, "shix.sdram2", 0x01000000);
     vmstate_register_ram_global(&sdram[1]);
     memory_region_add_subregion(sysmem, 0x0c000000, &sdram[1]);
@@ -75,10 +71,8 @@ static void shix_init(QEMUMachineInitArgs *args)
     /* Load BIOS in 0 (and access it through P2, 0xA0000000) */
     if (bios_name == NULL)
         bios_name = BIOS_FILENAME;
-    printf("%s: load BIOS '%s'\n", __func__, bios_name);
     ret = load_image_targphys(bios_name, 0, 0x4000);
     if (ret < 0) {		/* Check bios size */
-	fprintf(stderr, "ret=%d\n", ret);
 	fprintf(stderr, "qemu: could not load SHIX bios '%s'\n",
 		bios_name);
 	exit(1);

hw/sh4/shix.c static void shix_init(QEMUMachineInitArgs *args) · line 87

Quoted 7 lines
hw/sh4/shix.c +0 -1
@@ -88,7 +82,6 @@ static void shix_init(QEMUMachineInitArgs *args)
     s = sh7750_init(cpu, sysmem);
     /* XXXXX Check success */
     tc58128_init(s, "shix_linux_nand.bin", NULL);
-    fprintf(stderr, "initialization terminated\n");
 }
 
 static QEMUMachine shix_machine = {
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#25 lore raw

PATCH v2 19/21 shix: Don't require firmware presence for qtest

In reply to Andreas Färber

Adopt error_report() while at it.

---
 hw/block/tc58128.c | 10 ++++++----
 hw/sh4/shix.c      |  9 +++++----
 2 files changed, 11 insertions(+), 8 deletions(-)
hw/block/tc58128.c +6 -4
index a3929d4..728f1c3 100644
@@ -1,6 +1,8 @@
 #include "hw/hw.h"
 #include "hw/sh4/sh.h"
 #include "hw/loader.h"
+#include "sysemu/qtest.h"
+#include "qemu/error-report.h"
 
 #define CE1  0x0100
 #define CE2  0x0200
@@ -36,10 +38,10 @@ static void init_dev(tc58128_dev * dev, const char *filename)
 	/* Load flash image skipping the first block */
 	ret = load_image(filename, dev->flash_contents + 528 * 32);
 	if (ret < 0) {
-	    fprintf(stderr, "ret=%d\n", ret);
-	    fprintf(stderr, "qemu: could not load flash image %s\n",
-		    filename);
-	    exit(1);
+            if (!qtest_enabled()) {
+                error_report("Could not load flash image %s", filename);
+                exit(1);
+            }
 	} else {
 	    /* Build first block with number of blocks */
 	    blocks = (ret + 528 * 32 - 1) / (528 * 32);
hw/sh4/shix.c +5 -4
index 66cbea4..5ee7af6 100644
@@ -30,9 +30,11 @@
 #include "hw/hw.h"
 #include "hw/sh4/sh.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
 #include "exec/address-spaces.h"
+#include "qemu/error-report.h"
 
 #define BIOS_FILENAME "shix_bios.bin"
 #define BIOS_ADDRESS 0xA0000000
@@ -72,10 +74,9 @@ static void shix_init(QEMUMachineInitArgs *args)
     if (bios_name == NULL)
         bios_name = BIOS_FILENAME;
     ret = load_image_targphys(bios_name, 0, 0x4000);
-    if (ret < 0) {		/* Check bios size */
-	fprintf(stderr, "qemu: could not load SHIX bios '%s'\n",
-		bios_name);
-	exit(1);
+    if (ret < 0 && !qtest_enabled()) {
+        error_report("Could not load SHIX bios '%s'", bios_name);
+        exit(1);
     }
 
     /* Register peripherals */
Signature · 1 line
1.8.1.4
Reviewed-by on v2 19/21
#27 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 19/21] shix: Don't require firmware presence for qtest

In reply to Andreas Färber
Quoted 56 lines · Andreas Färber

Adopt error_report() while at it.

---
 hw/block/tc58128.c | 10 ++++++----
 hw/sh4/shix.c      |  9 +++++----
 2 files changed, 11 insertions(+), 8 deletions(-)
hw/block/tc58128.c +6 -4
index a3929d4..728f1c3 100644
@@ -1,6 +1,8 @@
 #include "hw/hw.h"
 #include "hw/sh4/sh.h"
 #include "hw/loader.h"
+#include "sysemu/qtest.h"
+#include "qemu/error-report.h"
 
 #define CE1  0x0100
 #define CE2  0x0200
@@ -36,10 +38,10 @@ static void init_dev(tc58128_dev * dev, const char *filename)
 	/* Load flash image skipping the first block */
 	ret = load_image(filename, dev->flash_contents + 528 * 32);
 	if (ret < 0) {
-	    fprintf(stderr, "ret=%d\n", ret);
-	    fprintf(stderr, "qemu: could not load flash image %s\n",
-		    filename);
-	    exit(1);
+            if (!qtest_enabled()) {
+                error_report("Could not load flash image %s", filename);
+                exit(1);
+            }
 	} else {
 	    /* Build first block with number of blocks */
 	    blocks = (ret + 528 * 32 - 1) / (528 * 32);
hw/sh4/shix.c +2 -0
index 66cbea4..5ee7af6 100644
@@ -30,9 +30,11 @@
 #include "hw/hw.h"
 #include "hw/sh4/sh.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
 #include "exec/address-spaces.h"
+#include "qemu/error-report.h"
 
 #define BIOS_FILENAME "shix_bios.bin"
 #define BIOS_ADDRESS 0xA0000000
@@ -72,10 +74,9 @@ static void shix_init(QEMUMachineInitArgs *args)
     if (bios_name == NULL)
         bios_name = BIOS_FILENAME;
     ret = load_image_targphys(bios_name, 0, 0x4000);

hw/sh4/shix.c static void shix_init(QEMUMachineInitArgs *args) · line 82

Quoted 10 lines
hw/sh4/shix.c +3 -4
-    if (ret < 0) {		/* Check bios size */
-	fprintf(stderr, "qemu: could not load SHIX bios '%s'\n",
-		bios_name);
-	exit(1);
+    if (ret < 0 && !qtest_enabled()) {
+        error_report("Could not load SHIX bios '%s'", bios_name);
+        exit(1);
     }
 
     /* Register peripherals */
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#28 lore raw

PATCH v2 20/21 leon3: Don't enforce use of -bios with qtest

In reply to Andreas Färber
---
 hw/sparc/leon3.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
hw/sparc/leon3.c +2 -1
index 5ef282f..1d60cb7 100644
@@ -26,6 +26,7 @@
 #include "hw/ptimer.h"
 #include "sysemu/char.h"
 #include "sysemu/sysemu.h"
+#include "sysemu/qtest.h"
 #include "hw/boards.h"
 #include "hw/loader.h"
 #include "elf.h"
@@ -178,7 +179,7 @@ static void leon3_generic_hw_init(QEMUMachineInitArgs *args)
             fprintf(stderr, "qemu: could not load prom '%s'\n", filename);
             exit(1);
         }
-    } else if (kernel_filename == NULL) {
+    } else if (kernel_filename == NULL && !qtest_enabled()) {
         fprintf(stderr, "Can't read bios image %s\n", filename);
         exit(1);
     }
Signature · 1 line
1.8.1.4
#29 lore raw

PATCH v2 21/21 qtest: Prepare QOM machine tests

In reply to Andreas Färber

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.

---
 tests/Makefile   |  26 ++++++
 tests/qom-test.c | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 306 insertions(+)
 create mode 100644 tests/qom-test.c
tests/Makefile +26 -0
index d044908..a7e1319 100644
@@ -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
 
tests/qom-test.c new file +280 -0

280 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#30 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 21/21] qtest: Prepare QOM machine tests

Quoted 5 lines · Andreas Färber

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 :).

Quoted 285 lines

i386 and x86_64 do not cover pc*-x.y or xenfv.

---
tests/Makefile | 26 ++++++
tests/qom-test.c | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++++

2 files changed, 306 insertions(+)

create mode 100644 tests/qom-test.c

tests/Makefile +1 -0
index d044908..a7e1319 100644
@@ -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)

tests/Makefile +4 -0
+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)

tests/Makefile +2 -0
+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

tests/Makefile +2 -0
+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)

tests/Makefile +15 -0
+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 \
tests/Makefile +1 -0
@@ -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
 
tests/qom-test.c new file +207 -0
new file mode 100644
index 0000000..c9494e0
@@ -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]);

tests/qom-test.c line 217

Quoted 10 lines
tests/qom-test.c new file +10 -0
+        }
+    } 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?

Quoted 7 lines
tests/qom-test.c new file +7 -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) {

tests/qom-test.c line 234

Quoted 10 lines
tests/qom-test.c new file +10 -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);
}
Quoted 12 lines
tests/qom-test.c new file +12 -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]);

tests/qom-test.c line 256

Quoted 10 lines
tests/qom-test.c new file +10 -0
+        }
+        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?

Quoted 7 lines
tests/qom-test.c new file +7 -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]);
+        }

tests/qom-test.c line 273

Quoted 10 lines
tests/qom-test.c new file +10 -0
+    } 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

Quoted 11 lines
tests/qom-test.c new file +7 -0
+        for (i = 0; i < ARRAY_SIZE(xtensa_machines); i++) {
+            add_test_cases(arch, xtensa_machines[i]);
+        }
+    }
+
+    return g_test_run();
+}
Signature · 1 line
1.8.1.4
#31 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 21/21] qtest: Prepare QOM machine tests

Am 25.08.2013 19:22, schrieb Alexander Graf:

Quoted 10 lines · Andreas Färber
Quoted 6 lines

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!

Quoted 289 lines
Quoted 289 lines

i386 and x86_64 do not cover pc*-x.y or xenfv.

---
tests/Makefile | 26 ++++++
tests/qom-test.c | 280 +++++++++++++++++++++++++++++++++++++++++++++++++++++++

2 files changed, 306 insertions(+)

create mode 100644 tests/qom-test.c

tests/Makefile +1 -0
index d044908..a7e1319 100644
@@ -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)

tests/Makefile +4 -0
+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)

tests/Makefile +2 -0
+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

tests/Makefile +2 -0
+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)

tests/Makefile +15 -0
+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 \
tests/Makefile +1 -0
@@ -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
 
tests/qom-test.c new file +211 -0
new file mode 100644
index 0000000..c9494e0
@@ -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++) {
Quoted 8 lines

tests/qom-test.c line 217

Quoted 6 lines
tests/qom-test.c new file +6 -0
+            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...

Quoted 38 lines
Quoted 7 lines
tests/qom-test.c new file +7 -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) {

tests/qom-test.c line 234

Quoted 10 lines
tests/qom-test.c new file +10 -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]); \
	}
Quoted 10 lines
} 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

Quoted 61 lines
Quoted 13 lines
tests/qom-test.c new file +12 -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]);

tests/qom-test.c line 256

Quoted 10 lines
tests/qom-test.c new file +10 -0
+        }
+        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?

Quoted 7 lines
tests/qom-test.c new file +7 -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]);
+        }

tests/qom-test.c line 273

Quoted 10 lines
tests/qom-test.c new file +10 -0
+    } 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

Quoted 11 lines
tests/qom-test.c new file +7 -0
+        for (i = 0; i < ARRAY_SIZE(xtensa_machines); i++) {
+            add_test_cases(arch, xtensa_machines[i]);
+        }
+    }
+
+    return g_test_run();
+}
Signature · 1 line
1.8.1.4
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#32 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 21/21] qtest: Prepare QOM machine tests

In reply to Andreas Färber

tests/qom-test.c line 45

Quoted 7 lines · Andreas Färber
tests/qom-test.c new file +7 -0
+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

#33 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 21/21] qtest: Prepare QOM machine tests

Am 25.08.2013 19:33, schrieb Peter Maydell:

Quoted 9 lines · Andreas Färber

tests/qom-test.c line 45

Quoted 7 lines
tests/qom-test.c new file +7 -0
+static const char *arm_machines[] = {
+    "integratorcp",
+    "versatilepb",
+    "versatileab",
+    "lm3s811evb",
+    "lm3s6965evb",
+    "collie",
Quoted 4 lines

[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

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#34 lore raw

Re: [Qemu-devel] [PATCH for-1.6? v2 21/21] qtest: Prepare QOM machine tests

Quoted 10 lines · On Sun, 25 Aug 2013 19:42:56 +0200 Andreas Färber <[email protected]> wrote:

Am 25.08.2013 19:33, schrieb Peter Maydell:

Quoted 9 lines · Andreas Färber
Quoted 7 lines
tests/qom-test.c new file +7 -0
+static const char *arm_machines[] = {
+    "integratorcp",
+    "versatilepb",
+    "versatileab",
+    "lm3s811evb",
+    "lm3s6965evb",
+    "collie",
Quoted 7 lines
Quoted 4 lines

[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.

#35 lore raw
In reply to Andreas Färber
Quoted 7 lines · Andreas Färber

Hello Anthony/Aurélien,

This series extends test coverage to all 16 targets.
For now it tests that QOM type changes do not lead to QOM cast assertions.

v2 extends it to cover virtually all machines (except Xen and pc*-x.y). Where an fprintf() is touched, use error_report() instead.

Yes, we need such a smoke test for all targets.

I toyed with it myself, but I haven't been able to go beyond the crude hackery we discussed about a year ago:
https://lists.nongnu.org/archive/html/qemu-devel/2012-08/msg01197.html

The problem is that many targets have mandatory options (fun oxymoron), such as -kernel or -pflash.

If I understand your approach correctly, you solve it by making these mandatory options optional when qtest_enabled().

My idea was to create suitable dummy images, so we can provide the mandatory options. Guest won't be happy, but that's fine, as this smoke test doesn't want to run any guest code.

I like my idea better, because with it we can run unmodified standard code. No testing of qtest_enabled().

However, you've got patches, and I haven't, and that means I like your *patches* infinitely more than mine ;)

#36 lore raw

Am 06.08.2013 10:39, schrieb Markus Armbruster:

Quoted 19 lines
Quoted 7 lines · Andreas Färber

Hello Anthony/Aurélien,

This series extends test coverage to all 16 targets.
For now it tests that QOM type changes do not lead to QOM cast assertions.

v2 extends it to cover virtually all machines (except Xen and pc*-x.y). Where an fprintf() is touched, use error_report() instead.

Yes, we need such a smoke test for all targets.

I toyed with it myself, but I haven't been able to go beyond the crude hackery we discussed about a year ago:
https://lists.nongnu.org/archive/html/qemu-devel/2012-08/msg01197.html

The problem is that many targets have mandatory options (fun oxymoron), such as -kernel or -pflash.

Quoted 6 lines

If I understand your approach correctly, you solve it by making these mandatory options optional when qtest_enabled().

My idea was to create suitable dummy images, so we can provide the mandatory options. Guest won't be happy, but that's fine, as this smoke test doesn't want to run any guest code.

Peter rejected having a U-Boot per machine. And from my own arm porting experiences that would mean having close to one source of U-Boot per machine since upstreaming works really badly in the embedded world. :(

Anthony's JeOS project doesn't seem to be actively worked on any more, at least my patch unbreaking .gitmodules never seemed to get incorporated, and I ran into the issue of openrisc and unicore32 (the targets where we didn't have any test images at the time) not having upstream binutils/gcc support yet. I really hate to say: I did predict one source of binutils/gcc/uClibc/kernel/etc. was not going to be sufficient for all targets...

Quoted 5 lines

I like my idea better, because with it we can run unmodified standard code. No testing of qtest_enabled().

However, you've got patches, and I haven't, and that means I like your *patches* infinitely more than mine ;)

Thanks. I'm thinking "qtest" is easy to grep for in machines and most should be easy to revert/replace once we have a better plan.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#37 lore raw
Quoted 23 lines · Andreas Färber

Am 06.08.2013 10:39, schrieb Markus Armbruster:

Quoted 22 lines
Quoted 7 lines · Andreas Färber

Hello Anthony/Aurélien,

This series extends test coverage to all 16 targets.
For now it tests that QOM type changes do not lead to QOM cast assertions.

v2 extends it to cover virtually all machines (except Xen and pc*-x.y). Where an fprintf() is touched, use error_report() instead.

Yes, we need such a smoke test for all targets.

I toyed with it myself, but I haven't been able to go beyond the crude hackery we discussed about a year ago:
https://lists.nongnu.org/archive/html/qemu-devel/2012-08/msg01197.html

The problem is that many targets have mandatory options (fun oxymoron), such as -kernel or -pflash.

If I understand your approach correctly, you solve it by making these mandatory options optional when qtest_enabled().

Quoted 7 lines
Quoted 3 lines

My idea was to create suitable dummy images, so we can provide the mandatory options. Guest won't be happy, but that's fine, as this smoke test doesn't want to run any guest code.

Peter rejected having a U-Boot per machine. And from my own arm porting experiences that would mean having close to one source of U-Boot per machine since upstreaming works really badly in the embedded world. :(

Mind, I said "dummy images". Just good enough to fool QEMU into loading them. Guest surviving even a single cycle after reset is entirely optional.

[...]