]> git.saurik.com Git - apt.git/blobdiff - test/integration/framework
only warn about missing/invalid Date field for now
[apt.git] / test / integration / framework
index c97500ffd0bf1ff27780f2bbbe7d56693cecad61..2aed77d5bc68ca9a697b93e3734c5caba1701a09 100644 (file)
@@ -95,7 +95,7 @@ msgfail() {
        if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2;
        else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi
        if [ -n "$APT_DEBUG_TESTS" ]; then
-               APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" $SHELL
+               runapt $SHELL
        fi
        EXIT_CODE=$((EXIT_CODE+1));
 }
@@ -173,7 +173,7 @@ runapt() {
        sh|aptitude|*/*|command) ;;
        *) CMD="${BUILDDIRECTORY}/$CMD";;
        esac
-       MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${LIBRARYPATH} "$CMD" "$@"
+       MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@"
 }
 aptconfig() { runapt apt-config "$@"; }
 aptcache() { runapt apt-cache "$@"; }
@@ -520,13 +520,13 @@ EOF
        testsuccess --nomsg gcc -Wall -fPIC -shared -o noopchroot.so noopchroot.c -ldl
 }
 configcompression() {
+       local CMD='apthelper cat-file -C'
        while [ -n "$1" ]; do
                case "$1" in
                '.') printf ".\t.\tcat\n";;
-               'gz') printf "gzip\tgz\tgzip\n";;
-               'bz2') printf "bzip2\tbz2\tbzip2\n";;
-               'lzma') printf "lzma\tlzma\txz --format=lzma\n";;
-               *) printf "$1\t$1\t$1\n";;
+               'gz') printf "gzip\tgz\t$CMD $1\n";;
+               'bz2') printf "bzip2\tbz2\t$CMD $1\n";;
+               *) printf "$1\t$1\t$CMD $1\n";;
                esac
                shift
        done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf"
@@ -550,7 +550,7 @@ confighashes() {
 forcecompressor() {
        COMPRESSOR="$1"
        COMPRESS="$1"
-       COMPRESSOR_CMD="$1"
+       COMPRESSOR_CMD="apthelper cat-file -C $1"
        case $COMPRESSOR in
        gzip) COMPRESS='gz';;
        bzip2) COMPRESS='bz2';;
@@ -558,20 +558,6 @@ forcecompressor() {
        local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor"
        echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; };
 Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE"
-       for COMP in $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Name \([^.].\+\)$#\1#p'); do
-               echo "Dir::Bin::${COMP} \"/does/not/exist\";"
-       done >> "$CONFFILE"
-       if [ -e "/bin/${COMPRESSOR}" ]; then
-               echo "Dir::Bin::${COMPRESSOR} \"/bin/${COMPRESSOR}\";" >> "$CONFFILE"
-       elif [ -e "/usr/bin/${COMPRESSOR}" ]; then
-               echo "Dir::Bin::${COMPRESSOR} \"/usr/bin/${COMPRESSOR}\";" >> "$CONFFILE"
-       elif [ "${COMPRESSOR}" = 'lzma' ]; then
-               echo 'Dir::Bin::xz "/usr/bin/xz";' >> "$CONFFILE"
-               COMPRESSOR_CMD='xz --format=lzma'
-       else
-               msgtest 'Test for availability of compressor' "${COMPRESSOR}"
-               msgfail "${COMPRESSOR} not available"
-       fi
 }
 
 setupsimplenativepackage() {
@@ -863,31 +849,33 @@ Description-en: $DESCRIPTION
 }
 
 insertsource() {
-       local RELEASE="$1"
+       local RELEASES="$1"
        local NAME="$2"
        local ARCH="$3"
        local VERSION="$4"
        local DEPENDENCIES="$5"
-        local BINARY="${6:-$NAME}"
+       local BINARY="${6:-$NAME}"
        local ARCHS=""
-       local SPATH="aptarchive/dists/${RELEASE}/main/source"
-       mkdir -p $SPATH
-       local FILE="${SPATH}/Sources"
-       local DSCFILE="${NAME}_${VERSION}.dsc"
-       local TARFILE="${NAME}_${VERSION}.tar.gz"
-       echo "Package: $NAME
+       for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do
+               local SPATH="aptarchive/dists/${RELEASE}/main/source"
+               mkdir -p $SPATH
+               local FILE="${SPATH}/Sources"
+               local DSCFILE="${NAME}_${VERSION}.dsc"
+               local TARFILE="${NAME}_${VERSION}.tar.gz"
+               echo "Package: $NAME
 Binary: $BINARY
 Version: $VERSION
 Maintainer: Joe Sixpack <joe@example.org>
 Architecture: $ARCH" >> $FILE
-       test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> "$FILE"
-       echo "Files:
+               test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> "$FILE"
+               echo "Files:
  $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE"
  $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE"
 Checksums-Sha256:
  $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE"
  $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE"
 " >> "$FILE"
+       done
 }
 
 insertinstalledpackage() {
@@ -1534,6 +1522,14 @@ msgfailoutput() {
                        msgfailoutputstatfile "$2" "$3"
                done
                echo '#### test output ####'
+       elif [ "$1" = 'cmp' ]; then
+               echo >&2
+               while [ -n "$2" ]; do
+                       echo "#### Complete file: $2 ####"
+                       cat >&2 "$2" || true
+                       shift
+               done
+               echo '#### cmp output ####'
        fi
        cat >&2 "$OUTPUT"
        msgfail "$MSG"
@@ -1856,7 +1852,7 @@ aptautotest() {
        local TESTCALL="$1"
        local CMD="$2"
        local FIRSTOPT="$3"
-       local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d '-')"
+       local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')"
        if command -v $AUTOTEST >/dev/null; then
                shift 3
                # save and restore the *.output files from other tests