Message ID | 1353042317-13688-3-git-send-email-xiawenc@linux.vnet.ibm.com |
---|---|
State | New |
Headers | show |
Il 16/11/2012 06:05, Wenchao Xia ha scritto: > Currently make clean only clean tests/tcg and hard to extend. > This patch added command make check-clean, which clean all > generated files used in tests. With this command root Makefile > do not care tests clean method any more, it simply calls the > command to do it, so any more clean script could be added in > tests/Makefile make it easier to extend. > > Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> > --- > Makefile | 2 +- > configure | 2 +- > tests/Makefile | 7 +++++++ > 3 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/Makefile b/Makefile > index f40885b..8201e80 100644 > --- a/Makefile > +++ b/Makefile > @@ -251,7 +251,7 @@ clean: > rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp) > rm -rf qapi-generated > rm -rf qga/qapi-generated > - $(MAKE) -C tests/tcg clean > + MAKEFILES=./tests/Makefile $(MAKE) check-clean What is MAKEFILES? Paolo > for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \ > if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ > rm -f $$d/qemu-options.def; \ > diff --git a/configure b/configure > index f847ee2..a18e267 100755 > --- a/configure > +++ b/configure > @@ -4163,7 +4163,7 @@ DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas" > DIRS="$DIRS roms/seabios roms/vgabios" > DIRS="$DIRS qapi-generated" > DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" > -FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" > +FILES="Makefile tests/Makefile tests/tcg/Makefile qdict-test-data.txt" > FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" > FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile" > FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" > diff --git a/tests/Makefile b/tests/Makefile > index 9bf0765..a286622 100644 > --- a/tests/Makefile > +++ b/tests/Makefile > @@ -94,6 +94,7 @@ check-help: > @echo " make check-unit Run qobject 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." > @@ -148,4 +149,10 @@ check-unit: $(patsubst %,check-%, $(check-unit-y)) > check-block: $(patsubst %,check-%, $(check-block-y)) > check: check-unit check-qtest > > +check-clean: > + $(MAKE) -C tests/tcg clean > + rm -f $(check-unit-y) > + rm -f $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y) > + rm -f tests/*.o > + > -include $(wildcard tests/*.d) >
On 16 November 2012 10:23, Paolo Bonzini <pbonzini@redhat.com> wrote: > Il 16/11/2012 06:05, Wenchao Xia ha scritto: >> - $(MAKE) -C tests/tcg clean >> + MAKEFILES=./tests/Makefile $(MAKE) check-clean > > What is MAKEFILES? make uses it as a list of additional makefiles to be read, as if they were 'include'd at the start of whatever makefile it actually reads. This is almost certainly not what is meant here, because this $(MAKE) invocation will reread the makefile we're currently executing, prepend tests/Makefile (gratuitously since our Makefile explicitly includes it anyway) and then invoke the check-clean target, which happens to work OK because tests/Makefile expects to be included rather than standalone. If this roundabout approach is intentional and not accidental it needs a comment explaining why it's needed. -- PMM
diff --git a/Makefile b/Makefile index f40885b..8201e80 100644 --- a/Makefile +++ b/Makefile @@ -251,7 +251,7 @@ clean: rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp) rm -rf qapi-generated rm -rf qga/qapi-generated - $(MAKE) -C tests/tcg clean + MAKEFILES=./tests/Makefile $(MAKE) check-clean for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \ if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ rm -f $$d/qemu-options.def; \ diff --git a/configure b/configure index f847ee2..a18e267 100755 --- a/configure +++ b/configure @@ -4163,7 +4163,7 @@ DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas" DIRS="$DIRS roms/seabios roms/vgabios" DIRS="$DIRS qapi-generated" DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" -FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" +FILES="Makefile tests/Makefile tests/tcg/Makefile qdict-test-data.txt" FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile" FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" diff --git a/tests/Makefile b/tests/Makefile index 9bf0765..a286622 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -94,6 +94,7 @@ check-help: @echo " make check-unit Run qobject 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." @@ -148,4 +149,10 @@ check-unit: $(patsubst %,check-%, $(check-unit-y)) check-block: $(patsubst %,check-%, $(check-block-y)) check: check-unit check-qtest +check-clean: + $(MAKE) -C tests/tcg clean + rm -f $(check-unit-y) + rm -f $(check-qtest-i386-y) $(check-qtest-x86_64-y) $(check-qtest-sparc64-y) $(check-qtest-sparc-y) + rm -f tests/*.o + -include $(wildcard tests/*.d)
Currently make clean only clean tests/tcg and hard to extend. This patch added command make check-clean, which clean all generated files used in tests. With this command root Makefile do not care tests clean method any more, it simply calls the command to do it, so any more clean script could be added in tests/Makefile make it easier to extend. Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com> --- Makefile | 2 +- configure | 2 +- tests/Makefile | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-)