]>
Commit | Line | Data |
---|---|---|
8d876415 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
adee3bae | 4 | FAIL=0 |
2b4e2e83 | 5 | FAILED_TESTS="" |
9962ae93 | 6 | DIR=$(readlink -f $(dirname $0)) |
39cc8228 DK |
7 | if [ "$1" = "-q" ]; then |
8 | export MSGLEVEL=2 | |
9 | elif [ "$1" = "-v" ]; then | |
18331adf | 10 | export MSGLEVEL=4 |
39cc8228 | 11 | fi |
682a3bf7 DK |
12 | |
13 | if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then | |
14 | CTEST='\033[1;32m' | |
15 | CHIGH='\033[1;35m' | |
16 | CRESET='\033[0m' | |
17 | elif [ -z "${MSGLEVEL}" ]; then | |
18 | export MSGLEVEL=2 | |
19 | fi | |
20 | ||
fe268128 DK |
21 | if [ -z "$MSGLEVEL" ]; then |
22 | MSGLEVEL=5 | |
23 | fi | |
24 | ||
8d876415 | 25 | for testcase in $(run-parts --list $DIR | grep '/test-'); do |
682a3bf7 DK |
26 | if [ "$MSGLEVEL" -le 2 ]; then |
27 | echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: " | |
39cc8228 | 28 | else |
682a3bf7 | 29 | echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}" |
39cc8228 | 30 | fi |
adee3bae MV |
31 | if ! ${testcase}; then |
32 | FAIL=$((FAIL+1)) | |
2b4e2e83 | 33 | FAILED_TESTS="$FAILED_TESTS $(basename $testcase)" |
adee3bae MV |
34 | echo "$(basename $testcase) ... FAIL" |
35 | fi | |
682a3bf7 | 36 | if [ "$MSGLEVEL" -le 2 ]; then |
39cc8228 DK |
37 | echo |
38 | fi | |
8d876415 | 39 | done |
adee3bae MV |
40 | |
41 | echo "failures: $FAIL" | |
2b4e2e83 MV |
42 | if [ -n "$FAILED_TESTS" ]; then |
43 | echo "Failed tests: $FAILED_TESTS"; | |
44 | fi | |
f91bd741 MV |
45 | # ensure we don't overflow |
46 | exit $((FAIL <= 255 ? FAIL : 255)) |