Skip to contentSkip to conversation

tests/Makefile: Run qom-test for every architecture

PATCH In review Peter Maydell 3 participants 7 messages Jan 23, 2014 – Mar 31, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/Makefile: Run qom-test for every architecture

Rather than requiring every new architecture to remember to add a line to the Makefile to say that qom-test will work on it, autogenerate the list of supported architectures by looking at the files in default-configs (as configure does), and add qom-test to the test list for all of them automatically.

---
Together with Markus' patch for running the test for all known machines for the architecture, this will avoid the problem of coverage being missed because of forgetting to update a whitelist.

 tests/Makefile | 31 ++++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)
tests/Makefile +8 -23
index fd36eee..42a52ff 100644
@@ -1,5 +1,9 @@
 export SRC_PATH
 
+# Get the list of all supported sysemu targets
+SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
+   $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
+
 check-unit-y = tests/check-qdict$(EXESUF)
 gcov-files-check-qdict-y = qobject/qdict.c
 check-unit-y += tests/check-qfloat$(EXESUF)
@@ -71,7 +75,6 @@ check-qtest-i386-y += tests/acpi-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-i386-y += tests/blockdev-test$(EXESUF)
 check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)
@@ -80,44 +83,26 @@ 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)
 
+# qom-test works for all sysemu architectures:
+$(foreach target,$(SYSEMU_TARGET_LIST), \
+    $(eval check-qtest-$(target)-y += tests/qom-test$(EXESUF)))
+
 check-qapi-schema-y := $(addprefix tests/qapi-schema/, \
         comments.json empty.json funny-char.json indented-expr.json \
         missing-colon.json missing-comma-list.json \
Signature · 1 line
1.8.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Peter Maydell

Rather than requiring every new architecture to remember to add a line to the Makefile to say that qom-test will work on it, autogenerate the list of supported architectures by looking at the files in default-configs (as configure does), and add qom-test to the test list for all of them automatically.

---
Together with Markus' patch for running the test for all known machines for the architecture, this will avoid the problem of coverage being missed because of forgetting to update a whitelist.

I applied this on top of Andreas's rebase of my patch rebased to current master. Applies cleanly and works fine.

#2 lore raw

Am 04.02.2014 10:16, schrieb Markus Armbruster:

Quoted 14 lines
Quoted 11 lines · Peter Maydell

Rather than requiring every new architecture to remember to add a line to the Makefile to say that qom-test will work on it, autogenerate the list of supported architectures by looking at the files in default-configs (as configure does), and add qom-test to the test list for all of them automatically.

---
Together with Markus' patch for running the test for all known machines for the architecture, this will avoid the problem of coverage being missed because of forgetting to update a whitelist.

Quoted 4 lines

I applied this on top of Andreas's rebase of my patch rebased to current master. Applies cleanly and works fine.

Thanks for bringing this one up on my radar again, applied to qom-next (won't do good without Markus' patch but no harm either):

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

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
#3 lore raw
In reply to Peter Maydell

Peter,

Am 23.01.2014 17:22, schrieb Peter Maydell:

Quoted 30 lines

Rather than requiring every new architecture to remember to add a line to the Makefile to say that qom-test will work on it, autogenerate the list of supported architectures by looking at the files in default-configs (as configure does), and add qom-test to the test list for all of them automatically.

---
Together with Markus' patch for running the test for all known machines for the architecture, this will avoid the problem of coverage being missed because of forgetting to update a whitelist.

 tests/Makefile | 31 ++++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)
tests/Makefile +4 -0
index fd36eee..42a52ff 100644
@@ -1,5 +1,9 @@
 export SRC_PATH
 
+# Get the list of all supported sysemu targets
+SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
+   $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
+
 check-unit-y = tests/check-qdict$(EXESUF)
 gcov-files-check-qdict-y = qobject/qdict.c
 check-unit-y += tests/check-qfloat$(EXESUF)

tests/Makefile check-qtest-i386-y += tests/acpi-test$(EXESUF) · line 80

Quoted 7 lines
tests/Makefile +0 -1
@@ -71,7 +75,6 @@ check-qtest-i386-y += tests/acpi-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-i386-y += tests/blockdev-test$(EXESUF)
 check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)

qom-test gets executed twice for x86_64 now.

Without having debugged this further yet, my guess is this last line is causing qom-test to get added twice to check-qtest-x86_64-y, once inherited from check-qtest-i386-y and then newly added like for any other target. Could you please take a look how to fix?

Thanks,
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
#4 lore raw
Quoted 10 lines · Andreas Färber

Am 23.01.2014 17:22, schrieb Peter Maydell:

