From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnLNA-0004xe-CA for qemu-devel@nongnu.org; Fri, 23 Sep 2016 03:58:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnLN5-0008SZ-Ck for qemu-devel@nongnu.org; Fri, 23 Sep 2016 03:58:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnLN5-0008SJ-2y for qemu-devel@nongnu.org; Fri, 23 Sep 2016 03:58:11 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 99EAE61E50 for ; Fri, 23 Sep 2016 07:58:09 +0000 (UTC) Date: Fri, 23 Sep 2016 15:58:07 +0800 From: Fam Zheng Message-ID: <20160923075807.GH8832@lemon> References: <1470993574-11906-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH RFC] tests: Run qtest cases in parallel List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: qemu-devel@nongnu.org, pbonzini@redhat.com On Wed, 09/21 14:24, John Snow wrote: > > > On 08/12/2016 05:19 AM, Fam Zheng wrote: > > Previously all test cases in a category, such as check-qtest-y, are > > executed in a single long gtester command. This patch separates each > > test into its own make target to allow better parallism. > > > > Signed-off-by: Fam Zheng > > --- > > > > This saves 50% of the time "make check takes" compared to on master > > (I use -j8). RFC because I'm not sure if the new gcov usage is correct > > with the now much higher level of parallism compared to before. > > --- > > tests/Makefile.include | 34 ++++++++++++++++++---------------- > > 1 file changed, 18 insertions(+), 16 deletions(-) > > > > diff --git a/tests/Makefile.include b/tests/Makefile.include > > index 14be491..9bf0326 100644 > > --- a/tests/Makefile.include > > +++ b/tests/Makefile.include > > @@ -691,27 +691,29 @@ 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) > > + > > +qtest-run-%: tests/% > > $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,) > > - $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ > > + $(call quiet-command,\ > > + $(if $(QTEST_TARGET), \ > > + QTEST_QEMU_BINARY=$(QTEST_TARGET)-softmmu/qemu-system-$(QTEST_TARGET)) \ > > QTEST_QEMU_IMG=qemu-img$(EXESUF) \ > > MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \ > > - gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER $@") > > - $(if $(CONFIG_GCOV),@for f in $(gcov-files-$*-y) $(gcov-files-generic-y); do \ > > - echo Gcov report for $$f:;\ > > - $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \ > > - done,) > > + gtester $< $(GTESTER_OPTIONS) -m=$(SPEED),"GTESTER $<") > > + $(if $(CONFIG_GCOV), @echo Gcov report for $<:;\ > > + $(GCOV) $(GCOV_OPTIONS) $< -o `dirname $<`; \ > > + ) > > + > > +$(foreach target, $(QTEST_TARGETS), \ > > + $(eval check-qtest-$(target): QTEST_TARGET := $(target)) \ > > + $(eval check-qtest-$(target): $(patsubst tests/%, qtest-run-%, \ > > + $(check-qtest-y) \ > > + $(check-qtest-$(target)-y) \ > > + $(check-qtest-generic-y))) \ > > +) > > > > .PHONY: $(patsubst %, check-%, $(check-unit-y)) > > -$(patsubst %, check-%, $(check-unit-y)): check-%: % > > - $(if $(CONFIG_GCOV),@rm -f *.gcda */*.gcda */*/*.gcda */*/*/*.gcda,) > > - $(call quiet-command, \ > > - MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$((RANDOM % 255 + 1))} \ > > - gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER $*") > > - $(if $(CONFIG_GCOV),@for f in $(gcov-files-$(subst tests/,,$*)-y) $(gcov-files-generic-y); do \ > > - echo Gcov report for $$f:;\ > > - $(GCOV) $(GCOV_OPTIONS) $$f -o `dirname $$f`; \ > > - done,) > > +$(patsubst %, check-%, $(check-unit-y)): check-tests/%: qtest-run-% > > > > # gtester tests with XML output > > > > > > I can't vouch for gcov either, but: Too bad that this seems to be too big a hammer that breaks the way gcov was used: 1) the "rm *.gcda" command now runs in each test, so it's harder to get an overall coverage report; 2) there is a risk that the parallism may corrupt those files. :( Fam > > Tested-by: John Snow > > -j1: > > real 1m51.195s > user 1m5.478s > sys 0m21.158s > > -j9: > > real 0m53.039s > user 1m41.754s > sys 0m31.150s > > > This seems useful. > > --js