diff mbox

How to add qemu-system-$(target) as a dependency for qtests

Message ID 52712F36.5060102@redhat.com
State New
Headers show

Commit Message

Paolo Bonzini Oct. 30, 2013, 4:09 p.m. UTC
Il 30/10/2013 16:07, Stefan Hajnoczi ha scritto:
> I came across this little tests/Makefile annoyance:
> If you modify QEMU code and then run "make check" it will not rebuild QEMU.
> 
> This can be confusing during development when you expect changing the
> code and rerunning the tests to pass :).
> 
> I played with tests/Makefile but was unable to add the right
> dependency.  We need something that makes all libqtest tests depend on
> $(TARGET)-softmmu/qemu-system-$(TARGET) at "make check" time.
> 
> This way QEMU gets rebuilt if "make check" will execute the QEMU binary.
> 
> Any ideas?

Does this work?

Comments

Stefan Hajnoczi Oct. 31, 2013, 12:30 p.m. UTC | #1
On Wed, Oct 30, 2013 at 05:09:26PM +0100, Paolo Bonzini wrote:
> Il 30/10/2013 16:07, Stefan Hajnoczi ha scritto:
> > I came across this little tests/Makefile annoyance:
> > If you modify QEMU code and then run "make check" it will not rebuild QEMU.
> > 
> > This can be confusing during development when you expect changing the
> > code and rerunning the tests to pass :).
> > 
> > I played with tests/Makefile but was unable to add the right
> > dependency.  We need something that makes all libqtest tests depend on
> > $(TARGET)-softmmu/qemu-system-$(TARGET) at "make check" time.
> > 
> > This way QEMU gets rebuilt if "make check" will execute the QEMU binary.
> > 
> > Any ideas?
> 
> Does this work?
> 
> diff --git a/tests/Makefile b/tests/Makefile
> index fa4c9f0..f3f78ee 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -212,7 +212,7 @@ GCOV_OPTIONS = -n $(if $(V),-f,)
>  # gtester tests, possibly with verbose output
>  
>  .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
> -$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
> +$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y) subdir-%-softmmu
>  	$(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
>  	$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
>  		MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \

Yes, it does!

Yesterday I tried the same approach with "%-softmmu/qemu-system-%".  The
'%' is only expanded once so it failed.

Stefan
diff mbox

Patch

diff --git a/tests/Makefile b/tests/Makefile
index fa4c9f0..f3f78ee 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -212,7 +212,7 @@  GCOV_OPTIONS = -n $(if $(V),-f,)
 # gtester tests, possibly with verbose output
 
 .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS))
-$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y)
+$(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: $(check-qtest-y) subdir-%-softmmu
 	$(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,)
 	$(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \
 		MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \