From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com,
blauwirbel@gmail.com, pbonzini@redhat.com, eblake@redhat.com,
Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH V4 4/5] libqblock test build system
Date: Thu, 27 Sep 2012 10:24:01 +0800 [thread overview]
Message-ID: <1348712642-4427-5-git-send-email-xiawenc@linux.vnet.ibm.com> (raw)
In-Reply-To: <1348712642-4427-1-git-send-email-xiawenc@linux.vnet.ibm.com>
This patch will create a new directory in ./tests, make check-libqblock will
build an executable binary, make clean or make check-clean will delete generated
binaries.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
.gitignore | 2 +
Makefile | 1 +
tests/Makefile | 45 +++++++++++++++++++++++++++++++++++++
tests/libqblock/libqblock-qcow2.c | 4 +++
4 files changed, 52 insertions(+), 0 deletions(-)
create mode 100644 tests/libqblock/libqblock-qcow2.c
diff --git a/.gitignore b/.gitignore
index 824c0d2..080a88b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -95,3 +95,5 @@ cscope.*
tags
TAGS
*~
+tests/libqblock/check-*
+tests/libqblock/test_images
diff --git a/Makefile b/Makefile
index 128bc6a..7cfb555 100644
--- a/Makefile
+++ b/Makefile
@@ -237,6 +237,7 @@ clean:
rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
rm -rf qapi-generated
rm -rf qga/qapi-generated
+ $(MAKE) check-clean
for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard libqblock; do \
if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
rm -f $$d/qemu-options.def; \
diff --git a/tests/Makefile b/tests/Makefile
index 26a67ce..668c825 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -84,6 +84,17 @@ check-qtest-$(CONFIG_POSIX)=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)
qtest-obj-y = tests/libqtest.o $(oslib-obj-y) $(tools-obj-y)
$(check-qtest-y): $(qtest-obj-y)
+#libqblock
+LIBQBLOCK_TEST_DIR=$(SRC_PATH)/tests/libqblock/test_images
+qtest-lib-y=$(patsubst %.o, %.lo,$(qtest-obj-y))
+libqblock-la-path = $(libqblock-lib-path)/$(libqblock-lib-la)
+
+tests/libqblock/%.lo: QEMU_INCLUDES += -I$(libqblock-lib-path) -Itests
+
+check-libqblock-y = tests/libqblock/check-libqblock-qcow2$(EXESUF)
+tests/libqblock/check-libqblock-qcow2$(EXESUF): tests/libqblock/libqblock-qcow2.lo $(libqblock-la-path) $(qtest-lib-y)
+ $(call quiet-command,$(LIBTOOL) --mode=link --quiet --tag=CC $(CC) -shared -rpath $(libdir) -o $@ $^," lt LINK $@")
+
.PHONY: check-help
check-help:
@echo "Regression testing targets:"
@@ -93,7 +104,9 @@ check-help:
@echo " make check-qtest Run qtest tests"
@echo " make check-unit Run qobject tests"
@echo " make check-block Run block tests"
+ @echo " make check-libqblock Run libqblock tests"
@echo " make check-report.html Generates an HTML test report"
+ @echo " make check-clean Clean the test"
@echo
@echo "Please note that HTML reports do not regenerate if the unit tests"
@echo "has not changed."
@@ -116,6 +129,11 @@ $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
$(patsubst %, check-%, $(check-unit-y)): check-%: %
$(call quiet-command,gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
+#libqblock tests
+.PHONY: $(patsubst %, check-%, $(check-libqblock-y))
+$(patsubst %, check-%, $(check-libqblock-y)): check-%: %
+ $(call quiet-command, LIBQBLOCK_TEST_DIR=$(LIBQBLOCK_TEST_DIR) gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*")
+
# gtester tests with XML output
$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y)
@@ -148,4 +166,31 @@ check-unit: $(patsubst %,check-%, $(check-unit-y))
check-block: $(patsubst %,check-%, $(check-block-y))
check: check-unit check-qtest
+ifeq ($(LIBTOOL),)
+check-libqblock:
+ @echo "libtool is missing, skip libqblock test."
+else
+$(libqblock-la-path):
+ @echo "Building libqblock.la..."
+ $(call quiet-command,$(MAKE) -C $(SRC_PATH) $(libqblock-lib-la),)
+$(LIBQBLOCK_TEST_DIR):
+ @echo "Make libqblock test directory"
+ mkdir $(LIBQBLOCK_TEST_DIR)
+
+check-libqblock: $(libqblock-la-path) $(LIBQBLOCK_TEST_DIR) $(patsubst %,check-%, $(check-libqblock-y))
+endif
+
+check-clean:
+ $(MAKE) -C tests/tcg clean
+ rm -f tests/*.lo tests/*.o
+ rm -rf tests/.libs
+ rm -f tests/libqblock/*.lo tests/libqblock/*.o
+ rm -rf tests/libqblock/.libs
+ rm -f trace/*.lo trace/*.o
+ rm -rf trace/.libs
+ rm -f $(check-libqblock-y)
+ rm -rf $(LIBQBLOCK_TEST_DIR)
+ rm -f $(check-unit-y)
+ rm -f $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y)
+
-include $(wildcard tests/*.d)
diff --git a/tests/libqblock/libqblock-qcow2.c b/tests/libqblock/libqblock-qcow2.c
new file mode 100644
index 0000000..c05c0c4
--- /dev/null
+++ b/tests/libqblock/libqblock-qcow2.c
@@ -0,0 +1,4 @@
+int main(int argc, char **argv)
+{
+ return 0;
+}
--
1.7.1
next prev parent reply other threads:[~2012-09-27 2:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-27 2:23 [Qemu-devel] [PATCH V4 0/5] libqblock qemu block layer library Wenchao Xia
2012-09-27 2:23 ` [Qemu-devel] [PATCH V4 1/5] libqblock build system Wenchao Xia
2012-09-27 8:06 ` Paolo Bonzini
2012-09-27 9:39 ` Wenchao Xia
2012-09-27 2:23 ` [Qemu-devel] [PATCH V4 2/5] libqblock type defines Wenchao Xia
2012-09-27 8:25 ` Paolo Bonzini
2012-09-27 9:52 ` Wenchao Xia
2012-09-27 10:16 ` Paolo Bonzini
2012-09-28 3:00 ` Wenchao Xia
2012-09-28 7:51 ` Paolo Bonzini
2012-09-28 10:52 ` Wenchao Xia
2012-09-28 10:58 ` Paolo Bonzini
2012-09-27 2:24 ` [Qemu-devel] [PATCH V4 3/5] libqblock API Wenchao Xia
2012-09-27 2:24 ` Wenchao Xia [this message]
2012-09-27 8:30 ` [Qemu-devel] [PATCH V4 4/5] libqblock test build system Paolo Bonzini
2012-09-27 9:56 ` Wenchao Xia
2012-09-27 10:17 ` Paolo Bonzini
2012-09-28 3:04 ` Wenchao Xia
2012-09-28 7:52 ` Paolo Bonzini
2012-09-28 9:46 ` Wenchao Xia
2012-09-27 2:24 ` [Qemu-devel] [PATCH V4 5/5] libqblock test example Wenchao Xia
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=1348712642-4427-5-git-send-email-xiawenc@linux.vnet.ibm.com \
--to=xiawenc@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/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).