diff options
author | Michael Vogt <mvo@debian.org> | 2014-03-14 09:02:44 +0100 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-03-14 09:02:44 +0100 |
commit | 83b880c6505a20247239d897b7387bba37942993 (patch) | |
tree | 11a23275548175e301f6fefda20a6a8bb6fe6de8 /test/integration | |
parent | f98d9bd2adf4f24a72d973f5752b47987843984c (diff) | |
parent | 40f8a8ba8c2e7ff9ce80781250c863c07ac130dd (diff) |
fix test/integration/test-apt-helper
Diffstat (limited to 'test/integration')
18 files changed, 618 insertions, 209 deletions
diff --git a/test/integration/framework b/test/integration/framework index d9bacef83..8e401cb5f 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -101,7 +101,11 @@ runapt() { msgdebug "Executing: ${CCMD}$*${CDEBUG} " local CMD="$1" shift - MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$CMD "$@" + case $CMD in + sh|aptitude|*/*) ;; + *) CMD="${BUILDDIRECTORY}/$CMD";; + esac + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} $CMD "$@" } aptconfig() { runapt apt-config "$@"; } aptcache() { runapt apt-cache "$@"; } @@ -111,24 +115,19 @@ aptftparchive() { runapt apt-ftparchive "$@"; } aptkey() { runapt apt-key "$@"; } aptmark() { runapt apt-mark "$@"; } apt() { runapt apt "$@"; } -apthelper() { - APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${APTHELPERBINDIR} ${APTHELPERBINDIR}/apt-helper "$@"; -} -aptwebserver() { - LD_LIBRARY_PATH=${APTWEBSERVERBINDIR} ${APTWEBSERVERBINDIR}/aptwebserver "$@"; -} +apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } +aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; } +aptitude() { runapt aptitude "$@"; } + dpkg() { command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@" } -aptitude() { - APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} command aptitude "$@" +dpkgcheckbuilddeps() { + command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@" } gdb() { echo "gdb: run »$*«" - APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH=${BUILDDIRECTORY} command gdb ${BUILDDIRECTORY}/$1 --args "$@" -} -http() { - LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/http + APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${LIBRARYPATH} command gdb ${BUILDDIRECTORY}/$1 --args "$@" } gpg() { # see apt-key for the whole trickery. Setup is done in setupenvironment @@ -173,6 +172,7 @@ setupenvironment() { # allow overriding the default BUILDDIR location BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"} + LIBRARYPATH=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"} METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"} APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"} APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"} @@ -184,11 +184,12 @@ setupenvironment() { mkdir rootdir aptarchive keys cd rootdir mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d - mkdir -p var/cache var/lib var/log tmp + mkdir -p var/cache var/lib/apt var/log tmp 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 ${METHODSDIR} usr/lib/apt/methods + ln -s ${BUILDDIRECTORY}/../../debian/apt.conf.autoremove etc/apt/apt.conf.d/01autoremove cd .. local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/') if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then @@ -217,8 +218,6 @@ setupenvironment() { 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' # gpg needs a trustdb to function, but it can't be invalid (not even empty) @@ -234,6 +233,12 @@ setupenvironment() { # newer gpg versions are fine without it, but play it safe for now gpg --quiet --check-trustdb --secret-keyring $SECRETKEYRING --keyring $SECRETKEYRING >/dev/null 2>&1 + # cleanup the environment a bit + export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" + export LC_ALL=C.UTF-8 + unset LANGUAGE APT_CONFIG + unset GREP_OPTIONS DEB_BUILD_PROFILES + msgdone "info" } @@ -254,6 +259,10 @@ getarchitectures() { echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')" } +getarchitecturesfromcommalist() { + echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" +} + configarchitecture() { { echo "APT::Architecture \"$(getarchitecture $1)\";" @@ -427,7 +436,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control # fi done - for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do + for arch in $(getarchitecturesfromcommalist "$ARCH"); do rm -rf ${BUILDDIR}/debian/tmp mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} @@ -582,7 +591,7 @@ insertpackage() { something went horribly wrong! They are autogenerated und used only by testcases and surf no other propose…"}" local ARCHS="" - for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do + for arch in $(getarchitecturesfromcommalist "$ARCH"); do if [ "$arch" = 'all' -o "$arch" = 'none' ]; then ARCHS="$(getarchitectures)" else @@ -644,7 +653,7 @@ insertinstalledpackage() { local FILE='rootdir/var/lib/dpkg/status' local INFO='rootdir/var/lib/dpkg/info' - for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do + for arch in $(getarchitecturesfromcommalist "$ARCH"); do echo "Package: $NAME Status: $STATUS Priority: $PRIORITY @@ -850,18 +859,16 @@ signreleasefiles() { webserverconfig() { msgtest "Set webserver config option '${1}' to" "$2" - downloadfile "http://localhost:8080/_config/set/${1}/${2}" '/dev/null' >/dev/null - local DOWNLOG='download-testfile.log' - rm -f "$DOWNLOG" - local STATUS="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.status" - downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" - if [ "$(cat "$STATUS")" = '200' ]; then + local DOWNLOG='rootdir/tmp/download-testfile.log' + local STATUS='rootdir/tmp/webserverconfig.status' + rm -f "$STATUS" "$DOWNLOG" + if downloadfile "http://localhost:8080/_config/set/${1}/${2}" "$STATUS" > "$DOWNLOG"; then msgpass else - cat >&2 "$DOWNLOG" - msgfail "Statuscode was $(cat "$STATUS")" + cat "$DOWNLOG" "$STATUS" + msgfail fi - rm "$STATUS" + testwebserverlaststatuscode '200' } rewritesourceslist() { @@ -919,23 +926,29 @@ connect = 8080 changetocdrom() { mkdir -p rootdir/media/cdrom/.disk local CD="$(readlink -f rootdir/media/cdrom)" - echo "acquire::cdrom::mount \"${CD}\";" > rootdir/etc/apt/apt.conf.d/00cdrom - echo 'acquire::cdrom::autodetect 0;' >> rootdir/etc/apt/apt.conf.d/00cdrom + echo "acquire::cdrom::mount \"${CD}\"; +acquire::cdrom::${CD}/::mount \"mv ${CD}-unmounted ${CD}\"; +acquire::cdrom::${CD}/::umount \"mv ${CD} ${CD}-unmounted\"; +acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom echo -n "$1" > ${CD}/.disk/info if [ ! -d aptarchive/dists ]; then msgdie 'Flat file archive cdroms can not be created currently' return 1 fi - mv aptarchive/dists $CD + mv aptarchive/dists "$CD" ln -s "$(readlink -f ./incoming)" $CD/pool find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete + # start with an unmounted disk + mv "${CD}" "${CD}-unmounted" + # we don't want the disk to be modifiable + addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/media/cdrom/dists/ $PWD/rootdir/media/cdrom-unmounted/dists/ || true;" + chmod -R -w rootdir/media/cdrom-unmounted/dists } downloadfile() { - PROTO="$(echo "$1" | cut -d':' -f 1)" - apthelper -o Acquire::https::CaInfo=${TESTDIR}/apt.pem \ - -o Debug::Acquire::${PROTO}=1 \ - download-file "$1" "$2" 2>&1 + local PROTO="$(echo "$1" | cut -d':' -f 1 )" + apthelper -o Debug::Acquire::${PROTO}=1 \ + download-file "$1" "$2" 2>&1 || true # only if the file exists the download was successful if [ -e "$2" ]; then return 0 @@ -947,8 +960,8 @@ downloadfile() { checkdiff() { local DIFFTEXT="$(command diff -u "$@" | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" if [ -n "$DIFFTEXT" ]; then - echo - echo "$DIFFTEXT" + echo >&2 + echo >&2 "$DIFFTEXT" return 1 else return 0 @@ -997,11 +1010,17 @@ testequalor2() { shift 2 msgtest "Test for equality OR of" "$*" $* >$COMPAREAGAINST 2>&1 || true - (checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null || - checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null) && msgpass || - ( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \ - "\n${CINFO}Diff against OR 2${CNORMAL}" "$(checkdiff $COMPAREFILE2 $COMPAREAGAINST)" && - msgfail ) + if checkdiff $COMPAREFILE1 $COMPAREAGAINST >/dev/null 2>&1 || \ + checkdiff $COMPAREFILE2 $COMPAREAGAINST >/dev/null 2>&1 + then + msgpass + else + echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" + checkdiff $COMPAREFILE1 $COMPAREAGAINST || true + echo -n "${CINFO}Diff against OR 2${CNORMAL}" + checkdiff $COMPAREFILE2 $COMPAREAGAINST || true + msgfail + fi } testshowvirtual() { @@ -1027,24 +1046,24 @@ testnopackage() { msgtest "Test for non-existent packages" "apt-cache show $*" local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" if [ -n "$SHOWPKG" ]; then - echo - echo "$SHOWPKG" + echo >&2 + echo >&2 "$SHOWPKG" msgfail - return 1 + else + msgpass fi - msgpass } 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 - echo $PKGS - dpkg -l "$@" | grep '^[a-z]' + echo >&2 $PKGS + dpkg -l "$@" | grep '^[a-z]' >&2 msgfail - return 1 + else + msgpass fi - msgpass } testdpkgnotinstalled() { @@ -1052,11 +1071,11 @@ testdpkgnotinstalled() { local PKGS="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)" if [ "$PKGS" != 0 ]; then echo - dpkg -l "$@" | grep '^[a-z]' + dpkg -l "$@" | grep '^[a-z]' >&2 msgfail - return 1 + else + msgpass fi - msgpass } testmarkedauto() { @@ -1081,8 +1100,8 @@ testsuccess() { if $@ >${OUTPUT} 2>&1; then msgpass else - echo - cat $OUTPUT + echo >&2 + cat >&2 $OUTPUT msgfail fi } @@ -1095,14 +1114,35 @@ testfailure() { fi local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" if $@ >${OUTPUT} 2>&1; then - echo - cat $OUTPUT + echo >&2 + cat >&2 $OUTPUT msgfail else msgpass fi } +testwebserverlaststatuscode() { + local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log' + local STATUS='rootdir/tmp/webserverstatus-statusfile.log' + rm -f "$DOWNLOG" "$STATUS" + msgtest 'Test last status code from the webserver was' "$1" + downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" + if [ "$(cat "$STATUS")" = "$1" ]; then + msgpass + else + echo >&2 + if [ -n "$2" ]; then + shift + echo >&2 '#### Additionally provided output files contain:' + cat >&2 "$@" + fi + echo >&2 '#### Download log of the status code:' + cat >&2 "$DOWNLOG" + msgfail "Status was $(cat "$STATUS")" + fi +} + pause() { echo "STOPPED execution. Press enter to continue" local IGNORE diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types new file mode 100755 index 000000000..a5c98f3d6 --- /dev/null +++ b/test/integration/test-allow-scores-for-all-dependency-types @@ -0,0 +1,144 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +insertpackage 'unversioned' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev +Conflicts: libdb5.1-dev' +insertpackage 'unversioned' 'libdb5.1-dev' 'amd64' '5.1.29-7' +insertpackage 'unversioned' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev' + +insertpackage 'unversioned' 'foo' 'amd64' '1' +insertpackage 'unversioned' 'bar' 'amd64' '1' +insertpackage 'unversioned' 'foo' 'amd64' '2' 'Conflicts: bar' +insertpackage 'unversioned' 'bar' 'amd64' '2' 'Conflicts: foo' +insertpackage 'unversioned' 'baz' 'amd64' '2' 'Depends: bar | foo' + +insertpackage 'versioned' 'libdb-dev' 'amd64' '5.3.0' 'Depends: libdb5.3-dev +Conflicts: libdb5.1-dev (<< 5.2)' +insertpackage 'versioned' 'libdb5.3-dev' 'amd64' '5.3.28-3' 'Conflicts: libdb5.1-dev (<< 5.2)' + +insertpackage 'versioned' 'foo' 'amd64' '2' 'Conflicts: bar (<= 2)' +insertpackage 'versioned' 'bar' 'amd64' '2' 'Conflicts: foo (<= 2)' +insertpackage 'versioned' 'baz' 'amd64' '2' 'Depends: bar (>= 2) | foo (>= 2)' + +insertpackage 'multipleno' 'foo' 'amd64' '2.1' 'Conflicts: bar (<= 3)' +insertpackage 'multipleno' 'bar' 'amd64' '2.1' 'Conflicts: foo (<= 3), foo (<= 1)' + +insertpackage 'multipleyes' 'foo' 'amd64' '2.2' 'Conflicts: bar (<= 3)' +# having foo multiple times as conflict is a non-advisable hack in general +insertpackage 'multipleyes' 'bar' 'amd64' '2.2' 'Conflicts: foo (<= 3), foo (<= 3)' + +cp rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup +setupaptarchive + +insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev' +insertinstalledpackage 'libdb5.1-dev' 'amd64' '5.1.29-7' +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + libdb5.1-dev +The following NEW packages will be installed: + libdb5.3-dev +The following packages will be upgraded: + libdb-dev +1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ] +Inst libdb-dev [5.1.7] (5.3.0 unversioned [amd64]) [] +Inst libdb5.3-dev (5.3.28-3 unversioned [amd64]) +Conf libdb5.3-dev (5.3.28-3 unversioned [amd64]) +Conf libdb-dev (5.3.0 unversioned [amd64])' aptget dist-upgrade -st unversioned +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + libdb5.1-dev +The following NEW packages will be installed: + libdb5.3-dev +The following packages will be upgraded: + libdb-dev +1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv libdb5.1-dev [5.1.29-7] [libdb-dev:amd64 ] +Inst libdb-dev [5.1.7] (5.3.0 versioned [amd64]) [] +Inst libdb5.3-dev (5.3.28-3 versioned [amd64]) +Conf libdb5.3-dev (5.3.28-3 versioned [amd64]) +Conf libdb-dev (5.3.0 versioned [amd64])' aptget dist-upgrade -st versioned + +cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status +insertinstalledpackage 'foo' 'amd64' '1' +insertinstalledpackage 'bar' 'amd64' '1' +testequal 'Reading package lists... +Building dependency tree... +The following packages have been kept back: + bar foo +0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st unversioned +testequal 'Reading package lists... +Building dependency tree... +The following packages have been kept back: + bar foo +0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st versioned +testequal 'Reading package lists... +Building dependency tree... +The following packages have been kept back: + bar foo +0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st multipleno +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + foo +The following packages will be upgraded: + bar +1 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. +Remv foo [1] +Inst bar [1] (2.2 multipleyes [amd64]) +Conf bar (2.2 multipleyes [amd64])' aptget dist-upgrade -st multipleyes + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + baz +0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. +Inst baz (2 unversioned [amd64]) +Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following packages will be REMOVED: + bar +The following NEW packages will be installed: + baz +The following packages will be upgraded: + foo +1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv bar [1] +Inst foo [1] (2 versioned [amd64]) +Inst baz (2 versioned [amd64]) +Conf foo (2 versioned [amd64]) +Conf baz (2 versioned [amd64])' aptget install baz -st versioned + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + baz +0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. +Inst baz (2 unversioned [amd64]) +Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following packages will be REMOVED: + bar +The following NEW packages will be installed: + baz +The following packages will be upgraded: + foo +1 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. +Remv bar [1] +Inst foo [1] (2 versioned [amd64]) +Inst baz (2 versioned [amd64]) +Conf foo (2 versioned [amd64]) +Conf baz (2 versioned [amd64])' aptget install baz -st versioned diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index cc3483f9b..8d8fdf167 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -12,31 +12,60 @@ setupaptarchive --no-update changetocdrom 'Debian APT Testdisk 0.8.15' # -de is not in the Release file, but picked up anyway for compatibility -cd rootdir/media/cdrom/dists/stable/main/i18n +cd rootdir/media/cdrom-unmounted/dists/stable/main/i18n +chmod +w . sed -e '/^Description-en:/ d' -e '/^ / d' -e '/^$/ d' Translation-en > Translation-de echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable Diese Pakete sind nur für das testen von APT gedacht, sie erfüllen keinen Zweck auf einem normalen System… ' >> Translation-de compressfile Translation-de -rm Translation-en Translation-de +rm -f Translation-en Translation-de +chmod -R -w . cd - > /dev/null -addtrap 'prefix' "chmod -R +w $PWD/rootdir/media/cdrom/dists/;" -chmod -R -w rootdir/media/cdrom/dists -aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1 -sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log -testfileequal apt-cdrom.log "Scanning disc for index files.. -Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures -Found label 'Debian APT Testdisk 0.8.15' -This disc is called: +aptcdromlog() { + rm -f rootdir/tmp/apt-cdrom.log + test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" + test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" + aptcdrom "$@" -o quiet=1 >rootdir/tmp/apt-cdrom.log 2>&1 </dev/null + sed -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' rootdir/tmp/apt-cdrom.log + test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!" + test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!" +} + +CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ +Unmounting CD-ROM... +Waiting for disc... +Please insert a Disc in the drive and press enter +Mounting CD-ROM... +Scanning disc for index files..." +CDROM_POST="This disc is called: 'Debian APT Testdisk 0.8.15' Writing new source list Source list entries for this disc are: deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main +Unmounting CD-ROM... Repeat this process for the rest of the CDs in your set." +testequal "$CDROM_PRE +Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures +Found label 'Debian APT Testdisk 0.8.15' +$CDROM_POST" aptcdromlog add + +testequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/ +Mounting CD-ROM... +Stored label: Debian APT Testdisk 0.8.15 +Unmounting CD-ROM..." aptcdromlog ident + +# apt-setup uses these commands (expect the tr in the id) to find id and label +ident="$(LC_ALL=C aptcdrom ident 2>&1 )" +CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')" +CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")" +testequal "CD::${CD_ID} \"${CD_LABEL}\"; +CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list + testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: @@ -54,49 +83,24 @@ Inst testing:i386 (0.8.15 stable [i386]) Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s # check Idempotence of apt-cdrom (and disabling of Translation dropping) -aptcdrom add -m -o quiet=1 -o APT::CDROM::DropTranslation=0 > apt-cdrom.log 2>&1 -sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log -testfileequal apt-cdrom.log "Scanning disc for index files.. +testequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures -This disc is called: -'Debian APT Testdisk 0.8.15' -Writing new source list -Source list entries for this disc are: -deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main -deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main -Repeat this process for the rest of the CDs in your set." +$CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0 # take Translations from previous runs as needed -aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1 -sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log -testfileequal apt-cdrom.log "Scanning disc for index files.. +testequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures -This disc is called: -'Debian APT Testdisk 0.8.15' -Writing new source list -Source list entries for this disc are: -deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main -deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main -Repeat this process for the rest of the CDs in your set." +$CDROM_POST" aptcdromlog add msgtest 'Test for the german description translation of' 'testing' aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail rm -rf rootdir/var/lib/apt/lists mkdir -p rootdir/var/lib/apt/lists/partial -aptcdrom add -m -o quiet=1 > apt-cdrom.log 2>&1 -sed -i -e '/^Using CD-ROM/ d' -e '/gpgv/ d' -e '/^Identifying/ d' -e '/Reading / d' apt-cdrom.log -testfileequal apt-cdrom.log "Scanning disc for index files.. +testequal "$CDROM_PRE Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures -This disc is called: -'Debian APT Testdisk 0.8.15' -Writing new source list -Source list entries for this disc are: -deb cdrom:[Debian APT Testdisk 0.8.15]/ stable main -deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main -Repeat this process for the rest of the CDs in your set." +$CDROM_POST" aptcdromlog add msgtest 'Test for the english description translation of' 'testing' aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && msgpass || msgfail - # check that we really can install from a 'cdrom' testdpkgnotinstalled testing testsuccess aptget install testing -y diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index 37ed95181..6505b5956 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -33,5 +33,7 @@ if ! apthelper -qq download-file http://localhost:8080/foo foo5 MD5Sum:aabbcc 2> else msgfail fi -testfileequal download.stderr 'E: HashSum Failed' -testfileequal foo5.failed 'foo' +testfileequal download.stderr 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch + +E: Download Failed' +testfileequal foo5.FAILED 'foo' diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect index 99419d1cc..73352a28c 100755 --- a/test/integration/test-apt-https-no-redirect +++ b/test/integration/test-apt-https-no-redirect @@ -7,19 +7,24 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "i386" -buildsimplenativepackage 'apt' 'all' '1.0' 'stable' +insertpackage 'stable' 'apt' 'all' '1' setupaptarchive --no-update +echo 'alright' > aptarchive/working changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/' -DOWNLOG='download-testfile.log' -msgtest 'normal http download works' -downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog2 > "$DOWNLOG" && msgpass || msgfail +msgtest 'download of a file works via' 'http' +downloadfile 'http://localhost:8080/working' httpfile >/dev/null 2>&1 && msgpass || msgfail +testfileequal httpfile 'alright' -msgtest 'normal https download works' -downloadfile 'https://localhost:4433/pool/apt_1.0/changelog' changelog > "$DOWNLOG" && msgpass || msgfail +msgtest 'download of a file works via' 'https' +downloadfile 'https://localhost:4433/working' httpsfile >/dev/null 2>&1 && msgpass || msgfail +testfileequal httpsfile 'alright' -msgtest 'redirecting https to http does not work' -downloadfile 'https://localhost:4433/redirectme/pool/apt_1.0/changelog' changelog3 2>&1 | grep "Protocol http not supported or disabled in libcurl" > /dev/null && msgpass || msgfail +msgtest 'download of a file does not work if' 'https redirected to http' +downloadfile 'https://localhost:4433/redirectme/working' redirectfile >curloutput 2>&1 && msgfail || msgpass + +msgtest 'libcurl has forbidden access in last request to' 'http resource' +grep -q -- 'Protocol http not supported or disabled in libcurl' curloutput && msgpass || msgfail diff --git a/test/integration/test-bug-661537-build-profiles-support b/test/integration/test-bug-661537-build-profiles-support new file mode 100755 index 000000000..ae1403f71 --- /dev/null +++ b/test/integration/test-bug-661537-build-profiles-support @@ -0,0 +1,147 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' 'armel' + +insertinstalledpackage 'build-essential' 'all' '0' 'Multi-Arch: foreign' + +insertpackage 'unstable' 'foo' 'all' '1.0' +insertpackage 'unstable' 'bar' 'all' '1.0' + +insertsource 'unstable' 'buildprofiles' 'any' '1' 'Build-Depends: foo (>= 1.0) [i386 arm] <!profile.stage1 !profile.cross>, bar' + +# table from https://wiki.debian.org/BuildProfileSpec +insertsource 'unstable' 'spec-1' 'any' '1' 'Build-Depends: foo <!profile.stage1>' +insertsource 'unstable' 'spec-2' 'any' '1' 'Build-Depends: foo <profile.stage1>' +insertsource 'unstable' 'spec-3' 'any' '1' 'Build-Depends: foo <!profile.stage1 !profile.notest>' +insertsource 'unstable' 'spec-4' 'any' '1' 'Build-Depends: foo <profile.stage1 profile.notest>' +insertsource 'unstable' 'spec-5' 'any' '1' 'Build-Depends: foo <!profile.stage1 profile.notest>' +insertsource 'unstable' 'spec-6' 'any' '1' 'Build-Depends: foo <profile.stage1 !profile.notest>' +# multiple stanzas not supported: error out +insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo <profile.stage1><!profile.notest>' +insertsource 'unstable' 'spec-8' 'any' '1' 'Build-Depends: foo <profile.stage1> <!profile.notest>' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [all]) +Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [all]) +Inst foo (1.0 unstable [all]) +Conf bar (1.0 unstable [all]) +Conf foo (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [all]) +Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=armel + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [all]) +Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386 -P stage1 + +KEEP='Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [all]) +Conf foo (1.0 unstable [all])' +DROP='Reading package lists... +Building dependency tree... +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' + +msgtest 'Check if version of installed dpkg is high enough for' 'build profiles support' +if dpkg --compare-versions "$(command dpkg-query --showformat='${Version}' --show dpkg)" 'ge' '1.17.2'; then + msgpass + testwithdpkg() { + msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'" + local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwithdpkg.output" + if dpkgcheckbuilddeps -d "$1" -P "$2" /dev/null >$OUTPUT 2>&1; then + if [ "$3" = "$DROP" ]; then + msgpass + else + cat $OUTPUT + msgfail + fi + else + if [ "$3" = "$KEEP" ]; then + msgpass + else + cat $OUTPUT + msgfail + fi + fi + } +else + msgskip + testwithdpkg() { + msgtest "Test with" "dpkg-checkbuilddeps -d '$1' -P '$2'" + msgskip + } +fi + +testprofile() { + if [ -n "$3" ]; then + testequal "$4" aptget build-dep "$1" -s -P "$3" + export DEB_BUILD_PROFILES="$(echo "$3" | tr ',' ' ')" + testequal "$4" aptget build-dep "$1" -s -o with::environment=1 + unset DEB_BUILD_PROFILES + else + testequal "$4" aptget build-dep "$1" -s + fi + testwithdpkg "$2" "$3" "$4" +} + +testprofile 'spec-1' 'foo <!profile.stage1>' '' "$KEEP" +testprofile 'spec-1' 'foo <!profile.stage1>' 'stage1' "$DROP" +testprofile 'spec-1' 'foo <!profile.stage1>' 'notest' "$KEEP" +testprofile 'spec-1' 'foo <!profile.stage1>' 'stage1,notest' "$DROP" + +testprofile 'spec-2' 'foo <profile.stage1>' '' "$DROP" +testprofile 'spec-2' 'foo <profile.stage1>' 'stage1' "$KEEP" +testprofile 'spec-2' 'foo <profile.stage1>' 'notest' "$DROP" +testprofile 'spec-2' 'foo <profile.stage1>' 'stage1,notest' "$KEEP" + +testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' '' "$KEEP" +testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' 'stage1' "$DROP" +testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' 'notest' "$DROP" +testprofile 'spec-3' 'foo <!profile.stage1 !profile.notest>' 'stage1,notest' "$DROP" + +testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' '' "$DROP" +testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' 'stage1' "$KEEP" +testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' 'notest' "$KEEP" +testprofile 'spec-4' 'foo <profile.stage1 profile.notest>' 'stage1,notest' "$KEEP" + +testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' '' "$KEEP" +testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' 'stage1' "$DROP" +testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' 'notest' "$KEEP" +testprofile 'spec-5' 'foo <!profile.stage1 profile.notest>' 'stage1,notest' "$DROP" + +testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' '' "$KEEP" +testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' 'stage1' "$KEEP" +testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' 'notest' "$DROP" +testprofile 'spec-6' 'foo <profile.stage1 !profile.notest>' 'stage1,notest' "$KEEP" + +testfailure aptget build-dep spec-7 -s +testfailure aptget build-dep spec-8 -s diff --git a/test/integration/test-bug-740843-versioned-up-down-breaks b/test/integration/test-bug-740843-versioned-up-down-breaks new file mode 100755 index 000000000..cb035a71f --- /dev/null +++ b/test/integration/test-bug-740843-versioned-up-down-breaks @@ -0,0 +1,55 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertinstalledpackage 'foo-driver' 'amd64' '1' 'Depends: libfoo (= 1) +Recommends: libgl1-foo-glx (= 1) +Breaks: libgl1-foo-glx (<< 1), libgl1-foo-glx (>> 1)' +insertinstalledpackage 'libgl1-foo-glx' 'amd64,i386' '1' 'Depends: libfoo (= 1) +Multi-Arch: same' +insertinstalledpackage 'libfoo' 'amd64,i386' '1' 'Multi-Arch: same' + +buildsimplenativepackage 'foo-driver' 'amd64' '2' 'stable' 'Depends: libfoo (= 2) +Recommends: libgl1-foo-glx (= 2) +Breaks: libgl1-foo-glx (<< 2), libgl1-foo-glx (>> 2)' +buildsimplenativepackage 'libgl1-foo-glx' 'amd64,i386' '2' 'stable' 'Depends: libfoo (= 2) +Multi-Arch: same' +buildsimplenativepackage 'libfoo' 'amd64,i386' '2' 'stable' 'Multi-Arch: same' + +setupaptarchive + +testequalor2 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + foo-driver libfoo libfoo:i386 libgl1-foo-glx libgl1-foo-glx:i386 +5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst libgl1-foo-glx [1] (2 stable [amd64]) [libgl1-foo-glx:amd64 on libgl1-foo-glx:i386] [libgl1-foo-glx:i386 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:amd64] [libgl1-foo-glx:i386 foo-driver:amd64 ] +Inst libgl1-foo-glx:i386 [1] (2 stable [i386]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:i386] [foo-driver:amd64 ] +Inst foo-driver [1] (2 stable [amd64]) [] +Inst libfoo:i386 [1] (2 stable [i386]) [libfoo:amd64 on libfoo:i386] [libfoo:i386 on libfoo:amd64] [libfoo:amd64 ] +Inst libfoo [1] (2 stable [amd64]) +Conf libfoo:i386 (2 stable [i386]) +Conf libfoo (2 stable [amd64]) +Conf libgl1-foo-glx:i386 (2 stable [i386]) +Conf libgl1-foo-glx (2 stable [amd64]) +Conf foo-driver (2 stable [amd64])' 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + foo-driver libfoo libfoo:i386 libgl1-foo-glx libgl1-foo-glx:i386 +5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst libgl1-foo-glx [1] (2 stable [amd64]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [libgl1-foo-glx:amd64 on libgl1-foo-glx:i386] [libgl1-foo-glx:i386 on libgl1-foo-glx:amd64] [foo-driver:amd64 libgl1-foo-glx:i386 ] +Inst libgl1-foo-glx:i386 [1] (2 stable [i386]) [foo-driver:amd64 on libgl1-foo-glx:amd64] [foo-driver:amd64 on libgl1-foo-glx:i386] [foo-driver:amd64 ] +Inst foo-driver [1] (2 stable [amd64]) [] +Inst libfoo:i386 [1] (2 stable [i386]) [libfoo:amd64 on libfoo:i386] [libfoo:i386 on libfoo:amd64] [libfoo:amd64 ] +Inst libfoo [1] (2 stable [amd64]) +Conf libfoo:i386 (2 stable [i386]) +Conf libfoo (2 stable [amd64]) +Conf libgl1-foo-glx:i386 (2 stable [i386]) +Conf libgl1-foo-glx (2 stable [amd64]) +Conf foo-driver (2 stable [amd64])' aptget dist-upgrade -s + +testsuccess aptget dist-upgrade -y -o Debug::pkgPackageManager=1 -o Debug::pkgOrderList=1 diff --git a/test/integration/test-bug-multiarch-upgrade b/test/integration/test-bug-multiarch-upgrade index dc3725df1..c29e1f903 100755 --- a/test/integration/test-bug-multiarch-upgrade +++ b/test/integration/test-bug-multiarch-upgrade @@ -25,5 +25,5 @@ The following packages will be upgraded: 2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Inst libcups2 [1] (2 unstable [amd64]) [libcups2:amd64 on libcups2:i386] [libcups2:i386 on libcups2:amd64] [libcups2:i386 ] Inst libcups2:i386 [1] (2 unstable [i386]) -Conf libcups2 (2 unstable [amd64]) -Conf libcups2:i386 (2 unstable [i386])' aptget install -s libcups2:i386 +Conf libcups2:i386 (2 unstable [i386]) +Conf libcups2 (2 unstable [amd64])' aptget install -s libcups2:i386 diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index c6f5ab49e..67ca0ba27 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -5,6 +5,7 @@ TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment +configcompression '.' 'gz' # only gz is supported for this, so ensure it is used configarchitecture "i386" buildsimplenativepackage "testpkg" "i386" "1.0" diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop index 4407fbd9d..4978fe1e8 100755 --- a/test/integration/test-conflicts-loop +++ b/test/integration/test-conflicts-loop @@ -6,11 +6,11 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "i386" -insertinstalledpackage 'openjdk-6-jre' 'i386' '6b16-1.8-0ubuntu1' +insertinstalledpackage 'openjdk-6-jre' 'i386' '6b16-1.8-0ubuntu1' insertpackage 'unstable' 'openjdk-6-jre' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre-headless (<< 6b17~pre3-1), openjdk-6-jre-lib (<< 6b17~pre3-1)' -insertinstalledpackage 'openjdk-6-jre-lib' 'i386' '6b16-1.8-0ubuntu1' +insertinstalledpackage 'openjdk-6-jre-lib' 'i386' '6b16-1.8-0ubuntu1' insertpackage 'unstable' 'openjdk-6-jre-lib' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre (<< 6b17~pre3-1), openjdk-6-jre-headless (<< 6b17~pre3-1)' -insertinstalledpackage 'openjdk-6-jre-headless' 'i386' '6b16-1.8-0ubuntu1' +insertinstalledpackage 'openjdk-6-jre-headless' 'i386' '6b16-1.8-0ubuntu1' insertpackage 'unstable' 'openjdk-6-jre-headless' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre (<< 6b17~pre3-1), openjdk-6-jre-lib (<< 6b17~pre3-1)' setupaptarchive @@ -19,16 +19,10 @@ testequal 'Reading package lists... Building dependency tree... The following packages will be upgraded: openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib - openjdk-6-jre-lib:i386 conflicts with openjdk-6-jre:i386 - openjdk-6-jre:i386 conflicts with openjdk-6-jre-headless:i386 - openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre:i386 3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Remv openjdk-6-jre [6b16-1.8-0ubuntu1] - openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre-lib:i386 Remv openjdk-6-jre-lib [6b16-1.8-0ubuntu1] Inst openjdk-6-jre-headless [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) - openjdk-6-jre:i386 conflicts with openjdk-6-jre-lib:i386 - openjdk-6-jre:i386 conflicts with openjdk-6-jre-lib:i386 Inst openjdk-6-jre [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Inst openjdk-6-jre-lib [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) Conf openjdk-6-jre-lib (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) diff --git a/test/integration/test-ignore-provides-if-versioned-breaks b/test/integration/test-ignore-provides-if-versioned-breaks index f8b4544a0..745f7d206 100755 --- a/test/integration/test-ignore-provides-if-versioned-breaks +++ b/test/integration/test-ignore-provides-if-versioned-breaks @@ -142,9 +142,9 @@ The following packages will be upgraded: 2 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) [foo-same:amd64 on foo-same:i386] [foo-same:i386 on foo-same:amd64] [foo-same:i386 ] Inst foo-same [2.0] (4.0 unstable [i386]) -Conf foo-same:amd64 (4.0 unstable [amd64]) -Conf foo-same (4.0 unstable [i386]) Inst foo-same-breaker-3 (1.0 unstable [i386]) Inst foo-same-provider (1.0 unstable [i386]) +Conf foo-same (4.0 unstable [i386]) +Conf foo-same:amd64 (4.0 unstable [amd64]) Conf foo-same-breaker-3 (1.0 unstable [i386]) Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-3 -s diff --git a/test/integration/test-ignore-provides-if-versioned-conflicts b/test/integration/test-ignore-provides-if-versioned-conflicts index 44eafcff1..a07252768 100755 --- a/test/integration/test-ignore-provides-if-versioned-conflicts +++ b/test/integration/test-ignore-provides-if-versioned-conflicts @@ -142,9 +142,9 @@ The following packages will be upgraded: 2 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) [foo-same:amd64 on foo-same:i386] [foo-same:i386 on foo-same:amd64] [foo-same:i386 ] Inst foo-same [2.0] (4.0 unstable [i386]) -Conf foo-same:amd64 (4.0 unstable [amd64]) -Conf foo-same (4.0 unstable [i386]) Inst foo-same-breaker-3 (1.0 unstable [i386]) Inst foo-same-provider (1.0 unstable [i386]) +Conf foo-same (4.0 unstable [i386]) +Conf foo-same:amd64 (4.0 unstable [amd64]) Conf foo-same-breaker-3 (1.0 unstable [i386]) Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-3 -s diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index 2b165d100..7713c0875 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -1,55 +1,100 @@ #!/bin/sh - set -e -# setup testdir TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +# the executed script would use the installed apt-config, +# which is outside of our control +msgtest 'Check that the installed apt-config supports' '--no-empty' +if apt-config dump --no-empty >/dev/null 2>&1; then + msgpass +else + msgskip + exit 0 +fi + +CURRENTKERNEL="linux-image-$(uname -r)" +insertinstalledpackage "$CURRENTKERNEL" 'amd64' '1' +insertinstalledpackage 'linux-image-1.0.0-2-generic' 'amd64' '1.0.0-2' +insertinstalledpackage 'linux-image-100.0.0-1-generic' 'amd64' '100.0.0-1' +# ensure that the '.' is really a dot and not a wildcard +insertinstalledpackage 'linux-headers-1000000-1-generic' 'amd64' '100.0.0-1' -TMPDIR=$(mktemp -d) -cd $TMPDIR -addtrap "cd /; rm -rf $TMPDIR" +testsuccess aptmark auto "$CURRENTKERNEL" 'linux-image-1.0.0-2-generic' 'linux-image-100.0.0-1-generic' 'linux-headers-1000000-1-generic' -# create mock environment -mkdir apt.conf.d -cat > aptconfig.conf <<EOF -Dir::Etc::parts "$TMPDIR/apt.conf.d"; -Dir::bin::dpkg "$TMPDIR/fake-dpkg"; +cat > ./fake-dpkg <<EOF +#!/bin/sh +exec $(aptconfig dump --no-empty --format='%v ' 'DPKG::options') "\$@" EOF -APT_CONFIG=aptconfig.conf -export APT_CONFIG +chmod +x ./fake-dpkg +echo 'Dir::Bin::dpkg "./fake-dpkg";' > rootdir/etc/apt/apt.conf.d/99fakedpkg # install fake-dpkg into it -install -m755 $TESTDIR/test-kernel-helper-autoremove.fake-dpkg $TMPDIR/fake-dpkg +catfail() { + echo >&2 + echo >&2 '### List of protected kernels:' + cat >&2 protected.list + msgfail +} -# run the helper -sh ${TESTDIR}/../../debian/apt.auto-removal.sh +testprotected() { + rm -f rootdir/etc/apt/apt.conf.d/01autoremove-kernels protected.list -msgtest 'Check that kernel autoremoval list is correctly created' -# and ensure its there, valid and version 10.0.0-1 is there too -test -e $TMPDIR/apt.conf.d/01autoremove-kernels && msgpass || msgfail + testsuccess runapt sh ${TESTDIR}/../../debian/apt.auto-removal.sh "$@" -msgtest 'Check that most recent kernel is saved from autoremoval' -apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic" && msgpass || msgfail + msgtest 'Check kernel autoremoval protection list' 'is created' + test -e rootdir/etc/apt/apt.conf.d/01autoremove-kernels && msgpass || msgfail -# ... and also that the running kernel is excluded -msgtest 'Check that running kernel is saved from autoremoval' -apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)" && msgpass || msgfail + msgtest 'Check kernel autoremoval protection list' 'can be dumped' + aptconfig dump --no-empty --format '%v%n' 'APT::NeverAutoRemove' >protected.list 2>&1 && msgpass || catfail -# and that the old kernel is *not* excluded from autoremoval -msgtest 'Check that older kernels are not excluded from autoremoval' -apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.01-2-generic" && msgfail || msgpass + msgtest 'Check kernel autoremoval protection list' 'can be parsed' + grep -q '^[A-Z]: ' protected.list && catfail || msgpass -msgtest "Check that the older kernel is retained when it's being installed" -sh ${TESTDIR}/../../debian/apt.auto-removal.sh 1.0.01-2-generic -test -e $TMPDIR/apt.conf.d/01autoremove-kernels -if ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-10.0.0-1-generic" \ - || ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-$(uname -r)" \ - || ! apt-config -c ${APT_CONFIG} dump|grep -q "APT::NeverAutoRemove::.*\^linux-image-1\.0\.01-2-generic" -then - msgfail -else - msgpass -fi + msgtest 'Check kernel autoremoval protection list includes' 'most recent kernel' + grep -q '^\^linux-image-100\\\.0\\\.0-1-generic\$$' protected.list && msgpass || catfail + + msgtest 'Check kernel autoremoval protection list includes' 'running kernel' + grep -q "^\\^linux-image-$(uname -r | sed -e 's#\.#\\\\.#g')\\\$\$" protected.list && msgpass || catfail +} + +testequal "Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + linux-headers-1000000-1-generic (100.0.0-1) + linux-image-1.0.0-2-generic (1.0.0-2) + linux-image-100.0.0-1-generic (100.0.0-1) + $CURRENTKERNEL (1) +0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded. +Remv linux-headers-1000000-1-generic [100.0.0-1] +Remv linux-image-1.0.0-2-generic [1.0.0-2] +Remv linux-image-100.0.0-1-generic [100.0.0-1] +Remv $CURRENTKERNEL [1]" aptget autoremove -sV + +testprotected +msgtest 'Check kernel autoremoval protection list does not include' 'old kernel' +grep -q '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list && catfail || msgpass + +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + linux-headers-1000000-1-generic linux-image-1.0.0-2-generic +0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. +Remv linux-headers-1000000-1-generic [100.0.0-1] +Remv linux-image-1.0.0-2-generic [1.0.0-2]' aptget autoremove -s -# done +testprotected 1.0.0-2-generic +msgtest 'Check kernel autoremoval protection list includes' 'installed kernel' +grep -q '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list && msgpass || catfail +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + linux-headers-1000000-1-generic +0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. +Remv linux-headers-1000000-1-generic [100.0.0-1]' aptget autoremove -s diff --git a/test/integration/test-kernel-helper-autoremove.fake-dpkg b/test/integration/test-kernel-helper-autoremove.fake-dpkg deleted file mode 100644 index a365c5370..000000000 --- a/test/integration/test-kernel-helper-autoremove.fake-dpkg +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -if [ "$1" = "-l" ]; then - echo "ii linux-image-1.0.0-2-generic 1.0.01-2 amd64" - echo "ii linux-image-$(uname -r) not-used amd64" - echo "ii linux-image-10.0.0-1-generic 10.0.0.1-1 amd64" -elif [ "$1" = "--compare-versions" ]; then - dpkg "$1" "$2" "$3" "$4" -else - dpkg $@ -fi - diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support index 382789e68..5ab326def 100755 --- a/test/integration/test-partial-file-support +++ b/test/integration/test-partial-file-support @@ -13,17 +13,18 @@ copysource() { touch -d "$(stat --format '%y' "${TESTFILE}")" "$3" } +DOWNLOADLOG='rootdir/tmp/testdownloadfile.log' + testdownloadfile() { - local DOWNLOG='download-testfile.log' - rm -f "$DOWNLOG" + rm -f "$DOWNLOADLOG" msgtest "Testing download of file $2 with" "$1" - if ! downloadfile "$2" "$3" > "$DOWNLOG"; then - cat >&2 "$DOWNLOG" + if ! downloadfile "$2" "$3" > "$DOWNLOADLOG"; then + cat >&2 "$DOWNLOADLOG" msgfail else msgpass fi - cat "$DOWNLOG" | while read field hash; do + cat "$DOWNLOADLOG" | while read field hash; do local EXPECTED case "$field" in 'MD5Sum-Hash:') EXPECTED="$(md5sum "$TESTFILE" | cut -d' ' -f 1)";; @@ -40,28 +41,12 @@ testdownloadfile() { if [ "$EXPECTED" "$4" "$hash" ]; then msgpass else - cat >&2 "$DOWNLOG" + cat >&2 "$DOWNLOADLOG" msgfail "expected: $EXPECTED ; got: $hash" fi done } -testwebserverlaststatuscode() { - local DOWNLOG='download-testfile.log' - rm -f "$DOWNLOG" - local STATUS="$(mktemp)" - addtrap "rm $STATUS;" - msgtest 'Test last status code from the webserver was' "$1" - downloadfile "http://localhost:8080/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" - if [ "$(cat "$STATUS")" = "$1" ]; then - msgpass - else - cat >&2 "$DOWNLOG" - msgfail "Status was $(cat "$STATUS")" - fi -} - - TESTFILE='aptarchive/testfile' cp -a ${TESTDIR}/framework $TESTFILE @@ -70,34 +55,34 @@ testrun() { copysource $TESTFILE 0 ./testfile testdownloadfile 'no data' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '200' + testwebserverlaststatuscode '200' "$DOWNLOADLOG" copysource $TESTFILE 20 ./testfile testdownloadfile 'valid partial data' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '206' + testwebserverlaststatuscode '206' "$DOWNLOADLOG" copysource /dev/zero 20 ./testfile testdownloadfile 'invalid partial data' "${1}/testfile" './testfile' '!=' - testwebserverlaststatuscode '206' + testwebserverlaststatuscode '206' "$DOWNLOADLOG" copysource $TESTFILE 1M ./testfile testdownloadfile 'completely downloaded file' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '416' + testwebserverlaststatuscode '416' "$DOWNLOADLOG" copysource /dev/zero 1M ./testfile testdownloadfile 'too-big partial file' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '200' + testwebserverlaststatuscode '200' "$DOWNLOADLOG" copysource /dev/zero 20 ./testfile touch ./testfile testdownloadfile 'old data' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '200' + testwebserverlaststatuscode '200' "$DOWNLOADLOG" webserverconfig 'aptwebserver::support::range' 'false' copysource $TESTFILE 20 ./testfile testdownloadfile 'no server support' "${1}/testfile" './testfile' '=' - testwebserverlaststatuscode '200' + testwebserverlaststatuscode '200' "$DOWNLOADLOG" } testrun 'http://localhost:8080' diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew index fed12dad0..d647856cb 100755 --- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -55,14 +55,14 @@ Remv out-of-sync-gone-foreign:i386 [1] Remv out-of-sync-gone-native [1] Inst fine [1] (2 unstable [amd64]) [fine:amd64 on fine:i386] [fine:i386 on fine:amd64] [fine:i386 ] Inst fine:i386 [1] (2 unstable [i386]) -Conf fine (2 unstable [amd64]) -Conf fine:i386 (2 unstable [i386]) Inst fine-installed [1] (2 unstable [amd64]) [fine-installed:amd64 on fine-installed:i386] [fine-installed:i386 on fine-installed:amd64] [fine-installed:i386 ] Inst fine-installed:i386 [1] (2 unstable [i386]) -Conf fine-installed (2 unstable [amd64]) -Conf fine-installed:i386 (2 unstable [i386]) Inst out-of-sync-gone-foreign [1] (2 unstable [amd64]) Inst out-of-sync-gone-native:i386 [1] (2 unstable [i386]) +Conf fine:i386 (2 unstable [i386]) +Conf fine (2 unstable [amd64]) +Conf fine-installed:i386 (2 unstable [i386]) +Conf fine-installed (2 unstable [amd64]) Conf out-of-sync-gone-foreign (2 unstable [amd64]) Conf out-of-sync-gone-native:i386 (2 unstable [i386])' aptget dist-upgrade -s #-o Debug::pkgDepCache::Marker=1 diff --git a/test/integration/test-bug-1078697-missing-source-hashes b/test/integration/test-ubuntu-bug-1078697-missing-source-hashes index 6fcb856b5..6fcb856b5 100755 --- a/test/integration/test-bug-1078697-missing-source-hashes +++ b/test/integration/test-ubuntu-bug-1078697-missing-source-hashes diff --git a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages index 5856cd744..c1d454f88 100755 --- a/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages +++ b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages @@ -39,9 +39,9 @@ Inst libreoffice-core [3] (4 sid [amd64]) [libreoffice-core:amd64 on libreoffice Inst libreoffice-common [3] (4 sid [all]) [] Inst ure (4 sid [amd64]) Conf ure (4 sid [amd64]) -Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice-common (4 sid [all]) Conf libreoffice-core (4 sid [amd64]) +Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice (4 sid [amd64])' 'Reading package lists... Building dependency tree... The following NEW packages will be installed: @@ -55,7 +55,7 @@ Inst libreoffice-core [3] (4 sid [amd64]) [libreoffice-common:amd64 on libreoffi Inst libreoffice-common [3] (4 sid [all]) [] Inst ure (4 sid [amd64]) Conf ure (4 sid [amd64]) -Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice-common (4 sid [all]) Conf libreoffice-core (4 sid [amd64]) +Conf libreoffice-style-galaxy (4 sid [amd64]) Conf libreoffice (4 sid [amd64])' aptget dist-upgrade -s |