]> git.saurik.com Git - apt.git/blame - test/integration/run-tests
ensure the right permissions as dpkg-deb ensists
[apt.git] / test / integration / run-tests
CommitLineData
8d876415
DK
1#!/bin/sh
2set -e
3
adee3bae 4FAIL=0
0954c58e
DK
5PASS=0
6ALL=0
7
2b4e2e83 8FAILED_TESTS=""
9962ae93 9DIR=$(readlink -f $(dirname $0))
39cc8228
DK
10if [ "$1" = "-q" ]; then
11 export MSGLEVEL=2
12elif [ "$1" = "-v" ]; then
18331adf 13 export MSGLEVEL=4
39cc8228 14fi
682a3bf7
DK
15
16if expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then
17 CTEST='\033[1;32m'
18 CHIGH='\033[1;35m'
19 CRESET='\033[0m'
20elif [ -z "${MSGLEVEL}" ]; then
21 export MSGLEVEL=2
22fi
23
fe268128
DK
24if [ -z "$MSGLEVEL" ]; then
25 MSGLEVEL=5
26fi
27
8d876415 28for testcase in $(run-parts --list $DIR | grep '/test-'); do
682a3bf7
DK
29 if [ "$MSGLEVEL" -le 2 ]; then
30 echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: "
39cc8228 31 else
682a3bf7 32 echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}"
39cc8228 33 fi
adee3bae 34 if ! ${testcase}; then
0954c58e
DK
35 FAIL=$((FAIL+1))
36 FAILED_TESTS="$FAILED_TESTS $(basename $testcase)"
37 echo >&2 "$(basename $testcase) ... FAIL"
38 else
39 PASS=$((PASS+1))
40 fi
41 ALL=$((ALL+1))
682a3bf7 42 if [ "$MSGLEVEL" -le 2 ]; then
39cc8228
DK
43 echo
44 fi
8d876415 45done
adee3bae 46
0954c58e
DK
47echo >&2 "Statistics: $ALL tests were run: $PASS successfully and $FAIL failed"
48if [ -n "$FAILED_TESTS" ]; then
49 echo >&2 "Failed tests: $FAILED_TESTS"
50else
51 echo >&2 'All tests seem to have been run successfully. What could possibly go wrong?'
2b4e2e83 52fi
f91bd741
MV
53# ensure we don't overflow
54exit $((FAIL <= 255 ? FAIL : 255))