apt-key del: Ignore case when checking if a keyid exists in a keyring.
[ntk/apt.git] / test / integration / framework
index df1942f..a12b884 100644 (file)
@@ -102,7 +102,7 @@ runapt() {
        local CMD="$1"
        shift
        case $CMD in
-       sh|aptitude|*/*) ;;
+       sh|aptitude|*/*|command) ;;
        *) CMD="${BUILDDIRECTORY}/$CMD";;
        esac
        MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@"
@@ -780,7 +780,7 @@ buildaptarchivefromincoming() {
        [ -e ftparchive.conf ] || createaptftparchiveconfig
        [ -e dists ] || buildaptftparchivedirectorystructure
        msgninfo "\tGenerate Packages, Sources and Contents files… "
-       aptftparchive -qq generate ftparchive.conf
+       testsuccess aptftparchive generate ftparchive.conf
        cd - > /dev/null
        msgdone "info"
        generatereleasefiles
@@ -1064,8 +1064,8 @@ acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom
 }
 
 downloadfile() {
-       local PROTO="$(echo "$1" | cut -d':' -f 1 )"
-       apthelper -o Debug::Acquire::${PROTO}=1 \
+       local PROTO="${1%%:*}"
+       apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \
                download-file "$1" "$2" 2>&1 || true
        # only if the file exists the download was successful
        if [ -e "$2" ]; then
@@ -1178,10 +1178,13 @@ testnopackage() {
        fi
 }
 
-testdpkginstalled() {
-       msgtest "Test for correctly installed package(s) with" "dpkg -l $*"
-       local PKGS="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)"
-       if [ "$PKGS" != $# ]; then
+testdpkgstatus() {
+       local STATE="$1"
+       local NR="$2"
+       shift 2
+       msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*"
+       local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)"
+       if [ "$PKGS" != $NR ]; then
                echo >&2 $PKGS
                dpkg -l "$@" | grep '^[a-z]' >&2
                msgfail
@@ -1190,16 +1193,12 @@ testdpkginstalled() {
        fi
 }
 
+testdpkginstalled() {
+       testdpkgstatus 'ii' "$#" "$@"
+}
+
 testdpkgnotinstalled() {
-       msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*"
-       local PKGS="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)"
-       if [ "$PKGS" != 0 ]; then
-               echo
-               dpkg -l "$@" | grep '^[a-z]' >&2
-               msgfail
-       else
-               msgpass
-       fi
+       testdpkgstatus 'ii' '0' "$@"
 }
 
 testmarkedauto() {
@@ -1221,7 +1220,7 @@ testsuccess() {
                msgtest 'Test for successful execution of' "$*"
        fi
        local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
-       if $@ >${OUTPUT} 2>&1; then
+       if "$@" >${OUTPUT} 2>&1; then
                msgpass
        else
                echo >&2
@@ -1237,7 +1236,7 @@ testfailure() {
                msgtest 'Test for failure in execution of' "$*"
        fi
        local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
-       if $@ >${OUTPUT} 2>&1; then
+       if "$@" >${OUTPUT} 2>&1; then
                echo >&2
                cat >&2 $OUTPUT
                msgfail