Quoted 9 lines
tests/Makefile +4 -0
+# Get the list of all supported sysemu targets
+SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
+   $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
+
 check-unit-y = tests/check-qdict$(EXESUF)
 gcov-files-check-qdict-y = qobject/qdict.c
 check-unit-y += tests/check-qfloat$(EXESUF)
@@ -71,7 +75,6 @@ check-qtest-i386-y += tests/acpi-test$(EXESUF)
 check-qtest-i386-y += tests/rtc-test$(EXESUF)
Quoted 8 lines

tests/Makefile check-qtest-i386-y += tests/acpi-test$(EXESUF) · line 80

Quoted 6 lines
tests/Makefile +0 -1
 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-i386-y += tests/blockdev-test$(EXESUF)
 check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)

qom-test gets executed twice for x86_64 now.

It doesn't for me:

TESTER check-qtest-sparc
GTESTER check-qtest-sparc64
GTESTER check-qtest-unicore32
GTESTER check-qtest-x86_64
blkdebug: Suspended request 'A'
blkdebug: Resuming request 'A' [vmxnet3][WR][vmxnet3_peer_has_vnet_hdr]: Peer has no virtio extension. Task offloads will be emulated.
GTESTER check-qtest-xtensa
GTESTER check-qtest-xtensaeb

Quoted 4 lines

Without having debugged this further yet, my guess is this last line is causing qom-test to get added twice to check-qtest-x86_64-y, once inherited from check-qtest-i386-y and then newly added like for any other target.

When I was writing the patch I did think about whether this was going to be a problem, but I realised that it would not, because the check-qtest-*-y we're building up here are not lists of commands to run, but lists of Makefile targets. Make will automatically only run the target once even if it happens to be specified twice on the RHS of a rule.

thanks
-- PMM

#5 lore raw

Am 31.03.2014 10:28, schrieb Peter Maydell:

Quoted 22 lines · Andreas Färber
Quoted 10 lines

Am 23.01.2014 17:22, schrieb Peter Maydell:

Quoted 9 lines
tests/Makefile +4 -0
+# Get the list of all supported sysemu targets
+SYSEMU_TARGET_LIST := $(subst -softmmu.mak,,$(notdir \
+   $(wildcard $(SRC_PATH)/default-configs/*-softmmu.mak)))
+
 check-unit-y = tests/check-qdict$(EXESUF)
 gcov-files-check-qdict-y = qobject/qdict.c
 check-unit-y += tests/check-qfloat$(EXESUF)
@@ -71,7 +75,6 @@ check-qtest-i386-y += tests/acpi-test$(EXESUF)
 check-qtest-i386-y += tests/rtc-test$(EXESUF)
Quoted 8 lines

tests/Makefile check-qtest-i386-y += tests/acpi-test$(EXESUF) · line 80

Quoted 6 lines
tests/Makefile +0 -1
 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-i386-y += tests/blockdev-test$(EXESUF)
 check-qtest-i386-y += tests/qdev-monitor-test$(EXESUF)
 check-qtest-x86_64-y = $(check-qtest-i386-y)

qom-test gets executed twice for x86_64 now.

It doesn't for me:

Quoted 10 lines

TESTER check-qtest-sparc
GTESTER check-qtest-sparc64
GTESTER check-qtest-unicore32
GTESTER check-qtest-x86_64
blkdebug: Suspended request 'A'
blkdebug: Resuming request 'A' [vmxnet3][WR][vmxnet3_peer_has_vnet_hdr]: Peer has no virtio extension. Task offloads will be emulated.
GTESTER check-qtest-xtensa
GTESTER check-qtest-xtensaeb

What does that prove? I said qom-test, not check-qtest-x86_64. :) You need to run make check-qtest-x86_64 V=1 to see it.

Quoted 11 lines
Quoted 4 lines

Without having debugged this further yet, my guess is this last line is causing qom-test to get added twice to check-qtest-x86_64-y, once inherited from check-qtest-i386-y and then newly added like for any other target.

When I was writing the patch I did think about whether this was going to be a problem, but I realised that it would not, because the check-qtest-*-y we're building up here are not lists of commands to run, but lists of Makefile targets. Make will automatically only run the target once even if it happens to be specified twice on the RHS of a rule.

I am not aware of a qom-test specific Makefile command - with growing number of tests that would be really handy to have for testing a newly added one quickly...

Thanks,
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
#6 lore raw
Quoted 2 lines · Andreas Färber

What does that prove? I said qom-test, not check-qtest-x86_64. :) You need to run make check-qtest-x86_64 V=1 to see it.

Ah, gotcha. I guess we do need to stick some kind of uniqueness filter in somewhere.

thanks
-- PMM