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
# A basic test runner for shell script tests:
# searches all test-* scripts under the test
# folder, and run them.
echo "Running shell script unit tests..."
CURDIR=$(pwd)
SUCCESS=yes
CNT=0
for i in $(find test -type f -iname 'test-*' | grep -v -E "^test/test-mic\$|^test/test-growpart\$|^test/test-growpart-lvm\$") ; 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
|