]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
fix testcase framework to test correctly for virtual packages
[apt.git] / test / integration / framework
index 7b323fdb53c902e0f13a4f35d40c498ff7e5f6b2..5e6c5427f8a09e450084336689cf5fbe36965e6b 100644 (file)
@@ -36,7 +36,11 @@ msgdone() { if [ "$1" = "debug" -o "$1" = "info" ]; then true; else echo "${CDON
 
 runapt() {
        msgdebug "Executing: ${CCMD}$*${CDEBUG} "
-       APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
+       if [ -f ./aptconfig.conf ]; then
+               APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
+       else
+               LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$*
+       fi
 }
 aptconfig() { runapt apt-config $*; }
 aptcache() { runapt apt-cache $*; }
@@ -69,7 +73,7 @@ setupenvironment() {
        if [ -f "${TESTDIR}/${PACKAGESFILE}" ]; then
                cp "${TESTDIR}/${PACKAGESFILE}" aptarchive/Packages
        else
-               touch var/lib/dpkg/status
+               touch aptarchive/Packages
        fi
        echo "RootDir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf
        echo "Debug::NoLocking \"true\";" >> aptconfig.conf
@@ -147,6 +151,7 @@ testequal() {
        shift
        msgtest "Test for equality of" "$*"
        $* 2>&1 | diff $COMPAREFILE - && msgpass || msgfail
+       rm $COMPAREFILE
 }
 
 testequalor2() {
@@ -163,26 +168,28 @@ testequalor2() {
                ( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(diff $COMPAREFILE1 $COMPAREAGAINST)" \
                       "\n${CINFO}Diff against OR 2${CNORMAL}" "$(diff $COMPAREFILE2 $COMPAREAGAINST)" &&
                  msgfail )
+       rm $COMPAREFILE1 $COMPAREFILE2 $COMPAREAGAINST
 }
 
 testshowvirtual() {
-       local VIRTUAL="E: Can't select versions from package '$1' as it purely virtual"
+       local VIRTUAL="N: Can't select versions from package '$1' as it purely virtual"
        local PACKAGE="$1"
        shift
        while [ -n "$1" ]; do
                VIRTUAL="${VIRTUAL}
-E: Can't select versions from package '$1' as it purely virtual"
+N: Can't select versions from package '$1' as it purely virtual"
                PACKAGE="${PACKAGE} $1"
                shift
        done
        msgtest "Test for virtual packages" "apt-cache show $PACKAGE"
        VIRTUAL="${VIRTUAL}
-E: No packages found"
+N: No packages found"
        local COMPAREFILE=$(mktemp)
        local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH_CPU)
        eval `apt-config shell ARCH APT::Architecture`
        echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE
        aptcache show $PACKAGE 2>&1 | diff $COMPAREFILE - && msgpass || msgfail
+       rm $COMPAREFILE
 }
 
 testnopackage() {