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