Skip to contentSkip to conversation

qtest: Test all targets

PATCH In review Andreas Färber 3 participants 24 messages Sep 23, 2013 – Sep 30, 2013 Arm Samsung Exynos

lore
Share & tools
lore
#0 lore raw

v3 cover qtest: Test all targets

Hello,

As discussed on the KVM Call, this series extends test coverage to all 16 targets. For now it tests that QOM type changes do not lead to QOM cast assertions.

v3 macro'fies and cleans up ppcemb machine test setup.
There was a discussion of dropping usage of qtest_enabled() in favor of never erroring out in machine inits but Aurélien went ahead to restore mips error behavior, Markus suggested as alternative to supply dummy blobs and real blobs per machine seem infeasible. This solution seems the easiest way forward, be it an interim solution, so I am planning to take this through qom-next before I pull in more QOM realize conversions on so far untested machines. Similarly I see it as more important to get test coverage quickly than waiting for a working QMP query-machines based solution; if we do more than just machine instantiation, we will need to pass in machine-specific QOM paths anyway.

Regards,
Andreas

v2 -> v3:
* Rebased onto mips and Makefile changes; ppc patches were applied.
* Use macros for machine list traversal.

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 Paolo Bonzini <[email protected]>
Cc Peter Maydell <[email protected]>

Andreas Färber (18):
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
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/sh4/shix.c           |  16 +--
 hw/sparc/leon3.c        |   3 +-
 hw/unicore32/puv3.c     |   4 +
 tests/Makefile          |  26 +++++
 tests/qom-test.c        | 253 ++++++++++++++++++++++++++++++++++++++++++++++++
 19 files changed, 353 insertions(+), 44 deletions(-)
 create mode 100644 tests/qom-test.c
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH v3 1/18 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 242bab9..239aa6a 100644
@@ -38,6 +38,7 @@
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
 #include "qemu/error-report.h"
+#include "sysemu/qtest.h"
 
 static struct _loaderparams {
     int ram_size;
@@ -190,7 +191,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. */
         error_report("Could not load MIPS bios '%s', and no "
                      "-kernel argument was specified", filename);
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH v3 2/18 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 1e313af..0c3dc5f 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
#3 lore raw

Re: [Qemu-devel] [PATCH v3 02/18] arm/boot: Turn arm_load_kernel() into no-op for qtest without -kernel

Am 23.09.2013 15:35, schrieb Andreas Färber:

Quoted 4 lines
---
 hw/arm/boot.c | 4 ++++
 1 file changed, 4 insertions(+)

Sorry, I forgot that Grant Likely had an alternative patch [1] not restricted to qtest. Last thing I read was that PMM had similar/further patches. How to proceed?

Andreas

[1] http://patchwork.ozlabs.org/patch/257997/

Quoted 24 lines
hw/arm/boot.c +4 -0
index 1e313af..0c3dc5f 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 · 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
#4 lore raw

Re: [Qemu-devel] [PATCH v3 02/18] arm/boot: Turn arm_load_kernel() into no-op for qtest without -kernel

Quoted 9 lines · Andreas Färber

Am 23.09.2013 15:35, schrieb Andreas Färber:

Quoted 4 lines
---
 hw/arm/boot.c | 4 ++++
 1 file changed, 4 insertions(+)

Sorry, I forgot that Grant Likely had an alternative patch [1] not restricted to qtest. Last thing I read was that PMM had similar/further patches. How to proceed?

Whoops, I forgot about that. I'll stick the patches I have out on the list, but I'm not really in a position to put them in the arm tree for a pullreq yet; so I'm happy for you to either stick them in this series, or to commit this patch (and then I'll fix it up later).

-- PMM

#5 lore raw

Re: [Qemu-devel] [PATCH v3 02/18] arm/boot: Turn arm_load_kernel() into no-op for qtest without -kernel

Am 24.09.2013 01:55, schrieb Peter Maydell:

Quoted 7 lines · Andreas Färber
Quoted 6 lines

Am 23.09.2013 15:35, schrieb Andreas Färber:

Quoted 4 lines
---
 hw/arm/boot.c | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 8 lines
Quoted 3 lines

Sorry, I forgot that Grant Likely had an alternative patch [1] not restricted to qtest. Last thing I read was that PMM had similar/further patches. How to proceed?

Whoops, I forgot about that. I'll stick the patches I have out on the list, but I'm not really in a position to put them in the arm tree for a pullreq yet; so I'm happy for you to either stick them in this series,

Done, thanks.

Andreas

Quoted 4 lines

or to commit this patch (and then I'll fix it up later).

-- PMM

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
#6 lore raw

PATCH v3 3/18 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 a900061..e05cbc1 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
#7 lore raw

PATCH v3 4/18 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 b244f7e..9402c84 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
#8 lore raw

PATCH v3 5/18 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 e97fbbd..aeea172 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
#9 lore raw

PATCH v3 6/18 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 2e0d5d4..61c9ca7 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
#10 lore raw

PATCH v3 7/18 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 3e39044..ff6bfab 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
#11 lore raw

PATCH v3 8/18 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 b0f8664..235fed8 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
#12 lore raw

PATCH v3 9/18 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 2929f9f..26cedec 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
#13 lore raw

PATCH v3 10/18 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 89a9015..397e8df 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.  */
 
@@ -232,21 +234,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
#14 lore raw

PATCH v3 11/18 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 03058d3..5524088 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
Reviewed-by on v3 11/18
#15 lore raw

Re: [Qemu-devel] [PATCH v3 11/18] axis_dev88: Don't enforce use of kernel for qtest

Quoted 1 line · Andreas Färber
Quoted 39 lines
---
 hw/cris/axis_dev88.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
hw/cris/axis_dev88.c +6 -5
index 03058d3..5524088 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
#16 lore raw

PATCH v3 12/18 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 fb96fe8..6e30c0b 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
#17 lore raw

PATCH v3 13/18 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 a8eee44..24f2068 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
#18 lore raw

PATCH v3 14/18 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 f1744ec..15053c4 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
#19 lore raw

PATCH v3 15/18 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 1ff37f5..f008b98 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
#20 lore raw

PATCH v3 16/18 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 f008b98..904a966 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
#21 lore raw

PATCH v3 17/18 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 390f3e4..c583c3d 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
#22 lore raw

PATCH v3 18/18 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 | 253 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 279 insertions(+)
 create mode 100644 tests/qom-test.c
tests/Makefile +26 -0
index 994fef1..53a5c09 100644
@@ -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
tests/qom-test.c new file +253 -0

253 lines not on this page · raw message

Signature · 1 line
1.8.1.4
#23 lore raw
In reply to Andreas Färber

Am 23.09.2013 15:35, schrieb Andreas Färber:

Quoted 4 lines

Andreas Färber (18):
mips_mipssim: Silence BIOS loading warning for qtest

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

With the exception of this patch for which PMM provided a replacement...

Quoted 8 lines

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

Quoted 8 lines

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

... applied to qom-next:
https://github.com/afaerber/qemu-cpu/commits/qom-next

Thanks,
Andreas

Quoted 22 lines
 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/sh4/shix.c           |  16 +--
 hw/sparc/leon3.c        |   3 +-
 hw/unicore32/puv3.c     |   4 +
 tests/Makefile          |  26 +++++
 tests/qom-test.c        | 253 ++++++++++++++++++++++++++++++++++++++++++++++++
 19 files changed, 353 insertions(+), 44 deletions(-)
 create mode 100644 tests/qom-test.c
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