diff options
Diffstat (limited to 'test')
45 files changed, 833 insertions, 202 deletions
diff --git a/test/integration/framework b/test/integration/framework index 7dd7c20a7..4003d932c 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -88,11 +88,11 @@ msgdone() { runapt() { msgdebug "Executing: ${CCMD}$*${CDEBUG} " if [ -f ./aptconfig.conf ]; then - APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* - elif [ -f ../aptconfig.conf ]; then - APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* + elif [ -f ../aptconfig.conf ]; then + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* else - LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* fi } aptconfig() { runapt apt-config $*; } @@ -131,13 +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() { if [ "$1" = 'prefix' ]; then CURRENTTRAP="$2 $CURRENTTRAP" else CURRENTTRAP="$CURRENTTRAP $1" fi - trap "$CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM + trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM } setupenvironment() { @@ -177,13 +187,14 @@ 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 echo 'quiet::NoUpdate "true";' >> aptconfig.conf export LC_ALL=C export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin" + configcompression '.' 'gz' #'bz2' 'lzma' 'xz' msgdone "info" } @@ -225,12 +236,18 @@ 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)" for ARCH in ${ARCHS}; do - if [ "${ARCH}" != "${DPKGARCH}" ]; then dpkg --add-architecture ${ARCH}; fi + if [ "${ARCH}" != "${DPKGARCH}" ]; then + if ! dpkg --add-architecture ${ARCH}; then + # old-style used e.g. in Ubuntu-P – and as it seems travis + echo "DPKG::options:: \"--foreign-architecture\";" >> aptconfig.conf + echo "DPKG::options:: \"${ARCH}\";" >> aptconfig.conf + fi + fi done if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then # dpkg doesn't really check the version as long as it is fully installed, @@ -241,6 +258,20 @@ configdpkg() { fi } +configcompression() { + while [ -n "$1" ]; do + case "$1" in + '.') echo ".\t.\tcat";; + 'gz') echo "gzip\tgz\tgzip";; + 'bz2') echo "bzip2\tbz2\tbzip2";; + 'lzma') echo "lzma\tlzma\txz --format=lzma";; + 'xz') echo "xz\txz\txz";; + *) echo "$1\t$1\t$1";; + esac + shift + done > ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf +} + setupsimplenativepackage() { local NAME="$1" local ARCH="$2" @@ -411,6 +442,8 @@ buildaptarchive() { } createaptftparchiveconfig() { + local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')" + COMPRESSORS="${COMPRESSORS%* }" local ARCHS="$(find pool/ -name '*.deb' | grep -oE '_[a-z0-9-]+\.deb$' | sort | uniq | sed -e '/^_all.deb$/ d' -e 's#^_\([a-z0-9-]*\)\.deb$#\1#' | tr '\n' ' ')" if [ -z "$ARCHS" ]; then # the pool is empty, so we will operate on faked packages - let us use the configured archs @@ -428,10 +461,10 @@ createaptftparchiveconfig() { echo -n '"; }; Default { - Packages::Compress ". gzip bzip2 lzma xz"; - Sources::Compress ". gzip bzip2 lzma xz"; - Contents::Compress ". gzip bzip2 lzma xz"; - Translation::Compress ". gzip bzip2 lzma xz"; + Packages::Compress "'"$COMPRESSORS"'"; + Sources::Compress "'"$COMPRESSORS"'"; + Contents::Compress "'"$COMPRESSORS"'"; + Translation::Compress "'"$COMPRESSORS"'"; LongDescription "false"; }; TreeDefault { @@ -601,18 +634,27 @@ buildaptarchivefromfiles() { msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…" find aptarchive -name 'Packages' -o -name 'Sources' | while read line; do msgninfo "\t${line} file… " - cat ${line} | gzip > ${line}.gz - 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 + compressfile "$line" "$1" msgdone "info" done generatereleasefiles "$@" } +compressfile() { + cat ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | while read compressor extension command; do + if [ "$compressor" = '.' ]; then + if [ -n "$2" ]; then + touch -d "$2" "$1" + fi + continue + fi + cat "$1" | $command > "${1}.${extension}" + if [ -n "$2" ]; then + touch -d "$2" "${1}.${extension}" + fi + done +} + # can be overridden by testcases for their pleasure getcodenamefromsuite() { echo -n "$1"; } getreleaseversionfromsuite() { true; } @@ -711,22 +753,45 @@ setupaptarchive() { 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 --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg ${RELEASE} local INRELEASE="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')" - gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" --clearsign -o $INRELEASE $RELEASE + $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" } @@ -828,7 +893,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)" \ @@ -905,6 +970,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/test-apt-cdrom b/test/integration/test-apt-cdrom index 6e3533152..cc3483f9b 100755 --- a/test/integration/test-apt-cdrom +++ b/test/integration/test-apt-cdrom @@ -18,10 +18,7 @@ echo 'Description-de: automatisch generiertes Testpaket testing=0.8.15/stable Diese Pakete sind nur für das testen von APT gedacht, sie erfüllen keinen Zweck auf einem normalen System… ' >> Translation-de -cat Translation-de | gzip > Translation-de.gz -cat Translation-de | bzip2 > Translation-de.bz2 -cat Translation-de | xz --format=lzma > Translation-de.lzma -cat Translation-de | xz > Translation-de.xz +compressfile Translation-de rm Translation-en Translation-de cd - > /dev/null addtrap 'prefix' "chmod -R +w $PWD/rootdir/media/cdrom/dists/;" @@ -102,5 +99,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-507998-dist-upgrade-recommends b/test/integration/test-bug-507998-dist-upgrade-recommends new file mode 100755 index 000000000..513421a94 --- /dev/null +++ b/test/integration/test-bug-507998-dist-upgrade-recommends @@ -0,0 +1,25 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'tshark' 'amd64' '1.0.4-1' 'Depends: wireshark-common' +insertinstalledpackage 'wireshark-common' 'amd64' '1.0.4-1' 'Recommends: wireshark (>= 1.0.4-1) | tshark (>= 1.0.4-1)' +insertpackage 'unstable' 'tshark' 'amd64' '1.2.1-2' 'Depends: wireshark-common (= 1.2.1-2)' +insertpackage 'unstable' 'wireshark-common' 'amd64' '1.2.1-2' 'Recommends: wireshark (>= 1.2.1-2) | tshark (>= 1.2.1-2)' +insertpackage 'unstable' 'wireshark' 'amd64' '1.2.1-2' 'Depends: wireshark-common (= 1.2.1-2)' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + tshark wireshark-common +2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst wireshark-common [1.0.4-1] (1.2.1-2 unstable [amd64]) +Inst tshark [1.0.4-1] (1.2.1-2 unstable [amd64]) +Conf wireshark-common (1.2.1-2 unstable [amd64]) +Conf tshark (1.2.1-2 unstable [amd64])' aptget dist-upgrade -s 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-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-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect index c20443559..bcebb57b8 100755 --- a/test/integration/test-bug-602412-dequote-redirect +++ b/test/integration/test-bug-602412-dequote-redirect @@ -16,7 +16,7 @@ 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:8080 unstable InRelease @@ -26,4 +26,4 @@ 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-712116-dpkg-pre-install-pkgs-hook-multiarch b/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch index aee44f76b..62355a6b5 100755 --- a/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch +++ b/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch @@ -13,83 +13,124 @@ 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 +FD=0 +echo -n > ${hook}-v${1}.list +if [ -n \"${2}\" ]; then + FD=\$APT_HOOK_INFO_FD + if [ "\$FD" != \"${2}\" ]; then echo \"ERROR: Information is not on requested FD: \$FD != ${2}\" >> ${hook}-v${1}.list; fi +fi +while read </proc/\$\$/fd/\$FD line; do if echo \"\$line\" | grep -Fq '**'; then echo \"\$line\" fi -done > ${hook}-v${1}.list" > ${hook}-v${1}.sh +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 + if [ -n "$2" ]; then + echo "DPkg::Tools::options::\"./${hook}-v${1}.sh\"::InfoFD \"${2}\";" >> rootdir/etc/apt/apt.conf.d/hook-v$1 + fi } -enablehookversion 2 -enablehookversion 3 - observehook() { rm -f ${hook}-v2.list ${hook}-v3.list msgtest 'Observe hooks while' "$*" - aptget "$@" -y --force-yes >/dev/null 2>&1 && msgpass || msgfail + testsuccess --nomsg aptget "$@" -y --force-yes } -observehook install stuff -t stable -testfileequal "${hook}-v2.list" 'libsame - < 1 **CONFIGURE** +testrun() { + 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** + 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** + 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** + 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** + 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** + 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 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** + 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** + 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** + 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** + 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** + 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** + 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 +} + +enablehookversion 2 +enablehookversion 3 +testrun + +enablehookversion 2 13 +enablehookversion 3 13 +testrun diff --git a/test/integration/test-bug-712435-missing-descriptions b/test/integration/test-bug-712435-missing-descriptions index 9b3c2ee50..53ecbbeb3 100755 --- a/test/integration/test-bug-712435-missing-descriptions +++ b/test/integration/test-bug-712435-missing-descriptions @@ -52,7 +52,32 @@ $PACKAGESTANZA Description-md5: dddddddddddddddddddddddddddddddd Package: apt-none -$PACKAGESTANZA" > aptarchive/Packages +$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 @@ -87,3 +112,54 @@ Description-md5: dddddddddddddddddddddddddddddddd 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 6764fefff..41b27f691 100755 --- a/test/integration/test-cve-2013-1051-InRelease-parsing +++ b/test/integration/test-cve-2013-1051-InRelease-parsing @@ -14,7 +14,7 @@ setupaptarchive changetowebserver 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: 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-hashsum-verification b/test/integration/test-hashsum-verification index 99ea8bffa..e77efb46e 100755 --- a/test/integration/test-hashsum-verification +++ b/test/integration/test-hashsum-verification @@ -21,9 +21,7 @@ prepare() { done cp $1 aptarchive/Packages find aptarchive -name 'Release' -delete - cat aptarchive/Packages | gzip > aptarchive/Packages.gz - cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2 - cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma + compressfile aptarchive/Packages # create Release file with incorret checksums cat > aptarchive/Release <<EOF Date: Fri, 05 Aug 2011 09:22:08 UTC diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index e45326970..ac0563b7f 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-#')" @@ -19,9 +19,7 @@ testequal "$(cat ${PKGFILE}) " aptcache show apt oldstuff cp ${PKGFILE}-new aptarchive/Packages -cat aptarchive/Packages | gzip > aptarchive/Packages.gz -cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2 -cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma +compressfile 'aptarchive/Packages' rm -rf aptarchive/Packages.diff mkdir -p aptarchive/Packages.diff PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)" @@ -38,7 +36,7 @@ SHA1-Patches: 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-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-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 e56f458d3..a9f4b9775 100755 --- a/test/integration/test-releasefile-verification +++ b/test/integration/test-releasefile-verification @@ -22,9 +22,7 @@ prepare() { aptget clean cp $1 aptarchive/Packages find aptarchive -name 'Release' -delete - cat aptarchive/Packages | gzip > aptarchive/Packages.gz - cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2 - cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma + compressfile 'aptarchive/Packages' generatereleasefiles "$DATE" } @@ -107,13 +105,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 +156,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() { 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/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc index a8d191d0e..fde95fec9 100644 --- a/test/interactive-helper/aptwebserver.cc +++ b/test/interactive-helper/aptwebserver.cc @@ -319,6 +319,33 @@ bool parseFirstLine(int const client, std::string const &request, /*{{{*/ 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 … @@ -342,6 +369,7 @@ int main(int const argc, const char * argv[]) { CommandLine::Args Args[] = { {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} @@ -447,14 +475,6 @@ 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) diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc index 87d5699ef..2c974ee0a 100644 --- a/test/libapt/configuration_test.cc +++ b/test/libapt/configuration_test.cc @@ -98,6 +98,10 @@ int main(int argc,const char *argv[]) { equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null"); equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null"); + Cnf.Set("Moo::Bar", "1"); + Cnf.Clear(); + equals(Cnf.Find("Moo::Bar"), ""); + //FIXME: Test for configuration file parsing; // currently only integration/ tests test them implicitly diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc new file mode 100644 index 000000000..b6b8ac579 --- /dev/null +++ b/test/libapt/fileutl_test.cc @@ -0,0 +1,42 @@ +#include <apt-pkg/error.h> +#include <apt-pkg/fileutl.h> + +#include "assert.h" +#include <string> +#include <vector> + +#include <stdio.h> +#include <iostream> +#include <stdlib.h> + + +int main(int argc,char *argv[]) +{ + std::vector<std::string> files; + + // normal match + files = Glob("*.lst"); + if (files.size() != 1) + { + _error->DumpErrors(); + return 1; + } + + // not there + files = Glob("xxxyyyzzz"); + if (files.size() != 0 || _error->PendingError()) + { + _error->DumpErrors(); + return 1; + } + + // many matches (number is a bit random) + files = Glob("*.cc"); + if (files.size() < 10) + { + _error->DumpErrors(); + return 1; + } + + return 0; +} diff --git a/test/libapt/makefile b/test/libapt/makefile index 1b67cba9d..73403b24c 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -98,6 +98,11 @@ include $(PROGRAM_H) PROGRAM = IndexCopyToSourceList${BASENAME} SLIBS = -lapt-pkg SOURCE = indexcopytosourcelist_test.cc + +# test fileutls +PROGRAM = FileUtl${BASENAME} +SLIBS = -lapt-pkg +SOURCE = fileutl_test.cc include $(PROGRAM_H) # test tagfile diff --git a/test/libapt/run-tests b/test/libapt/run-tests index f18be6d2b..a056f31f9 100755 --- a/test/libapt/run-tests +++ b/test/libapt/run-tests @@ -2,9 +2,11 @@ set -e DIR=$(readlink -f $(dirname $0)) -echo "Compiling the tests …" -(cd $DIR && make) -echo "Running all testcases …" +if [ -z "$MAKELEVEL" ]; then + echo 'Compiling the tests …' + (cd $DIR && make) + echo 'Running all testcases …' +fi LDPATH="$DIR/../../build/bin" EXT="_libapt_test" EXIT_CODE=0 @@ -70,9 +72,11 @@ do "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tlh%5fDE" elif [ $name = "HashSums${EXT}" ]; then TMP="$(readlink -f "./${0}")" - echo -n "Testing with ${NAME} " - LD_LIBRARY_PATH=${LDPATH} ${testapp} $TMP $(md5sum $TMP | cut -d' ' -f 1) $(sha1sum $TMP | cut -d' ' -f 1) $(sha256sum $TMP | cut -d' ' -f 1) $(sha512sum $TMP | cut -d' ' -f 1) && echo "$TESTOKAY" || echo "$TESTFAIL" - continue + tmppath="$TMP" + tmppath="${tmppath} $(md5sum $TMP | cut -d' ' -f 1)" + tmppath="${tmppath} $(sha1sum $TMP | cut -d' ' -f 1)" + tmppath="${tmppath} $(sha256sum $TMP | cut -d' ' -f 1)" + tmppath="${tmppath} $(sha512sum $TMP | cut -d' ' -f 1)" elif [ $name = "CompareVersion${EXT}" ]; then tmppath="${DIR}/versions.lst" elif [ $name = "CdromFindPackages${EXT}" ]; then @@ -107,8 +111,8 @@ do fi echo -n "Testing with ${NAME} " - if LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} ; then - echo "$TESTOKAY" + if MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} ; then + echo "$TESTOKAY" else echo "$TESTFAIL" EXIT_CODE=1 |