qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH V4 4/5] libqblock test build system


From: Wenchao Xia
Subject: [Qemu-devel] [PATCH V4 4/5] libqblock test build system
Date: Thu, 27 Sep 2012 10:24:01 +0800

  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 <address@hidden>
---
 .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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]