summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorKarel Zak2007-05-18 15:34:28 +0200
committerKarel Zak2007-05-18 15:34:28 +0200
commit57a917d630b18908ac0b83336b3b0692c5033f9a (patch)
tree5b518b248fb00755b62400585075de42f66e46ee /tests/functions.sh
parenttests: "if [...]" clean up (diff)
downloadkernel-qcow2-util-linux-57a917d630b18908ac0b83336b3b0692c5033f9a.tar.gz
kernel-qcow2-util-linux-57a917d630b18908ac0b83336b3b0692c5033f9a.tar.xz
kernel-qcow2-util-linux-57a917d630b18908ac0b83336b3b0692c5033f9a.zip
tests: add ts_log and --verbose support
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index 001c39f96..24308f696 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -3,6 +3,7 @@ TS_OUTDIR="output"
TS_DIFFDIR="diff"
TS_EXPECTEDDIR="expected"
TS_INPUTDIR="input"
+TS_VERBOSE="no"
function ts_skip {
echo " IGNORE ($1)"
@@ -36,6 +37,11 @@ function ts_ok {
exit 0
}
+function ts_log {
+ echo "$1" >> $TS_OUTPUT
+ [ "$TS_VERBOSE" == "yes" ] && echo "$1"
+}
+
function ts_init {
export LANG="en_US.UTF-8":
TS_NAME=$(basename $0)
@@ -45,6 +51,7 @@ function ts_init {
if [ ! -d $TS_DIFFDIR ]; then
mkdir -p $TS_DIFFDIR
fi
+ [ "$1" == "--verbose" ] && TS_VERBOSE="yes"
TS_OUTPUT="$TS_OUTDIR/$TS_NAME"
TS_DIFF="$TS_DIFFDIR/$TS_NAME"
TS_EXPECTED="$TS_EXPECTEDDIR/$TS_NAME"
@@ -80,7 +87,7 @@ function ts_finalize {
}
function ts_die {
- echo "$1" >> $TS_OUTPUT
+ ts_log "$1"
if [ -n "$2" ] && [ -b "$2" ]; then
ts_device_deinit "$2"
fi