From: Peter Xu <peterx@redhat.com>
To: Andrew Jones <drjones@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>
Subject: Re: [Qemu-devel] [kvm-unit-tests PATCH v3 2/2] run_tests: allow run tests in parallel
Date: Mon, 9 Jan 2017 11:47:31 +0800 [thread overview]
Message-ID: <20170109034731.GG4135@pxdev.xzpeter.org> (raw)
In-Reply-To: <20170106144041.3ruyijfgwlpqpfei@kamzik.brq.redhat.com>
On Fri, Jan 06, 2017 at 03:40:41PM +0100, Andrew Jones wrote:
> On Fri, Jan 06, 2017 at 11:33:01AM +0800, Peter Xu wrote:
> > run_task.sh is getting slow. This patch is trying to make it faster by
> > running the tests concurrently.
> >
> > We provide a new parameter "-j" for the run_tests.sh, which can be used
> > to specify how many run queues we want for the tests. Default queue
> > length is 1, which is the old behavior.
> >
> > Quick test on my laptop (4 cores, 2 threads each) shows 3x speed boost:
> >
> > |-----------------+-----------|
> > | command | time used |
> > |-----------------+-----------|
> > | run_test.sh | 75s |
> > | run_test.sh -j8 | 27s |
> > |-----------------+-----------|
> >
> > Suggested-by: Radim Krčmář <rkrcmar@redhat.com>
>
> Radim suggested how to implement this, but not the idea of implementing
> it. The suggested-by tag is for ideas, not the code, and the idea (which
> is a good one) was yours, not Radim's. So the above tag should be removed.
> It's hard to credit Radim for his help here. Adding a signed-off-by to
> indicate co-authorship is probably the best you can do. Of course he's
> the maintainer and will add that when he merges anyway though...
I see, thanks for the clarification. Then let me remove this line.
>
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > run_tests.sh | 12 ++++++++++--
> > scripts/functions.bash | 17 ++++++++++++++++-
> > scripts/global.bash | 11 +++++++++++
> > 3 files changed, 37 insertions(+), 3 deletions(-)
> >
> > diff --git a/run_tests.sh b/run_tests.sh
> > index e1bb3a6..a4fc895 100755
> > --- a/run_tests.sh
> > +++ b/run_tests.sh
> > @@ -14,10 +14,11 @@ function usage()
> > {
> > cat <<EOF
> >
> > -Usage: $0 [-g group] [-h] [-v]
> > +Usage: $0 [-g group] [-h] [-v] [-j N]
>
> s/N/num_run_queues/
Sure.
[...]
> > @@ -38,6 +39,13 @@ while getopts "g:hv" opt; do
> > usage
> > exit
> > ;;
> > + j)
> > + ut_run_queues=$OPTARG
> > + if ! is_number "$ut_run_queues"; then
> > + echo "Invalid -j option: $ut_run_queues"
> > + exit 1
> > + fi
>
> Instead of adding is_number() and just checking for numeric
> input, I'd check the input is > 0. A string input resolves
> as zero when treated as a number, so it'll fail too.
Wasn't familiar with shell arithmetic before. Your suggestion is much
simpler, thanks.
>
> > + ;;
> > v)
> > verbose="yes"
> > ;;
> > diff --git a/scripts/functions.bash b/scripts/functions.bash
> > index d1d2e1c..c6281f4 100644
> > --- a/scripts/functions.bash
> > +++ b/scripts/functions.bash
> > @@ -1,9 +1,18 @@
> > +source scripts/global.bash
> > +
> > function run_task()
> > {
> > local testname="$2"
> >
> > + while [[ "$(jobs | wc -l)" == $ut_run_queues ]]; do
>
> Bash arithmetic expressions should use (( ... )) instead
> of [[ ... ]]
Will do.
[...]
> > diff --git a/scripts/global.bash b/scripts/global.bash
> > index 77b0b29..52095bd 100644
> > --- a/scripts/global.bash
> > +++ b/scripts/global.bash
> > @@ -1,2 +1,13 @@
> > : ${ut_log_dir:=logs}
> > : ${ut_log_summary:=${ut_log_dir}/SUMMARY}
> > +: ${ut_run_queues:=1}
> > +
> > +function ut_in_parallel()
> > +{
> > + [[ $ut_run_queues != 1 ]]
> > +}
>
> I don't see any users of ut_in_parallel. Anyway I'd drop it
> and open code the condition, with ((...)), when needed.
Yes, it should be removed.
Thanks!
-- peterx
prev parent reply other threads:[~2017-01-09 3:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-06 3:32 [kvm-unit-tests PATCH v3 0/2] run_tests: support concurrent test execution Peter Xu
2017-01-06 3:32 ` [Qemu-devel] " Peter Xu
2017-01-06 3:33 ` [kvm-unit-tests PATCH v3 1/2] run_tests: put logs into per-test file Peter Xu
2017-01-06 3:33 ` [Qemu-devel] " Peter Xu
2017-01-06 13:51 ` Andrew Jones
2017-01-09 3:13 ` Peter Xu
2017-01-06 3:33 ` [kvm-unit-tests PATCH v3 2/2] run_tests: allow run tests in parallel Peter Xu
2017-01-06 3:33 ` [Qemu-devel] " Peter Xu
2017-01-06 14:40 ` Andrew Jones
2017-01-06 14:40 ` [Qemu-devel] " Andrew Jones
2017-01-09 3:47 ` Peter Xu [this message]
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=20170109034731.GG4135@pxdev.xzpeter.org \
--to=peterx@redhat.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.