diff options
author | Rob Landley <rob@landley.net> | 2019-03-10 18:17:16 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2019-03-10 18:17:16 -0500 |
commit | fe12fb5146a8e6ad9a873a700aa6f7c01adf3064 (patch) | |
tree | 51e090b2466b2adf155feb0ba2aa268a1e4a0aeb /scripts | |
parent | bfd80bec14954ce2457d33dd4ce78903681c7a3a (diff) | |
download | toybox-fe12fb5146a8e6ad9a873a700aa6f7c01adf3064.tar.gz |
Do a rm -rf of testdir between each command so debris files don't accumulate.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/test.sh | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/scripts/test.sh b/scripts/test.sh index a31021c6..ea58f56f 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -23,7 +23,7 @@ fi cd generated/testdir PATH="$PWD:$PATH" -cd testdir +TESTDIR="$PWD" export LC_COLLATE=C [ -f "$TOPDIR/generated/config.h" ] && @@ -31,20 +31,17 @@ export LC_COLLATE=C do_test() { + cd "$TESTDIR" && rm -rf testdir && mkdir testdir && cd testdir || exit 1 CMDNAME="${1##*/}" CMDNAME="${CMDNAME%.test}" + C="$CMDNAME" if [ -z "$TEST_HOST" ] then - [ -z "$2" ] && C="$(readlink -f ../$CMDNAME)" || C="$(which $CMDNAME)" - else - C="$CMDNAME" - fi - if [ ! -z "$C" ] - then - . "$1" - else - echo "$CMDNAME disabled" + C="$TESTDIR/$CMDNAME" + [ ! -e "$C" ] && echo "$CMDNAME disabled" && return fi + + . "$1" } if [ $# -ne 0 ] @@ -57,13 +54,6 @@ else for i in "$TOPDIR"/tests/*.test do [ -z "$TEST_ALL" ] && [ ! -x "$i" ] && continue - if [ -z "$TEST_HOST" ] - then - do_test "$i" 1 - else - rm -rf testdir && mkdir testdir && cd testdir || exit 1 - do_test "$i" - cd .. - fi + do_test "$i" done fi |