add apt-key support for armored GPG key files (*.asc)
[apt.git] / test / integration / run-tests
index e90b4b7558eb13c3b45d04cc5b968fb0c6b9575e..7c0b74ce238921af56cc7258970d49604f699bad 100755 (executable)
@@ -1,16 +1,12 @@
 #!/bin/sh
 #!/bin/sh
-
-TESTDIR="$(readlink -f "$(dirname "$0")")"
-. "$TESTDIR/framework"
-
-find_project_binary_dir
-
 set -e
 
 TESTTORUN=''
 while [ -n "$1" ]; do
        if [ "$1" = "-q" ]; then
                export MSGLEVEL=2
 set -e
 
 TESTTORUN=''
 while [ -n "$1" ]; do
        if [ "$1" = "-q" ]; then
                export MSGLEVEL=2
+       elif [ "$1" = "-qq" ]; then
+               export MSGLEVEL=1
        elif [ "$1" = "-v" ]; then
                export MSGLEVEL=4
        elif [ "$1" = '--color=no' ]; then
        elif [ "$1" = "-v" ]; then
                export MSGLEVEL=4
        elif [ "$1" = '--color=no' ]; then
@@ -56,7 +52,9 @@ if [ -n "$TESTTORUN" ]; then
        CURRENTTRAP="rm -f \"$OUTPUT\"; $CURRENTTRAP"
        trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
        {
        CURRENTTRAP="rm -f \"$OUTPUT\"; $CURRENTTRAP"
        trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
        {
-               if [ "$MSGLEVEL" -le 2 ]; then
+               if [ "$MSGLEVEL" -le 1 ]; then
+                       printf "${TESTTORUN##*/}"
+               elif [ "$MSGLEVEL" -le 2 ]; then
                        printf "${CTEST}Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}: "
                else
                        printf "${CTEST}Run Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}\n"
                        printf "${CTEST}Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}: "
                else
                        printf "${CTEST}Run Testcase ${CHIGH}${TESTTORUN##*/}${CRESET}\n"
@@ -64,12 +62,20 @@ if [ -n "$TESTTORUN" ]; then
                if ! "$TESTTORUN"; then
                        FAIL='yes'
                        if [ "$MSGLEVEL" -le 2 ]; then
                if ! "$TESTTORUN"; then
                        FAIL='yes'
                        if [ "$MSGLEVEL" -le 2 ]; then
+                               printf >&2 "\n${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}\n"
+                       elif [ "$MSGLEVEL" -le 2 ]; then
                                printf >&2 "\n${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}"
                        else
                                echo >&2 "${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}"
                        fi
                                printf >&2 "\n${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}"
                        else
                                echo >&2 "${CHIGH}Running ${TESTTORUN##*/} -> FAILED${CRESET}"
                        fi
+               else
+                       if [ "$MSGLEVEL" -le 1 ]; then
+                               printf " "
+                       fi
                fi
                fi
-               if [ "$MSGLEVEL" -le 2 ]; then
+               if [ "$MSGLEVEL" -le 1 ]; then
+                       :
+               elif [ "$MSGLEVEL" -le 2 ]; then
                        echo
                fi
        } >"$OUTPUT" 2>&1
                        echo
                fi
        } >"$OUTPUT" 2>&1
@@ -95,11 +101,20 @@ if [ -n "$APT_TEST_JOBS" ]; then
        if [ "$MSGCOLOR" != 'NO' ]; then
                export MSGCOLOR='ALWAYS'
        fi
        if [ "$MSGCOLOR" != 'NO' ]; then
                export MSGCOLOR='ALWAYS'
        fi
-       exec parallel -j "$APT_TEST_JOBS" "./$(basename "$0")" -- $(echo "$TESTLIST")
+       parallel=parallel
+       if command -v moreutils-parallel >/dev/null 2>&1; then
+               parallel=moreutils-parallel
+       fi
+       exec $parallel -j "$APT_TEST_JOBS" "./$(basename "$0")" -- $(echo "$TESTLIST")
 fi
 TOTAL="$(echo "$TESTLIST" | wc -l)"
 fi
 TOTAL="$(echo "$TESTLIST" | wc -l)"
+if [ "$MSGLEVEL" -le 1 ]; then
+       printf "${CTEST}Running testcases${CRESET}: "
+fi
 for testcase in $TESTLIST; do
 for testcase in $TESTLIST; do
-       if [ "$MSGLEVEL" -le 2 ]; then
+       if [ "$MSGLEVEL" -le 1 ]; then
+               printf "${testcase##*/}"
+       elif [ "$MSGLEVEL" -le 2 ]; then
                printf "($(($ALL+1))/${TOTAL}) ${CTEST}Testcase ${CHIGH}${testcase##*/}${CRESET}: "
        else
                printf "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}${testcase##*/}${CRESET}\n"
                printf "($(($ALL+1))/${TOTAL}) ${CTEST}Testcase ${CHIGH}${testcase##*/}${CRESET}: "
        else
                printf "${CTEST}Run Testcase ($(($ALL+1))/${TOTAL}) ${CHIGH}${testcase##*/}${CRESET}\n"
@@ -107,16 +122,23 @@ for testcase in $TESTLIST; do
        if ! ${testcase}; then
                FAIL=$((FAIL+1))
                FAILED_TESTS="$FAILED_TESTS ${testcase##*/}"
        if ! ${testcase}; then
                FAIL=$((FAIL+1))
                FAILED_TESTS="$FAILED_TESTS ${testcase##*/}"
-               if [ "$MSGLEVEL" -le 2 ]; then
+               if [ "$MSGLEVEL" -le 1 ]; then
+                       printf >&2 "\n${CHIGH}Running ${testcase##*/} -> FAILED${CRESET}\n"
+               elif [ "$MSGLEVEL" -le 2 ]; then
                        printf >&2 "\n${CHIGH}Running ${testcase##*/} -> FAILED${CRESET}"
                else
                        echo >&2 "${CHIGH}Running ${testcase##*/} -> FAILED${CRESET}"
                fi
        else
                PASS=$((PASS+1))
                        printf >&2 "\n${CHIGH}Running ${testcase##*/} -> FAILED${CRESET}"
                else
                        echo >&2 "${CHIGH}Running ${testcase##*/} -> FAILED${CRESET}"
                fi
        else
                PASS=$((PASS+1))
+               if [ "$MSGLEVEL" -le 1 ]; then
+                       printf " "
+               fi
        fi
        ALL=$((ALL+1))
        fi
        ALL=$((ALL+1))
-       if [ "$MSGLEVEL" -le 2 ]; then
+       if [ "$MSGLEVEL" -le 1 ]; then
+               :
+       elif [ "$MSGLEVEL" -le 2 ]; then
                echo
        fi
 done
                echo
        fi
 done