summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorKarel Zak2007-06-11 14:45:32 +0200
committerKarel Zak2007-06-11 14:45:32 +0200
commit1d9acab1c14a4464a757dbd5d68a1bf1dca117b2 (patch)
tree01ee619146c1bc907775381ef08be7c88e6931e2 /tests/functions.sh
parentdocs: clean up TODO file and add a new resuest for 2.14 (diff)
downloadkernel-qcow2-util-linux-1d9acab1c14a4464a757dbd5d68a1bf1dca117b2.tar.gz
kernel-qcow2-util-linux-1d9acab1c14a4464a757dbd5d68a1bf1dca117b2.tar.xz
kernel-qcow2-util-linux-1d9acab1c14a4464a757dbd5d68a1bf1dca117b2.zip
tests: pass all arguments to ts_init, add ts_has_option function
This patch: - replaces "$1" with "$*" for ts_init function - add ts_has_option function - removes some tailing white-spaces 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 ed435092c..a33b885bc 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -42,6 +42,12 @@ function ts_log {
[ "$TS_VERBOSE" == "yes" ] && echo "$1"
}
+function ts_has_option {
+ NAME="$1"
+ ALL="$2"
+ echo -n $ALL | sed 's/ //g' | gawk 'BEGIN { FS="="; RS="--" } /('$NAME'$|'$NAME'=)/ { print "yes" }'
+}
+
function ts_init {
export LANG="en_US.UTF-8":
TS_NAME=$(basename $0)
@@ -51,7 +57,8 @@ function ts_init {
if [ ! -d $TS_DIFFDIR ]; then
mkdir -p $TS_DIFFDIR
fi
- [ "$1" == "--verbose" ] && TS_VERBOSE="yes"
+
+ TS_VERBOSE=$( ts_has_option "verbose" "$*")
TS_OUTPUT="$TS_OUTDIR/$TS_NAME"
TS_DIFF="$TS_DIFFDIR/$TS_NAME"
TS_EXPECTED="$TS_EXPECTEDDIR/$TS_NAME"