#!/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