qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: John Snow <jsnow@redhat.com>, pbonzini@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH RFC] tests: Run qtest cases in parallel
Date: Tue, 27 Sep 2016 11:17:41 +0100	[thread overview]
Message-ID: <20160927101741.GK3967@redhat.com> (raw)
In-Reply-To: <20160923075807.GH8832@lemon>

On Fri, Sep 23, 2016 at 03:58:07PM +0800, Fam Zheng wrote:
> 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 <famz@redhat.com>
> > > ---
> > > 
> > > 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. :(

Almost no one will ever build with gcov support, so how about just
making the "normal" case run in parallel and add a special target
for running under gcov which serializes.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  parent reply	other threads:[~2016-09-27 10:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12  9:19 [Qemu-devel] [PATCH RFC] tests: Run qtest cases in parallel Fam Zheng
2016-09-21 18:24 ` John Snow
2016-09-23  7:58   ` Fam Zheng
2016-09-23  9:39     ` Gonglei (Arei)
2016-09-23  9:59       ` Fam Zheng
2016-09-24  2:37         ` Gonglei (Arei)
2016-09-27 10:14         ` Daniel P. Berrange
2016-09-28  1:31           ` Gonglei (Arei)
2016-09-28  1:45             ` Fam Zheng
2016-09-28  1:54               ` Gonglei (Arei)
2016-09-28  2:10                 ` Fam Zheng
2016-09-27 10:17     ` Daniel P. Berrange [this message]
2016-09-27 10:58       ` Fam Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160927101741.GK3967@redhat.com \
    --to=berrange@redhat.com \
    --cc=famz@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).