@@ -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
@@ -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}<&-
}
new file mode 100644
@@ -0,0 +1 @@
+: ${ut_default_log_file:=test.log}
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