diff options
author | Karel Zak | 2011-11-03 13:20:24 +0100 |
---|---|---|
committer | Karel Zak | 2011-11-03 13:20:24 +0100 |
commit | 949cf64bbc4febc35a254a132dabaaeb9e0e0fbe (patch) | |
tree | a4beafb0a6322bf3c5c2aef0903d8a445b273fb2 /tests/run.sh | |
parent | build-sys: fix libuuid initialization (diff) | |
download | kernel-qcow2-util-linux-949cf64bbc4febc35a254a132dabaaeb9e0e0fbe.tar.gz kernel-qcow2-util-linux-949cf64bbc4febc35a254a132dabaaeb9e0e0fbe.tar.xz kernel-qcow2-util-linux-949cf64bbc4febc35a254a132dabaaeb9e0e0fbe.zip |
tests: fix options evaluation, add support for optional tests
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/run.sh')
-rwxr-xr-x | tests/run.sh | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/tests/run.sh b/tests/run.sh index d7aa7ddcc..f1ec3328a 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -17,21 +17,44 @@ # TS_TOPDIR=$(cd $(dirname $0) && pwd) -comps=$(find $TS_TOPDIR/ts/ -type f -perm /a+x -regex ".*/[^\.~]*" | sort) - -if [ -n "$1" ]; then - if [ -d "$TS_TOPDIR/ts/$1" ]; then - comps=$(find $TS_TOPDIR/ts/$1 -type f -perm /a+x -regex ".*/[^\.~]*" | sort) - else - echo - echo "usage: $0 [<component>]" - echo "supported components:" - for ts in $comps; do - echo -e "\t$(basename $(dirname $ts))" - done | sort -u - echo +SUBTESTS= +OPTS= + +while [ -n "$1" ]; do + case "$1" in + --force) + OPTS="$OPTS --force" + ;; + --fake) + OPTS="$OPTS --fake" + ;; + --*) + echo "Unknown option $1" + echo "Usage: run [--fake] [--force] [<component> ...]" exit 1 - fi + ;; + + *) + SUBTESTS="$SUBTESTS $1" + ;; + esac + shift +done + +if [ -n "$SUBTESTS" ]; then + # selected tests only + for s in $SUBTESTS; do + if [ -d "$TS_TOPDIR/ts/$s" ]; then + co=$(find $TS_TOPDIR/ts/$s -type f -perm /a+x -regex ".*/[^\.~]*" | sort) + comps="$comps $co" + else + echo "Unknown test component '$s'" + exit 1 + fi + done +else + # all tests + comps=$(find $TS_TOPDIR/ts/ -type f -perm /a+x -regex ".*/[^\.~]*" | sort) fi echo @@ -44,7 +67,7 @@ echo res=0 count=0 for ts in $comps; do - $ts "$1" + $ts "$OPTS" res=$(( $res + $? )) count=$(( $count + 1 )) done |