diff mbox

tests/Makefile: Run qom-test for every architecture

Message ID 1390494179-17332-1-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell Jan. 23, 2014, 4:22 p.m. UTC
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.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
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(-)

Comments

Markus Armbruster Feb. 4, 2014, 9:16 a.m. UTC | #1
Peter Maydell <peter.maydell@linaro.org> writes:

> 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.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> 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.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Andreas Färber Feb. 5, 2014, 2 p.m. UTC | #2
Am 04.02.2014 10:16, schrieb Markus Armbruster:
> Peter Maydell <peter.maydell@linaro.org> writes:
> 
>> 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.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> 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.
> 
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

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
Andreas Färber March 31, 2014, 8:10 a.m. UTC | #3
Peter,

Am 23.01.2014 17:22, schrieb 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.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> 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(-)
> 
> diff --git a/tests/Makefile b/tests/Makefile
> index fd36eee..42a52ff 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -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)

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
Peter Maydell March 31, 2014, 8:28 a.m. UTC | #4
On 31 March 2014 09:10, Andreas Färber <afaerber@suse.de> wrote:
> Am 23.01.2014 17:22, schrieb Peter Maydell:
>> +# 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)
>
> 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

> 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
Andreas Färber March 31, 2014, 8:33 a.m. UTC | #5
Am 31.03.2014 10:28, schrieb Peter Maydell:
> On 31 March 2014 09:10, Andreas Färber <afaerber@suse.de> wrote:
>> Am 23.01.2014 17:22, schrieb Peter Maydell:
>>> +# 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)
>>
>> 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

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.

>> 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
Peter Maydell March 31, 2014, 8:42 a.m. UTC | #6
On 31 March 2014 09:33, Andreas Färber <afaerber@suse.de> wrote:
> 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
diff mbox

Patch

diff --git a/tests/Makefile b/tests/Makefile
index fd36eee..42a52ff 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -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 \