]> git.saurik.com Git - apt.git/blob - test/integration/run-tests
merged from the debian-wheezy branch
[apt.git] / test / integration / run-tests
1 #!/bin/sh
2 set -e
3
4 FAIL=0
5 DIR=$(readlink -f $(dirname $0))
6 if [ "$1" = "-q" ]; then
7 export MSGLEVEL=2
8 elif [ "$1" = "-v" ]; then
9 export MSGLEVEL=4
10 fi
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
20 if [ -z "$MSGLEVEL" ]; then
21 MSGLEVEL=5
22 fi
23
24 for testcase in $(run-parts --list $DIR | grep '/test-'); do
25 if [ "$MSGLEVEL" -le 2 ]; then
26 echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: "
27 else
28 echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}"
29 fi
30 if ! ${testcase}; then
31 FAIL=$((FAIL+1))
32 echo "$(basename $testcase) ... FAIL"
33 fi
34 if [ "$MSGLEVEL" -le 2 ]; then
35 echo
36 fi
37 done
38
39 echo "failures: $FAIL"
40 # ensure we don't overflow
41 exit $((FAIL <= 255 ? FAIL : 255))