diff options
author | Michael Vogt <mvo@debian.org> | 2013-08-15 09:26:00 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2013-08-15 09:26:00 +0200 |
commit | d7a4635391d9ff36152603ab6faa6eafa206750a (patch) | |
tree | e16a562e3e9a195cae286433c5751a1ab9990635 /test | |
parent | 2a49601f69e08f06fb2727d869d420daacdd09d5 (diff) | |
parent | 183116d1a64a2610b88fa6b50f2c5199b69d5841 (diff) |
Merge branch 'debian/sid' into debian/experimental
Conflicts:
apt-pkg/contrib/strutl.cc
apt-pkg/deb/dpkgpm.cc
configure.ac
debian/changelog
doc/po/apt-doc.pot
po/apt-all.pot
po/ar.po
po/ast.po
po/bg.po
po/bs.po
po/ca.po
po/cs.po
po/cy.po
po/da.po
po/de.po
po/dz.po
po/el.po
po/es.po
po/eu.po
po/fi.po
po/fr.po
po/gl.po
po/hu.po
po/it.po
po/ja.po
po/km.po
po/ko.po
po/ku.po
po/lt.po
po/mr.po
po/nb.po
po/ne.po
po/nl.po
po/nn.po
po/pl.po
po/pt.po
po/pt_BR.po
po/ro.po
po/ru.po
po/sk.po
po/sl.po
po/sv.po
po/th.po
po/tl.po
po/uk.po
po/vi.po
po/zh_CN.po
po/zh_TW.po
test/integration/framework
test/integration/test-bug-602412-dequote-redirect
test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
test/interactive-helper/aptwebserver.cc
test/interactive-helper/makefile
Diffstat (limited to 'test')
56 files changed, 1550 insertions, 338 deletions
diff --git a/test/integration/Packages-pdiff-usage b/test/integration/Packages-pdiff-usage index d1530a95c..ac962f29a 100644 --- a/test/integration/Packages-pdiff-usage +++ b/test/integration/Packages-pdiff-usage @@ -19,6 +19,7 @@ Description: Advanced front-end for dpkg . APT features complete installation ordering, multiple source capability and several other unique features, see the Users Guide in apt-doc. +Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c Package: oldstuff Version: 1.0 @@ -32,3 +33,4 @@ SHA1: 3c695e028f74d5c544deeddaaa1242desa81088c SHA256: b46fd1546151c545fe4bfa56a5cc0e7deaef23e2da3e4f129727fd660f28f050 Description: some cool but old stuff This package will disappear in the next mirror update +Description-md5: 1948af60eda0a41dfa9fe83f60eb8389 diff --git a/test/integration/Packages-pdiff-usage-new b/test/integration/Packages-pdiff-usage-new index 4f374b37f..f8d7b1958 100644 --- a/test/integration/Packages-pdiff-usage-new +++ b/test/integration/Packages-pdiff-usage-new @@ -22,6 +22,7 @@ Description: Advanced front-end for dpkg . APT features complete installation ordering, multiple source capability and several other unique features, see the Users Guide in apt-doc. +Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c Package: newstuff Version: 1.0 @@ -35,3 +36,4 @@ SHA1: 3c695e028f7a1ae324deeddaaa1242desa81088c SHA256: b46fd154615edefab321cc56a5cc0e7deaef23e2da3e4f129727fd660f28f050 Description: some cool and shiny new stuff This package will appear in the next mirror update +Description-md5: d5f89fbbc2ac69c43d7e4c9b67d82b6b diff --git a/test/integration/Packages-releasefile-verification b/test/integration/Packages-releasefile-verification index 29a385f4f..eb7327279 100644 --- a/test/integration/Packages-releasefile-verification +++ b/test/integration/Packages-releasefile-verification @@ -16,3 +16,4 @@ Description: Advanced front-end for dpkg . APT features complete installation ordering, multiple source capability and several other unique features, see the Users Guide in apt-doc. +Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c diff --git a/test/integration/Packages-releasefile-verification-new b/test/integration/Packages-releasefile-verification-new index e3b2edf1f..61509d157 100644 --- a/test/integration/Packages-releasefile-verification-new +++ b/test/integration/Packages-releasefile-verification-new @@ -19,3 +19,4 @@ Description: Advanced front-end for dpkg . APT features complete installation ordering, multiple source capability and several other unique features, see the Users Guide in apt-doc. +Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c diff --git a/test/integration/framework b/test/integration/framework index 9b01c3161..72c899e32 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -38,7 +38,11 @@ msgtest() { } msgpass() { echo "${CPASS}PASS${CNORMAL}" >&2; } msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; } -msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); } +msgfail() { + if [ $# -gt 0 ]; then echo "${CFAIL}FAIL: $*${CNORMAL}" >&2; + else echo "${CFAIL}FAIL${CNORMAL}" >&2; fi + EXIT_CODE=$((EXIT_CODE+1)); +} # enable / disable Debugging MSGLEVEL=${MSGLEVEL:-3} @@ -56,9 +60,9 @@ if [ $MSGLEVEL -le 2 ]; then msgpass() { echo -n " ${CPASS}P${CNORMAL}" >&2; } msgskip() { echo -n " ${CWARNING}S${CNORMAL}" >&2; } if [ -n "$CFAIL" ]; then - msgfail() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; } + msgfail() { echo -n " ${CFAIL}FAIL${CNORMAL}" >&2; EXIT_CODE=$((EXIT_CODE+1)); } else - msgfail() { echo -n " ###FAILED###" >&2; } + msgfail() { echo -n " ###FAILED###" >&2; EXIT_CODE=$((EXIT_CODE+1)); } fi fi if [ $MSGLEVEL -le 3 ]; then @@ -114,6 +118,9 @@ gdb() { echo "gdb: run »$*«" APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which gdb) ${BUILDDIRECTORY}/$1 } +http() { + LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/methods/http +} exitwithstatus() { # error if we about to overflow, but ... @@ -124,9 +131,23 @@ exitwithstatus() { exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); } +shellsetedetector() { + local exit_status=$? + if [ "$exit_status" != '0' ]; then + echo >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}" + if [ "$EXIT_CODE" = '0' ]; then + EXIT_CODE="$exit_status" + fi + fi +} + addtrap() { - CURRENTTRAP="$CURRENTTRAP $1" - trap "$CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM + if [ "$1" = 'prefix' ]; then + CURRENTTRAP="$2 $CURRENTTRAP" + else + CURRENTTRAP="$CURRENTTRAP $1" + fi + trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM } setupenvironment() { @@ -135,8 +156,7 @@ setupenvironment() { msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… " BUILDDIRECTORY="${TESTDIRECTORY}/../../build/bin" test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" - local OLDWORKINGDIRECTORY=$(pwd) - addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY; cd $OLDWORKINGDIRECTORY;" + addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY;" cd $TMPWORKINGDIRECTORY mkdir rootdir aptarchive keys cd rootdir @@ -167,7 +187,7 @@ setupenvironment() { echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf - if ! $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then + if ! $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it… fi echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf @@ -215,7 +235,7 @@ configdpkg() { echo -n > rootdir/var/lib/dpkg/status fi fi - if $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then + if $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then local ARCHS="$(getarchitectures)" if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then DPKGARCH="$(dpkg --print-architecture)" @@ -483,6 +503,7 @@ insertpackage() { local VERSION="$4" local DEPENDENCIES="$5" local PRIORITY="${6:-optional}" + local DESCRIPTION="${7}" local ARCHS="" for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do if [ "$arch" = 'all' -o "$arch" = 'none' ]; then @@ -504,11 +525,16 @@ Maintainer: Joe Sixpack <joe@example.org>" >> $FILE echo "Version: $VERSION Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE - echo "Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} + echo -n 'Description: ' >> $FILE + if [ -z "$DESCRIPTION" ]; then + echo "an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} If you find such a package installed on your system, YOU did something horribly wrong! They are autogenerated - und used only by testcases for APT and surf no other propose… -" >> $FILE + und used only by testcases for APT and surf no other propose…" >> $FILE + else + echo "$DESCRIPTION" >> $FILE + fi + echo >> $FILE done done } @@ -589,9 +615,12 @@ buildaptarchivefromfiles() { cat ${line} | bzip2 > ${line}.bz2 cat ${line} | xz --format=lzma > ${line}.lzma cat ${line} | xz > ${line}.xz + if [ -n "$1" ]; then + touch -d "$1" ${line}.gz ${line}.bz2 ${line}.lzma ${line}.xz + fi msgdone "info" done - generatereleasefiles + generatereleasefiles "$@" } # can be overridden by testcases for their pleasure @@ -683,58 +712,87 @@ setupaptarchive() { setupflataptarchive fi signreleasefiles - msgninfo "\tSync APT's cache with the archive… " - aptget update -qq - msgdone "info" + if [ "$1" != '--no-update' ]; then + msgninfo "\tSync APT's cache with the archive… " + aptget update -qq + msgdone "info" + fi } signreleasefiles() { local SIGNER="${1:-Joe Sixpack}" + local GPG="gpg --batch --yes --no-default-keyring --trustdb-name rootdir/etc/apt/trustdb.gpg" msgninfo "\tSign archive with $SIGNER key… " - local SECKEYS="" + local REXKEY='keys/rexexpired' + local SECEXPIREBAK="${REXKEY}.sec.bak" + local PUBEXPIREBAK="${REXKEY}.pub.bak" + if [ "${SIGNER}" = 'Rex Expired' ]; then + # the key is expired, so gpg doesn't allow to sign with and the --faked-system-time + # option doesn't exist anymore (and using faketime would add a new obscure dependency) + # therefore we 'temporary' make the key not expired and restore a backup after signing + cp ${REXKEY}.sec $SECEXPIREBAK + cp ${REXKEY}.pub $PUBEXPIREBAK + local SECUNEXPIRED="${REXKEY}.sec.unexpired" + local PUBUNEXPIRED="${REXKEY}.pub.unexpired" + if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then + cp $SECUNEXPIRED ${REXKEY}.sec + cp $PUBUNEXPIRED ${REXKEY}.pub + else + printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub --secret-keyring ${REXKEY}.sec --command-fd 0 --edit-key "${SIGNER}" >/dev/null 2>&1 || true + cp ${REXKEY}.sec $SECUNEXPIRED + cp ${REXKEY}.pub $PUBUNEXPIRED + fi + fi for KEY in $(find keys/ -name '*.sec'); do - SECKEYS="$SECKEYS --secret-keyring $KEY" + GPG="$GPG --secret-keyring $KEY" done - local PUBKEYS="" for KEY in $(find keys/ -name '*.pub'); do - PUBKEYS="$PUBKEYS --keyring $KEY" + GPG="$GPG --keyring $KEY" done for RELEASE in $(find aptarchive/ -name Release); do - gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" -abs -o ${RELEASE}.gpg ${RELEASE} - gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" --clearsign -o "$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')" $RELEASE + $GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg ${RELEASE} + local INRELEASE="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')" + $GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE + # we might have set a specific date for the Release file, so copy it + touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg ${INRELEASE} done + if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then + mv -f $SECEXPIREBAK ${REXKEY}.sec + mv -f $PUBEXPIREBAK ${REXKEY}.pub + fi msgdone "info" } changetowebserver() { - if [ -n "$1" ] && ! test -x ${BUILDDIRECTORY}/aptwebserver; then - msgdie 'Need the aptwebserver when passing arguments' - fi - local LOG='/dev/null' if test -x ${BUILDDIRECTORY}/aptwebserver; then cd aptarchive - LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver $@ 2> $LOG > $LOG & - addtrap "kill $!;" + LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver -o aptwebserver::fork=1 "$@" >$LOG 2>&1 + local PID="$(cat aptwebserver.pid)" + if [ -z "$PID" ]; then + msgdie 'Could not fork aptwebserver successfully' + fi + addtrap "kill $PID;" cd - > /dev/null + elif [ $# -gt 0 ]; then + msgdie 'Need the aptwebserver when passing arguments for the webserver' elif which weborf > /dev/null; then - weborf -xb aptarchive/ 2> $LOG > $LOG & + weborf -xb aptarchive/ >$LOG 2>&1 & addtrap "kill $!;" elif which gatling > /dev/null; then cd aptarchive - gatling -p 8080 -F -S 2> $LOG > $LOG & + gatling -p 8080 -F -S >$LOG 2>&1 & addtrap "kill $!;" cd - > /dev/null elif which lighttpd > /dev/null; then echo "server.document-root = \"$(readlink -f ./aptarchive)\" server.port = 8080 server.stat-cache-engine = \"disable\"" > lighttpd.conf - lighttpd -t -f lighttpd.conf 2> $LOG > $LOG || msgdie 'Can not change to webserver: our lighttpd config is invalid' - lighttpd -D -f lighttpd.conf 2> $LOG > $LOG & + lighttpd -t -f lighttpd.conf >/dev/null || msgdie 'Can not change to webserver: our lighttpd config is invalid' + lighttpd -D -f lighttpd.conf >$LOG 2>&1 & addtrap "kill $!;" else - msgdie 'You have to install weborf or lighttpd first' - return 1 + msgdie 'You have to build aptwerbserver or install a webserver' fi local APTARCHIVE="file://$(readlink -f ./aptarchive)" for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do @@ -803,7 +861,7 @@ testequalor2() { echo "$2" > $COMPAREFILE2 shift 2 msgtest "Test for equality OR of" "$*" - $* 2>&1 1> $COMPAREAGAINST + $* >$COMPAREAGAINST 2>&1 (checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null || checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null) && msgpass || ( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \ @@ -880,6 +938,40 @@ testmarkedauto() { aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail } +testsuccess() { + if [ "$1" = '--nomsg' ]; then + shift + else + msgtest 'Test for successful execution of' "$*" + fi + local OUTPUT=$(mktemp) + addtrap "rm $OUTPUT;" + if $@ >${OUTPUT} 2>&1; then + msgpass + else + echo + cat $OUTPUT + msgfail + fi +} + +testfailure() { + if [ "$1" = '--nomsg' ]; then + shift + else + msgtest 'Test for failure in execution of' "$*" + fi + local OUTPUT=$(mktemp) + addtrap "rm $OUTPUT;" + if $@ >${OUTPUT} 2>&1; then + echo + cat $OUTPUT + msgfail + else + msgpass + fi +} + pause() { echo "STOPPED execution. Press enter to continue" local IGNORE diff --git a/test/integration/rexexpired.pub b/test/integration/rexexpired.pub Binary files differnew file mode 100644 index 000000000..5ab2e489a --- /dev/null +++ b/test/integration/rexexpired.pub diff --git a/test/integration/rexexpired.sec b/test/integration/rexexpired.sec Binary files differnew file mode 100644 index 000000000..dc00168cd --- /dev/null +++ b/test/integration/rexexpired.sec diff --git a/test/integration/skip-avoid-avoiding-breaks-predepends b/test/integration/skip-avoid-avoiding-breaks-predepends index a47e8bc2b..ed231bc3f 100755 --- a/test/integration/skip-avoid-avoiding-breaks-predepends +++ b/test/integration/skip-avoid-avoiding-breaks-predepends @@ -17,5 +17,5 @@ Pre-Depends: looping (>= 1.15)' setupaptarchive -aptget dist-upgrade -y -o Debug::pkgOrderList=1 #-qq 2>&1 > /dev/null +aptget dist-upgrade -y -o Debug::pkgOrderList=1 #-qq >/dev/null 2>&1 testdpkginstalled looping loop1 loop2 diff --git a/test/integration/skip-bug-711456-apt-cdrom-multiple-cds-multiarch b/test/integration/skip-bug-711456-apt-cdrom-multiple-cds-multiarch new file mode 100755 index 000000000..9e683b5b9 --- /dev/null +++ b/test/integration/skip-bug-711456-apt-cdrom-multiple-cds-multiarch @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable' 'Depends: libtest' +buildsimplenativepackage 'libtest' 'amd64,i386' '0.8.15' 'stable' 'Multi-Arch: same' +buildsimplenativepackage 'libtest' 'amd64,i386' '1' 'unstable' 'Multi-Arch: same' + +# needed by the ftparchive.conf +cd aptarchive +ln -s ../incoming pool +createaptftparchiveconfig +cd - >/dev/null +# create an amd64 cdrom +sed -i 's#Architectures .*$#Architectures "amd64 source";#' aptarchive/ftparchive.conf +setupaptarchive --no-update +changetocdrom 'Debian APT Testdisk amd64 0.8.15' +mv rootdir/media/cdrom rootdir/media/cdrom-amd64 +addtrap 'prefix' "chmod -R +w $PWD/rootdir/media/cdrom-amd64/dists/;" +chmod -R -w rootdir/media/cdrom-amd64/dists +ln -s $PWD/rootdir/media/cdrom-amd64 $PWD/rootdir/media/cdrom +aptcdrom add -m -o quiet=1 +rm $PWD/rootdir/media/cdrom +# do it again to create a i386 cdrom +sed -i 's#Architectures .*$#Architectures "i386 source";#' aptarchive/ftparchive.conf +setupaptarchive --no-update +changetocdrom 'Debian APT Testdisk i386 0.8.15' +mv rootdir/media/cdrom rootdir/media/cdrom-i386 +addtrap 'prefix' "chmod -R +w $PWD/rootdir/media/cdrom-i386/dists/;" +chmod -R -w rootdir/media/cdrom-i386/dists +ln -s $PWD/rootdir/media/cdrom-i386 $PWD/rootdir/media/cdrom +aptcdrom add -m -o quiet=1 + +# play with the cdroms +testdpkgnotinstalled testing +aptget install testing -t stable -y #> /dev/null 2>&1 +testdpkginstalled testing + +testdpkgnotinstalled testing:i386 +aptget install testing:i386 -t stable -y #> /dev/null 2>&1 +testdpkginstalled testing:i386 + +aptget dist-upgrade -y diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom index f1c4fd9d3..85c3a2fee 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -7,7 +7,7 @@ setupenvironment configarchitecture 'amd64' 'i386' buildsimplenativepackage 'testing' 'amd64,i386' '0.8.15' 'stable' -setupaptarchive +setupaptarchive --no-update changetocdrom 'Debian APT Testdisk 0.8.15' @@ -24,7 +24,7 @@ cat Translation-de | xz --format=lzma > Translation-de.lzma cat Translation-de | xz > Translation-de.xz rm Translation-en Translation-de cd - > /dev/null -addtrap "chmod -R +w $PWD/rootdir/media/cdrom/dists/;" +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 @@ -102,5 +102,5 @@ aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' && # check that we really can install from a 'cdrom' testdpkgnotinstalled testing -aptget install testing -y > /dev/null 2>&1 +testsuccess aptget install testing -y testdpkginstalled testing diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove index c25ce3f58..dc30cde34 100755 --- a/test/integration/test-apt-get-autoremove +++ b/test/integration/test-apt-get-autoremove @@ -11,11 +11,11 @@ buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable' buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf' setupaptarchive -aptget install unrelated debhelper -qq 2>&1 > /dev/null +testsuccess aptget install unrelated debhelper -y testdpkginstalled 'unrelated' 'debhelper' 'po-debconf' testmarkedauto 'po-debconf' -aptget remove debhelper -y -qq 2>&1 > /dev/null +testsuccess aptget remove debhelper -y testdpkgnotinstalled 'debhelper' testdpkginstalled 'po-debconf' 'unrelated' @@ -30,15 +30,15 @@ Remv po-debconf [1.0.16]' aptget autoremove -s testdpkginstalled 'po-debconf' echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove -aptget autoremove -y -qq 2>&1 > /dev/null +testsuccess aptget autoremove -y testdpkginstalled 'po-debconf' echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove -aptget autoremove -y -qq 2>&1 > /dev/null +testsuccess aptget autoremove -y testdpkginstalled "po-debconf" rm rootdir/etc/apt/apt.conf.d/00autoremove -aptget autoremove -y -qq 2>&1 > /dev/null +testsuccess aptget autoremove -y testdpkgnotinstalled 'po-debconf' testmarkedauto diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key new file mode 100755 index 000000000..68b3f9710 --- /dev/null +++ b/test/integration/test-apt-key @@ -0,0 +1,107 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +msgtest 'Check that paths in list output are not' 'double-slashed' +aptkey list 2>&1 | grep -q '//' && msgfail || msgpass + +msgtest 'Check that paths in finger output are not' 'double-slashed' +aptkey finger 2>&1 | grep -q '//' && msgfail || msgpass + +echo 'APT::Key::ArchiveKeyring "./keys/joesixpack.pub"; +APT::Key::RemovedKeys "./keys/rexexpired.pub";' > rootdir/etc/apt/apt.conf.d/aptkey.conf + +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + +testequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed +gpg: Total number processed: 1 +gpg: unchanged: 1' aptkey --fakeroot update + +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + +testsuccess aptkey --fakeroot add ./keys/rexexpired.pub + +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 2048R/27CE74F9 2013-07-12 [expired: 2013-07-13] +pub 2048R/DBAC8DAE 2010-08-18' + +msgtest 'Execute update again to trigger removal of' 'Rex Expired key' +testsuccess --nomsg aptkey --fakeroot update + +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + +msgtest "Try to remove a key which exists, but isn't in the" 'forced keyring' +testsuccess --nomsg aptkey --fakeroot --keyring rootdir/etc/apt/trusted.gpg del DBAC8DAE + +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18' + +testsuccess aptkey --fakeroot del DBAC8DAE +testempty aptkey list + +# start from a clean plate again +cleanplate() { + rm -rf rootdir/etc/apt/trusted.gpg.d/ rootdir/etc/apt/trusted.gpg + mkdir rootdir/etc/apt/trusted.gpg.d/ +} + +msgtest 'Test key removal with' 'single key in real file' +cleanplate +cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg +testsuccess --nomsg aptkey --fakeroot del DBAC8DAE +testempty aptkey list +testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg +testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ + +msgtest 'Test key removal with' 'single key in softlink' +cleanplate +ln -s $(readlink -f ./keys/joesixpack.pub) rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg +testsuccess --nomsg aptkey --fakeroot del DBAC8DAE +testempty aptkey list +testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg +testsuccess test -L rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ + +cleanplate +testsuccess aptkey --fakeroot add ./keys/joesixpack.pub +testsuccess aptkey --fakeroot add ./keys/marvinparanoid.pub +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 2048R/DBAC8DAE 2010-08-18 +pub 2048R/528144E2 2011-01-16' +cp -a rootdir/etc/apt/trusted.gpg keys/testcase-multikey.pub # store for reuse + +msgtest 'Test key removal with' 'multi key in real file' +cleanplate +cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg +testsuccess --nomsg aptkey --fakeroot del DBAC8DAE +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' +testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ + +msgtest 'Test key removal with' 'multi key in softlink' +cleanplate +ln -s $(readlink -f ./keys/testcase-multikey.pub) rootdir/etc/apt/trusted.gpg.d/multikey.gpg +testsuccess --nomsg aptkey --fakeroot del DBAC8DAE +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' +testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ +testsuccess test ! -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg +testsuccess test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ + +msgtest 'Test key removal with' 'multiple files including key' +cleanplate +cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg +cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg +testsuccess --nomsg aptkey --fakeroot del DBAC8DAE +aptkey list | grep '^pub' > aptkey.list +testfileequal ./aptkey.list 'pub 2048R/528144E2 2011-01-16' +testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg +testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~ +testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~ diff --git a/test/integration/test-bug-407511-fail-invalid-default-release b/test/integration/test-bug-407511-fail-invalid-default-release index 7f23a1e82..3d3b0ada3 100755 --- a/test/integration/test-bug-407511-fail-invalid-default-release +++ b/test/integration/test-bug-407511-fail-invalid-default-release @@ -35,14 +35,14 @@ setupaptarchive passdist() { msgtest 'Test that target-release is accepted' $1 - aptget dist-upgrade -t $1 -qq && msgpass || msgfail + testsuccess --nomsg aptget dist-upgrade -t $1 msgtest 'Test that target-release pins with' $1 aptcache policy -t $1 | grep -q ' 990' && msgpass || msgfail } faildist() { msgtest 'Test that target-release is refused' $1 - aptget dist-upgrade -t $1 -qq 2> /dev/null && msgfail || msgpass + testfailure --nomsg aptget dist-upgrade -t $1 } msgtest 'Test that no default-release is active in this test' 'setup' diff --git a/test/integration/test-bug-543966-downgrade-below-1000-pin b/test/integration/test-bug-543966-downgrade-below-1000-pin new file mode 100755 index 000000000..f602bea95 --- /dev/null +++ b/test/integration/test-bug-543966-downgrade-below-1000-pin @@ -0,0 +1,81 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'i386' + +insertpackage 'unstable' 'base-files' 'all' '5.0.0' +insertinstalledpackage 'base-files' 'all' '5.0.0-1' + +setupaptarchive + +STATUS=$(readlink -f rootdir/var/lib/dpkg/status) +APTARCHIVE="$(readlink -f aptarchive)/" + +testequal "base-files: + Installed: 5.0.0-1 + Candidate: 5.0.0-1 + Version table: + *** 5.0.0-1 0 + 100 $STATUS + 5.0.0 0 + 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=0 + +echo 'Package: base-files +Pin: release a=unstable +Pin-Priority: 99' > rootdir/etc/apt/preferences + +testequal "base-files: + Installed: 5.0.0-1 + Candidate: 5.0.0-1 + Package pin: 5.0.0 + Version table: + *** 5.0.0-1 99 + 100 $STATUS + 5.0.0 99 + 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=99 + +echo 'Package: base-files +Pin: release a=unstable +Pin-Priority: 100' > rootdir/etc/apt/preferences + +testequal "base-files: + Installed: 5.0.0-1 + Candidate: 5.0.0-1 + Package pin: 5.0.0 + Version table: + *** 5.0.0-1 100 + 100 $STATUS + 5.0.0 100 + 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=100 + +echo 'Package: base-files +Pin: release a=unstable +Pin-Priority: 999' > rootdir/etc/apt/preferences + +testequal "base-files: + Installed: 5.0.0-1 + Candidate: 5.0.0-1 + Package pin: 5.0.0 + Version table: + *** 5.0.0-1 999 + 100 $STATUS + 5.0.0 999 + 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=999 + +echo 'Package: base-files +Pin: release a=unstable +Pin-Priority: 1000' > rootdir/etc/apt/preferences + +testequal "base-files: + Installed: 5.0.0-1 + Candidate: 5.0.0 + Package pin: 5.0.0 + Version table: + *** 5.0.0-1 1000 + 100 $STATUS + 5.0.0 1000 + 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=1000 diff --git a/test/integration/test-bug-590041-prefer-non-virtual-packages b/test/integration/test-bug-590041-prefer-non-virtual-packages index e0dd7737f..0ce4c1413 100755 --- a/test/integration/test-bug-590041-prefer-non-virtual-packages +++ b/test/integration/test-bug-590041-prefer-non-virtual-packages @@ -9,6 +9,7 @@ pkglibc6="Package: libc6 Architecture: armel Version: 2.11.2-2~0.3 Description: Embedded GNU C Library: Shared libraries +Description-md5: b8c1e0561b75e2dc6b6482a99079c3e4 Filename: pool/main/e/eglibc/libc6_2.11.2-2_armel.deb Installed-Size: 9740 MD5sum: f5b878ce5fb8aa01a7927fa1460df537 @@ -25,6 +26,7 @@ Architecture: i386 Version: 2.1.3-13~0.3 Replaces: libc6 (<< 2.2.5-13~0.3) Description: The Berkeley database routines [glibc 2.0/2.1 compatibility] +Description-md5: de1876f7fe7f7709a110875e145e38a8 Filename: pool/main/d/db1-compat/libdb1-compat_2.1.3-13_armel.deb Installed-Size: 136 MD5sum: 4043f176ab2b40b0c01bc1211b8c103c diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files index 4611b8b8e..a05ed5fa6 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -103,23 +103,23 @@ testoverhttp() { setupcompressor "$1" createemptyfile 'en' - testaptgetupdate "Get: http://localhost Packages [] -Get: http://localhost Translation-en + testaptgetupdate "Get: http://localhost:8080 Packages [] +Get: http://localhost:8080 Translation-en Reading package lists..." "empty file en.$COMPRESS over http" createemptyarchive 'en' - testaptgetupdate "Get: http://localhost Packages [] -Get: http://localhost Translation-en [] + testaptgetupdate "Get: http://localhost:8080 Packages [] +Get: http://localhost:8080 Translation-en [] Reading package lists..." "empty archive en.$COMPRESS over http" createemptyarchive 'Packages' - testaptgetupdate "Get: http://localhost Packages [] + testaptgetupdate "Get: http://localhost:8080 Packages [] Reading package lists..." "empty archive Packages.$COMPRESS over http" createemptyfile 'Packages' #FIXME: we should response with a good error message instead - testaptgetupdate "Get: http://localhost Packages -Err http://localhost Packages + testaptgetupdate "Get: http://localhost:8080 Packages +Err http://localhost:8080 Packages Empty files can't be valid archives W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:8080_Packages) Empty files can't be valid archives diff --git a/test/integration/test-bug-596498-trusted-unsigned-repo b/test/integration/test-bug-596498-trusted-unsigned-repo index 6ebc4a3bb..5c643c40e 100755 --- a/test/integration/test-bug-596498-trusted-unsigned-repo +++ b/test/integration/test-bug-596498-trusted-unsigned-repo @@ -27,7 +27,7 @@ aptgetupdate testequal "$PKGTEXT WARNING: The following packages cannot be authenticated! cool -Install these packages without verification [y/N]? N +Install these packages without verification? [y/N] N E: Some packages could not be authenticated" aptget install cool --assume-no -d find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete @@ -37,7 +37,7 @@ aptgetupdate testequal "$PKGTEXT WARNING: The following packages cannot be authenticated! cool -Install these packages without verification [y/N]? N +Install these packages without verification? [y/N] N E: Some packages could not be authenticated" aptget install cool --assume-no -d sed -i -e 's#deb#deb [trusted=yes]#' $DEBFILE diff --git a/test/integration/test-bug-601016-description-translation b/test/integration/test-bug-601016-description-translation index 03fddbfda..33c209e9d 100755 --- a/test/integration/test-bug-601016-description-translation +++ b/test/integration/test-bug-601016-description-translation @@ -9,8 +9,9 @@ configarchitecture 'i386' 'amd64' # we need a valid locale here, otherwise the language configuration # will be overridden by LC_ALL=C LOCALE="$(echo "$LANG" | cut -d'_' -f 1)" +MD5Sum='Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c' -PACKAGESTANZA="Package: apt +PACKAGESTANZA='Package: apt Priority: important Section: admin Installed-Size: 5984 @@ -19,8 +20,7 @@ Architecture: i386 Version: 0.8.7 Filename: pool/main/a/apt/apt_0.8.7_i386.deb Size: 2140230 -MD5sum: 74769bfbcef9ebc4fa74f7a5271b9c08 -Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c" +MD5sum: 74769bfbcef9ebc4fa74f7a5271b9c08' PACKAGESTANZA2='Package: apt Priority: important @@ -31,22 +31,23 @@ Architecture: amd64 Version: 0.8.7 Filename: pool/main/a/apt/apt_0.8.7_amd64.deb Size: 2210342 -MD5sum: 4a869bfbdef9ebc9fa74f7a5271e8d1a -Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c' +MD5sum: 4a869bfbdef9ebc9fa74f7a5271e8d1a' echo "$PACKAGESTANZA Description: Advanced front-end for dpkg +$MD5Sum $PACKAGESTANZA2 -Description: Advanced front-end for dpkg" > aptarchive/Packages +Description: Advanced front-end for dpkg +$MD5Sum" > aptarchive/Packages echo "Package: apt -Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c Description-${LOCALE}: Mächtige Oberfläche für dpkg Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die APT-Dselect-Methode. Beides sind einfache und sicherere Wege, - um Pakete zu installieren und Upgrades durchzuführen." | bzip2 > aptarchive/${LOCALE}.bz2 + um Pakete zu installieren und Upgrades durchzuführen. +$MD5Sum" | bzip2 > aptarchive/${LOCALE}.bz2 # the $LOCALE translation file will not be included as it is a flat archive it came from and therefore # its name can not be guessed correctly… (in non-flat archives the files are called Translation-*) @@ -54,10 +55,12 @@ echo 'APT::Cache::Generate "false";' > rootdir/etc/apt/apt.conf.d/00nogenerate NOLONGSTANZA="$PACKAGESTANZA Description: Advanced front-end for dpkg +$MD5Sum " ENGLISHSTANZA="$PACKAGESTANZA Description: Advanced front-end for dpkg +$MD5Sum " LOCALESTANZA="$PACKAGESTANZA @@ -66,6 +69,7 @@ Description-${LOCALE}: Mächtige Oberfläche für dpkg auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die APT-Dselect-Methode. Beides sind einfache und sicherere Wege, um Pakete zu installieren und Upgrades durchzuführen. +$MD5Sum " LOCALESTANZA2="$PACKAGESTANZA2 Description-${LOCALE}: Mächtige Oberfläche für dpkg @@ -73,6 +77,7 @@ Description-${LOCALE}: Mächtige Oberfläche für dpkg auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die APT-Dselect-Methode. Beides sind einfache und sicherere Wege, um Pakete zu installieren und Upgrades durchzuführen. +$MD5Sum " testrun() { @@ -97,28 +102,32 @@ testrun echo "$PACKAGESTANZA Description: Advanced front-end for dpkg +$MD5Sum $PACKAGESTANZA2 -Description: Advanced front-end for dpkg" > aptarchive/Packages +Description: Advanced front-end for dpkg +$MD5Sum" > aptarchive/Packages echo "Package: apt -Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c Description-en: Advanced front-end for dpkg This is Debian's next generation front-end for the dpkg package manager. It provides the apt-get utility and APT dselect method that provides a - simpler, safer way to install and upgrade packages." | bzip2 > aptarchive/en.bz2 + simpler, safer way to install and upgrade packages. +$MD5Sum" | bzip2 > aptarchive/en.bz2 ENGLISHSTANZA="$PACKAGESTANZA Description-en: Advanced front-end for dpkg This is Debian's next generation front-end for the dpkg package manager. It provides the apt-get utility and APT dselect method that provides a simpler, safer way to install and upgrade packages. +$MD5Sum " ENGLISHSTANZA2="$PACKAGESTANZA2 Description-en: Advanced front-end for dpkg This is Debian's next generation front-end for the dpkg package manager. It provides the apt-get utility and APT dselect method that provides a simpler, safer way to install and upgrade packages. +$MD5Sum " testrun diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect index f1e67c6d8..bcebb57b8 100755 --- a/test/integration/test-bug-602412-dequote-redirect +++ b/test/integration/test-bug-602412-dequote-redirect @@ -16,14 +16,14 @@ mv aptarchive/pool aptarchive/newpool mv aptarchive/dists aptarchive/newdists msgtest 'Test redirection works in' 'apt-get update' -aptget update -qq && msgpass || msgfail +testsuccess --nomsg aptget update # check that I-M-S header is kept in redirections -testequal 'Hit http://localhost unstable InRelease -Hit http://localhost unstable/main Sources -Hit http://localhost unstable/main amd64 Packages -Hit http://localhost unstable/main Translation-en -Reading package lists...' aptget update +testequal 'Hit http://localhost:8080 unstable InRelease +Hit http://localhost:8080 unstable/main Sources +Hit http://localhost:8080 unstable/main amd64 Packages +Hit http://localhost:8080 unstable/main Translation-en +Reading package lists...' aptget update #-o debug::pkgacquire=1 -o debug::pkgacquire::worker=1 msgtest 'Test redirection works in' 'package download' -aptget install unrelated --download-only -qq && msgpass || msgfail +testsuccess --nomsg aptget install unrelated --download-only -y diff --git a/test/integration/test-bug-604222-new-and-autoremove b/test/integration/test-bug-604222-new-and-autoremove index ea73c5775..b29347f64 100755 --- a/test/integration/test-bug-604222-new-and-autoremove +++ b/test/integration/test-bug-604222-new-and-autoremove @@ -8,7 +8,7 @@ configarchitecture "i386" setupaptarchive touch rootdir/var/lib/apt/extended_states -aptmark markauto 'libvtk5.4' +testsuccess aptmark markauto 'libvtk5.4' testmarkedauto 'libvtk5.4' testequal "Reading package lists... diff --git a/test/integration/test-bug-604401-files-are-directories b/test/integration/test-bug-604401-files-are-directories index aae717a19..e6913edcf 100755 --- a/test/integration/test-bug-604401-files-are-directories +++ b/test/integration/test-bug-604401-files-are-directories @@ -11,7 +11,7 @@ test ! -e rootdir/etc/apt/apt.conf || mv rootdir/etc/apt/apt.conf rootdir/etc/ap msgtest "Directory instead of a file as apt.conf ignored" mkdir -p rootdir/etc/apt/apt.conf -aptconfig dump > /dev/null && msgpass || msgfail +testsuccess --nomsg aptconfig dump rmdir rootdir/etc/apt/apt.conf msgtest "Good link instead of a file as apt.conf ignored" @@ -22,7 +22,7 @@ rm rootdir/etc/apt/apt.conf msgtest "Broken link instead of a file as apt.conf ignored" ln -s /tmp/doesnt-exist rootdir/etc/apt/apt.conf -aptconfig dump > /dev/null && msgpass || msgfail +testsuccess --nomsg aptconfig dump rm rootdir/etc/apt/apt.conf @@ -30,7 +30,7 @@ test ! -e rootdir/etc/apt/sources.list || mv rootdir/etc/apt/sources.list rootdi msgtest "Directory instead of a file as sources.list ignored" mkdir -p rootdir/etc/apt/sources.list -aptget update --print-uris 2> /dev/null && msgpass || msgfail +testsuccess --nomsg aptget update --print-uris rmdir rootdir/etc/apt/sources.list msgtest "Good link instead of a file as sources.list ignored" @@ -49,7 +49,7 @@ test ! -e rootdir/etc/apt/preferences || mv rootdir/etc/apt/preferences rootdir/ msgtest "Directory instead of a file as preferences ignored" mkdir -p rootdir/etc/apt/preferences -aptcache policy > /dev/null 2> /dev/null && msgpass || msgfail +testsuccess --nomsg aptcache policy rmdir rootdir/etc/apt/preferences msgtest "Good link instead of a file as preferences ignored" @@ -62,5 +62,5 @@ rm rootdir/etc/apt/preferences msgtest "Broken link instead of a file as preferences ignored" ln -s /tmp/doesnt-exist rootdir/etc/apt/preferences -aptcache policy > /dev/null 2> /dev/null && msgpass || msgfail +testsuccess --nomsg aptcache policy rm rootdir/etc/apt/preferences diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual index 9cf01610c..e3d454f97 100755 --- a/test/integration/test-bug-611729-mark-as-manual +++ b/test/integration/test-bug-611729-mark-as-manual @@ -15,21 +15,21 @@ buildsimplenativepackage "c" "all" "1.0" "stable" "Depends: b" setupaptarchive # dpkg freaks out if the last package is removed so keep one around -aptget install peace-dpkg -y -qq 2>&1 > /dev/null +testsuccess aptget install peace-dpkg -y testdpkginstalled peace-dpkg testmarkedauto -aptget install a -y -qq 2>&1 > /dev/null +testsuccess aptget install a -y testdpkginstalled a b testdpkgnotinstalled c testmarkedauto 'b' -aptget remove a -y -qq 2>&1 > /dev/null +testsuccess aptget remove a -y testdpkgnotinstalled a c testdpkginstalled b testmarkedauto 'b' -aptget install c -y -qq 2>&1 > /dev/null +testsuccess aptget install c -y testdpkgnotinstalled a testdpkginstalled b c testmarkedauto 'b' @@ -50,7 +50,7 @@ testmarkedauto 'b' rm rootdir/var/log/apt/history.log -aptget install b --reinstall -y -qq 2>&1 > /dev/null +testsuccess aptget install b --reinstall -y testdpkgnotinstalled a testdpkginstalled b c testmarkedauto 'b' @@ -67,24 +67,24 @@ b set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b testmarkedauto -aptget remove b -y -qq 2>&1 > /dev/null +testsuccess aptget remove b -y testdpkgnotinstalled a b c testmarkedauto -aptget install a b -y -qq 2>&1 > /dev/null +testsuccess aptget install a b -y testdpkginstalled a b testdpkgnotinstalled c testmarkedauto -aptget purge a b -y -qq 2>&1 > /dev/null +testsuccess aptget purge a b -y testdpkgnotinstalled a b c testmarkedauto -aptget install b c -y -qq 2>&1 > /dev/null +testsuccess aptget install b c -y testdpkgnotinstalled a testdpkginstalled b c testmarkedauto -aptget install a -y -qq 2>&1 > /dev/null +testsuccess aptget install a -y testdpkginstalled a b c testmarkedauto diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts index 530012e5d..20dc3a7e5 100755 --- a/test/integration/test-bug-612099-multiarch-conflicts +++ b/test/integration/test-bug-612099-multiarch-conflicts @@ -15,7 +15,7 @@ buildsimplenativepackage 'foobar' 'amd64' '1.0' 'stable' 'Depends: libc6' setupaptarchive -aptget install libc6:i386 -t stable -y -qq 2>&1 > /dev/null +testsuccess aptget install libc6:i386 -t stable -y testdpkginstalled libc6:i386 testequal 'Reading package lists... Building dependency tree... @@ -78,9 +78,9 @@ Conf libc6 (2.0 testing [all])' aptget upgrade -t testing -s # FIXME: on amd64 systems this test wouldn't run with a real upgrade # as APT (here i386) disagree about the native architecture, so # we fake it here: -#aptget upgrade -y -qq 2>&1 > /dev/null -aptget purge libc6 -y -qq 2>&1 >/dev/null -aptget install libc6:i386 -y -qq 2>&1 >/dev/null +#aptget upgrade -y -qq >/dev/null 2>&1 +testsuccess aptget purge libc6 -y +testsuccess aptget install libc6:i386 -y testdpkginstalled libc6:all testequal 'Reading package lists... @@ -129,7 +129,7 @@ buildsimplenativepackage 'foobar-same' 'amd64' '1.0' 'stable' 'Depends: libc6-sa setupaptarchive -aptget install libc6-same:i386 -t stable -y -qq 2>&1 > /dev/null +testsuccess aptget install libc6-same:i386 -t stable -y testdpkginstalled libc6-same:i386 testequal 'Reading package lists... @@ -176,9 +176,9 @@ Conf libc6-same (2.0 testing [all])' aptget upgrade -t testing -s # FIXME: on amd64 systems this test wouldn't run with a real upgrade # as APT (here i386) disagree about the native architecture, so # we fake it here: -#aptget upgrade -y -qq 2>&1 > /dev/null -aptget purge libc6-same -y -qq 2>&1 >/dev/null -aptget install libc6-same:i386 -y -qq 2>&1 >/dev/null +#aptget upgrade -y -qq >/dev/null 2>&1 +testsuccess aptget purge libc6-same -y +testsuccess aptget install libc6-same:i386 -y testdpkginstalled libc6-same:all diff --git a/test/integration/test-bug-612557-garbage-upgrade b/test/integration/test-bug-612557-garbage-upgrade index 8efd1687a..910b3b149 100755 --- a/test/integration/test-bug-612557-garbage-upgrade +++ b/test/integration/test-bug-612557-garbage-upgrade @@ -13,7 +13,7 @@ insertpackage 'unstable' 'libreoffice-common' 'all' '1:3.3.0-2' 'Conflicts: open setupaptarchive touch rootdir/var/lib/apt/extended_states -aptmark markauto python-uno openoffice.org-common +testsuccess aptmark markauto python-uno openoffice.org-common #aptmark unmarkauto openoffice.org-emailmerge testmarkedauto python-uno openoffice.org-common @@ -32,7 +32,7 @@ The following packages will be upgraded: After this operation, 53.2 MB disk space will be freed. E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno -aptmark markauto openoffice.org-emailmerge +testsuccess aptmark markauto openoffice.org-emailmerge testmarkedauto python-uno openoffice.org-common openoffice.org-emailmerge testequal 'Reading package lists... diff --git a/test/integration/test-bug-612958-use-dpkg-multiarch-config b/test/integration/test-bug-612958-use-dpkg-multiarch-config index 18b964636..4d1f00ca0 100755 --- a/test/integration/test-bug-612958-use-dpkg-multiarch-config +++ b/test/integration/test-bug-612958-use-dpkg-multiarch-config @@ -14,13 +14,13 @@ insertinstalledpackage 'libapt' 'armel' '1.0' testpass() { rm rootdir/var/cache/apt/*.bin msgtest 'Test architecture handling' "$1 with $2" - aptcache show libapt:$2 2> /dev/null > /dev/null && msgpass || msgfail + testsuccess --nomsg aptcache show libapt:$2 } testfail() { rm rootdir/var/cache/apt/*.bin msgtest 'Test architecture handling' "$1 with $2" - aptcache show libapt:$2 2> /dev/null > /dev/null && msgfail || msgpass + testfailure --nomsg aptcache show libapt:$2 } testpass 'no config' 'i386' diff --git a/test/integration/test-bug-613420-new-garbage-dependency b/test/integration/test-bug-613420-new-garbage-dependency index 7a08871ca..9d9f1096a 100755 --- a/test/integration/test-bug-613420-new-garbage-dependency +++ b/test/integration/test-bug-613420-new-garbage-dependency @@ -15,7 +15,7 @@ insertpackage 'unstable' 'openoffice.org-officebean' 'all' '1:3.3.0-5' 'Depends: setupaptarchive touch rootdir/var/lib/apt/extended_states -aptmark markauto openoffice.org-officebean +testsuccess aptmark markauto openoffice.org-officebean testmarkedauto openoffice.org-officebean testequal "Reading package lists... diff --git a/test/integration/test-bug-618288-multiarch-same-lockstep b/test/integration/test-bug-618288-multiarch-same-lockstep index fde075172..e0305b64b 100755 --- a/test/integration/test-bug-618288-multiarch-same-lockstep +++ b/test/integration/test-bug-618288-multiarch-same-lockstep @@ -16,7 +16,7 @@ buildsimplenativepackage 'apt' 'i386' '2' 'unstable' 'Depends: libsame (= 2)' '' buildsimplenativepackage 'apt2' 'amd64' '2' 'unstable' 'Depends: libsame (= 2)' '' 'required' setupaptarchive -aptget dist-upgrade -s 2>&1 > output.apt +aptget dist-upgrade -s >output.apt 2>&1 # order in switch libsame:{amd64,i386} are unpacked is irrelevant, as both are installed - but we need to do it together LS_U_AMD="$(grep -o -n '^Inst libsame ' output.apt | cut -d: -f1)" diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling index d146b943c..d3c5b08ac 100755 --- a/test/integration/test-bug-624218-Translation-file-handling +++ b/test/integration/test-bug-624218-Translation-file-handling @@ -14,34 +14,47 @@ changetowebserver rm -rf rootdir/var/lib/apt/lists -msgtest 'No download of non-existent locals' 'with Index' -LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists +translationslisted() { + msgtest 'No download of non-existent locals' "$1" + LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass + rm -rf rootdir/var/lib/apt/lists -msgtest 'Download of existent locals' 'with Index' -LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail -rm -rf rootdir/var/lib/apt/lists + msgtest 'Download of existent locals' "$1" + LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail + rm -rf rootdir/var/lib/apt/lists -msgtest 'Download of en in LC_ALL=C' 'with Index' -LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail -rm -rf rootdir/var/lib/apt/lists + msgtest 'Download of en in LC_ALL=C' "$1" + LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail + rm -rf rootdir/var/lib/apt/lists -msgtest 'Download of en as forced language' 'with Index' -aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail -rm -rf rootdir/var/lib/apt/lists + msgtest 'Download of en as forced language' "$1" + aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail + rm -rf rootdir/var/lib/apt/lists -msgtest 'Download of nothing else in forced language' 'with Index' -aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists + msgtest 'Download of nothing else in forced language' "$1" + aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass + rm -rf rootdir/var/lib/apt/lists -msgtest 'Download no Translation- if forced language is non-existent' 'with Index' -aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists + msgtest 'Download no Translation- if forced language is non-existent' "$1" + aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass + rm -rf rootdir/var/lib/apt/lists + + msgtest 'Download of nothing if none is forced' "$1" + aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass + rm -rf rootdir/var/lib/apt/lists +} + +translationslisted 'with full Index' + + +# only compressed files available (as it happens on CD-ROM) +sed -i '/i18n\/Translation-[^.]*$/ d' $(find aptarchive -name 'Release') +signreleasefiles + +translationslisted 'with partial Index' -msgtest 'Download of nothing if none is forced' 'with Index' -aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists +# no records at all about Translation files (fallback to guessing) sed -i '/i18n\/Translation-.*$/ d' $(find aptarchive -name 'Release') signreleasefiles diff --git a/test/integration/test-bug-64141-install-dependencies-for-on-hold b/test/integration/test-bug-64141-install-dependencies-for-on-hold index e2d206fdd..9a9e7be10 100755 --- a/test/integration/test-bug-64141-install-dependencies-for-on-hold +++ b/test/integration/test-bug-64141-install-dependencies-for-on-hold @@ -31,7 +31,7 @@ The following packages will be upgraded: After this operation, 0 B of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only -aptmark hold apt -qq +testsuccess aptmark hold apt testequal 'Reading package lists... Building dependency tree... diff --git a/test/integration/test-bug-673536-pre-depends-breaks-loop b/test/integration/test-bug-673536-pre-depends-breaks-loop index e9d3c4de6..f6a90b21f 100755 --- a/test/integration/test-bug-673536-pre-depends-breaks-loop +++ b/test/integration/test-bug-673536-pre-depends-breaks-loop @@ -15,9 +15,9 @@ setupaptarchive # we check with 'real' packages here as the simulation reports a 'Conf broken' # which is technical correct for the simulation, but testing errormsg is ugly -aptget install basic=1 -qq > /dev/null +testsuccess aptget install basic=1 -y testdpkginstalled basic testdpkgnotinstalled common -aptget dist-upgrade -qq > /dev/null +testsuccess aptget dist-upgrade -y testdpkginstalled basic common diff --git a/test/integration/test-bug-679371-apt-get-autoclean-multiarch b/test/integration/test-bug-679371-apt-get-autoclean-multiarch index ba6857b73..b62d437aa 100755 --- a/test/integration/test-bug-679371-apt-get-autoclean-multiarch +++ b/test/integration/test-bug-679371-apt-get-autoclean-multiarch @@ -14,8 +14,8 @@ setupaptarchive changetowebserver -aptget update -qq -aptget install pkgall pkgnative pkgforeign -y -qq > /dev/null +testsuccess aptget update +testsuccess aptget install pkgall pkgnative pkgforeign -y testdpkginstalled pkgall pkgnative pkgforeign diff --git a/test/integration/test-bug-686346-package-missing-architecture b/test/integration/test-bug-686346-package-missing-architecture index b2c9ec9ee..3b02811ca 100755 --- a/test/integration/test-bug-686346-package-missing-architecture +++ b/test/integration/test-bug-686346-package-missing-architecture @@ -58,13 +58,13 @@ Building dependency tree... # pkgd has no update with an architecture testdpkginstalled pkgd msgtest 'Test apt-get purge' 'pkgd' -aptget purge pkgd -y >/dev/null 2>&1 && msgpass || msgfail +testsuccess --nomsg aptget purge pkgd -y testdpkgnotinstalled pkgd # there is a pkgb with an architecture testdpkginstalled pkgb msgtest 'Test apt-get purge' 'pkgb:none' -aptget purge pkgb:none -y >/dev/null 2>&1 && msgpass || msgfail +testsuccess --nomsg aptget purge pkgb:none -y testdpkgnotinstalled pkgb # check that dependencies are created after the none package exists in the cache diff --git a/test/integration/test-bug-691453-apt-cache-search-multi-pattern b/test/integration/test-bug-691453-apt-cache-search-multi-pattern new file mode 100755 index 000000000..0367892fc --- /dev/null +++ b/test/integration/test-bug-691453-apt-cache-search-multi-pattern @@ -0,0 +1,33 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'native' + +insertpackage 'unstable' 'foobar' 'native' '1' '' '' 'funky tool' +insertpackage 'unstable' 'coolstuff' 'native' '1' '' '' 'funky tool just like foo and bar' +insertpackage 'unstable' 'foo' 'native' '1' '' '' 'tool best used with bar' +insertpackage 'unstable' 'bar' 'native' '1' '' '' 'tool best used with foo' +insertpackage 'unstable' 'baz' 'native' '1' 'Provides: bar' '' 'alternative tool best used with foo' + +setupaptarchive + +# in this special case the following queries should be equal +FOOBAR='foobar - funky tool +coolstuff - funky tool just like foo and bar +foo - tool best used with bar +bar - tool best used with foo +baz - alternative tool best used with foo' + +testequal "$FOOBAR" aptcache search foo +testequal "$FOOBAR" aptcache search bar +testequal "$FOOBAR" aptcache search foo bar + +testequal 'foobar - funky tool +foo - tool best used with bar' aptcache search -n foo +testequal 'foobar - funky tool +bar - tool best used with foo +baz - alternative tool best used with foo' aptcache search -n bar +testequal 'foobar - funky tool' aptcache search -n foo bar diff --git a/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch b/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch new file mode 100755 index 000000000..af65397ea --- /dev/null +++ b/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch @@ -0,0 +1,120 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +buildsimplenativepackage 'toolkit' 'all' '1' 'stable' 'Multi-Arch: foreign' +buildsimplenativepackage 'toolkit' 'amd64' '2' 'unstable' 'Multi-Arch: foreign' +buildsimplenativepackage 'libsame' 'i386,amd64' '1' 'stable' 'Multi-Arch: same' +buildsimplenativepackage 'libsame' 'i386,amd64' '2' 'unstable' 'Multi-Arch: same' +buildsimplenativepackage 'stuff' 'i386,amd64' '1' 'stable' 'Depends: libsame (= 1), toolkit (= 1)' +buildsimplenativepackage 'stuff' 'i386,amd64' '2' 'unstable' 'Depends: libsame (= 2), toolkit (= 2)' + +setupsimplenativepackage 'confpkg' 'amd64' '1' 'unstable' +BUILDDIR='incoming/confpkg-1' +echo 'foo "bar";' > ${BUILDDIR}/pkg.conf +echo 'pkg.conf /etc/pkg.conf' >> ${BUILDDIR}/debian/install +buildpackage "$BUILDDIR" 'unstable' 'main' 'amd64' +rm -rf "$BUILDDIR" + +setupaptarchive + +hook='pre-install-pkgs' + +enablehookversion() { + echo "#!/bin/sh +while read line; do + if echo \"\$line\" | grep -Fq '**'; then + echo \"\$line\" + fi +done > ${hook}-v${1}.list" > ${hook}-v${1}.sh + chmod +x ${hook}-v${1}.sh + echo "dpkg::${hook}:: \"./${hook}-v${1}.sh --foo -bar\"; +DPkg::Tools::options::\"./${hook}-v${1}.sh\"::Version \"$1\";" > rootdir/etc/apt/apt.conf.d/hook-v$1 +} + +enablehookversion 2 +enablehookversion 3 + +observehook() { + rm -f ${hook}-v2.list ${hook}-v3.list + msgtest 'Observe hooks while' "$*" + testsuccess --nomsg aptget "$@" -y --force-yes +} + +observehook install stuff -t stable +testfileequal "${hook}-v2.list" 'libsame - < 1 **CONFIGURE** +toolkit - < 1 **CONFIGURE** +stuff - < 1 **CONFIGURE**' +testfileequal "${hook}-v3.list" 'libsame - - none < 1 amd64 same **CONFIGURE** +toolkit - - none < 1 all foreign **CONFIGURE** +stuff - - none < 1 amd64 none **CONFIGURE**' + +observehook install stuff -t unstable +testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE** +toolkit 1 < 2 **CONFIGURE** +stuff 1 < 2 **CONFIGURE**' +testfileequal "${hook}-v3.list" 'libsame 1 amd64 same < 2 amd64 same **CONFIGURE** +toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE** +stuff 1 amd64 none < 2 amd64 none **CONFIGURE**' + +observehook install stuff:i386 -t unstable +testfileequal "${hook}-v2.list" 'stuff 2 > - **REMOVE** +libsame - < 2 **CONFIGURE** +stuff - < 2 **CONFIGURE**' +testfileequal "${hook}-v3.list" 'stuff 2 amd64 none > - - none **REMOVE** +libsame - - none < 2 i386 same **CONFIGURE** +stuff - - none < 2 i386 none **CONFIGURE**' + +observehook remove libsame +testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**' +testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**' + +observehook install stuff:i386/stable libsame:i386/stable toolkit/stable +testfileequal "${hook}-v2.list" 'libsame 2 > 1 **CONFIGURE** +toolkit 2 > 1 **CONFIGURE** +stuff 2 > 1 **CONFIGURE**' +testfileequal "${hook}-v3.list" 'libsame 2 i386 same > 1 i386 same **CONFIGURE** +toolkit 2 amd64 foreign > 1 all foreign **CONFIGURE** +stuff 2 i386 none > 1 i386 none **CONFIGURE**' + +observehook install 'libsame:*' +testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE** +libsame - < 2 **CONFIGURE** +toolkit 1 < 2 **CONFIGURE** +stuff 1 < 2 **CONFIGURE**' +testfileequal "${hook}-v3.list" 'libsame 1 i386 same < 2 i386 same **CONFIGURE** +libsame - - none < 2 amd64 same **CONFIGURE** +toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE** +stuff 1 i386 none < 2 i386 none **CONFIGURE**' + +observehook purge stuff:i386 'libsame:*' toolkit +testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE** +stuff 2 > - **REMOVE** +libsame 2 > - **REMOVE** +toolkit 2 > - **REMOVE**' +testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE** +stuff 2 i386 none > - - none **REMOVE** +libsame 2 i386 same > - - none **REMOVE** +toolkit 2 amd64 foreign > - - none **REMOVE**' + +observehook install confpkg +testfileequal "${hook}-v2.list" 'confpkg - < 1 **CONFIGURE**' +testfileequal "${hook}-v3.list" 'confpkg - - none < 1 amd64 none **CONFIGURE**' + +observehook remove confpkg +testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**' +testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**' + +msgtest 'Conffiles of package remained after remove' 'confpkg' +dpkg -l confpkg | grep -q '^rc' && msgpass || msgfail + +observehook purge confpkg +testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**' +testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**' + +msgtest 'Conffiles are gone after purge' 'confpkg' +dpkg -l confpkg 2>/dev/null | grep -q '^rc' && msgfail || msgpass diff --git a/test/integration/test-bug-712435-missing-descriptions b/test/integration/test-bug-712435-missing-descriptions new file mode 100755 index 000000000..53ecbbeb3 --- /dev/null +++ b/test/integration/test-bug-712435-missing-descriptions @@ -0,0 +1,165 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +PACKAGESTANZA='Version: 0.9.7.8 +Installed-Size: 3270 +Maintainer: APT Development Team <deity@lists.debian.org> +Architecture: amd64 +Filename: pool/main/a/apt/apt_0.9.7.8_amd64.deb +MD5sum: 3a622acda41620df50aa22a9fac6f32e' + +DESCRIPTION='Description: commandline package manager + This APT has Super Cow Powers.' + +TRANSDESCRIPTION='Description-en: commandline package manager + This APT has translated Super Cow Powers.' + +echo "Package: apt-normal +$PACKAGESTANZA +$DESCRIPTION +Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +Package: apt-both-below +$PACKAGESTANZA +$DESCRIPTION +$TRANSDESCRIPTION +Description-md5: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + +Package: apt-both-middle +$PACKAGESTANZA +$DESCRIPTION +Description-md5: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +$TRANSDESCRIPTION + +Package: apt-both-top +$PACKAGESTANZA +Description-md5: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +$DESCRIPTION +$TRANSDESCRIPTION + +Package: apt-trans +$PACKAGESTANZA +$TRANSDESCRIPTION +Description-md5: cccccccccccccccccccccccccccccccc + +Package: apt-md5 +$PACKAGESTANZA +Description-md5: dddddddddddddddddddddddddddddddd + +Package: apt-none +$PACKAGESTANZA + +Package: apt-intermixed +$PACKAGESTANZA +$DESCRIPTION +X-Some-Flag: yes +Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa + +Package: apt-intermixed2 +$PACKAGESTANZA +$DESCRIPTION +X-Some-Flag: yes +$TRANSDESCRIPTION +X-Foo-Flag: Something with a Description +Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +X-Bar-Flag: no + +Package: apt-intermixed3 +$PACKAGESTANZA +$DESCRIPTION +X-Some-Flag: yes +$TRANSDESCRIPTION +X-Foo-Flag: Something with a Description +X-Bar-Flag: no +Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" > aptarchive/Packages + + +setupaptarchive + +testequal "Package: apt-normal +$PACKAGESTANZA +$DESCRIPTION +Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +" aptcache show apt-normal + +# displaying the translated Description would be equally valid, +# but we assume only one description is in a Packages file and +# so we prefer "Description" over "Description-*" currently. +for variant in 'below' 'middle' 'top'; do + testequal "Package: apt-both-$variant +$PACKAGESTANZA +$DESCRIPTION +Description-md5: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb +" aptcache show apt-both-$variant +done + +testequal "Package: apt-trans +$PACKAGESTANZA +$TRANSDESCRIPTION +Description-md5: cccccccccccccccccccccccccccccccc +" aptcache show apt-trans + +testequal "Package: apt-md5 +$PACKAGESTANZA +Description-md5: dddddddddddddddddddddddddddddddd +" aptcache show apt-md5 + +testequal "Package: apt-none +$PACKAGESTANZA +" aptcache show apt-none + +testequal "Package: apt-intermixed +$PACKAGESTANZA +$DESCRIPTION +Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +X-Some-Flag: yes +" aptcache show apt-intermixed + +testequal "Package: apt-intermixed2 +$PACKAGESTANZA +$DESCRIPTION +Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +X-Some-Flag: yes +X-Foo-Flag: Something with a Description +X-Bar-Flag: no +" aptcache show apt-intermixed2 + +testequal "Package: apt-intermixed3 +$PACKAGESTANZA +$DESCRIPTION +Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +X-Some-Flag: yes +X-Foo-Flag: Something with a Description +X-Bar-Flag: no +" aptcache show apt-intermixed3 + +msgtest 'Test that no description does not destroy' 'showpkg' +aptcache showpkg apt-none | sed 's#/tmp/.*_aptarchive_#/tmp/aptarchive_#' >showpkg.explosion && msgpass || msgfail +testfileequal showpkg.explosion 'Package: apt-none +Versions: +0.9.7.8 (/tmp/aptarchive_Packages) + + +Reverse Depends: +Dependencies: +0.9.7.8 - +Provides: +0.9.7.8 - +Reverse Provides: ' + +testempty aptcache search nonexistentstring + +# packages without a description can't be found +testequal 'apt-normal - commandline package manager +apt-both-below - commandline package manager +apt-both-middle - commandline package manager +apt-both-top - commandline package manager +apt-trans - commandline package manager +apt-intermixed - commandline package manager +apt-intermixed2 - commandline package manager +apt-intermixed3 - commandline package manager' aptcache search apt diff --git a/test/integration/test-bug-717891-abolute-uris-for-proxies b/test/integration/test-bug-717891-abolute-uris-for-proxies new file mode 100755 index 000000000..ac1d6ec11 --- /dev/null +++ b/test/integration/test-bug-717891-abolute-uris-for-proxies @@ -0,0 +1,28 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable' + +setupaptarchive +changetowebserver --request-absolute='uri' + +msgtest 'Check that absolute paths are' 'not accepted' +testfailure --nomsg aptget update + +echo 'Acquire::http::Proxy "http://localhost:8080";' > rootdir/etc/apt/apt.conf.d/99proxy + +msgtest 'Check that requests to proxies are' 'absolute uris' +testsuccess --nomsg aptget update + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + unrelated +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst unrelated (0.5~squeeze1 unstable [all]) +Conf unrelated (0.5~squeeze1 unstable [all])' aptget install unrelated -s diff --git a/test/integration/test-bug-719263-print-uris-removes-authentication b/test/integration/test-bug-719263-print-uris-removes-authentication new file mode 100755 index 000000000..1c1a27ceb --- /dev/null +++ b/test/integration/test-bug-719263-print-uris-removes-authentication @@ -0,0 +1,41 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'unrelated' 'all' '1' +buildsimplenativepackage 'unrelated' 'all' '2' 'unstable' + +setupaptarchive + +testnoact() { + cp -a rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup-noact + touch rootdir/var/lib/apt/extended_states + testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be upgraded: + unrelated +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst unrelated [1] (2 unstable [all]) +Conf unrelated (2 unstable [all])' aptget install unrelated -s + testsuccess aptget install unrelated -y + testdpkginstalled unrelated + cp -a rootdir/var/lib/dpkg/status-backup-noact rootdir/var/lib/dpkg/status +} + +testnoact +testsuccess aptget update --print-uris +testnoact + +# same thing, just not with InRelease this time +rm -rf rootdir/var/lib/apt/lists +testsuccess aptget update -o Acquire::TryInRelease=0 + +testnoact +testsuccess aptget update --print-uris -o Acquire::TryInRelease=0 +testnoact diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index a5e885745..c6f5ab49e 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -46,10 +46,10 @@ testrun() { msgpass fi msgtest "Check if package is downloadable" - aptget install -d testpkg -qq && msgpass || msgfail - msgtest "\tdeb file is present"; test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail + testsuccess --nomsg aptget install -d testpkg + msgtest "\tdeb file is present"; testsuccess --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb aptget clean - msgtest "\tdeb file is gone"; ! test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail + msgtest "\tdeb file is gone"; testfailure --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb fi rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin testequal "$GOODSHOW" aptcache show testpkg @@ -62,9 +62,9 @@ testrun() { testequal "$GOODSHOWSRC" aptcache showsrc testpkg aptget clean msgtest "Check if the source is aptgetable" - aptget source testpkg -qq 2> /dev/null > /dev/null && msgpass || msgfail - msgtest "\tdsc file is present"; test -f testpkg_1.0.dsc && msgpass || msgfail - msgtest "\tdirectory is present"; test -d testpkg-1.0 && msgpass || msgfail + testsuccess --nomsg aptget source testpkg + msgtest "\tdsc file is present"; testsuccess --nomsg test -f testpkg_1.0.dsc + msgtest "\tdirectory is present"; testsuccess --nomsg test -d testpkg-1.0 rm -rf testpkg-1.0 } @@ -72,11 +72,11 @@ echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressinde msgmsg "File: Test with uncompressed indexes" testrun -aptget update -qq -o Acquire::Pdiffs=1 +testsuccess aptget update -o Acquire::Pdiffs=1 msgmsg "File: Test with uncompressed indexes (update unchanged with pdiffs)" testrun -aptget update -qq -o Acquire::Pdiffs=0 +testsuccess aptget update -o Acquire::Pdiffs=0 msgmsg "File: Test with uncompressed indexes (update unchanged without pdiffs)" testrun @@ -84,21 +84,21 @@ rm -rf rootdir/var/lib/apt/lists echo 'Acquire::CompressionTypes::Order:: "gz"; Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex -aptget update -qq +testsuccess aptget update msgmsg "File: Test with compressed indexes" testrun "compressed" -aptget update -qq -o Acquire::Pdiffs=1 +testsuccess aptget update -o Acquire::Pdiffs=1 msgmsg "File: Test with compressed indexes (update unchanged with pdiffs)" testrun "compressed" -aptget update -qq -o Acquire::Pdiffs=0 +testsuccess aptget update -o Acquire::Pdiffs=0 msgmsg "File: Test with compressed indexes (update unchanged without pdiffs)" testrun "compressed" rm rootdir/etc/apt/apt.conf.d/02compressindex changetowebserver -aptget update -qq +testsuccess aptget update GOODPOLICY="$(aptcache policy testpkg)" test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 testequal "$GOODPOLICY" aptcache policy testpkg @@ -106,11 +106,11 @@ testequal "$GOODPOLICY" aptcache policy testpkg msgmsg "HTTP: Test with uncompressed indexes" testrun -aptget update -qq -o Acquire::Pdiffs=1 +testsuccess aptget update -o Acquire::Pdiffs=1 msgmsg "HTTP: Test with uncompressed indexes (update unchanged with pdiffs)" testrun -aptget update -qq -o Acquire::Pdiffs=0 +testsuccess aptget update -o Acquire::Pdiffs=0 msgmsg "HTTP: Test with uncompressed indexes (update unchanged without pdiffs)" testrun @@ -118,14 +118,14 @@ rm -rf rootdir/var/lib/apt/lists echo 'Acquire::CompressionTypes::Order:: "gz"; Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex -aptget update -qq +testsuccess aptget update msgmsg "HTTP: Test with compressed indexes" testrun "compressed" -aptget update -qq -o Acquire::Pdiffs=1 +testsuccess aptget update -o Acquire::Pdiffs=1 msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)" testrun "compressed" -aptget update -qq -o Acquire::Pdiffs=0 +testsuccess aptget update -o Acquire::Pdiffs=0 msgmsg "HTTP: Test with compressed indexes (update unchanged without pdiffs)" testrun "compressed" diff --git a/test/integration/test-cve-2013-1051-InRelease-parsing b/test/integration/test-cve-2013-1051-InRelease-parsing index bd68fccf6..41b27f691 100755 --- a/test/integration/test-cve-2013-1051-InRelease-parsing +++ b/test/integration/test-cve-2013-1051-InRelease-parsing @@ -12,9 +12,9 @@ insertpackage 'stable' 'good-pkg' 'all' '1.0' setupaptarchive changetowebserver -ARCHIVE='http://localhost/' +ARCHIVE='http://localhost:8080/' msgtest 'Initial apt-get update should work with' 'InRelease' -aptget update -qq && msgpass || msgfail +testsuccess --nomsg aptget update # check that the setup is correct testequal "good-pkg: @@ -37,7 +37,7 @@ sed -i '/^-----BEGIN PGP SIGNATURE-----/,/^-----END PGP SIGNATURE-----/ s/^$/ / # we append the (evil unsigned) Release file to the (good signed) InRelease cat aptarchive/dists/stable/Release >> aptarchive/dists/stable/InRelease - +touch -d '+1hour' aptarchive/dists/stable/InRelease # ensure the update fails # useful for debugging to add "-o Debug::pkgAcquire::auth=true" diff --git a/test/integration/test-disappearing-packages b/test/integration/test-disappearing-packages index d2ac4edc6..09dbf7014 100755 --- a/test/integration/test-disappearing-packages +++ b/test/integration/test-disappearing-packages @@ -29,7 +29,7 @@ rm -rf "$BUILDDIR" setupaptarchive -aptget install old-pkg=1.0 --trivial-only -qq 2>&1 > /dev/null +testsuccess aptget install old-pkg=1.0 --trivial-only testmarkedauto # old-pkg is manual installed diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 29301d07d..994489ee5 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -11,7 +11,7 @@ buildaptarchive setupflataptarchive changetowebserver signreleasefiles -aptget update -qq +testsuccess aptget update testnopackage newstuff PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')" @@ -35,10 +35,10 @@ SHA1-History: SHA1-Patches: 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28 $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX -generatereleasefiles +generatereleasefiles '+1hour' signreleasefiles find aptarchive -name 'Packages*' -type f -delete -aptget update -qq +testsuccess aptget update testnopackage oldstuff testequal "$(cat ${PKGFILE}-new) diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning index 9e1ea4ac5..8eb4bcbad 100755 --- a/test/integration/test-policy-pinning +++ b/test/integration/test-policy-pinning @@ -228,16 +228,16 @@ testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=ButAutomat testequalpolicycoolstuff "" "1.0" 100 990 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t stable rm rootdir/etc/apt/preferences -aptget install coolstuff -qq > /dev/null 2> /dev/null +testsuccess aptget install coolstuff -y testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades -aptget dist-upgrade -qq > /dev/null 2> /dev/null +testsuccess aptget dist-upgrade -y testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades testequalpolicycoolstuff "1.0" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable testequalpolicycoolstuff "1.0" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports -aptget install coolstuff -t backports -qq > /dev/null 2> /dev/null +testsuccess aptget install coolstuff -t backports -y testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades -aptget dist-upgrade -qq > /dev/null 2> /dev/null +testsuccess aptget dist-upgrade -y testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports diff --git a/test/integration/test-prefer-higher-priority-providers b/test/integration/test-prefer-higher-priority-providers new file mode 100755 index 000000000..64b901dd0 --- /dev/null +++ b/test/integration/test-prefer-higher-priority-providers @@ -0,0 +1,106 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'native' + +insertpackage 'unstable' 'foo' 'all' '1' 'Provides: stuff' 'important' +insertpackage 'unstable' 'bar' 'all' '1' 'Provides: stuff' 'optional' +insertpackage 'unstable' 'baz' 'all' '1' 'Provides: stuff' 'extra' +insertpackage 'unstable' 'awesome' 'all' '1' 'Depends: stuff' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + awesome foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1 unstable [all]) +Inst awesome (1 unstable [all]) +Conf foo (1 unstable [all]) +Conf awesome (1 unstable [all])' aptget install awesome -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + awesome foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1 unstable [all]) +Inst awesome (1 unstable [all]) +Conf foo (1 unstable [all]) +Conf awesome (1 unstable [all])' aptget install awesome foo -s + +testequal "Reading package lists... +Building dependency tree... +Package 'bar' is not installed, so not removed +Package 'baz' is not installed, so not removed +The following extra packages will be installed: + foo +The following NEW packages will be installed: + awesome foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1 unstable [all]) +Inst awesome (1 unstable [all]) +Conf foo (1 unstable [all]) +Conf awesome (1 unstable [all])" aptget install awesome bar- baz- -s + +testequal "Reading package lists... +Building dependency tree... +Package 'foo' is not installed, so not removed +The following extra packages will be installed: + bar +The following NEW packages will be installed: + awesome bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1 unstable [all]) +Inst awesome (1 unstable [all]) +Conf bar (1 unstable [all]) +Conf awesome (1 unstable [all])" aptget install awesome foo- -s + +testequal "Reading package lists... +Building dependency tree... +Package 'foo' is not installed, so not removed +Package 'baz' is not installed, so not removed +The following extra packages will be installed: + bar +The following NEW packages will be installed: + awesome bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1 unstable [all]) +Inst awesome (1 unstable [all]) +Conf bar (1 unstable [all]) +Conf awesome (1 unstable [all])" aptget install awesome foo- baz- -s + +testequal "Reading package lists... +Building dependency tree... +Package 'foo' is not installed, so not removed +Package 'bar' is not installed, so not removed +The following extra packages will be installed: + baz +The following NEW packages will be installed: + awesome baz +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst baz (1 unstable [all]) +Inst awesome (1 unstable [all]) +Conf baz (1 unstable [all]) +Conf awesome (1 unstable [all])" aptget install awesome foo- bar- -s + +testequal "Reading package lists... +Building dependency tree... +Package 'foo' is not installed, so not removed +Package 'bar' is not installed, so not removed +Package 'baz' is not installed, so not removed +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + awesome : Depends: stuff +E: Unable to correct problems, you have held broken packages." aptget install awesome foo- bar- baz- -s diff --git a/test/integration/test-prefer-native-architecture-over-higher-priority b/test/integration/test-prefer-native-architecture-over-higher-priority new file mode 100755 index 000000000..2e5696376 --- /dev/null +++ b/test/integration/test-prefer-native-architecture-over-higher-priority @@ -0,0 +1,25 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'arm64' + +insertpackage 'unstable' 'm4' 'amd64' '1' 'Multi-Arch: foreign' 'optional' +insertpackage 'unstable' 'm4' 'arm64' '1' 'Multi-Arch: foreign' 'standard' +insertpackage 'unstable' 'autoconf' 'all' '1' 'Depends: m4' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + m4 +The following NEW packages will be installed: + autoconf m4 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst m4 (1 unstable [amd64]) +Inst autoconf (1 unstable [all]) +Conf m4 (1 unstable [amd64]) +Conf autoconf (1 unstable [all])' aptget install autoconf -s diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew new file mode 100755 index 000000000..fed12dad0 --- /dev/null +++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew @@ -0,0 +1,100 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' 'armel' + +insertpackage 'stable' 'allarchs' 'all' '1' +insertpackage 'unstable' 'allarchs' 'all' '2' + +insertinstalledpackage 'fine' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable' 'fine' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'unstable' 'fine' 'amd64,i386' '2' 'Multi-Arch: same' + +insertinstalledpackage 'fine-installed' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable' 'fine-installed' 'i386,amd64,armel' '1' 'Multi-Arch: same' +insertpackage 'unstable' 'fine-installed' 'i386,amd64' '2' 'Multi-Arch: same' + +insertinstalledpackage 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable' 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'unstable' 'out-of-sync-native' 'amd64' '2' 'Multi-Arch: same' + +insertinstalledpackage 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable' 'out-of-sync-foreign' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'unstable' 'out-of-sync-foreign' 'i386' '2' 'Multi-Arch: same' + +insertinstalledpackage 'out-of-sync-gone-native' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable' 'out-of-sync-gone-native' 'i386' '1' 'Multi-Arch: same' +insertpackage 'unstable' 'out-of-sync-gone-native' 'i386' '2' 'Multi-Arch: same' + +insertinstalledpackage 'out-of-sync-gone-foreign' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'stable' 'out-of-sync-gone-foreign' 'amd64' '1' 'Multi-Arch: same' +insertpackage 'unstable' 'out-of-sync-gone-foreign' 'amd64' '2' 'Multi-Arch: same' + +insertpackage 'stable' 'libsame2' 'i386' '1' 'Multi-Arch: same' +insertpackage 'unstable' 'libsame2' 'amd64' '2' 'Multi-Arch: same' +insertpackage 'unstable' 'depender2' 'all' '2' 'Depends: libsame2 (= 2)' +insertpackage 'stable' 'libsame3' 'i386' '1' 'Multi-Arch: same' +insertpackage 'unstable' 'libsame3' 'i386,amd64' '3' 'Multi-Arch: same' +insertpackage 'unstable' 'depender3' 'all' '3' 'Depends: libsame3 (= 3)' +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + out-of-sync-gone-foreign:i386 out-of-sync-gone-native +The following packages have been kept back: + out-of-sync-foreign:i386 out-of-sync-native +The following packages will be upgraded: + fine fine:i386 fine-installed fine-installed:i386 out-of-sync-gone-foreign + out-of-sync-gone-native:i386 +6 upgraded, 0 newly installed, 2 to remove and 2 not upgraded. +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 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 + +rm rootdir/var/lib/dpkg/status +insertinstalledpackage 'libsame2' 'i386' '1' 'Multi-Arch: same' +insertinstalledpackage 'libsame3' 'i386' '1' 'Multi-Arch: same' + +# the error message isn't great, but better than nothing, right? +testequal 'Reading package lists... +Building dependency tree... +Some packages could not be installed. This may mean that you have +requested an impossible situation or if you are using the unstable +distribution that some required packages have not yet been created +or been moved out of Incoming. +The following information may help to resolve the situation: + +The following packages have unmet dependencies: + depender2 : Depends: libsame2 (= 2) but it is not going to be installed +E: Unable to correct problems, you have held broken packages.' aptget install depender2 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + libsame3:i386 libsame3 +The following NEW packages will be installed: + depender3 libsame3 +The following packages will be upgraded: + libsame3:i386 +1 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libsame3:i386 [1] (3 unstable [i386]) +Inst libsame3 (3 unstable [amd64]) +Inst depender3 (3 unstable [all]) +Conf libsame3:i386 (3 unstable [i386]) +Conf libsame3 (3 unstable [amd64]) +Conf depender3 (3 unstable [all])' aptget install depender3 -s diff --git a/test/integration/test-releasefile-valid-until b/test/integration/test-releasefile-valid-until index 680a370cb..e673d5f71 100755 --- a/test/integration/test-releasefile-valid-until +++ b/test/integration/test-releasefile-valid-until @@ -32,64 +32,64 @@ aptgetupdate() { setupreleasefile msgtest 'Release file is accepted as it has' 'no Until' -aptgetupdate && msgpass || msgfail +testsuccess --nomsg aptgetupdate setupreleasefile msgtest 'Release file is accepted as it has' 'no Until and good Max-Valid' -aptgetupdate -o Acquire::Max-ValidTime=3600 && msgpass || msgfail +testsuccess --nomsg aptgetupdate -o Acquire::Max-ValidTime=3600 setupreleasefile 'now - 2 days' msgtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid' -aptgetupdate -o Acquire::Max-ValidTime=3600 && msgfail || msgpass +testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=3600 setupreleasefile 'now - 3 days' 'now + 1 day' msgtest 'Release file is accepted as it has' 'good Until' -aptgetupdate && msgpass || msgfail +testsuccess --nomsg aptgetupdate setupreleasefile 'now - 7 days' 'now - 4 days' msgtest 'Release file is rejected as it has' 'bad Until' -aptgetupdate && msgfail || msgpass +testfailure --nomsg aptgetupdate setupreleasefile 'now - 7 days' 'now - 4 days' msgtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)' -aptgetupdate -o Acquire::Max-ValidTime=1209600 && msgfail || msgpass +testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=1209600 setupreleasefile 'now - 7 days' 'now - 4 days' msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)' -aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass +testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 setupreleasefile 'now - 7 days' 'now + 4 days' msgtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)' -aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass +testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 setupreleasefile 'now - 7 days' 'now + 4 days' msgtest 'Release file is accepted as it has' 'good labeled Max-Valid' -aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 && msgpass || msgfail +testsuccess --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 setupreleasefile 'now - 7 days' 'now + 4 days' msgtest 'Release file is rejected as it has' 'bad labeled Max-Valid' -aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 && msgfail || msgpass +testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 setupreleasefile 'now - 7 days' 'now + 1 days' msgtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)' -aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail +testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 setupreleasefile 'now - 7 days' 'now - 4 days' msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)' -aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail +testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 setupreleasefile 'now - 7 days' 'now - 2 days' msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <' -aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 && msgpass || msgfail +testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 setupreleasefile 'now - 7 days' 'now - 2 days' msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >' -aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 && msgfail || msgpass +testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 setupreleasefile 'now - 7 days' 'now - 2 days' msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <' -aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 && msgfail || msgpass +testfailure --nomsg aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 setupreleasefile 'now - 7 days' 'now - 2 days' msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >' -aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 && msgfail || msgpass +testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification index 01fb2e529..daba3919b 100755 --- a/test/integration/test-releasefile-verification +++ b/test/integration/test-releasefile-verification @@ -37,7 +37,7 @@ The following NEW packages will be installed: apt 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. After this operation, 5370 kB of additional disk space will be used. -Get:1 http://localhost/ apt 0.7.25.3 +Get:1 http://localhost:8080/ apt 0.7.25.3 Download complete and in download only mode' aptget install apt -dy } @@ -50,7 +50,7 @@ The following NEW packages will be installed: apt 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. After this operation, 5808 kB of additional disk space will be used. -Get:1 http://localhost/ apt 0.8.0~pre1 +Get:1 http://localhost:8080/ apt 0.8.0~pre1 Download complete and in download only mode' aptget install apt -dy } @@ -107,13 +107,24 @@ runtest() { " aptcache show apt installaptnew + prepare ${PKGFILE} + rm -rf rootdir/var/lib/apt/lists + cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg + signreleasefiles 'Rex Expired' + find aptarchive/ -name "$DELETEFILE" -delete + msgtest 'Cold archive signed by' 'Rex Expired' + aptget update 2>&1 | grep -E '^W: .* KEYEXPIRED' > /dev/null && msgpass || msgfail + testequal "$(cat ${PKGFILE}) +" aptcache show apt + failaptold + rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg prepare ${PKGFILE} rm -rf rootdir/var/lib/apt/lists signreleasefiles 'Marvin Paranoid' find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Cold archive signed by' 'Marvin Paranoid' - aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgpass || msgfail + aptget update 2>&1 | grep -E '^W: .* NO_PUBKEY' > /dev/null && msgpass || msgfail testequal "$(cat ${PKGFILE}) " aptcache show apt failaptold @@ -147,10 +158,30 @@ runtest() { signreleasefiles 'Marvin Paranoid' find aptarchive/ -name "$DELETEFILE" -delete msgtest 'Good warm archive signed by' 'Marvin Paranoid' - aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgpass || msgfail + aptget update 2>&1 | grep -E '^W: .* NO_PUBKEY' > /dev/null && msgpass || msgfail testequal "$(cat ${PKGFILE}) " aptcache show apt installaptold + + prepare ${PKGFILE}-new + cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg + signreleasefiles 'Rex Expired' + find aptarchive/ -name "$DELETEFILE" -delete + msgtest 'Good warm archive signed by' 'Rex Expired' + aptget update 2>&1 | grep -E '^W: .* KEYEXPIRED' > /dev/null && msgpass || msgfail + testequal "$(cat ${PKGFILE}) +" aptcache show apt + installaptold + rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg + + prepare ${PKGFILE}-new + signreleasefiles + find aptarchive/ -name "$DELETEFILE" -delete + msgtest 'Good warm archive signed by' 'Joe Sixpack' + aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass + testequal "$(cat ${PKGFILE}-new) +" aptcache show apt + installaptnew } runtest2() { @@ -184,5 +215,5 @@ runtest2 DELETEFILE="InRelease" runtest -#DELETEFILE="Release.gpg" -#runtest +DELETEFILE="Release.gpg" +runtest diff --git a/test/integration/test-sourceslist-arch-plusminus-options b/test/integration/test-sourceslist-arch-plusminus-options new file mode 100755 index 000000000..0d4d7448f --- /dev/null +++ b/test/integration/test-sourceslist-arch-plusminus-options @@ -0,0 +1,85 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +testbinaries() { + msgtest 'Test acquired archs for' "$1" + shift + rm -f gotarchs.list + aptget update --print-uris | grep -o '/binary-[a-z0-9-]\+/Packages' | sort > gotarchs.list + while [ -n "$1" ]; do + echo "/binary-${1}/Packages" + shift + done | sort | checkdiff - gotarchs.list && msgpass || msgfail +} + +echo 'deb http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'default & native' 'amd64' +configarchitecture 'amd64' 'i386' +testbinaries 'default & native + foreign' 'amd64' 'i386' +configarchitecture 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel' +testbinaries 'default & native + many foreigns' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel' + +echo 'deb [arch=amd64] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch=native' 'amd64' + +echo 'deb [arch=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch=foreign' 'mips' + +echo 'deb [arch=kfreebsd-armel] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch=unknown' 'kfreebsd-armel' + +echo 'deb [arch=amd64,i386] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch=native,foreign' 'amd64' 'i386' + +echo 'deb [arch=mips,armhf] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch=foreign,foreign' 'mips' 'armhf' + +echo 'deb [arch=kfreebsd-armel,hurd-powerpc,mipsel,armel] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch=unknown,unknown,foreign,foreign' 'kfreebsd-armel' 'hurd-powerpc' 'mipsel' 'armel' + +echo 'deb [arch+=amd64] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch+=native' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel' + +echo 'deb [arch+=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch+=foreign' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel' + +echo 'deb [arch+=mips,armhf,i386] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch+=foreign,foreign,foreign' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel' + +echo 'deb [arch+=hurd-powerpc] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch+=unknown' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel' 'hurd-powerpc' + +echo 'deb [arch+=mips,hurd-powerpc,i386] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch+=foreign,unknown,foreign' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel' 'hurd-powerpc' + +echo 'deb [arch-=amd64] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch-=native' 'i386' 'armel' 'armhf' 'mips' 'mipsel' + +echo 'deb [arch-=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch-=foreign' 'amd64' 'i386' 'armel' 'armhf' 'mipsel' + +echo 'deb [arch-=mips,armhf,i386] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch-=foreign,foreign,foreign' 'amd64' 'armel' 'mipsel' + +echo 'deb [arch-=hurd-powerpc] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch-=unknown' 'amd64' 'i386' 'armel' 'armhf' 'mips' 'mipsel' + +echo 'deb [arch-=mips,hurd-powerpc,i386] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'arch-=foreign,unknown,foreign' 'amd64' 'armel' 'armhf' 'mipsel' + +echo 'deb [arch=mips,i386 arch-=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'substract from a arch-set' 'i386' + +echo 'deb [arch=mips,i386 arch-=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'useless substract from a arch-set' 'i386' + +echo 'deb [arch=mips,i386 arch+=armhf] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'addition to a arch-set' 'i386' 'mips' 'armhf' + +echo 'deb [arch=mips,i386 arch+=mips] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testbinaries 'useless addition to a arch-set' 'i386' 'mips' diff --git a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall index 25cccf067..1576c396c 100755 --- a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall +++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall @@ -1,23 +1,6 @@ #!/bin/sh set -e -ensure_n_canary_strings_in_dir() { - DIR=$1 - CANARY_STRING=$2 - EXPECTED_N=$3 - - msgtest "Testing for $EXPECTED_N canary strings '$CANARY_STRING' in in" "$DIR" - - N=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l ) - if [ "$N" = "$EXPECTED_N" ]; then - msgpass - return 0 - else - msgfail "Expected $EXPECTED_N canaries, got $N" - return 1 - fi -} - TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework @@ -25,23 +8,57 @@ setupenvironment configarchitecture 'native' insertpackage 'unstable' 'unrelated' 'all' '1.0' 'stable' +insertsource 'unstable' 'unrelated' 'all' '1.0' 'stable' + +echo 'ni ni ni' > aptarchive/knights setupaptarchive -changetowebserver --simulate-paywall +changetowebserver -o 'aptwebserver::overwrite::.*::filename=/knights' + +msgtest 'Acquire test file from the webserver to check' 'overwrite' +echo '601 Configuration +Config-Item: Acquire::http::DependOnSTDIN=0 + +600 Acquire URI +URI: http://localhost:8080/holygrail +Filename: knights-talking +' | http >/dev/null 2>&1 && msgpass || msgfail +testfileequal knights-talking 'ni ni ni' + +ensure_n_canary_strings_in_dir() { + local DIR="$1" + local CANARY_STRING="$2" + local EXPECTED_N="$3" + + msgtest "Testing in $DIR for $EXPECTED_N canary" "$CANARY_STRING" + local N=$(grep "$CANARY_STRING" $DIR/* 2>/dev/null |wc -l ) + test "$N" = "$EXPECTED_N" && msgpass || msgfail "Expected $EXPECTED_N canaries, got $N" +} +LISTS='rootdir/var/lib/apt/lists' rm -rf rootdir/var/lib/apt/lists -msgtest 'excpected failure of' 'apt-get update' -aptget update -qq 2>/dev/null && msgfail || msgpass +msgtest 'Got expected NODATA failure in' 'apt-get update' +aptget update -qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass || msgfail -ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ 'ni ni ni' 0 -testequal 'partial' ls rootdir/var/lib/apt/lists/ +ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 +testequal 'partial' ls $LISTS -# again, this time with pre-existing files valid data -for f in Release Release.gpg main_binary-amd64_Packages stable_main_source_Sources; do - echo "canary" > rootdir/var/lib/apt/lists/localhost:8080_dists_stable_${f} +# and again with pre-existing files with "valid data" which should remain +for f in Release Release.gpg main_binary-amd64_Packages main_source_Sources; do + echo 'peng neee-wom' > $LISTS/localhost:8080_dists_stable_${f} done -# this will fail, the important part is that the canaries remain +msgtest 'Got expected NODATA failure in' 'apt-get update' +aptget update -qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass || msgfail + +ensure_n_canary_strings_in_dir $LISTS 'peng neee-wom' 4 +ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 + +# and now with a pre-existing InRelease file +echo 'peng neee-wom' > $LISTS/localhost:8080_dists_stable_InRelease +rm -f $LISTS/localhost:8080_dists_stable_Release $LISTS/localhost:8080_dists_stable_Release.gpg msgtest 'excpected failure of' 'apt-get update' -aptget update -qq 2>/dev/null && msgfail || msgpass -ensure_n_canary_strings_in_dir rootdir/var/lib/apt/lists/ 'canary' 4 +aptget update -qq 2>&1 | grep -q 'E: GPG error.*NODATA' && msgpass || msgfail + +ensure_n_canary_strings_in_dir $LISTS 'peng neee-wom' 3 +ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0 diff --git a/test/integration/test-ubuntu-bug-761175-remove-purge b/test/integration/test-ubuntu-bug-761175-remove-purge index f55c6e909..14648e9b8 100755 --- a/test/integration/test-ubuntu-bug-761175-remove-purge +++ b/test/integration/test-ubuntu-bug-761175-remove-purge @@ -18,12 +18,10 @@ setupaptarchive testdpkgnotinstalled compiz-core -msgtest 'Install package' 'compiz-core' -aptget install compiz-core -qq 2>&1 >/dev/null && msgpass || msgfail +testsuccess aptget install compiz-core testdpkginstalled compiz-core -msgtest 'Remove package' 'compiz-core' -aptget remove compiz-core -y -qq 2>&1 >/dev/null && msgpass || msgfail +testsuccess aptget remove compiz-core -y testdpkgnotinstalled compiz-core msgtest 'Check that conffiles are still around for' 'compiz-core' diff --git a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only index fad5488fb..e9d684309 100755 --- a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only +++ b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only @@ -28,7 +28,7 @@ MD5Sum: done msgtest 'The unsigned garbage before signed block is' 'ignored' -aptget update -qq > /dev/null 2>&1 && msgpass || msgfail +testsuccess --nomsg aptget update ROOTDIR="$(readlink -f .)" testequal "Package files: 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 new file mode 100755 index 000000000..7f3b05e59 --- /dev/null +++ b/test/integration/test-very-tight-loop-configure-with-unpacking-new-packages @@ -0,0 +1,46 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +# the difference between version 3 and 4 is the new package 'ure' which +# we have to unpack before we start configuring parts of the loop +insertinstalledpackage 'libreoffice' 'amd64' '3' 'Depends: libreoffice-core (= 3)' +insertinstalledpackage 'libreoffice-core' 'amd64' '3' 'Depends: libreoffice-common (>= 3)' +insertinstalledpackage 'libreoffice-common' 'all' '3' 'Depends: libreoffice-style +Breaks: libreoffice-core (>= 3+), libreoffice-core (<= 3~), libreoffice-style-galaxy (>= 3+), libreoffice-style-galaxy (<= 3~)' +insertinstalledpackage 'libreoffice-style-galaxy' 'amd64' '3' 'Depends: libreoffice-core +Provides: libreoffice-style' + +buildsimplenativepackage 'libreoffice' 'amd64' '4' 'sid' 'Depends: libreoffice-core (= 4)' +buildsimplenativepackage 'libreoffice-core' 'amd64' '4' 'sid' 'Depends: libreoffice-common (>= 4) +Breaks: libreoffice-common (<< 4), libreoffice-style-galaxy (<< 4)' +buildsimplenativepackage 'libreoffice-common' 'all' '4' 'sid' 'Depends: libreoffice-style, ure +Breaks: libreoffice-core (>= 4+), libreoffice-core (<= 4~), libreoffice-style-galaxy (>= 4+), libreoffice-style-galaxy (<= 4~)' +buildsimplenativepackage 'libreoffice-style-galaxy' 'amd64' '4' 'sid' 'Depends: libreoffice-core +Provides: libreoffice-style' + +buildsimplenativepackage 'ure' 'amd64' '4' 'sid' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + ure +The following packages will be upgraded: + libreoffice libreoffice-common libreoffice-core libreoffice-style-galaxy +4 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libreoffice [3] (4 sid [amd64]) [] +Inst libreoffice-style-galaxy [3] (4 sid [amd64]) [libreoffice-common:amd64 on libreoffice-style-galaxy:amd64] [libreoffice-common:amd64 ] +Inst libreoffice-core [3] (4 sid [amd64]) [libreoffice-core:amd64 on libreoffice-common:amd64] [libreoffice-common:amd64 on libreoffice-core:amd64] [libreoffice-common:amd64 on libreoffice-style-galaxy:amd64] [libreoffice-common:amd64 ] +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 (4 sid [amd64])' aptget dist-upgrade -s diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index ff60d64a3..fde95fec9 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -23,8 +23,10 @@ #include <dirent.h> #include <signal.h> -char const * const httpcodeToStr(int const httpcode) { /*{{{*/ - switch (httpcode) { +char const * const httpcodeToStr(int const httpcode) /*{{{*/ +{ + switch (httpcode) + { // Informational 1xx case 100: return "100 Continue"; case 101: return "101 Switching Protocols"; @@ -63,6 +65,7 @@ char const * const httpcodeToStr(int const httpcode) { /*{{{*/ case 415: return "415 Unsupported Media Type"; case 416: return "416 Requested range not satisfiable"; case 417: return "417 Expectation Failed"; + case 418: return "418 I'm a teapot"; // Server error 5xx case 500: return "500 Internal Server Error"; case 501: return "501 Not Implemented"; @@ -74,7 +77,8 @@ char const * const httpcodeToStr(int const httpcode) { /*{{{*/ return NULL; } /*}}}*/ -void addFileHeaders(std::list<std::string> &headers, FileFd &data) { /*{{{*/ +void addFileHeaders(std::list<std::string> &headers, FileFd &data) /*{{{*/ +{ std::ostringstream contentlength; contentlength << "Content-Length: " << data.FileSize(); headers.push_back(contentlength.str()); @@ -82,27 +86,17 @@ void addFileHeaders(std::list<std::string> &headers, FileFd &data) { /*{{{*/ std::string lastmodified("Last-Modified: "); lastmodified.append(TimeRFC1123(data.ModificationTime())); headers.push_back(lastmodified); - - std::string const fileext = flExtension(data.Name()); - if (fileext.empty() == false && fileext != data.Name()) { - std::string confcontenttype("aptwebserver::ContentType::"); - confcontenttype.append(fileext); - std::string const contenttype = _config->Find(confcontenttype); - if (contenttype.empty() == false) { - std::string header("Content-Type: "); - header.append(contenttype); - headers.push_back(header); - } - } } /*}}}*/ -void addDataHeaders(std::list<std::string> &headers, std::string &data) {/*{{{*/ +void addDataHeaders(std::list<std::string> &headers, std::string &data) /*{{{*/ +{ std::ostringstream contentlength; contentlength << "Content-Length: " << data.size(); headers.push_back(contentlength.str()); } /*}}}*/ -bool sendHead(int const client, int const httpcode, std::list<std::string> &headers) { /*{{{*/ +bool sendHead(int const client, int const httpcode, std::list<std::string> &headers)/*{{{*/ +{ std::string response("HTTP/1.1 "); response.append(httpcodeToStr(httpcode)); headers.push_front(response); @@ -113,12 +107,11 @@ bool sendHead(int const client, int const httpcode, std::list<std::string> &head date.append(TimeRFC1123(time(NULL))); headers.push_back(date); - headers.push_back("Accept-Ranges: bytes"); - std::clog << ">>> RESPONSE >>>" << std::endl; bool Success = true; for (std::list<std::string>::const_iterator h = headers.begin(); - Success == true && h != headers.end(); ++h) { + Success == true && h != headers.end(); ++h) + { Success &= FileFd::Write(client, h->c_str(), h->size()); if (Success == true) Success &= FileFd::Write(client, "\r\n", 2); @@ -130,11 +123,13 @@ bool sendHead(int const client, int const httpcode, std::list<std::string> &head return Success; } /*}}}*/ -bool sendFile(int const client, FileFd &data) { /*{{{*/ +bool sendFile(int const client, FileFd &data) /*{{{*/ +{ bool Success = true; char buffer[500]; unsigned long long actual = 0; - while ((Success &= data.Read(buffer, sizeof(buffer), &actual)) == true) { + while ((Success &= data.Read(buffer, sizeof(buffer), &actual)) == true) + { if (actual == 0) break; if (Success == true) @@ -145,7 +140,8 @@ bool sendFile(int const client, FileFd &data) { /*{{{*/ return Success; } /*}}}*/ -bool sendData(int const client, std::string const &data) { /*{{{*/ +bool sendData(int const client, std::string const &data) /*{{{*/ +{ bool Success = true; Success &= FileFd::Write(client, data.c_str(), data.size()); if (Success == true) @@ -153,7 +149,9 @@ bool sendData(int const client, std::string const &data) { /*{{{*/ return Success; } /*}}}*/ -void sendError(int const client, int const httpcode, std::string const &request, bool content, std::string const &error = "") { /*{{{*/ +void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/ + bool content, std::string const &error = "") +{ std::list<std::string> headers; std::string response("<html><head><title>"); response.append(httpcodeToStr(httpcode)).append("</title></head>"); @@ -168,7 +166,9 @@ void sendError(int const client, int const httpcode, std::string const &request, sendData(client, response); } /*}}}*/ -void sendRedirect(int const client, int const httpcode, std::string const &uri, std::string const &request, bool content) { /*{{{*/ +void sendRedirect(int const client, int const httpcode, std::string const &uri,/*{{{*/ + std::string const &request, bool content) +{ std::list<std::string> headers; std::string response("<html><head><title>"); response.append(httpcodeToStr(httpcode)).append("</title></head>"); @@ -188,8 +188,8 @@ void sendRedirect(int const client, int const httpcode, std::string const &uri, sendData(client, response); } /*}}}*/ -// sendDirectoryLisiting /*{{{*/ -int filter_hidden_files(const struct dirent *a) { +int filter_hidden_files(const struct dirent *a) /*{{{*/ +{ if (a->d_name[0] == '.') return 0; #ifdef _DIRENT_HAVE_D_TYPE @@ -225,13 +225,17 @@ int grouped_alpha_case_sort(const struct dirent **a, const struct dirent **b) { } return strcasecmp((*a)->d_name, (*b)->d_name); } -void sendDirectoryListing(int const client, std::string const &dir, std::string const &request, bool content) { + /*}}}*/ +void sendDirectoryListing(int const client, std::string const &dir, /*{{{*/ + std::string const &request, bool content) +{ std::list<std::string> headers; std::ostringstream listing; struct dirent **namelist; int const counter = scandir(dir.c_str(), &namelist, filter_hidden_files, grouped_alpha_case_sort); - if (counter == -1) { + if (counter == -1) + { sendError(client, 500, request, content); return; } @@ -251,11 +255,14 @@ void sendDirectoryListing(int const client, std::string const &dir, std::string std::string filename(dir); filename.append("/").append(namelist[i]->d_name); stat(filename.c_str(), &fs); - if (S_ISDIR(fs.st_mode)) { + if (S_ISDIR(fs.st_mode)) + { listing << "<tr><td>d</td>" << "<td><a href=\"" << namelist[i]->d_name << "/\">" << namelist[i]->d_name << "</a></td>" << "<td>-</td>"; - } else { + } + else + { listing << "<tr><td>f</td>" << "<td><a href=\"" << namelist[i]->d_name << "\">" << namelist[i]->d_name << "</a></td>" << "<td>" << SizeToStr(fs.st_size) << "B</td>"; @@ -271,7 +278,10 @@ void sendDirectoryListing(int const client, std::string const &dir, std::string sendData(client, response); } /*}}}*/ -bool parseFirstLine(int const client, std::string const &request, std::string &filename, bool &sendContent, bool &closeConnection) { /*{{{*/ +bool parseFirstLine(int const client, std::string const &request, /*{{{*/ + std::string &filename, bool &sendContent, + bool &closeConnection) +{ if (strncmp(request.c_str(), "HEAD ", 5) == 0) sendContent = false; if (strncmp(request.c_str(), "GET ", 4) != 0) @@ -285,7 +295,8 @@ bool parseFirstLine(int const client, std::string const &request, std::string &f for (; request[filestart] == ' '; ++filestart); size_t fileend = request.rfind(' ', lineend); if (lineend == std::string::npos || filestart == std::string::npos || - fileend == std::string::npos || filestart == fileend) { + fileend == std::string::npos || filestart == fileend) + { sendError(client, 500, request, sendContent, "Filename can't be extracted"); return false; } @@ -296,23 +307,53 @@ bool parseFirstLine(int const client, std::string const &request, std::string &f closeConnection = strcasecmp(LookupTag(request, "Connection", "Keep-Alive").c_str(), "Keep-Alive") != 0; else if (strncmp(request.c_str() + httpstart, "HTTP/1.0\r", 9) == 0) closeConnection = strcasecmp(LookupTag(request, "Connection", "Keep-Alive").c_str(), "close") == 0; - else { - sendError(client, 500, request, sendContent, "Not an HTTP/1.{0,1} request"); + else + { + sendError(client, 500, request, sendContent, "Not a HTTP/1.{0,1} request"); return false; } filename = request.substr(filestart, fileend - filestart); - if (filename.find(' ') != std::string::npos) { + if (filename.find(' ') != std::string::npos) + { sendError(client, 500, request, sendContent, "Filename contains an unencoded space"); return false; } + + std::string host = LookupTag(request, "Host", ""); + if (host.empty() == true) + { + // RFC 2616 §14.23 requires Host + sendError(client, 400, request, sendContent, "Host header is required"); + return false; + } + host = "http://" + host; + + // Proxies require absolute uris, so this is a simple proxy-fake option + std::string const absolute = _config->Find("aptwebserver::request::absolute", "uri,path"); + if (strncmp(host.c_str(), filename.c_str(), host.length()) == 0) + { + if (absolute.find("uri") == std::string::npos) + { + sendError(client, 400, request, sendContent, "Request is absoluteURI, but configured to not accept that"); + return false; + } + // strip the host from the request to make it an absolute path + filename.erase(0, host.length()); + } + else if (absolute.find("path") == std::string::npos) + { + sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that"); + return false; + } filename = DeQuoteString(filename); // this is not a secure server, but at least prevent the obvious … if (filename.empty() == true || filename[0] != '/' || strncmp(filename.c_str(), "//", 2) == 0 || filename.find_first_of("\r\n\t\f\v") != std::string::npos || - filename.find("/../") != std::string::npos) { + filename.find("/../") != std::string::npos) + { sendError(client, 400, request, sendContent, "Filename contains illegal character (sequence)"); return false; } @@ -327,16 +368,16 @@ bool parseFirstLine(int const client, std::string const &request, std::string &f int main(int const argc, const char * argv[]) { CommandLine::Args Args[] = { - {0, "simulate-paywall", "aptwebserver::Simulate-Paywall", - CommandLine::Boolean}, {0, "port", "aptwebserver::port", CommandLine::HasArg}, + {0, "request-absolute", "aptwebserver::request::absolute", CommandLine::HasArg}, {'c',"config-file",0,CommandLine::ConfigFile}, {'o',"option",0,CommandLine::ArbItem}, {0,0,0,0} }; CommandLine CmdL(Args, _config); - if(CmdL.Parse(argc,argv) == false) { + if(CmdL.Parse(argc,argv) == false) + { _error->DumpErrors(); exit(1); } @@ -345,20 +386,19 @@ int main(int const argc, const char * argv[]) // ignore SIGPIPE, this can happen on write() if the socket closes connection signal(SIGPIPE, SIG_IGN); int sock = socket(AF_INET6, SOCK_STREAM, 0); - if(sock < 0 ) { + if(sock < 0) + { _error->Errno("aptwerbserver", "Couldn't create socket"); _error->DumpErrors(std::cerr); return 1; } - // get the port int const port = _config->FindI("aptwebserver::port", 8080); - bool const simulate_broken_server = _config->FindB("aptwebserver::Simulate-Paywall", false); // ensure that we accept all connections: v4 or v6 int const iponly = 0; setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &iponly, sizeof(iponly)); - // to not linger to an address + // to not linger on an address int const enable = 1; setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)); @@ -368,29 +408,62 @@ int main(int const argc, const char * argv[]) locAddr.sin6_port = htons(port); locAddr.sin6_addr = in6addr_any; - if (bind(sock, (struct sockaddr*) &locAddr, sizeof(locAddr)) < 0) { + if (bind(sock, (struct sockaddr*) &locAddr, sizeof(locAddr)) < 0) + { _error->Errno("aptwerbserver", "Couldn't bind"); _error->DumpErrors(std::cerr); return 2; } - if (simulate_broken_server) { - std::clog << "Simulating a broken web server that return nonsense " - "for all querries" << std::endl; - } else { - std::clog << "Serving ANY file on port: " << port << std::endl; + FileFd pidfile; + if (_config->FindB("aptwebserver::fork", false) == true) + { + std::string const pidfilename = _config->Find("aptwebserver::pidfile", "aptwebserver.pid"); + int const pidfilefd = GetLock(pidfilename); + if (pidfilefd < 0 || pidfile.OpenDescriptor(pidfilefd, FileFd::WriteOnly) == false) + { + _error->Errno("aptwebserver", "Couldn't acquire lock on pidfile '%s'", pidfilename.c_str()); + _error->DumpErrors(std::cerr); + return 3; + } + + pid_t child = fork(); + if (child < 0) + { + _error->Errno("aptwebserver", "Forking failed"); + _error->DumpErrors(std::cerr); + return 4; + } + else if (child != 0) + { + // successfully forked: ready to serve! + std::string pidcontent; + strprintf(pidcontent, "%d", child); + pidfile.Write(pidcontent.c_str(), pidcontent.size()); + if (_error->PendingError() == true) + { + _error->DumpErrors(std::cerr); + return 5; + } + std::cout << "Successfully forked as " << child << std::endl; + return 0; + } } + std::clog << "Serving ANY file on port: " << port << std::endl; + listen(sock, 1); /*}}}*/ std::vector<std::string> messages; int client; - while ((client = accept(sock, NULL, NULL)) != -1) { + while ((client = accept(sock, NULL, NULL)) != -1) + { std::clog << "ACCEPT client " << client << " on socket " << sock << std::endl; - while (ReadMessages(client, messages)) { + while (ReadMessages(client, messages)) + { bool closeConnection = false; for (std::vector<std::string>::const_iterator m = messages.begin(); m != messages.end() && closeConnection == false; ++m) { @@ -402,102 +475,77 @@ int main(int const argc, const char * argv[]) if (parseFirstLine(client, *m, filename, sendContent, closeConnection) == false) continue; - std::string host = LookupTag(*m, "Host", ""); - if (host.empty() == true) { - // RFC 2616 §14.23 requires Host - sendError(client, 400, *m, sendContent, "Host header is required"); - continue; + // string replacements in the requested filename + ::Configuration::Item const *Replaces = _config->Tree("aptwebserver::redirect::replace"); + if (Replaces != NULL) + { + std::string redirect = "/" + filename; + for (::Configuration::Item *I = Replaces->Child; I != NULL; I = I->Next) + redirect = SubstVar(redirect, I->Tag, I->Value); + redirect.erase(0,1); + if (redirect != filename) + { + sendRedirect(client, 301, redirect, *m, sendContent); + continue; + } } - if (simulate_broken_server == true) { - std::string data("ni ni ni\n"); - addDataHeaders(headers, data); - sendHead(client, 200, headers); - sendData(client, data); + ::Configuration::Item const *Overwrite = _config->Tree("aptwebserver::overwrite"); + if (Overwrite != NULL) + { + for (::Configuration::Item *I = Overwrite->Child; I != NULL; I = I->Next) + { + regex_t *pattern = new regex_t; + int const res = regcomp(pattern, I->Tag.c_str(), REG_EXTENDED | REG_ICASE | REG_NOSUB); + if (res != 0) + { + char error[300]; + regerror(res, pattern, error, sizeof(error)); + sendError(client, 500, *m, sendContent, error); + continue; + } + if (regexec(pattern, filename.c_str(), 0, 0, 0) == 0) + { + filename = _config->Find("aptwebserver::overwrite::" + I->Tag + "::filename", filename); + if (filename[0] == '/') + filename.erase(0,1); + regfree(pattern); + break; + } + regfree(pattern); + } } - else if (RealFileExists(filename) == true) { + + // deal with the request + if (RealFileExists(filename) == true) + { FileFd data(filename, FileFd::ReadOnly); std::string condition = LookupTag(*m, "If-Modified-Since", ""); - if (condition.empty() == false) { + if (condition.empty() == false) + { time_t cache; if (RFC1123StrToTime(condition.c_str(), cache) == true && - cache >= data.ModificationTime()) { + cache >= data.ModificationTime()) + { sendHead(client, 304, headers); continue; } } - condition = LookupTag(*m, "If-Range", ""); - bool ignoreRange = false; - if (condition.empty() == false) { - time_t cache; - if (RFC1123StrToTime(condition.c_str(), cache) == false || - cache < data.ModificationTime()) - ignoreRange = true; - } - condition = LookupTag(*m, "Range", ""); - if (ignoreRange == false && condition.empty() == false && - strncmp(condition.c_str(), "bytes=", 6) == 0) { - size_t end = condition.find(','); - // FIXME: support multiple byte-ranges - if (end == std::string::npos) { - size_t start = 6; - unsigned long long filestart = strtoull(condition.c_str() + start, NULL, 10); - // FIXME: no fileend support - size_t dash = condition.find('-') + 1; - unsigned long long fileend = strtoull(condition.c_str() + dash, NULL, 10); - unsigned long long filesize = data.FileSize(); - if (fileend == 0 || fileend == filesize) { - if (filesize > filestart) { - data.Skip(filestart); - std::ostringstream contentlength; - contentlength << "Content-Length: " << (filesize - filestart); - headers.push_back(contentlength.str()); - std::ostringstream contentrange; - contentrange << "Content-Range: bytes " << filestart << "-" - << filesize - 1 << "/" << filesize; - headers.push_back(contentrange.str()); - sendHead(client, 206, headers); - if (sendContent == true) - sendFile(client, data); - continue; - } else { - headers.push_back("Content-Length: 0"); - std::ostringstream contentrange; - contentrange << "Content-Range: bytes 0-0/" << filesize; - headers.push_back(contentrange.str()); - sendHead(client, 416, headers); - continue; - } - } - } - } addFileHeaders(headers, data); sendHead(client, 200, headers); if (sendContent == true) sendFile(client, data); } - else if (DirectoryExists(filename) == true) { + else if (DirectoryExists(filename) == true) + { if (filename == "." || filename[filename.length()-1] == '/') sendDirectoryListing(client, filename, *m, sendContent); else sendRedirect(client, 301, filename.append("/"), *m, sendContent); } else - { - ::Configuration::Item const *Replaces = _config->Tree("aptwebserver::redirect::replace"); - if (Replaces != NULL) { - std::string redirect = "/" + filename; - for (::Configuration::Item *I = Replaces->Child; I != NULL; I = I->Next) - redirect = SubstVar(redirect, I->Tag, I->Value); - redirect.erase(0,1); - if (redirect != filename) { - sendRedirect(client, 301, redirect, *m, sendContent); - continue; - } - } sendError(client, 404, *m, sendContent); - } } _error->DumpErrors(std::cerr); messages.clear(); @@ -509,5 +557,7 @@ int main(int const argc, const char * argv[]) << " on socket " << sock << std::endl; close(client); } + pidfile.Close(); + return 0; } diff --git a/test/interactive-helper/makefile b/test/interactive-helper/makefile index fee94cd77..74659cf12 100644 --- a/test/interactive-helper/makefile +++ b/test/interactive-helper/makefile @@ -1,6 +1,7 @@ # -*- make -*- BASE=../.. SUBDIR=test/interactive-helper +APT_DOMAIN=none # Bring in the default rules include ../../buildlib/defaults.mak diff --git a/test/libapt/makefile b/test/libapt/makefile index 969d6e2d9..73403b24c 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -2,6 +2,7 @@ BASE=../.. SUBDIR=test/libapt BASENAME=_libapt_test +APT_DOMAIN=none # Bring in the default rules include ../../buildlib/defaults.mak diff --git a/test/libapt/uri_test.cc b/test/libapt/uri_test.cc index 99bb3067e..8216ade71 100644 --- a/test/libapt/uri_test.cc +++ b/test/libapt/uri_test.cc @@ -108,5 +108,13 @@ int main() { equals("/debian/", U.Path); } + // Percent-encoding. + { + URI U("ftp://foo:b%40r@example.org"); + equals("foo", U.User); + equals("b@r", U.Password); + equals("ftp://foo:b%40r@example.org/", (std::string) U); + } + return 0; } |