1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
#!/bin/sh
set -e
# This is a basic test runner for shell script tests
# it just searches for all test_ scripts under the tests
# folder, and run them.
echo "Running shell script unit tests..."
CURDIR=$(pwd)
SUCCESS=yes
CNT=0
for i in $(find tests -type f -iname 'test_*') ; do
DIRNAME=$(dirname $i)
BASENAME=$(basename $i)
cd ${DIRNAME}
echo -n $i" ... "
if ./${BASENAME} ; then
echo "OK"
else
SUCCESS=no
echo "FAILED"
fi
cd ${CURDIR}
CNT=$(( ${CNT} + 1 ))
done
if [ "${SUCCESS}" = "yes" ] ; then
echo "Successfully ran ${CNT} tests :)"
exit 0
else
echo "Failure while running unit tests :("
exit 1
fi
|