]> git.saurik.com Git - apt.git/blame_incremental - test/integration/run-tests
ensure the right permissions as dpkg-deb ensists
[apt.git] / test / integration / run-tests
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4FAIL=0
5PASS=0
6ALL=0
7
8FAILED_TESTS=""
9DIR=$(readlink -f $(dirname $0))
10if [ "$1" = "-q" ]; then
11 export MSGLEVEL=2
12elif [ "$1" = "-v" ]; then
13 export MSGLEVEL=4
14fi
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
24if [ -z "$MSGLEVEL" ]; then
25 MSGLEVEL=5
26fi
27
28for testcase in $(run-parts --list $DIR | grep '/test-'); do
29 if [ "$MSGLEVEL" -le 2 ]; then
30 echo -n "${CTEST}Testcase ${CHIGH}$(basename ${testcase})${CRESET}: "
31 else
32 echo "${CTEST}Run Testcase ${CHIGH}$(basename ${testcase})${CRESET}"
33 fi
34 if ! ${testcase}; then
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))
42 if [ "$MSGLEVEL" -le 2 ]; then
43 echo
44 fi
45done
46
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?'
52fi
53# ensure we don't overflow
54exit $((FAIL <= 255 ? FAIL : 255))