]> git.saurik.com Git - apt.git/blame - test/integration/run-tests
use our own homedir for gpg in testcases
[apt.git] / test / integration / run-tests
CommitLineData
8d876415
DK
1#!/bin/sh
2set -e
3
adee3bae 4FAIL=0
2b4e2e83 5FAILED_TESTS=""
9962ae93 6DIR=$(readlink -f $(dirname $0))
39cc8228
DK
7if [ "$1" = "-q" ]; then
8 export MSGLEVEL=2
9elif [ "$1" = "-v" ]; then
18331adf 10 export MSGLEVEL=4
39cc8228 11fi
682a3bf7
DK
12
13if 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'
17elif [ -z "${MSGLEVEL}" ]; then
18 export MSGLEVEL=2
19fi
20
fe268128
DK
21if [ -z "$MSGLEVEL" ]; then
22 MSGLEVEL=5
23fi
24
8d876415 25for 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 39done
adee3bae
MV
40
41echo "failures: $FAIL"
2b4e2e83
MV
42if [ -n "$FAILED_TESTS" ]; then
43 echo "Failed tests: $FAILED_TESTS";
44fi
f91bd741
MV
45# ensure we don't overflow
46exit $((FAIL <= 255 ? FAIL : 255))