]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
Merge branch 'debian/sid' into debian/experimental
[apt.git] / test / integration / framework
index 3ea9f3774a16d1b71cf5594be1ca9896c0ba0c2b..99214ef732c6748f3907cda3b9d048aa8bf10ef9 100644 (file)
@@ -110,6 +110,7 @@ aptget() { runapt apt-get "$@"; }
 aptftparchive() { runapt apt-ftparchive "$@"; }
 aptkey() { runapt apt-key "$@"; }
 aptmark() { runapt apt-mark "$@"; }
+apt() { runapt apt "$@"; }
 aptwebserver() {
   LD_LIBRARY_PATH=${APTWEBSERVERBINDIR} ${APTWEBSERVERBINDIR}/aptwebserver "$@";
 }
@@ -189,7 +190,7 @@ setupenvironment() {
        mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers
        touch var/lib/dpkg/available
        mkdir -p usr/lib/apt
-       ln -s ${BUILDDIRECTORY}/methods usr/lib/apt/methods
+       ln -s ${METHODSDIR} usr/lib/apt/methods
        cd ..
        local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/')
        if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then
@@ -217,6 +218,7 @@ setupenvironment() {
        echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
        echo 'quiet::NoUpdate "true";' >> aptconfig.conf
        echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https
+        echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary
        export LC_ALL=C.UTF-8
        export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
        configcompression '.' 'gz' #'bz2' 'lzma' 'xz'
@@ -375,6 +377,7 @@ buildsimplenativepackage() {
        local SECTION="${7:-others}"
        local PRIORITY="${8:-optional}"
         local FILE_TREE="$9"
+        local COMPRESS_TYPE="${10:-gzip}"
        local DISTSECTION
        if [ "$SECTION" = "$(echo "$SECTION" | cut -d'/' -f 2)" ]; then
                DISTSECTION="main"
@@ -440,7 +443,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control
                local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log"
                # ensure the right permissions as dpkg-deb ensists
                chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN
-               if ! dpkg-deb --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
+               if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
                        cat $LOG
                        false
                fi
@@ -878,7 +881,8 @@ changetowebserver() {
        fi
        if test -x ${APTWEBSERVERBINDIR}/aptwebserver; then
                cd aptarchive
-               if ! aptwebserver -o aptwebserver::fork=1 "$@" >webserver.log 2>&1 ; then
+               local LOG="webserver.log"
+               if ! aptwebserver -o aptwebserver::fork=1 "$@" >$LOG 2>&1 ; then
                        cat $LOG
                        false
                fi
@@ -898,7 +902,7 @@ changetohttpswebserver() {
                msgdie 'You need to install stunnel4 for https testcases'
        fi
        if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then
-               changetowebserver --no-rewrite
+               changetowebserver --no-rewrite "$@"
        fi
        echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid
 cert = ${TESTDIRECTORY}/apt.pem
@@ -931,6 +935,10 @@ changetocdrom() {
 
 downloadfile() {
        PROTO="$(echo "$1" | cut -d':' -f 1)"
+        if [ ! -x "${METHODSDIR}/${PROTO}" ]; then
+            msgwarn "can not find ${METHODSDIR}/${PROTO}"
+            return 1
+        fi
        local DOWNLOG="${TMPWORKINGDIRECTORY}/download.log"
        rm -f "$DOWNLOG"
        touch "$DOWNLOG"
@@ -944,7 +952,7 @@ URI: $1
 Filename: ${2}
 "
                # simple worker keeping stdin open until we are done (201) or error (400)
-               # and requesting new URIs on try-agains/redirects inbetween
+               # and requesting new URIs on try-agains/redirects in-between
                { tail -n 999 -f "$DOWNLOG" & echo "TAILPID: $!"; } | while read f1 f2; do
                        if [ "$f1" = 'TAILPID:' ]; then
                                TAILPID="$f2"
@@ -959,7 +967,7 @@ Filename: ${2}
                                break
                        fi
                done
-       } | LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/${PROTO} 2>&1 | tee "$DOWNLOG"
+       } | LD_LIBRARY_PATH=${BUILDDIRECTORY} ${METHODSDIR}/${PROTO} 2>&1 | tee "$DOWNLOG"
        rm "$DOWNLOG"
        # only if the file exists the download was successful
        if [ -e "$2" ]; then
@@ -997,10 +1005,19 @@ testempty() {
 }
 
 testequal() {
+       local MSG='Test of equality of'
+       if [ "$1" = '--nomsg' ]; then
+               MSG=''
+               shift
+       fi
+
        local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile"
        echo "$1" > $COMPAREFILE
        shift
-       msgtest "Test for equality of" "$*"
+
+       if [ -n "$MSG" ]; then
+               msgtest "$MSG" "$*"
+       fi
        $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
 }
 
@@ -1107,7 +1124,7 @@ testfailure() {
        if [ "$1" = '--nomsg' ]; then
                shift
        else
-               msgtest 'Test for failure in  execution of' "$*"
+               msgtest 'Test for failure in execution of' "$*"
        fi
        local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
        if $@ >${OUTPUT} 2>&1; then