qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Igor Mammedov" <imammedo@redhat.com>
Subject: [Qemu-devel] [PATCH v2 2/7] tests: Support target-specific unit tests
Date: Tue, 30 Sep 2014 15:26:01 -0300	[thread overview]
Message-ID: <1412101566-23669-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1412101566-23669-1-git-send-email-ehabkost@redhat.com>

To make unit tests that depend on target-specific files, use
check-unit-<target>-y and test-obj-<target>-y.

Note that the qtest test cases were per-*arch* (e.g. i386, mips, ppc),
not per-*target* (e.g. i386-softmmu, x86_64-linux-user), because they
implicitly apply only to the -softmmu targets. Target-specific unit
tests, on the other hand, may apply to any target (e.g. they may test
*-softmmu and/or *-user code). To clarify this, $(TARGETS) was renamed
to $(QTEST_ARCHES).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 tests/Makefile | 31 +++++++++++++++++++++++--------
 1 file changed, 23 insertions(+), 8 deletions(-)

diff --git a/tests/Makefile b/tests/Makefile
index 3b84e38..ea17838 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -357,12 +357,27 @@ ifeq ($(CONFIG_POSIX),y)
 LIBS += -lutil
 endif
 
+
+SOFTMMU_TARGETS=$(filter %-softmmu,$(TARGET_DIRS))
+SOFTMMU_ARCHES=$(patsubst %-softmmu,%, $(SOFTMMU_TARGETS))
+
+# unit test rules:
+
+# target-specific tests/objs:
+
+test-obj-y += $(foreach TARGET,$(TARGET_DIRS), $(test-obj-$(TARGET)-y))
+check-unit-y += $(foreach TARGET,$(TARGET_DIRS), $(check-unit-$(TARGET)-y))
+
+$(foreach TARGET,$(TARGET_DIRS),$(eval include $(TARGET)/config-target.mak) \
+                                $(eval $(test-obj-$(TARGET)-y): QEMU_CFLAGS += -I$(TARGET) -I$(SRC_PATH)/target-$(TARGET_BASE_ARCH) -DNEED_CPU_H))
+
+$(test-obj-y): QEMU_INCLUDES += -Itests
+
 # QTest rules
 
-TARGETS=$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS)))
 ifeq ($(CONFIG_POSIX),y)
-QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TARGET),))
-check-qtest-y=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
+QTEST_ARCHES=$(foreach ARCH,$(SOFTMMU_ARCHES), $(if $(check-qtest-$(ARCH)-y), $(ARCH),))
+check-qtest-y=$(foreach ARCH,$(QTEST_ARCHES), $(check-qtest-$(ARCH)-y))
 endif
 
 qtest-obj-y = tests/libqtest.o libqemuutil.a libqemustub.a
@@ -394,8 +409,8 @@ GCOV_OPTIONS = -n $(if $(V),-f,)
 
 # gtester tests, possibly with verbose output
 
-.PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
-$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
+.PHONY: $(patsubst %, check-qtest-%, $(QTEST_ARCHES))
+$(patsubst %, check-qtest-%, $(QTEST_ARCHES)): check-qtest-%: $(check-qtest-y)
 	$(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
 	$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
 		MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \
@@ -418,7 +433,7 @@ $(patsubst %, check-%, $(check-unit-y)): check-%: %
 
 # gtester tests with XML output
 
-$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
+$(patsubst %, check-report-qtest-%.xml, $(QTEST_ARCHES)): check-report-qtest-%.xml: $(check-qtest-y)
 	$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
 	  gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y),"GTESTER $@")
 
@@ -427,7 +442,7 @@ check-report-unit.xml: $(check-unit-y)
 
 # Reports and overall runs
 
-check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml
+check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_ARCHES)) check-report-unit.xml
 	$(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, "  GEN    $@")
 
 check-report.html: check-report.xml
@@ -461,7 +476,7 @@ $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
 
 .PHONY: check-qapi-schema check-qtest check-unit check check-clean
 check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y))
-check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
+check-qtest: $(patsubst %,check-qtest-%, $(QTEST_ARCHES))
 check-unit: $(patsubst %,check-%, $(check-unit-y))
 check-block: $(patsubst %,check-%, $(check-block-y))
 check: check-qapi-schema check-unit check-qtest
-- 
1.9.3

  parent reply	other threads:[~2014-09-30 18:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30 18:25 [Qemu-devel] [PATCH v2 0/7] Target-specific unit test support, add unit tests for target-i386/cpu.c code Eduardo Habkost
2014-09-30 18:26 ` [Qemu-devel] [PATCH v2 1/7] tests: Move fake yield_until_fd_readable() to coroutine-stub.c Eduardo Habkost
2014-09-30 22:17   ` Paolo Bonzini
2014-10-01 16:14     ` Eduardo Habkost
2014-09-30 18:26 ` Eduardo Habkost [this message]
2014-09-30 18:26 ` [Qemu-devel] [PATCH v2 3/7] tests: Make test-x86-cpuid target-specific Eduardo Habkost
2014-09-30 18:26 ` [Qemu-devel] [PATCH v2 4/7] tests: Add unit test for X86CPU code Eduardo Habkost
2014-09-30 22:20   ` Paolo Bonzini
2014-10-01 16:28     ` Eduardo Habkost
2014-10-01 18:18       ` Paolo Bonzini
2014-09-30 18:26 ` [Qemu-devel] [PATCH v2 5/7] target-i386: Isolate enabled-by-default features to a separate array Eduardo Habkost
2014-09-30 18:26 ` [Qemu-devel] [PATCH v2 6/7] tests: test-x86-cpu: Add TCG feature bit initialization test Eduardo Habkost
2014-09-30 18:26 ` [Qemu-devel] [PATCH v2 7/7] tests: test-x86-cpu: Add KVM " Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1412101566-23669-3-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=afaerber@suse.de \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).