#!/usr/bin/env bash
# do ldns tests
-cd test
+cd test || echo "Must be executed from srcdir" && exit -1
. common.sh
# find tpkg
-if [ -z "$TPKG" -o ! -x "$TPKG" ]
+if [ -z "$TPKG" ] || [ ! -x "$TPKG" ]
then
if [ -x tpkg/tpkg ] ; then TPKG="$(pwd)/tpkg/tpkg"
elif [ -x test/tpkg/tpkg ] ; then TPKG="$(pwd)/test/tpkg/tpkg"
$TPKG -a ../.. fake 01-compile.tpkg
# Works only on FreeBSD really
-if [[ "$is_freebsd" -ne 0 ]]; then
+if [[ "$is_freebsd" -eq 0 ]]; then
$TPKG -a ../.. fake 02-lint.tpkg
fi
if git log HEAD^..HEAD | grep -q 'git:TEST [0-9][0-9]*'
then
- ONLY_TEST=$( ( cd "$BUILD_DIR" ; git log HEAD^..HEAD ) | grep 'git:TEST [0-9][0-9]*' | sed 's/^.*git:TEST \([0-9][0-9]*\).*$/\1/g')
+ ONLY_TEST=$(git log HEAD^..HEAD | grep 'git:TEST [0-9][0-9]*' | sed 's/^.*git:TEST \([0-9][0-9]*\).*$/\1/g')
else
ONLY_TEST=""
fi
for tests in "$BUILD_DIR"/test/*.tpkg
do
TESTFN="$(basename "$tests")"
- TESTNR="$(echo "$TESTFN" | sed 's/-.*$//g')"
+ TESTNR=${TESTNR%-*}
[ -n "$ONLY_TEST" ] && [ x"$ONLY_TEST" != x"$TESTNR" ] && continue
case "$TESTNR" in
[3-5][0-9]*) [ $NO_REGRESSION = 1 ] && continue
$TPKG -b "$BUILD_DIR/test" -a "$BUILD_DIR" exe "$TESTFN"
done
-cd test
-exec $TPKG -n -1 r
\ No newline at end of file
+cd test || echo "Where is the test directory?" && exit 1
+exec "$TPKG" -n -1 r