From: Peter Xu <peterx@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>,
Andrew Jones <drjones@redhat.com>
Subject: Re: [kvm-unit-tests PATCH 2/2] run_tests: allow run tests in parallel
Date: Tue, 3 Jan 2017 10:45:01 +0800 [thread overview]
Message-ID: <20170103024501.GA22664@pxdev.xzpeter.org> (raw)
In-Reply-To: <20170102201824.GA2892@potion>
On Mon, Jan 02, 2017 at 09:18:24PM +0100, Radim Krčmář wrote:
> 2017-01-01 18:34+0800, Peter Xu:
> > run_task.sh is getting slow. This patch is trying to make it faster by
> > running the tests concurrently.
> >
> > First of all, 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.
> > When "-j" is not provided, we'll keep the old behavior.
> >
> > When the tests are running concurrently, we will use seperate log file
> > for each test case (currently located in logs/ dir, with name
> > test.TESTNAME.log), to avoid test logs messing up with each other.
> >
> > A quick test on my laptop (x86 with 4 cores and 2 threads, so 8
> > processors) shows 3x improvement on overall test time:
> >
> > |-----------------+-----------|
> > | command | time used |
> > |-----------------+-----------|
> > | run_test.sh | 75s |
> > | run_test.sh -j8 | 27s |
> > |-----------------+-----------|
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > diff --git a/scripts/functions.bash b/scripts/functions.bash
> > @@ -1,7 +1,18 @@
> > +source scripts/global.bash
> > +source scripts/task.bash
> > +
> > function run_task()
> > {
> > - RUNTIME_log_file=$ut_default_log_file
> > - "$@"
> > + local testname="$2"
> > +
> > + if ut_in_parallel; then
> > + RUNTIME_log_file="${ut_log_dir}/test.${testname}.log"
>
> No need for the "test." prefix.
>
> I would do this change regardless of ut_in_parallel. Having output of
> all tests in one file just wasted time when most usecases were to find a
> specific failed test.
>
> > + # run in background
> > + task_enqueue "$@"
>
> Couldn't the queue be much simpler ...
>
> > + else
> > + RUNTIME_log_file=$ut_default_log_file
> > + "$@"
> > + fi
> > }
> >
> > function for_each_unittest()
> > @@ -51,5 +62,10 @@ function for_each_unittest()
> > fi
> > done
>
> ... like this:
>
> while [ "`jobs | wc -l`" -gt $ut_run_queues ]; do
> wait
I suppose you mean "wait -n" here? And also a "if" should suffice
here, though a "while" won't hurt as well.
> done
> run_task "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" &
I think this might work, however it has assumption that these $cmd
tasks are the only jobs that is running in the background.
I didn't notice the "-n" parameter for "wait", otherwise I won't
bother using SIGUSR1 at all. :)
Thanks,
-- peterx
WARNING: multiple messages have this Message-ID (diff)
From: Peter Xu <peterx@redhat.com>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
Paolo Bonzini <pbonzini@redhat.com>,
Andrew Jones <drjones@redhat.com>
Subject: Re: [Qemu-devel] [kvm-unit-tests PATCH 2/2] run_tests: allow run tests in parallel
Date: Tue, 3 Jan 2017 10:45:01 +0800 [thread overview]
Message-ID: <20170103024501.GA22664@pxdev.xzpeter.org> (raw)
In-Reply-To: <20170102201824.GA2892@potion>
On Mon, Jan 02, 2017 at 09:18:24PM +0100, Radim Krčmář wrote:
> 2017-01-01 18:34+0800, Peter Xu:
> > run_task.sh is getting slow. This patch is trying to make it faster by
> > running the tests concurrently.
> >
> > First of all, 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.
> > When "-j" is not provided, we'll keep the old behavior.
> >
> > When the tests are running concurrently, we will use seperate log file
> > for each test case (currently located in logs/ dir, with name
> > test.TESTNAME.log), to avoid test logs messing up with each other.
> >
> > A quick test on my laptop (x86 with 4 cores and 2 threads, so 8
> > processors) shows 3x improvement on overall test time:
> >
> > |-----------------+-----------|
> > | command | time used |
> > |-----------------+-----------|
> > | run_test.sh | 75s |
> > | run_test.sh -j8 | 27s |
> > |-----------------+-----------|
> >
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> > diff --git a/scripts/functions.bash b/scripts/functions.bash
> > @@ -1,7 +1,18 @@
> > +source scripts/global.bash
> > +source scripts/task.bash
> > +
> > function run_task()
> > {
> > - RUNTIME_log_file=$ut_default_log_file
> > - "$@"
> > + local testname="$2"
> > +
> > + if ut_in_parallel; then
> > + RUNTIME_log_file="${ut_log_dir}/test.${testname}.log"
>
> No need for the "test." prefix.
>
> I would do this change regardless of ut_in_parallel. Having output of
> all tests in one file just wasted time when most usecases were to find a
> specific failed test.
>
> > + # run in background
> > + task_enqueue "$@"
>
> Couldn't the queue be much simpler ...
>
> > + else
> > + RUNTIME_log_file=$ut_default_log_file
> > + "$@"
> > + fi
> > }
> >
> > function for_each_unittest()
> > @@ -51,5 +62,10 @@ function for_each_unittest()
> > fi
> > done
>
> ... like this:
>
> while [ "`jobs | wc -l`" -gt $ut_run_queues ]; do
> wait
I suppose you mean "wait -n" here? And also a "if" should suffice
here, though a "while" won't hurt as well.
> done
> run_task "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout" &
I think this might work, however it has assumption that these $cmd
tasks are the only jobs that is running in the background.
I didn't notice the "-n" parameter for "wait", otherwise I won't
bother using SIGUSR1 at all. :)
Thanks,
-- peterx
next prev parent reply other threads:[~2017-01-03 2:45 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-01 10:34 [kvm-unit-tests PATCH 0/2] run_tests: support concurrent test execution Peter Xu
2017-01-01 10:34 ` [Qemu-devel] " Peter Xu
2017-01-01 10:34 ` [kvm-unit-tests PATCH 1/2] run_tests: provide RUNTIME_log_file Peter Xu
2017-01-01 10:34 ` [Qemu-devel] " Peter Xu
2017-01-01 10:34 ` [kvm-unit-tests PATCH 2/2] run_tests: allow run tests in parallel Peter Xu
2017-01-01 10:34 ` [Qemu-devel] " Peter Xu
2017-01-02 20:18 ` Radim Krčmář
2017-01-02 20:18 ` [Qemu-devel] " Radim Krčmář
2017-01-03 2:45 ` Peter Xu [this message]
2017-01-03 2:45 ` Peter Xu
2017-01-04 14:55 ` Radim Krčmář
2017-01-04 14:55 ` [Qemu-devel] " Radim Krčmář
2017-01-05 2:35 ` Peter Xu
2017-01-05 2:35 ` [Qemu-devel] " Peter Xu
2017-01-05 20:31 ` Radim Krčmář
2017-01-05 20:31 ` [Qemu-devel] " Radim Krčmář
2017-01-02 17:07 ` [kvm-unit-tests PATCH 0/2] run_tests: support concurrent test execution Paolo Bonzini
2017-01-02 17:07 ` [Qemu-devel] " Paolo Bonzini
2017-01-02 20:25 ` Radim Krčmář
2017-01-02 20:25 ` [Qemu-devel] " Radim Krčmář
2017-01-03 2:50 ` Peter Xu
2017-01-03 2:50 ` [Qemu-devel] " Peter Xu
2017-01-03 3:03 ` Peter Xu
2017-01-03 3:03 ` [Qemu-devel] " Peter Xu
2017-01-03 9:31 ` Paolo Bonzini
2017-01-03 9:31 ` [Qemu-devel] " Paolo Bonzini
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=20170103024501.GA22664@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.