From: Peter Xu <peterx@redhat.com>
To: qemu-devel@nongnu.org, kvm@vger.kernel.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Andrew Jones" <drjones@redhat.com>,
peterx@redhat.com, "Radim Krčmář" <rkrcmar@redhat.com>
Subject: [Qemu-devel] [kvm-unit-tests PATCH 1/2] run_tests: provide RUNTIME_log_file
Date: Sun, 1 Jan 2017 18:34:45 +0800 [thread overview]
Message-ID: <1483266886-25050-2-git-send-email-peterx@redhat.com> (raw)
In-Reply-To: <1483266886-25050-1-git-send-email-peterx@redhat.com>
Prepare that we may use different log file for different tests in the
future (i.e., to run tests in parallel).
Added another new file (scripts/global.bash) to store future global vars
and function clips.
Signed-off-by: Peter Xu <peterx@redhat.com>
---
run_tests.sh | 13 +++++++------
scripts/functions.bash | 9 +++++++--
scripts/global.bash | 1 +
3 files changed, 15 insertions(+), 8 deletions(-)
create mode 100644 scripts/global.bash
diff --git a/run_tests.sh b/run_tests.sh
index 254129d..a04bfce 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -7,6 +7,7 @@ if [ ! -f config.mak ]; then
exit 1
fi
source config.mak
+source scripts/global.bash
source scripts/functions.bash
function usage()
@@ -46,17 +47,17 @@ while getopts "g:hv" opt; do
esac
done
-RUNTIME_log_stderr () { cat >> test.log; }
+# RUNTIME_log_file will be configured later
+RUNTIME_log_stderr () { cat >> $RUNTIME_log_file; }
RUNTIME_log_stdout () {
if [ "$PRETTY_PRINT_STACKS" = "yes" ]; then
- ./scripts/pretty_print_stacks.py $1 >> test.log
+ ./scripts/pretty_print_stacks.py $1 >> $RUNTIME_log_file
else
- cat >> test.log
+ cat >> $RUNTIME_log_file
fi
}
-
config=$TEST_DIR/unittests.cfg
-rm -f test.log
-printf "BUILD_HEAD=$(cat build-head)\n\n" > test.log
+rm -f $ut_default_log_file
+printf "BUILD_HEAD=$(cat build-head)\n\n" > $ut_default_log_file
for_each_unittest $config run
diff --git a/scripts/functions.bash b/scripts/functions.bash
index ee9143c..90daed4 100644
--- a/scripts/functions.bash
+++ b/scripts/functions.bash
@@ -1,3 +1,8 @@
+function run_task()
+{
+ RUNTIME_log_file=$ut_default_log_file
+ "$@"
+}
function for_each_unittest()
{
@@ -17,7 +22,7 @@ function for_each_unittest()
while read -u $fd line; do
if [[ "$line" =~ ^\[(.*)\]$ ]]; then
- "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+ run_task "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
testname=${BASH_REMATCH[1]}
smp=1
kernel=""
@@ -45,6 +50,6 @@ function for_each_unittest()
timeout=${BASH_REMATCH[1]}
fi
done
- "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
+ run_task "$cmd" "$testname" "$groups" "$smp" "$kernel" "$opts" "$arch" "$check" "$accel" "$timeout"
exec {fd}<&-
}
diff --git a/scripts/global.bash b/scripts/global.bash
new file mode 100644
index 0000000..9076785
--- /dev/null
+++ b/scripts/global.bash
@@ -0,0 +1 @@
+: ${ut_default_log_file:=test.log}
--
2.7.4
next prev parent reply other threads:[~2017-01-01 10:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-01 10:34 [Qemu-devel] [kvm-unit-tests PATCH 0/2] run_tests: support concurrent test execution Peter Xu
2017-01-01 10:34 ` Peter Xu [this message]
2017-01-01 10:34 ` [Qemu-devel] [kvm-unit-tests PATCH 2/2] run_tests: allow run tests in parallel Peter Xu
2017-01-02 20:18 ` Radim Krčmář
2017-01-03 2:45 ` Peter Xu
2017-01-04 14:55 ` Radim Krčmář
2017-01-05 2:35 ` Peter Xu
2017-01-05 20:31 ` Radim Krčmář
2017-01-02 17:07 ` [Qemu-devel] [kvm-unit-tests PATCH 0/2] run_tests: support concurrent test execution Paolo Bonzini
2017-01-02 20:25 ` Radim Krčmář
2017-01-03 2:50 ` Peter Xu
2017-01-03 3:03 ` Peter Xu
2017-01-03 9:31 ` 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=1483266886-25050-2-git-send-email-peterx@redhat.com \
--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 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).