Skip to contentSkip to conversation

build: trivial patches for test

PATCH Superseded Wenchao Xia 2 participants 6 messages Sep 22, 2013 – Sep 24, 2013 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 tests: build the helper program in main build process

In reply to Wenchao Xia

This is a quick way to update helper program when qemu main code is changed or built, instead of adding new Makefile under test/qemu-iotest.

---
 tests/Makefile |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
tests/Makefile +7 -1
index 994fef1..5f2894f 100644
@@ -252,8 +252,10 @@ check-report.html: check-report.xml
 
 # Other tests
 
+QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
+
 .PHONY: check-tests/qemu-iotests-quick.sh
-check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF) tests/qemu-iotests/socket_scm_helper$(EXESUF)
+check-tests/qemu-iotests-quick.sh: tests/qemu-iotests-quick.sh qemu-img$(EXESUF) qemu-io$(EXESUF) $(QEMU_IOTESTS_HELPERS-y)
 	$<
 
 .PHONY: check-tests/test-qapi.py
@@ -275,5 +277,9 @@ check-unit: $(patsubst %,check-%, $(check-unit-y))
 check-block: $(patsubst %,check-%, $(check-block-y))
 check: check-qapi-schema check-unit check-qtest
 
+# Build the help program automatically
+
+all: $(QEMU_IOTESTS_HELPERS-y)
+
 -include $(wildcard tests/*.d)
 -include $(wildcard tests/libqos/*.d)
Signature · 1 line
1.7.1
#5 lore raw

PATCH 2/2 build: add command check-clean

In reply to Wenchao Xia

This command will package the clean operations in tests. Now root Makefile simply calls the command and do not care the details of it any more. Original the built binaries for test will not be removed, now they will be deleted in clean operation.

---
 Makefile       |    1 -
 tests/Makefile |    8 +++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
Makefile +0 -1
index 362fe3e..befc23a 100644
@@ -245,7 +245,6 @@ clean:
 	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
 	rm -rf qapi-generated
 	rm -rf qga/qapi-generated
-	$(MAKE) -C tests/tcg clean
 	for d in $(ALL_SUBDIRS); do \
 	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
 	rm -f $$d/qemu-options.def; \
tests/Makefile +7 -1
index 5f2894f..643c89c 100644
@@ -196,6 +196,7 @@ check-help:
 	@echo " make check-qapi-schema    Run QAPI schema tests"
 	@echo " make check-block          Run block tests"
 	@echo " make check-report.html    Generates an HTML test report"
+	@echo " make check-clean          Clean the tests"
 	@echo
 	@echo "Please note that HTML reports do not regenerate if the unit tests"
 	@echo "has not changed."
@@ -270,12 +271,17 @@ $(patsubst %, check-%, $(check-qapi-schema-y)): check-%.json: $(SRC_PATH)/%.json
 
 # Consolidated targets
 
-.PHONY: check-qapi-schema check-qtest check-unit check
+.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-unit: $(patsubst %,check-%, $(check-unit-y))
 check-block: $(patsubst %,check-%, $(check-block-y))
 check: check-qapi-schema check-unit check-qtest
+check-clean:
+	$(MAKE) -C tests/tcg clean
+	rm -rf $(check-unit-y) $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
+
+clean: check-clean
 
 # Build the help program automatically
 
Signature · 1 line
1.7.1
#0 lore raw

cover build: trivial patches for test

Wenchao Xia (2):
tests: build the helper program in main build process
build: add command check-clean

 Makefile       |    1 -
 tests/Makefile |   16 ++++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] tests: build the helper program in main build process

In reply to Wenchao Xia

22.09.2013 12:30, Wenchao Xia пишет:

Quoted 2 lines

This is a quick way to update helper program when qemu main code is changed or built, instead of adding new Makefile under test/qemu-iotest.

Why?

[]

tests/Makefile check-unit: $(patsubst %,check-%, $(check-unit-y)) · line 282

Quoted 4 lines
tests/Makefile +3 -0
+# Build the help program automatically
+
+all: $(QEMU_IOTESTS_HELPERS-y)

This appears to be somewhat awkward way (to do something which I clearly don't see).

First, it is not clear why this iotest helper should be built by default when we hasn't been asked to perform the tests.

Second, it apparently does not achieve the (unknown) goal anyway. At least the patch does not do what the commit coment says. Commit says that the helper gets updated when qemu main code is changed or built (which is main code?). But when I build, say, subdir-x86_64-softmmu, which is definitely some "main" code, the helper isn't being built...

Count me confused... :)

/mjt

#3 lore raw

Re: [Qemu-devel] [PATCH 1/2] tests: build the helper program in main build process

Quoted 7 lines · Michael Tokarev

22.09.2013 12:30, Wenchao Xia пишет:

Quoted 2 lines

This is a quick way to update helper program when qemu main code is changed or built, instead of adding new Makefile under test/qemu-iotest.

Why?

[]

I think it is a bit overkill to have a new Makefile for one single
.c file. If more
file comes, we can write Makefile at that time.

Quoted 10 lines

tests/Makefile check-unit: $(patsubst %,check-%, $(check-unit-y)) · line 282

Quoted 4 lines
tests/Makefile +3 -0
+# Build the help program automatically
+
+all: $(QEMU_IOTESTS_HELPERS-y)

This appears to be somewhat awkward way (to do something which I clearly don't see).

First, it is not clear why this iotest helper should be built by default when we hasn't been asked to perform the tests.

Usually we may:
1 configure and make.
2 goto tests/qemu-iotests, ./check.

It may encounter an error since build of the helper was not triggered.

Quoted 8 lines

Second, it apparently does not achieve the (unknown) goal anyway. At least the patch does not do what the commit coment says. Commit says that the helper gets updated when qemu main code is changed or built (which is main code?). But when I build, say, subdir-x86_64-softmmu, which is definitely some "main" code, the helper isn't being built...

Main code may refer to the codes other than ./tests, the commit
message is not accurate, I think it should be "build the helper by default".

Quoted 4 lines

Count me confused... :)

/mjt

#4 lore raw

Re: [Qemu-devel] [PATCH 1/2] tests: build the helper program in main build process

Quoted 37 lines · Wenchao Xia
Quoted 7 lines · Michael Tokarev

22.09.2013 12:30, Wenchao Xia пишет:

Quoted 2 lines

This is a quick way to update helper program when qemu main code is changed or built, instead of adding new Makefile under test/qemu-iotest.

Why?

[]

I think it is a bit overkill to have a new Makefile for one single
.c file. If more
file comes, we can write Makefile at that time.

Quoted 10 lines

tests/Makefile check-unit: $(patsubst %,check-%, $(check-unit-y)) · line 282

Quoted 4 lines
tests/Makefile +3 -0
+# Build the help program automatically
+
+all: $(QEMU_IOTESTS_HELPERS-y)

This appears to be somewhat awkward way (to do something which I clearly don't see).

First, it is not clear why this iotest helper should be built by default when we hasn't been asked to perform the tests.

Usually we may:
1 configure and make.
2 goto tests/qemu-iotests, ./check.

It may encounter an error since build of the helper was not triggered.

Quoted 8 lines

Second, it apparently does not achieve the (unknown) goal anyway. At least the patch does not do what the commit coment says. Commit says that the helper gets updated when qemu main code is changed or built (which is main code?). But when I build, say, subdir-x86_64-softmmu, which is definitely some "main" code, the helper isn't being built...

Quoted 10 lines

Main code may refer to the codes other than ./tests, the commit
message is not accurate, I think it should be "build the helper by default".

Quoted 4 lines

Count me confused... :)

/mjt

Are you OK with this method? To add a callable Makefile by
tests/qemu-iotests/check,
configure, variable may be needed to work on out of tree build case, so I try to avoid that. This patches simply build it in default make process.
If yes I will respin a version with better commit message.