]> git.saurik.com Git - apt.git/blame - test/integration/run-tests
merged lp:~mvo/apt/add-missing-dsc-hashes
[apt.git] / test / integration / run-tests
CommitLineData
8d876415
DK
1#!/bin/sh
2set -e
3
adee3bae 4FAIL=0
9962ae93 5DIR=$(readlink -f $(dirname $0))
39cc8228
DK
6if [ "$1" = "-q" ]; then
7 export MSGLEVEL=2
8elif [ "$1" = "-v" ]; then
18331adf 9 export MSGLEVEL=4
39cc8228 10fi
682a3bf7
DK
11
12if 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'
16elif [ -z "${MSGLEVEL}" ]; then
17 export MSGLEVEL=2
18fi
19
fe268128
DK
20if [ -z "$MSGLEVEL" ]; then
21 MSGLEVEL=5
22fi
23
8d876415 24for 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 37done
adee3bae
MV
38
39echo "failures: $FAIL"
f91bd741
MV
40# ensure we don't overflow
41exit $((FAIL <= 255 ? FAIL : 255))