Patchwork [V14,09/10] libqblock: build: add rules for test case

login
register
mail settings
Submitter Wayne Xia
Date Jan. 23, 2013, 11:18 a.m.
Message ID <1358939887-22533-10-git-send-email-xiawenc@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/214897/
State New
Headers show

Comments

Wayne Xia - Jan. 23, 2013, 11:18 a.m.
Libtool will be used for final link, the rules do nothing if
libqblock was disabled. Temp directory was used to store image
created in test, which will be deleted in clean.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 tests/Makefile |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)
Wayne Xia - Jan. 24, 2013, 1:53 a.m.
于 2013-1-23 19:27, Paolo Bonzini 写道:
> Il 23/01/2013 12:18, Wenchao Xia ha scritto:
>>    Libtool will be used for final link, the rules do nothing if
>> libqblock was disabled. Temp directory was used to store image
>> created in test, which will be deleted in clean.
>>
>> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
>> ---
>>   tests/Makefile |   29 ++++++++++++++++++++++++++---
>>   1 files changed, 26 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/Makefile b/tests/Makefile
>> index 9a759a1..e5a47af 100644
>> --- a/tests/Makefile
>> +++ b/tests/Makefile
>> @@ -122,9 +122,19 @@ qtest-obj-y = tests/libqtest.o libqemuutil.a libqemustub.a
>>   qtest-obj-y += tests/libi2c.o tests/libi2c-omap.o
>>   $(check-qtest-y): $(qtest-obj-y)
>>
>> +#libqblock build rules
>> +
>> +LIBQBLOCK_LA = libqblock.la
>
> Please inline this in the rule, and just put it in "make check-unit".
>
> Paolo
>
   OK.

>> +LIBQBLOCK_TEST_DIR = tests/test_images
>> +check-libqblock-$(CONFIG_LIBQBLOCK) = tests/check-libqblock-qcow2$(EXESUF)
>> +$(check-libqblock-y): QEMU_INCLUDES += -I$(SRC_PATH)/tests -I$(SRC_PATH)/libqblock
>> +
>> +$(check-libqblock-y): %$(EXESUF): %.o $(LIBQBLOCK_LA)
>> +	$(call LINK, $^)
>> +
>>   #clean rules
>>
>> -CHECK_CLEAN_TARGETS=$(check-unit-y) $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y) tests/*.o
>> +CHECK_CLEAN_TARGETS=$(check-unit-y) $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y) tests/*.o $(check-libqblock-y) $(LIBQBLOCK_TEST_DIR)
>>   SUBDIR_CLEAN_RULES+=check-clean
>>
>>   .PHONY: check-help
>> @@ -136,6 +146,7 @@ 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 tests"
>>   	@echo
>> @@ -180,9 +191,20 @@ $(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.
>>   check-report-unit.xml: $(check-unit-y)
>>   	$(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
>>
>> +# gtester tests with libqblock
>> +
>> +check-report-libqblock-$(CONFIG_LIBQBLOCK) = check-report-libqblock.xml
>> +
>> +.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 $*")
>> +
>> +$(check-report-libqblock-y): $(check-libqblock-y)
>> +	$(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
>> +
>>   # 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_TARGETS)) check-report-unit.xml $(check-report-libqblock-y)
>>   	$(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, "  GEN    $@")
>>
>>   check-report.html: check-report.xml
>> @@ -197,10 +219,11 @@ check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF)
>>
>>   # Consolidated targets
>>
>> -.PHONY: check-qtest check-unit check check-clean
>> +.PHONY: check-qtest check-unit check-libqblock check check-clean
>>   check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
>>   check-unit: $(patsubst %,check-%, $(check-unit-y))
>>   check-block: $(patsubst %,check-%, $(check-block-y))
>> +check-libqblock: $(patsubst %,check-%, $(check-libqblock-y))
>>   check: check-unit check-qtest
>>
>>   check-clean:
>>
>

Patch

diff --git a/tests/Makefile b/tests/Makefile
index 9a759a1..e5a47af 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -122,9 +122,19 @@  qtest-obj-y = tests/libqtest.o libqemuutil.a libqemustub.a
 qtest-obj-y += tests/libi2c.o tests/libi2c-omap.o
 $(check-qtest-y): $(qtest-obj-y)
 
+#libqblock build rules
+
+LIBQBLOCK_LA = libqblock.la
+LIBQBLOCK_TEST_DIR = tests/test_images
+check-libqblock-$(CONFIG_LIBQBLOCK) = tests/check-libqblock-qcow2$(EXESUF)
+$(check-libqblock-y): QEMU_INCLUDES += -I$(SRC_PATH)/tests -I$(SRC_PATH)/libqblock
+
+$(check-libqblock-y): %$(EXESUF): %.o $(LIBQBLOCK_LA)
+	$(call LINK, $^)
+
 #clean rules
 
-CHECK_CLEAN_TARGETS=$(check-unit-y) $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y) tests/*.o
+CHECK_CLEAN_TARGETS=$(check-unit-y) $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y) tests/*.o $(check-libqblock-y) $(LIBQBLOCK_TEST_DIR)
 SUBDIR_CLEAN_RULES+=check-clean
 
 .PHONY: check-help
@@ -136,6 +146,7 @@  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 tests"
 	@echo
@@ -180,9 +191,20 @@  $(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.
 check-report-unit.xml: $(check-unit-y)
 	$(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
 
+# gtester tests with libqblock
+
+check-report-libqblock-$(CONFIG_LIBQBLOCK) = check-report-libqblock.xml
+
+.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 $*")
+
+$(check-report-libqblock-y): $(check-libqblock-y)
+	$(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^, "GTESTER $@")
+
 # 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_TARGETS)) check-report-unit.xml $(check-report-libqblock-y)
 	$(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@, "  GEN    $@")
 
 check-report.html: check-report.xml
@@ -197,10 +219,11 @@  check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF)
 
 # Consolidated targets
 
-.PHONY: check-qtest check-unit check check-clean
+.PHONY: check-qtest check-unit check-libqblock check check-clean
 check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
 check-unit: $(patsubst %,check-%, $(check-unit-y))
 check-block: $(patsubst %,check-%, $(check-block-y))
+check-libqblock: $(patsubst %,check-%, $(check-libqblock-y))
 check: check-unit check-qtest
 
 check-clean: