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