Patchwork [for-1.4,qom-cpu,7/9] tests: Support target-specific unit tests

login
register
mail settings
Submitter Eduardo Habkost
Date Jan. 22, 2013, 8:25 p.m.
Message ID <1358886309-26258-8-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/214660/
State New
Headers show

Comments

Eduardo Habkost - Jan. 22, 2013, 8:25 p.m.
To make unit tests that depend on target-specific files, use
check-unit-<arch>-y and test-obj-<arch>-y.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 tests/Makefile | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Eduardo Habkost - Jan. 23, 2013, 5:47 p.m.
On Tue, Jan 22, 2013 at 06:25:07PM -0200, Eduardo Habkost wrote:
> To make unit tests that depend on target-specific files, use
> check-unit-<arch>-y and test-obj-<arch>-y.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Please drop this patch. I will submit a new version of patch 8/9 that
doesn't require it.

> ---
>  tests/Makefile | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/Makefile b/tests/Makefile
> index d86e95a..41172d6 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -112,9 +112,21 @@ tests/fdc-test$(EXESUF): tests/fdc-test.o
>  tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
>  tests/tmp105-test$(EXESUF): tests/tmp105-test.o
>  
> -# QTest rules
> +# unit test rules:
>  
>  TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
> +
> +# target-specific tests/objs:
> +
> +test-obj-y += $(foreach TARGET,$(TARGETS), $(test-obj-$(TARGET)-y))
> +check-unit-y += $(foreach TARGET,$(TARGETS), $(check-unit-$(TARGET)-y))
> +
> +$(foreach TARGET,$(TARGETS),$(eval $(test-obj-$(TARGET)-y): QEMU_INCLUDES += -Itarget-$(TARGET)))
> +
> +$(test-obj-y): QEMU_INCLUDES += -Itests
> +
> +# QTest rules
> +
>  QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
>  check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
>  
> -- 
> 1.8.1
> 
>

Patch

diff --git a/tests/Makefile b/tests/Makefile
index d86e95a..41172d6 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -112,9 +112,21 @@  tests/fdc-test$(EXESUF): tests/fdc-test.o
 tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
 tests/tmp105-test$(EXESUF): tests/tmp105-test.o
 
-# QTest rules
+# unit test rules:
 
 TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
+
+# target-specific tests/objs:
+
+test-obj-y += $(foreach TARGET,$(TARGETS), $(test-obj-$(TARGET)-y))
+check-unit-y += $(foreach TARGET,$(TARGETS), $(check-unit-$(TARGET)-y))
+
+$(foreach TARGET,$(TARGETS),$(eval $(test-obj-$(TARGET)-y): QEMU_INCLUDES += -Itarget-$(TARGET)))
+
+$(test-obj-y): QEMU_INCLUDES += -Itests
+
+# QTest rules
+
 QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
 check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))