diff options
Diffstat (limited to 'test')
37 files changed, 1240 insertions, 181 deletions
diff --git a/test/Makefile b/test/Makefile index da0a49b0c..74bffccb7 100644 --- a/test/Makefile +++ b/test/Makefile @@ -6,8 +6,8 @@ ifndef NOISY .SILENT: endif -.PHONY: headers library clean veryclean all binary program doc test -all clean veryclean binary program dirs test: +.PHONY: startup headers library clean veryclean all binary program doc test update-po +startup all clean veryclean binary program dirs test update-po manpages debiandoc: $(MAKE) -C libapt $@ $(MAKE) -C interactive-helper $@ diff --git a/test/integration/framework b/test/integration/framework index a738d27cc..8f37d4a03 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -107,6 +107,10 @@ aptitude() { LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which aptitude) $* fi } +gdb() { + echo "gdb: run »$*«" + APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} $(which gdb) ${BUILDDIRECTORY}/$1 +} addtrap() { CURRENTTRAP="$CURRENTTRAP $1" @@ -151,7 +155,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; then + if ! $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; 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 @@ -199,7 +203,7 @@ configdpkg() { echo -n > rootdir/var/lib/dpkg/status fi fi - if $(which dpkg) --assert-multi-arch; then + if $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then local ARCHS="$(getarchitectures)" if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then DPKGARCH="$(dpkg --print-architecture)" @@ -207,7 +211,9 @@ configdpkg() { if [ "${ARCH}" != "${DPKGARCH}" ]; then dpkg --add-architecture ${ARCH}; fi done if [ "0" = "$(dpkg -l dpkg 2> /dev/null | grep '^i' | wc -l)" ]; then - insertinstalledpackage 'dpkg' "all" '1.16.2~wipmultiarch~fake' + # dpkg doesn't really check the version as long as it is fully installed, + # but just to be sure we choose one above the required version + insertinstalledpackage 'dpkg' "all" '1.16.2+fake' fi fi fi @@ -298,23 +304,28 @@ echo '$NAME says \"Hello!\"'" > ${BUILDDIR}/${NAME} Section: $SECTION Priority: $PRIORITY Maintainer: Joe Sixpack <joe@example.org> -Standards-Version: 3.9.1 +Standards-Version: 3.9.3" > ${BUILDDIR}/debian/control + local BUILDDEPS="$(echo "$DEPENDENCIES" | grep '^Build-')" + test -z "$BUILDDEPS" || echo "$BUILDDEPS" >> ${BUILDDIR}/debian/control + echo " +Package: $NAME" >> ${BUILDDIR}/debian/control -Package: $NAME" > ${BUILDDIR}/debian/control if [ "$ARCH" = 'all' ]; then echo "Architecture: all" >> ${BUILDDIR}/debian/control else echo "Architecture: any" >> ${BUILDDIR}/debian/control fi - test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> ${BUILDDIR}/debian/control + local DEPS="$(echo "$DEPENDENCIES" | grep -v '^Build-')" + test -z "$DEPS" || echo "$DEPS" >> ${BUILDDIR}/debian/control if [ -z "$DESCRIPTION" ]; then echo "Description: 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…" >> ${BUILDDIR}/debian/control else - echo "Description: $DESCRIPTION" >> ${BUILDIR}/debian/control + echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control fi + echo '3.0 (native)' > ${BUILDDIR}/debian/source/format local SRCS="$( (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')" for SRC in $SRCS; do @@ -502,7 +513,8 @@ Architecture: $ARCH" >> $FILE test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE echo "Files: d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.dsc - d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz" >> $FILE + d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz +" >> $FILE } insertinstalledpackage() { @@ -556,7 +568,7 @@ buildaptarchivefromfiles() { msgninfo "\t${line} file… " cat ${line} | gzip > ${line}.gz cat ${line} | bzip2 > ${line}.bz2 - cat ${line} | lzma > ${line}.lzma + cat ${line} | xz --format=lzma > ${line}.lzma cat ${line} | xz > ${line}.xz msgdone "info" done @@ -676,7 +688,16 @@ signreleasefiles() { } changetowebserver() { - if which weborf > /dev/null; then + if [ -n "$1" ] && ! test -x ${BUILDDIRECTORY}/aptwebserver; then + msgdie 'Need the aptwebserver when passing arguments' + fi + + if test -x ${BUILDDIRECTORY}/aptwebserver; then + cd aptarchive + LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/aptwebserver $@ 2> /dev/null > /dev/null & + addtrap "kill $!;" + cd - > /dev/null + elif which weborf > /dev/null; then weborf -xb aptarchive/ 2>&1 > /dev/null & addtrap "kill $!;" elif which gatling > /dev/null; then diff --git a/test/integration/skip-aptwebserver b/test/integration/skip-aptwebserver new file mode 100755 index 000000000..0622941ce --- /dev/null +++ b/test/integration/skip-aptwebserver @@ -0,0 +1,25 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' + +setupaptarchive +changetowebserver + +rm -rf rootdir/var/lib/apt/lists +aptget update -qq +testequal 'Hit http://localhost stable InRelease +Hit http://localhost stable/main Sources +Hit http://localhost stable/main amd64 Packages +Hit http://localhost stable/main Translation-en +Reading package lists...' aptget update + +mv rootdir/var/lib/apt/lists/localhost* rootdir/var/lib/apt/lists/partial +aptget update + diff --git a/test/integration/skip-bug-602412-dequote-redirect b/test/integration/skip-bug-602412-dequote-redirect index a63d36246..689b671ce 100755 --- a/test/integration/skip-bug-602412-dequote-redirect +++ b/test/integration/skip-bug-602412-dequote-redirect @@ -19,18 +19,20 @@ echo "server.modules = ( \"mod_redirect\" ) server.document-root = \"$(readlink -f ./aptarchive)\" server.port = 8080 server.stat-cache-engine = \"disable\" -url.redirect = ( \"^/pool/(.*)$\" => \"/newpool/\$1\" )" > lighttpd.conf +url.redirect = ( \"^/pool/(.*)$\" => \"/newpool/\$1\", + \"^/dists/(.*)$\" => \"/newdists/\$1\" )" > lighttpd.conf mv aptarchive/pool aptarchive/newpool +mv aptarchive/dists aptarchive/newdists + lighttpd -t -f lighttpd.conf >/dev/null || msgdie 'Can not change to webserver: our lighttpd config is invalid' lighttpd -D -f lighttpd.conf 2>/dev/null >/dev/null & addtrap "kill $!;" -local APTARCHIVE="file://$(readlink -f ./aptarchive)" +APTARCHIVE="file://$(readlink -f ./aptarchive)" for LIST in $(find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list'); do sed -i $LIST -e "s#$APTARCHIVE#http://localhost:8080/#" done -aptget update -qq || msgdie 'apt-get update failed' -aptget install unrelated --download-only -qq || msgdie 'downloading package failed' - +aptget update || msgdie 'apt-get update failed' +aptget install unrelated --download-only || msgdie 'downloading package failed' diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog index 0a80cc08c..d013cc458 100755 --- a/test/integration/test-apt-get-changelog +++ b/test/integration/test-apt-get-changelog @@ -17,6 +17,9 @@ echo 'Apt::Changelogs::Server "http://localhost:8080/";' >> ./aptconfig.conf testequal "'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt --print-uris +testequal "'http://localhost:8080//pool/apt_1.0/changelog' +'http://localhost:8080//pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris + aptget changelog apt -qq > apt.changelog testfileequal 'apt.changelog' "$(cat aptarchive/pool/apt_1.0/changelog)" rm apt.changelog diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index 4edb7c173..b164f7dba 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -9,6 +9,7 @@ configarchitecture "i386" buildsimplenativepackage 'apt' 'all' '1.0' 'stable' buildsimplenativepackage 'apt' 'all' '2.0' 'unstable' +insertinstalledpackage 'vrms' 'all' '1.0' setupaptarchive @@ -26,3 +27,6 @@ testdownload apt_2.0_all.deb apt DEBFILE="$(readlink -f aptarchive)/pool/apt_2.0_all.deb" testequal "'file://${DEBFILE}' apt_2.0_all.deb $(stat -c%s $DEBFILE) sha256:$(sha256sum $DEBFILE | cut -d' ' -f 1)" aptget download apt --print-uris + +# deb:677887 +testequal "E: Can't find a source to download version '1.0' of 'vrms:i386'" aptget download vrms diff --git a/test/integration/test-architecture-specification-parsing b/test/integration/test-architecture-specification-parsing new file mode 100755 index 000000000..8f365dd55 --- /dev/null +++ b/test/integration/test-architecture-specification-parsing @@ -0,0 +1,96 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'pkg-arch-foo' 'amd64' '1.0' 'stable' 'Build-Depends: foo [amd64 !amd64] +Depends: foo [amd64 !amd64]' +buildsimplenativepackage 'pkg-arch-no-foo' 'amd64' '1.0' 'stable' 'Build-Depends: foo [!amd64 amd64] +Depends: foo [!amd64 amd64]' +buildsimplenativepackage 'pkg-arch-foo-unrelated-no' 'amd64' '1.0' 'stable' 'Build-Depends: foo [!kfreebsd-any amd64] +Depends: foo [!kfreebsd-any amd64]' +buildsimplenativepackage 'pkg-arch-foo-unrelated-no2' 'amd64' '1.0' 'stable' 'Build-Depends: foo [amd64 !kfreebsd-any] +Depends: foo [amd64 !kfreebsd-any]' + +buildsimplenativepackage 'foo' 'amd64' '1.0' 'stable' + +insertinstalledpackage 'build-essential' 'all' '11.5' 'Multi-Arch: foreign' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + foo pkg-arch-foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 stable [amd64]) +Inst pkg-arch-foo (1.0 stable [amd64]) +Conf foo (1.0 stable [amd64]) +Conf pkg-arch-foo (1.0 stable [amd64])' aptget install pkg-arch-foo -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + pkg-arch-no-foo +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst pkg-arch-no-foo (1.0 stable [amd64]) +Conf pkg-arch-no-foo (1.0 stable [amd64])' aptget install pkg-arch-no-foo -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + foo pkg-arch-foo-unrelated-no +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 stable [amd64]) +Inst pkg-arch-foo-unrelated-no (1.0 stable [amd64]) +Conf foo (1.0 stable [amd64]) +Conf pkg-arch-foo-unrelated-no (1.0 stable [amd64])' aptget install pkg-arch-foo-unrelated-no -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + foo pkg-arch-foo-unrelated-no2 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 stable [amd64]) +Inst pkg-arch-foo-unrelated-no2 (1.0 stable [amd64]) +Conf foo (1.0 stable [amd64]) +Conf pkg-arch-foo-unrelated-no2 (1.0 stable [amd64])' aptget install pkg-arch-foo-unrelated-no2 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 stable [amd64]) +Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo -s + +testequal 'Reading package lists... +Building dependency tree... +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget build-dep pkg-arch-no-foo -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 stable [amd64]) +Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo-unrelated-no -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 stable [amd64]) +Conf foo (1.0 stable [amd64])' aptget build-dep pkg-arch-foo-unrelated-no2 -s + + diff --git a/test/integration/test-bug-593360-modifiers-in-names b/test/integration/test-bug-593360-modifiers-in-names index 83a3cfabf..74826cbdb 100755 --- a/test/integration/test-bug-593360-modifiers-in-names +++ b/test/integration/test-bug-593360-modifiers-in-names @@ -15,6 +15,11 @@ The following NEW packages will be installed: Inst g++ (4:4.4.5-1 localhost [i386]) Conf g++ (4:4.4.5-1 localhost [i386])' aptget install g++ -s +testequal "Reading package lists... +Building dependency tree... +Package 'g++' is not installed, so not removed +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove g++ -s + testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: 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 bb1ac0e54..63883b380 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -28,10 +28,10 @@ testaptgetupdate() { createemptyarchive() { find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete if [ "en" = "$1" ]; then - echo -n "" | $COMPRESSOR > aptarchive/Packages.$COMPRESS + echo -n "" | $COMPRESSOR_CMD > aptarchive/Packages.$COMPRESS fi touch aptarchive/Packages - echo -n "" | $COMPRESSOR > aptarchive/${1}.$COMPRESS + echo -n "" | $COMPRESSOR_CMD > aptarchive/${1}.$COMPRESS generatereleasefiles signreleasefiles rm -f aptarchive/Packages @@ -40,7 +40,7 @@ createemptyarchive() { createemptyfile() { find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete if [ "en" = "$1" ]; then - echo -n "" | $COMPRESSOR > aptarchive/Packages.$COMPRESS + echo -n "" | $COMPRESSOR_CMD > aptarchive/Packages.$COMPRESS fi touch aptarchive/Packages aptarchive/${1}.$COMPRESS generatereleasefiles @@ -50,6 +50,7 @@ createemptyfile() { setupcompressor() { COMPRESSOR="$1" + COMPRESSOR_CMD="$1" case $COMPRESSOR in gzip) COMPRESS="gz";; bzip2) COMPRESS="bz2";; @@ -66,10 +67,13 @@ Dir::Bin::xz \"/does/not/exist\";" > rootdir/etc/apt/apt.conf.d/00compressor echo "Dir::Bin::${COMPRESSOR} \"/bin/${COMPRESSOR}\";" >> rootdir/etc/apt/apt.conf.d/00compressor elif [ -e "/usr/bin/${COMPRESSOR}" ]; then echo "Dir::Bin::${COMPRESSOR} \"/usr/bin/${COMPRESSOR}\";" >> rootdir/etc/apt/apt.conf.d/00compressor + elif [ "${COMPRESSOR}" = 'lzma' ]; then + echo "Dir::Bin::xz \"/usr/bin/xz\";" >> rootdir/etc/apt/apt.conf.d/00compressor + COMPRESSOR_CMD='xz --format=lzma' else msgtest "Test for availability of compressor" "${COMPRESSOR}" msgfail - exit 1 + #exit 1 fi } diff --git a/test/integration/test-bug-604222-new-and-autoremove b/test/integration/test-bug-604222-new-and-autoremove index 2875d547a..5820fb0dc 100755 --- a/test/integration/test-bug-604222-new-and-autoremove +++ b/test/integration/test-bug-604222-new-and-autoremove @@ -16,7 +16,7 @@ Building dependency tree... Reading state information... The following package was automatically installed and is no longer required: libvtk5.4 -Use 'apt-get autoremove' to remove them. +Use 'apt-get autoremove' to remove it. The following NEW packages will be installed: libavcodec52 0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. @@ -28,7 +28,7 @@ Building dependency tree... Reading state information... The following package was automatically installed and is no longer required: libvtk5.4 -Use 'apt-get autoremove' to remove them. +Use 'apt-get autoremove' to remove it. The following extra packages will be installed: libavcodec52 libopenal-dev libvtk5.4 The following NEW packages will be installed: diff --git a/test/integration/test-bug-613420-new-garbage-dependency b/test/integration/test-bug-613420-new-garbage-dependency index 34cf38cbc..7a08871ca 100755 --- a/test/integration/test-bug-613420-new-garbage-dependency +++ b/test/integration/test-bug-613420-new-garbage-dependency @@ -22,7 +22,7 @@ testequal "Reading package lists... Building dependency tree... Reading state information... The following packages were automatically installed and are no longer required: - openoffice.org-officebean libreoffice-officebean + libreoffice-officebean openoffice.org-officebean Use 'apt-get autoremove' to remove them. The following extra packages will be installed: libreoffice-core libreoffice-officebean openoffice.org-officebean diff --git a/test/integration/test-bug-632221-cross-dependency-satisfaction b/test/integration/test-bug-632221-cross-dependency-satisfaction index 30df48604..208c613a2 100755 --- a/test/integration/test-bug-632221-cross-dependency-satisfaction +++ b/test/integration/test-bug-632221-cross-dependency-satisfaction @@ -18,16 +18,76 @@ insertpackage 'unstable' 'libfwibble-dev' 'amd64,armel' '1.0' 'Depends: libfwibb insertpackage 'unstable' 'cool' 'amd64,armel' '1.0' 'Multi-Arch: allowed' insertpackage 'unstable' 'amdboot' 'amd64' '1.0' insertpackage 'unstable' 'foreigner' 'amd64,armel' '1.0' 'Multi-Arch: foreign' +insertpackage 'unstable' 'arm-stuff' 'armel' '1.0' +insertpackage 'unstable' 'linux-stuff' 'amd64,armel' '1.0' -insertsource 'unstable' 'apt' 'any' '0.8.15' 'Build-Depends: doxygen, libc6-dev, libc6-dev:native, cool:any, amdboot:amd64, foreigner, libfwibble-dev' +insertsource 'unstable' 'apt' 'any' '0.8.15' 'Build-Depends: doxygen, libc6-dev, libc6-dev:native, cool:any, amdboot:amd64, foreigner, libfwibble-dev, arm-stuff [any-arm] | linux-stuff [ linux-any]' + +insertsource 'unstable' 'forbidden-none' 'any' '1' 'Build-Depends: amdboot:any' +insertsource 'unstable' 'forbidden-same' 'any' '1' 'Build-Depends: libc6:any' +insertsource 'unstable' 'forbidden-foreign' 'any' '1' 'Build-Depends: doxygen:any' + +insertpackage 'unstable' 'specific' 'amd64' '1.0' 'Depends: libc6:amd64' +insertpackage 'unstable' 'specific' 'armel' '1.0' 'Depends: libc6:armel' + +insertsource 'unstable' 'source-specific-amd64' 'amd64' '1' 'Build-Depends: specific:amd64' +insertsource 'unstable' 'source-specific-armel' 'armel' '1' 'Build-Depends: specific:armel' setupaptarchive +testequal "Reading package lists... +Building dependency tree... +E: Build-Depends dependency for forbidden-none can't be satisfied because amdboot:any is not allowed on 'Multi-Arch: none' packages" aptget build-dep forbidden-none -s -a armel +testequal "Reading package lists... +Building dependency tree... +E: Build-Depends dependency for forbidden-same can't be satisfied because libc6:any is not allowed on 'Multi-Arch: same' packages" aptget build-dep forbidden-same -s -a armel +testequal "Reading package lists... +Building dependency tree... +E: Build-Depends dependency for forbidden-foreign can't be satisfied because doxygen:any is not allowed on 'Multi-Arch: foreign' packages" aptget build-dep forbidden-foreign -s -a armel + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libc6 specific +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (1.0 unstable [amd64]) +Inst specific (1.0 unstable [amd64]) +Conf libc6 (1.0 unstable [amd64]) +Conf specific (1.0 unstable [amd64])' aptget build-dep source-specific-amd64 -s +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libc6 specific +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6 (1.0 unstable [amd64]) +Inst specific (1.0 unstable [amd64]) +Conf libc6 (1.0 unstable [amd64]) +Conf specific (1.0 unstable [amd64])' aptget build-dep source-specific-amd64 -s -a armel +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libc6:armel specific:armel +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6:armel (1.0 unstable [armel]) +Inst specific:armel (1.0 unstable [armel]) +Conf libc6:armel (1.0 unstable [armel]) +Conf specific:armel (1.0 unstable [armel])' aptget build-dep source-specific-armel -s +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libc6:armel specific:armel +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libc6:armel (1.0 unstable [armel]) +Inst specific:armel (1.0 unstable [armel]) +Conf libc6:armel (1.0 unstable [armel]) +Conf specific:armel (1.0 unstable [armel])' aptget build-dep source-specific-armel -s -a armel + testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot cool doxygen foreigner libc6 libc6-dev libfwibble-dev libfwibble1 -0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded. + linux-stuff +0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. Inst amdboot (1.0 unstable [amd64]) Inst cool (1.0 unstable [amd64]) Inst doxygen (1.0 unstable [amd64]) @@ -36,6 +96,7 @@ Inst libc6 (1.0 unstable [amd64]) Inst libc6-dev (1.0 unstable [amd64]) Inst libfwibble1 (1.0 unstable [amd64]) Inst libfwibble-dev (1.0 unstable [amd64]) +Inst linux-stuff (1.0 unstable [amd64]) Conf amdboot (1.0 unstable [amd64]) Conf cool (1.0 unstable [amd64]) Conf doxygen (1.0 unstable [amd64]) @@ -43,15 +104,17 @@ Conf foreigner (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [amd64]) Conf libc6-dev (1.0 unstable [amd64]) Conf libfwibble1 (1.0 unstable [amd64]) -Conf libfwibble-dev (1.0 unstable [amd64])' aptget build-dep apt -s +Conf libfwibble-dev (1.0 unstable [amd64]) +Conf linux-stuff (1.0 unstable [amd64])' aptget build-dep apt -s testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: - amdboot cool doxygen foreigner libc6 libc6:armel libc6-dev libc6-dev:armel - libfwibble-dev:armel libfwibble1:armel -0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded. + amdboot arm-stuff:armel cool doxygen foreigner libc6 libc6:armel libc6-dev + libc6-dev:armel libfwibble-dev:armel libfwibble1:armel +0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded. Inst amdboot (1.0 unstable [amd64]) +Inst arm-stuff:armel (1.0 unstable [armel]) Inst cool (1.0 unstable [amd64]) Inst doxygen (1.0 unstable [amd64]) Inst foreigner (1.0 unstable [amd64]) @@ -62,6 +125,7 @@ Inst libc6-dev:armel (1.0 unstable [armel]) Inst libfwibble1:armel (1.0 unstable [armel]) Inst libfwibble-dev:armel (1.0 unstable [armel]) Conf amdboot (1.0 unstable [amd64]) +Conf arm-stuff:armel (1.0 unstable [armel]) Conf cool (1.0 unstable [amd64]) Conf doxygen (1.0 unstable [amd64]) Conf foreigner (1.0 unstable [amd64]) @@ -77,10 +141,11 @@ configarchitecture 'armel' 'amd64' testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: - amdboot:amd64 cool doxygen foreigner libc6 libc6-dev libfwibble-dev - libfwibble1 -0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded. + amdboot:amd64 arm-stuff cool doxygen foreigner libc6 libc6-dev + libfwibble-dev libfwibble1 +0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded. Inst amdboot:amd64 (1.0 unstable [amd64]) +Inst arm-stuff (1.0 unstable [armel]) Inst cool (1.0 unstable [armel]) Inst doxygen (1.0 unstable [armel]) Inst foreigner (1.0 unstable [armel]) @@ -89,6 +154,7 @@ Inst libc6-dev (1.0 unstable [armel]) Inst libfwibble1 (1.0 unstable [armel]) Inst libfwibble-dev (1.0 unstable [armel]) Conf amdboot:amd64 (1.0 unstable [amd64]) +Conf arm-stuff (1.0 unstable [armel]) Conf cool (1.0 unstable [armel]) Conf doxygen (1.0 unstable [armel]) Conf foreigner (1.0 unstable [armel]) @@ -101,8 +167,8 @@ testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot:amd64 cool doxygen foreigner libc6:amd64 libc6 libc6-dev:amd64 - libc6-dev libfwibble-dev:amd64 libfwibble1:amd64 -0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded. + libc6-dev libfwibble-dev:amd64 libfwibble1:amd64 linux-stuff:amd64 +0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded. Inst amdboot:amd64 (1.0 unstable [amd64]) Inst cool (1.0 unstable [armel]) Inst doxygen (1.0 unstable [armel]) @@ -113,6 +179,7 @@ Inst libc6-dev:amd64 (1.0 unstable [amd64]) Inst libc6-dev (1.0 unstable [armel]) Inst libfwibble1:amd64 (1.0 unstable [amd64]) Inst libfwibble-dev:amd64 (1.0 unstable [amd64]) +Inst linux-stuff:amd64 (1.0 unstable [amd64]) Conf amdboot:amd64 (1.0 unstable [amd64]) Conf cool (1.0 unstable [armel]) Conf doxygen (1.0 unstable [armel]) @@ -122,7 +189,8 @@ Conf libc6 (1.0 unstable [armel]) Conf libc6-dev:amd64 (1.0 unstable [amd64]) Conf libc6-dev (1.0 unstable [armel]) Conf libfwibble1:amd64 (1.0 unstable [amd64]) -Conf libfwibble-dev:amd64 (1.0 unstable [amd64])' aptget build-dep apt -s -a amd64 +Conf libfwibble-dev:amd64 (1.0 unstable [amd64]) +Conf linux-stuff:amd64 (1.0 unstable [amd64])' aptget build-dep apt -s -a amd64 configarchitecture 'amd64' 'armel' @@ -132,28 +200,31 @@ insertinstalledpackage 'foreigner' 'armel' '0.5' testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: - amdboot doxygen libc6 libc6-dev libfwibble-dev libfwibble1 -0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded. + amdboot doxygen libc6 libc6-dev libfwibble-dev libfwibble1 linux-stuff +0 upgraded, 7 newly installed, 0 to remove and 2 not upgraded. Inst amdboot (1.0 unstable [amd64]) Inst doxygen (1.0 unstable [amd64]) Inst libc6 (1.0 unstable [amd64]) Inst libc6-dev (1.0 unstable [amd64]) Inst libfwibble1 (1.0 unstable [amd64]) Inst libfwibble-dev (1.0 unstable [amd64]) +Inst linux-stuff (1.0 unstable [amd64]) Conf amdboot (1.0 unstable [amd64]) Conf doxygen (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [amd64]) Conf libc6-dev (1.0 unstable [amd64]) Conf libfwibble1 (1.0 unstable [amd64]) -Conf libfwibble-dev (1.0 unstable [amd64])' aptget build-dep apt -s +Conf libfwibble-dev (1.0 unstable [amd64]) +Conf linux-stuff (1.0 unstable [amd64])' aptget build-dep apt -s testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: - amdboot doxygen libc6 libc6:armel libc6-dev libc6-dev:armel + amdboot arm-stuff:armel doxygen libc6 libc6:armel libc6-dev libc6-dev:armel libfwibble-dev:armel libfwibble1:armel -0 upgraded, 8 newly installed, 0 to remove and 2 not upgraded. +0 upgraded, 9 newly installed, 0 to remove and 2 not upgraded. Inst amdboot (1.0 unstable [amd64]) +Inst arm-stuff:armel (1.0 unstable [armel]) Inst doxygen (1.0 unstable [amd64]) Inst libc6 (1.0 unstable [amd64]) Inst libc6:armel (1.0 unstable [armel]) @@ -162,6 +233,7 @@ Inst libc6-dev:armel (1.0 unstable [armel]) Inst libfwibble1:armel (1.0 unstable [armel]) Inst libfwibble-dev:armel (1.0 unstable [armel]) Conf amdboot (1.0 unstable [amd64]) +Conf arm-stuff:armel (1.0 unstable [armel]) Conf doxygen (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [amd64]) Conf libc6:armel (1.0 unstable [armel]) @@ -178,10 +250,12 @@ Building dependency tree... The following packages will be REMOVED: cool:amd64 The following NEW packages will be installed: - amdboot:amd64 cool doxygen libc6 libc6-dev libfwibble-dev libfwibble1 -0 upgraded, 7 newly installed, 1 to remove and 1 not upgraded. + amdboot:amd64 arm-stuff cool doxygen libc6 libc6-dev libfwibble-dev + libfwibble1 +0 upgraded, 8 newly installed, 1 to remove and 1 not upgraded. Remv cool:amd64 [0.5] Inst amdboot:amd64 (1.0 unstable [amd64]) +Inst arm-stuff (1.0 unstable [armel]) Inst cool (1.0 unstable [armel]) Inst doxygen (1.0 unstable [armel]) Inst libc6 (1.0 unstable [armel]) @@ -189,6 +263,7 @@ Inst libc6-dev (1.0 unstable [armel]) Inst libfwibble1 (1.0 unstable [armel]) Inst libfwibble-dev (1.0 unstable [armel]) Conf amdboot:amd64 (1.0 unstable [amd64]) +Conf arm-stuff (1.0 unstable [armel]) Conf cool (1.0 unstable [armel]) Conf doxygen (1.0 unstable [armel]) Conf libc6 (1.0 unstable [armel]) @@ -200,8 +275,8 @@ testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot:amd64 doxygen libc6:amd64 libc6 libc6-dev:amd64 libc6-dev - libfwibble-dev:amd64 libfwibble1:amd64 -0 upgraded, 8 newly installed, 0 to remove and 2 not upgraded. + libfwibble-dev:amd64 libfwibble1:amd64 linux-stuff:amd64 +0 upgraded, 9 newly installed, 0 to remove and 2 not upgraded. Inst amdboot:amd64 (1.0 unstable [amd64]) Inst doxygen (1.0 unstable [armel]) Inst libc6:amd64 (1.0 unstable [amd64]) @@ -210,6 +285,7 @@ Inst libc6-dev:amd64 (1.0 unstable [amd64]) Inst libc6-dev (1.0 unstable [armel]) Inst libfwibble1:amd64 (1.0 unstable [amd64]) Inst libfwibble-dev:amd64 (1.0 unstable [amd64]) +Inst linux-stuff:amd64 (1.0 unstable [amd64]) Conf amdboot:amd64 (1.0 unstable [amd64]) Conf doxygen (1.0 unstable [armel]) Conf libc6:amd64 (1.0 unstable [amd64]) @@ -217,6 +293,5 @@ Conf libc6 (1.0 unstable [armel]) Conf libc6-dev:amd64 (1.0 unstable [amd64]) Conf libc6-dev (1.0 unstable [armel]) Conf libfwibble1:amd64 (1.0 unstable [amd64]) -Conf libfwibble-dev:amd64 (1.0 unstable [amd64])' aptget build-dep apt -s -a amd64 - - +Conf libfwibble-dev:amd64 (1.0 unstable [amd64]) +Conf linux-stuff:amd64 (1.0 unstable [amd64])' aptget build-dep apt -s -a amd64 diff --git a/test/integration/test-bug-673536-pre-depends-breaks-loop b/test/integration/test-bug-673536-pre-depends-breaks-loop new file mode 100755 index 000000000..e9d3c4de6 --- /dev/null +++ b/test/integration/test-bug-673536-pre-depends-breaks-loop @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'native' + +buildsimplenativepackage 'basic' 'native' '1' 'stable' +buildsimplenativepackage 'basic' 'native' '2' 'unstable' 'Pre-Depends: common' +buildsimplenativepackage 'common' 'native' '2' 'unstable' 'Breaks: basic (<= 1)' + +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 +testdpkginstalled basic +testdpkgnotinstalled common + +aptget dist-upgrade -qq > /dev/null +testdpkginstalled basic common diff --git a/test/integration/test-bug-675449-essential-are-protected b/test/integration/test-bug-675449-essential-are-protected new file mode 100755 index 000000000..7d8cc3484 --- /dev/null +++ b/test/integration/test-bug-675449-essential-are-protected @@ -0,0 +1,88 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertinstalledpackage 'pkg-native' 'amd64' '1' 'Multi-Arch: foreign +Essential: yes' +insertinstalledpackage 'pkg-foreign' 'i386' '1' 'Multi-Arch: foreign +Essential: yes' +insertinstalledpackage 'pkg-none-native' 'amd64' '1' 'Essential: yes' +insertinstalledpackage 'pkg-none-foreign' 'i386' '1' 'Essential: yes' + +insertpackage 'unstable' 'pkg-native' 'amd64,i386' '2' 'Multi-Arch: foreign +Essential: yes' +insertpackage 'unstable' 'pkg-foreign' 'amd64,i386' '2' 'Multi-Arch: foreign +Depends: pkg-depends-new +Essential: yes' +insertpackage 'unstable' 'pkg-none-native' 'amd64,i386' '2' 'Essential: yes' +insertpackage 'unstable' 'pkg-none-foreign' 'amd64,i386' '2' 'Essential: yes +Depends: pkg-depends-new' + +insertpackage 'unstable' 'pkg-none-new' 'amd64,i386' '2' 'Essential: yes' +insertpackage 'unstable' 'pkg-depends-new' 'amd64,i386' '2' 'Essential: yes' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + pkg-native* +WARNING: The following essential packages will be removed. +This should NOT be done unless you know exactly what you are doing! + pkg-native +0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded. +Purg pkg-native [1]' aptget purge pkg-native -s + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + pkg-foreign:i386* +WARNING: The following essential packages will be removed. +This should NOT be done unless you know exactly what you are doing! + pkg-foreign:i386 +0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded. +Purg pkg-foreign:i386 [1]' aptget purge pkg-foreign:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + pkg-none-native* +WARNING: The following essential packages will be removed. +This should NOT be done unless you know exactly what you are doing! + pkg-none-native +0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded. +Purg pkg-none-native [1]' aptget purge pkg-none-native -s + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + pkg-none-foreign:i386* +WARNING: The following essential packages will be removed. +This should NOT be done unless you know exactly what you are doing! + pkg-none-foreign:i386 +0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded. +Purg pkg-none-foreign:i386 [1]' aptget purge pkg-none-foreign:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + pkg-depends-new:i386 pkg-none-new +The following packages will be upgraded: + pkg-foreign:i386 pkg-native pkg-none-foreign:i386 pkg-none-native +4 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst pkg-depends-new:i386 (2 unstable [i386]) +Conf pkg-depends-new:i386 (2 unstable [i386]) +Inst pkg-foreign:i386 [1] (2 unstable [i386]) +Conf pkg-foreign:i386 (2 unstable [i386]) +Inst pkg-native [1] (2 unstable [amd64]) +Conf pkg-native (2 unstable [amd64]) +Inst pkg-none-foreign:i386 [1] (2 unstable [i386]) +Conf pkg-none-foreign:i386 (2 unstable [i386]) +Inst pkg-none-native [1] (2 unstable [amd64]) +Conf pkg-none-native (2 unstable [amd64]) +Inst pkg-none-new (2 unstable [amd64]) +Conf pkg-none-new (2 unstable [amd64])' aptget dist-upgrade -s diff --git a/test/integration/test-cachecontainer-architecture-specification b/test/integration/test-cachecontainer-architecture-specification new file mode 100755 index 000000000..174efb087 --- /dev/null +++ b/test/integration/test-cachecontainer-architecture-specification @@ -0,0 +1,87 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'armel' + +#insertinstalledpackage 'xserver-xorg-core' 'amd64' '2:1.7.6-2ubuntu7.10' +insertpackage 'unstable' 'libsame' 'armel,amd64' '1' 'Multi-Arch: same' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libsame +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libsame (1 unstable [amd64]) +Conf libsame (1 unstable [amd64])' aptget -s install libsame +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libsame:armel +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libsame:armel (1 unstable [armel]) +Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:armel +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libsame +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libsame (1 unstable [amd64]) +Conf libsame (1 unstable [amd64])' aptget -s install libsame:amd64 +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libsame libsame:armel +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libsame (1 unstable [amd64]) +Inst libsame:armel (1 unstable [armel]) +Conf libsame (1 unstable [amd64]) +Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:armel libsame:amd64 +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libsame libsame:armel +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libsame (1 unstable [amd64]) +Inst libsame:armel (1 unstable [armel]) +Conf libsame (1 unstable [amd64]) +Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:* +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libsame +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libsame (1 unstable [amd64]) +Conf libsame (1 unstable [amd64])' aptget -s install libsame:any +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libsame libsame:armel +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libsame (1 unstable [amd64]) +Inst libsame:armel (1 unstable [armel]) +Conf libsame (1 unstable [amd64]) +Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:a* +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libsame +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst libsame (1 unstable [amd64]) +Conf libsame (1 unstable [amd64])' aptget -s install libsame:linux-any +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libsame libsame:armel +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst libsame (1 unstable [amd64]) +Inst libsame:armel (1 unstable [armel]) +Conf libsame (1 unstable [amd64]) +Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:linux-* +testequal 'Reading package lists... +Building dependency tree... +E: Unable to locate package libsame' aptget -s install libsame:windows-any diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop index 25f005969..4407fbd9d 100755 --- a/test/integration/test-conflicts-loop +++ b/test/integration/test-conflicts-loop @@ -19,10 +19,10 @@ testequal 'Reading package lists... Building dependency tree... The following packages will be upgraded: openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib -3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. openjdk-6-jre-lib:i386 conflicts with openjdk-6-jre:i386 openjdk-6-jre:i386 conflicts with openjdk-6-jre-headless:i386 openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre:i386 +3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Remv openjdk-6-jre [6b16-1.8-0ubuntu1] openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre-lib:i386 Remv openjdk-6-jre-lib [6b16-1.8-0ubuntu1] diff --git a/test/integration/test-disappearing-packages b/test/integration/test-disappearing-packages index 0e0e9618d..d2ac4edc6 100755 --- a/test/integration/test-disappearing-packages +++ b/test/integration/test-disappearing-packages @@ -39,7 +39,7 @@ COMPAREFILE=$(mktemp) echo "The following package disappeared from your system as all files have been overwritten by other packages: old-pkg -Note: This is done automatic and on purpose by dpkg." > $COMPAREFILE +Note: This is done automatically and on purpose by dpkg." > $COMPAREFILE $CMD 2>&1 | tail -n 4 | diff $COMPAREFILE - && msgpass || msgfail rm $COMPAREFILE diff --git a/test/integration/test-hashsum-verification b/test/integration/test-hashsum-verification index 3ac9eccfb..99ea8bffa 100755 --- a/test/integration/test-hashsum-verification +++ b/test/integration/test-hashsum-verification @@ -23,7 +23,7 @@ prepare() { find aptarchive -name 'Release' -delete cat aptarchive/Packages | gzip > aptarchive/Packages.gz cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2 - cat aptarchive/Packages | lzma > aptarchive/Packages.lzma + cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma # 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-ignore-provides-if-versioned-breaks b/test/integration/test-ignore-provides-if-versioned-breaks new file mode 100755 index 000000000..f8b4544a0 --- /dev/null +++ b/test/integration/test-ignore-provides-if-versioned-breaks @@ -0,0 +1,150 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' 'amd64' + +insertpackage 'unstable' 'unrlated' 'all' '1.0' + +insertinstalledpackage 'foo' 'i386' '2.0' +insertpackage 'unstable' 'foo' 'i386' '4.0' +insertpackage 'unstable' 'foo-provider' 'i386' '1.0' 'Provides: foo' +insertpackage 'unstable' 'foo-breaker-3' 'i386' '1.0' 'Breaks: foo (<< 3.0)' +insertpackage 'unstable' 'foo-breaker-2' 'i386' '1.0' 'Breaks: foo (<< 2.0)' +insertpackage 'unstable' 'foo-breaker-none' 'i386' '1.0' 'Breaks: foo' + +insertinstalledpackage 'foo-foreign' 'amd64' '2.0' 'Multi-Arch: foreign' +insertpackage 'unstable' 'foo-foreign' 'amd64' '4.0' 'Multi-Arch: foreign' +insertpackage 'unstable' 'foo-foreign-provider' 'i386' '1.0' 'Provides: foo-foreign' +insertpackage 'unstable' 'foo-foreign-breaker-3' 'i386' '1.0' 'Breaks: foo-foreign (<< 3.0)' +insertpackage 'unstable' 'foo-foreign-breaker-2' 'i386' '1.0' 'Breaks: foo-foreign (<< 2.0)' +insertpackage 'unstable' 'foo-foreign-breaker-none' 'i386' '1.0' 'Breaks: foo-foreign' + +insertinstalledpackage 'foo-same' 'i386,amd64' '2.0' 'Multi-Arch: same' +insertpackage 'unstable' 'foo-same' 'i386,amd64' '4.0' 'Multi-Arch: same' +insertpackage 'unstable' 'foo-same-provider' 'i386' '1.0' 'Provides: foo-same' +insertpackage 'unstable' 'foo-same-breaker-3' 'i386' '1.0' 'Breaks: foo-same (<< 3.0)' +insertpackage 'unstable' 'foo-same-breaker-2' 'i386' '1.0' 'Breaks: foo-same (<< 2.0)' +insertpackage 'unstable' 'foo-same-breaker-none' 'i386' '1.0' 'Breaks: foo-same' + + + +setupaptarchive + +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: + foo-breaker-none : Breaks: foo +E: Unable to correct problems, you have held broken packages.' aptget install foo-provider foo-breaker-none -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo-breaker-2 foo-provider +0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded. +Inst foo-breaker-2 (1.0 unstable [i386]) +Inst foo-provider (1.0 unstable [i386]) +Conf foo-breaker-2 (1.0 unstable [i386]) +Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-2 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + foo-breaker-3 foo-provider +The following packages will be upgraded: + foo +1 upgraded, 2 newly installed, 0 to remove and 3 not upgraded. +Inst foo [2.0] (4.0 unstable [i386]) +Inst foo-breaker-3 (1.0 unstable [i386]) +Inst foo-provider (1.0 unstable [i386]) +Conf foo (4.0 unstable [i386]) +Conf foo-breaker-3 (1.0 unstable [i386]) +Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-3 -s + +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: + foo-foreign-breaker-none : Breaks: foo-foreign +E: Unable to correct problems, you have held broken packages.' aptget install foo-foreign-provider foo-foreign-breaker-none -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo-foreign-breaker-2 foo-foreign-provider +0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded. +Inst foo-foreign-breaker-2 (1.0 unstable [i386]) +Inst foo-foreign-provider (1.0 unstable [i386]) +Conf foo-foreign-breaker-2 (1.0 unstable [i386]) +Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-2 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo-foreign:amd64 +The following NEW packages will be installed: + foo-foreign-breaker-3 foo-foreign-provider +The following packages will be upgraded: + foo-foreign:amd64 +1 upgraded, 2 newly installed, 0 to remove and 3 not upgraded. +Inst foo-foreign:amd64 [2.0] (4.0 unstable [amd64]) +Inst foo-foreign-breaker-3 (1.0 unstable [i386]) +Inst foo-foreign-provider (1.0 unstable [i386]) +Conf foo-foreign:amd64 (4.0 unstable [amd64]) +Conf foo-foreign-breaker-3 (1.0 unstable [i386]) +Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-3 -s + +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: + foo-same-breaker-none : Breaks: foo-same +E: Unable to correct problems, you have held broken packages.' aptget install foo-same-provider foo-same-breaker-none -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo-same-breaker-2 foo-same-provider +0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded. +Inst foo-same-breaker-2 (1.0 unstable [i386]) +Inst foo-same-provider (1.0 unstable [i386]) +Conf foo-same-breaker-2 (1.0 unstable [i386]) +Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-2 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo-same:amd64 foo-same +The following NEW packages will be installed: + foo-same-breaker-3 foo-same-provider +The following packages will be upgraded: + foo-same:amd64 foo-same +2 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) [foo-same:amd64 on foo-same:i386] [foo-same:i386 on foo-same:amd64] [foo-same:i386 ] +Inst foo-same [2.0] (4.0 unstable [i386]) +Conf foo-same:amd64 (4.0 unstable [amd64]) +Conf foo-same (4.0 unstable [i386]) +Inst foo-same-breaker-3 (1.0 unstable [i386]) +Inst foo-same-provider (1.0 unstable [i386]) +Conf foo-same-breaker-3 (1.0 unstable [i386]) +Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-3 -s diff --git a/test/integration/test-ignore-provides-if-versioned-conflicts b/test/integration/test-ignore-provides-if-versioned-conflicts new file mode 100755 index 000000000..44eafcff1 --- /dev/null +++ b/test/integration/test-ignore-provides-if-versioned-conflicts @@ -0,0 +1,150 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' 'amd64' + +insertpackage 'unstable' 'unrlated' 'all' '1.0' + +insertinstalledpackage 'foo' 'i386' '2.0' +insertpackage 'unstable' 'foo' 'i386' '4.0' +insertpackage 'unstable' 'foo-provider' 'i386' '1.0' 'Provides: foo' +insertpackage 'unstable' 'foo-breaker-3' 'i386' '1.0' 'Conflicts: foo (<< 3.0)' +insertpackage 'unstable' 'foo-breaker-2' 'i386' '1.0' 'Conflicts: foo (<< 2.0)' +insertpackage 'unstable' 'foo-breaker-none' 'i386' '1.0' 'Conflicts: foo' + +insertinstalledpackage 'foo-foreign' 'amd64' '2.0' 'Multi-Arch: foreign' +insertpackage 'unstable' 'foo-foreign' 'amd64' '4.0' 'Multi-Arch: foreign' +insertpackage 'unstable' 'foo-foreign-provider' 'i386' '1.0' 'Provides: foo-foreign' +insertpackage 'unstable' 'foo-foreign-breaker-3' 'i386' '1.0' 'Conflicts: foo-foreign (<< 3.0)' +insertpackage 'unstable' 'foo-foreign-breaker-2' 'i386' '1.0' 'Conflicts: foo-foreign (<< 2.0)' +insertpackage 'unstable' 'foo-foreign-breaker-none' 'i386' '1.0' 'Conflicts: foo-foreign' + +insertinstalledpackage 'foo-same' 'i386,amd64' '2.0' 'Multi-Arch: same' +insertpackage 'unstable' 'foo-same' 'i386,amd64' '4.0' 'Multi-Arch: same' +insertpackage 'unstable' 'foo-same-provider' 'i386' '1.0' 'Provides: foo-same' +insertpackage 'unstable' 'foo-same-breaker-3' 'i386' '1.0' 'Conflicts: foo-same (<< 3.0)' +insertpackage 'unstable' 'foo-same-breaker-2' 'i386' '1.0' 'Conflicts: foo-same (<< 2.0)' +insertpackage 'unstable' 'foo-same-breaker-none' 'i386' '1.0' 'Conflicts: foo-same' + + + +setupaptarchive + +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: + foo-breaker-none : Conflicts: foo +E: Unable to correct problems, you have held broken packages.' aptget install foo-provider foo-breaker-none -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo-breaker-2 foo-provider +0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded. +Inst foo-breaker-2 (1.0 unstable [i386]) +Inst foo-provider (1.0 unstable [i386]) +Conf foo-breaker-2 (1.0 unstable [i386]) +Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-2 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + foo-breaker-3 foo-provider +The following packages will be upgraded: + foo +1 upgraded, 2 newly installed, 0 to remove and 3 not upgraded. +Inst foo [2.0] (4.0 unstable [i386]) +Inst foo-breaker-3 (1.0 unstable [i386]) +Inst foo-provider (1.0 unstable [i386]) +Conf foo (4.0 unstable [i386]) +Conf foo-breaker-3 (1.0 unstable [i386]) +Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-3 -s + +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: + foo-foreign-breaker-none : Conflicts: foo-foreign +E: Unable to correct problems, you have held broken packages.' aptget install foo-foreign-provider foo-foreign-breaker-none -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo-foreign-breaker-2 foo-foreign-provider +0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded. +Inst foo-foreign-breaker-2 (1.0 unstable [i386]) +Inst foo-foreign-provider (1.0 unstable [i386]) +Conf foo-foreign-breaker-2 (1.0 unstable [i386]) +Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-2 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo-foreign:amd64 +The following NEW packages will be installed: + foo-foreign-breaker-3 foo-foreign-provider +The following packages will be upgraded: + foo-foreign:amd64 +1 upgraded, 2 newly installed, 0 to remove and 3 not upgraded. +Inst foo-foreign:amd64 [2.0] (4.0 unstable [amd64]) +Inst foo-foreign-breaker-3 (1.0 unstable [i386]) +Inst foo-foreign-provider (1.0 unstable [i386]) +Conf foo-foreign:amd64 (4.0 unstable [amd64]) +Conf foo-foreign-breaker-3 (1.0 unstable [i386]) +Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-3 -s + +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: + foo-same-breaker-none : Conflicts: foo-same +E: Unable to correct problems, you have held broken packages.' aptget install foo-same-provider foo-same-breaker-none -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + foo-same-breaker-2 foo-same-provider +0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded. +Inst foo-same-breaker-2 (1.0 unstable [i386]) +Inst foo-same-provider (1.0 unstable [i386]) +Conf foo-same-breaker-2 (1.0 unstable [i386]) +Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-2 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo-same:amd64 foo-same +The following NEW packages will be installed: + foo-same-breaker-3 foo-same-provider +The following packages will be upgraded: + foo-same:amd64 foo-same +2 upgraded, 2 newly installed, 0 to remove and 2 not upgraded. +Inst foo-same:amd64 [2.0] (4.0 unstable [amd64]) [foo-same:amd64 on foo-same:i386] [foo-same:i386 on foo-same:amd64] [foo-same:i386 ] +Inst foo-same [2.0] (4.0 unstable [i386]) +Conf foo-same:amd64 (4.0 unstable [amd64]) +Conf foo-same (4.0 unstable [i386]) +Inst foo-same-breaker-3 (1.0 unstable [i386]) +Inst foo-same-provider (1.0 unstable [i386]) +Conf foo-same-breaker-3 (1.0 unstable [i386]) +Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-3 -s diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 0a8293018..29301d07d 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -21,7 +21,7 @@ testequal "$(cat ${PKGFILE}) cp ${PKGFILE}-new aptarchive/Packages cat aptarchive/Packages | gzip > aptarchive/Packages.gz cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2 -cat aptarchive/Packages | lzma > aptarchive/Packages.lzma +cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma rm -rf aptarchive/Packages.diff mkdir -p aptarchive/Packages.diff PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)" diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification index 4f65cfa3b..d3ea91de5 100755 --- a/test/integration/test-releasefile-verification +++ b/test/integration/test-releasefile-verification @@ -24,7 +24,7 @@ prepare() { find aptarchive -name 'Release' -delete cat aptarchive/Packages | gzip > aptarchive/Packages.gz cat aptarchive/Packages | bzip2 > aptarchive/Packages.bz2 - cat aptarchive/Packages | lzma > aptarchive/Packages.lzma + cat aptarchive/Packages | xz --format=lzma > aptarchive/Packages.lzma generatereleasefiles "$DATE" } diff --git a/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first b/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first index a9a4069cf..269038d0f 100755 --- a/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first +++ b/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first @@ -14,7 +14,7 @@ insertpackage 'unstable' 'apt' 'i386' '2' 'Depends: libsame (= 2)' setupaptarchive -testequal 'Reading package lists... +testequalor2 'Reading package lists... Building dependency tree... The following extra packages will be installed: apt:i386 libsame:i386 @@ -28,4 +28,18 @@ Inst libsame (2 unstable [amd64]) [apt:i386 ] Conf libsame:i386 (2 unstable [i386]) [apt:i386 ] Conf libsame (2 unstable [amd64]) [apt:i386 ] Inst apt:i386 [1] (2 unstable [i386]) +Conf apt:i386 (2 unstable [i386])' 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + apt:i386 libsame:i386 +The following NEW packages will be installed: + libsame +The following packages will be upgraded: + apt:i386 libsame:i386 +2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst apt:i386 [1] (2 unstable [i386]) [] +Inst libsame:i386 [1] (2 unstable [i386]) +Inst libsame (2 unstable [amd64]) +Conf libsame:i386 (2 unstable [i386]) +Conf libsame (2 unstable [amd64]) Conf apt:i386 (2 unstable [i386])' aptget install libsame:amd64 -s diff --git a/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering b/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering new file mode 100755 index 000000000..462acad00 --- /dev/null +++ b/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'custom' 'amd64' '1.0' 'Pre-Depends: grub-pc | grub' +insertinstalledpackage 'grub' 'amd64' '1.0' +insertpackage 'unstable' 'custom' 'amd64' '2.0' 'Pre-Depends: grub-pc | grub' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + custom +1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Inst custom [1.0] (2.0 unstable [amd64]) +Conf custom (2.0 unstable [amd64])' aptget dist-upgrade -s diff --git a/test/integration/test-ubuntu-bug346386 b/test/integration/test-ubuntu-bug346386 new file mode 100755 index 000000000..a5f502853 --- /dev/null +++ b/test/integration/test-ubuntu-bug346386 @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +buildsimplenativepackage 'apt' 'all' '1.0' 'stable' + +setupaptarchive +changetowebserver --simulate-paywall + +rm -rf rootdir/var/lib/apt/lists +aptget update +testequal 'partial' "$(ls rootdir/var/lib/apt/lists/)" + + diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc new file mode 100644 index 000000000..8fbb9eab9 --- /dev/null +++ b/test/interactive-helper/aptwebserver.cc @@ -0,0 +1,264 @@ +#include <apt-pkg/strutl.h> +#include <apt-pkg/fileutl.h> +#include <apt-pkg/error.h> +#include <apt-pkg/cmndline.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/init.h> + +#include <vector> +#include <string> +#include <list> +#include <sstream> + +#include <sys/socket.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <unistd.h> +#include <errno.h> +#include <time.h> +#include <stdlib.h> + +char const * const httpcodeToStr(int httpcode) { /*{{{*/ + switch (httpcode) { + // Informational 1xx + case 100: return "100 Continue"; + case 101: return "101 Switching Protocols"; + // Successful 2xx + case 200: return "200 OK"; + case 201: return "201 Created"; + case 202: return "202 Accepted"; + case 203: return "203 Non-Authoritative Information"; + case 204: return "204 No Content"; + case 205: return "205 Reset Content"; + case 206: return "206 Partial Conent"; + // Redirections 3xx + case 300: return "300 Multiple Choices"; + case 301: return "301 Moved Permanently"; + case 302: return "302 Found"; + case 303: return "303 See Other"; + case 304: return "304 Not Modified"; + case 305: return "304 Use Proxy"; + case 307: return "307 Temporary Redirect"; + // Client errors 4xx + case 400: return "400 Bad Request"; + case 401: return "401 Unauthorized"; + case 402: return "402 Payment Required"; + case 403: return "403 Forbidden"; + case 404: return "404 Not Found"; + case 405: return "405 Method Not Allowed"; + case 406: return "406 Not Acceptable"; + case 407: return "Proxy Authentication Required"; + case 408: return "Request Time-out"; + case 409: return "Conflict"; + case 410: return "Gone"; + case 411: return "Length Required"; + case 412: return "Precondition Failed"; + case 413: return "Request Entity Too Large"; + case 414: return "Request-URI Too Large"; + case 415: return "Unsupported Media Type"; + case 416: return "Requested range not satisfiable"; + case 417: return "Expectation Failed"; + // Server error 5xx + case 500: return "Internal Server Error"; + case 501: return "Not Implemented"; + case 502: return "Bad Gateway"; + case 503: return "Service Unavailable"; + case 504: return "Gateway Time-out"; + case 505: return "HTTP Version not supported"; + } + return NULL; +} /*}}}*/ + +void addFileHeaders(std::list<std::string> &headers, FileFd &data) { /*{{{*/ + std::ostringstream contentlength; + contentlength << "Content-Length: " << data.FileSize(); + headers.push_back(contentlength.str()); + + std::string lastmodified("Last-Modified: "); + lastmodified.append(TimeRFC1123(data.ModificationTime())); + headers.push_back(lastmodified); +} /*}}}*/ + +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 client, int httpcode, std::list<std::string> &headers) { /*{{{*/ + string response("HTTP/1.1 "); + response.append(httpcodeToStr(httpcode)); + headers.push_front(response); + + headers.push_back("Server: APT webserver"); + + std::string date("Date: "); + date.append(TimeRFC1123(time(NULL))); + headers.push_back(date); + + 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 &= FileFd::Write(client, h->c_str(), h->size()); + Success &= FileFd::Write(client, "\r\n", 2); + std::clog << *h << std::endl; + } + Success &= FileFd::Write(client, "\r\n", 2); + std::clog << "<<<<<<<<<<<<<<<<" << std::endl; + return Success; +} /*}}}*/ + +bool sendFile(int client, FileFd &data) { /*{{{*/ + bool Success = true; + char buffer[500]; + unsigned long long actual = 0; + while ((Success &= data.Read(buffer, sizeof(buffer), &actual)) == true) { + if (actual == 0) + break; + Success &= FileFd::Write(client, buffer, actual); + } + Success &= FileFd::Write(client, "\r\n", 2); + return Success; +} /*}}}*/ + +bool sendData(int client, std::string &data) { /*{{{*/ + bool Success = true; + Success &= FileFd::Write(client, data.c_str(), data.size()); + Success &= FileFd::Write(client, "\r\n", 2); + return Success; +} /*}}}*/ + +void sendError(int client, int httpcode, string request, bool content) { /*{{{*/ + std::list<std::string> headers; + string response; + if (content == true) { + response.append("<html><head><title>"); + response.append(httpcodeToStr(httpcode)).append("</title></head>"); + response.append("<body><h1>").append(httpcodeToStr(httpcode)).append("</h1"); + response.append("This error is a result of the request: <pre>"); + response.append(request).append("</pre></body></html>"); + addDataHeaders(headers, response); + } + sendHead(client, httpcode, headers); + sendData(client, response); +} /*}}}*/ + +int main(int argc, const char *argv[]) +{ + CommandLine::Args Args[] = { + {0, "simulate-paywall", "aptwebserver::Simulate-Paywall", + CommandLine::Boolean}, + {0, "port", "aptwebserver::port", CommandLine::HasArg}, + {0,0,0,0} + }; + + CommandLine CmdL(Args, _config); + if(CmdL.Parse(argc,argv) == false) { + _error->DumpErrors(); + exit(1); + } + + // create socket, bind and listen to it {{{ + int sock = socket(AF_INET6, SOCK_STREAM, 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 + int const enable = 1; + setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable)); + + struct sockaddr_in6 locAddr; + memset(&locAddr, 0, sizeof(locAddr)); + locAddr.sin6_family = AF_INET6; + locAddr.sin6_port = htons(port); + locAddr.sin6_addr = in6addr_any; + + 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; + } + + listen(sock, 1); + + std::vector<std::string> messages; + int client; + while ((client = accept(sock, NULL, NULL)) != -1) { + std::clog << "ACCEPT client " << client + << " on socket " << sock << std::endl; + + while (ReadMessages(client, messages)) { + for (std::vector<std::string>::const_iterator m = messages.begin(); + m != messages.end(); ++m) { + std::clog << ">>> REQUEST >>>>" << std::endl << *m + << std::endl << "<<<<<<<<<<<<<<<<" << std::endl; + std::list<std::string> headers; + bool sendContent = true; + if (strncmp(m->c_str(), "HEAD ", 5) == 0) + sendContent = false; + if (strncmp(m->c_str(), "GET ", 4) != 0) + sendError(client, 501, *m, true); + + std::string host = LookupTag(*m, "Host", ""); + if (host.empty() == true) { + // RFC 2616 §14.23 Host + sendError(client, 400, *m, sendContent); + continue; + } + + size_t const filestart = m->find(' ', 5); + string filename = m->substr(5, filestart - 5); + + if (simulate_broken_server == true) { + string data("ni ni ni\n"); + addDataHeaders(headers, data); + sendHead(client, 200, headers); + sendData(client, data); + } + else if (RealFileExists(filename) == false) + sendError(client, 404, *m, sendContent); + else { + FileFd data(filename, FileFd::ReadOnly); + std::string condition = LookupTag(*m, "If-Modified-Since", ""); + if (condition.empty() == false) { + time_t cache; + if (RFC1123StrToTime(condition.c_str(), cache) == true && + cache >= data.ModificationTime()) { + sendError(client, 304, *m, false); + continue; + } + } + addFileHeaders(headers, data); + sendHead(client, 200, headers); + if (sendContent == true) + sendFile(client, data); + } + } + _error->DumpErrors(std::cerr); + messages.clear(); + } + + std::clog << "CLOSE client " << client + << " on socket " << sock << std::endl; + close(client); + } + return 0; +} diff --git a/test/interactive-helper/extract-control.cc b/test/interactive-helper/extract-control.cc index a1b3600aa..3f7feabcb 100644 --- a/test/interactive-helper/extract-control.cc +++ b/test/interactive-helper/extract-control.cc @@ -21,8 +21,7 @@ bool ExtractMember(const char *File,const char *Member) if (Extract.Control == 0) return true; - write(STDOUT_FILENO,Extract.Control,Extract.Length); - return true; + return write(STDOUT_FILENO,Extract.Control,Extract.Length) != -1; } int main(int argc, const char *argv[]) diff --git a/test/interactive-helper/makefile b/test/interactive-helper/makefile index b96139fda..fee94cd77 100644 --- a/test/interactive-helper/makefile +++ b/test/interactive-helper/makefile @@ -11,28 +11,24 @@ SLIBS = SOURCE = mthdcat.cc include $(PROGRAM_H) -# Version compare tester -PROGRAM=testextract -SLIBS = -lapt-pkg -lapt-inst -LIB_MAKES = apt-pkg/makefile apt-inst/makefile -SOURCE = testextract.cc -include $(PROGRAM_H) - # Program for testing the tar/deb extractor PROGRAM=testdeb SLIBS = -lapt-pkg -lapt-inst +LIB_MAKES = apt-pkg/makefile apt-inst/makefile SOURCE = testdeb.cc include $(PROGRAM_H) # Program for testing tar extraction PROGRAM=extract-control SLIBS = -lapt-pkg -lapt-inst +LIB_MAKES = apt-pkg/makefile apt-inst/makefile SOURCE = extract-control.cc include $(PROGRAM_H) # Program for testing udevcdrom PROGRAM=test_udevcdrom -SLIBS = -lapt-pkg +SLIBS = -lapt-pkg +LIB_MAKES = apt-pkg/makefile SOURCE = test_udevcdrom.cc include $(PROGRAM_H) @@ -41,3 +37,10 @@ include $(PROGRAM_H) #SLIBS = -lapt-pkg -lrpm #SOURCE = rpmver.cc #include $(PROGRAM_H) + +# very simple webserver for APT testing +PROGRAM=aptwebserver +SLIBS = -lapt-pkg +LIB_MAKES = apt-pkg/makefile +SOURCE = aptwebserver.cc +include $(PROGRAM_H) diff --git a/test/interactive-helper/testextract.cc b/test/interactive-helper/testextract.cc deleted file mode 100644 index f7ddb72f0..000000000 --- a/test/interactive-helper/testextract.cc +++ /dev/null @@ -1,103 +0,0 @@ -#include <apt-pkg/dpkgdb.h> -#include <apt-pkg/debfile.h> -#include <apt-pkg/error.h> -#include <apt-pkg/configuration.h> -#include <apt-pkg/progress.h> -#include <apt-pkg/extract.h> -#include <apt-pkg/init.h> -#include <apt-pkg/strutl.h> -#include <apt-pkg/fileutl.h> -#include <apt-pkg/pkgsystem.h> - -#include <stdio.h> -#include <stdlib.h> - -using namespace std; - -bool Go(int argc,char *argv[]) -{ - // Init the database - debDpkgDB Db; - { - OpTextProgress Prog; - - if (Db.ReadyPkgCache(Prog) == false) - return false; - Prog.Done(); - - if (Db.ReadyFileList(Prog) == false) - return false; - } - - for (int I = 1; I < argc; I++) - { - const char *Fake = 0; - for (unsigned J = 0; argv[I][J] != 0; J++) - { - if (argv[I][J] != ',') - continue; - Fake = argv[I] + J + 1; - argv[I][J] = 0; - } - - FileFd F(argv[I],FileFd::ReadOnly); - debDebFile Deb(F); - - if (_error->PendingError() == true) - return false; - - if (Deb.ExtractControl(Db) == false) - return false; - cout << argv[I] << endl; - - pkgCache::VerIterator Ver = Deb.MergeControl(Db); - if (Ver.end() == true) - return false; - - cout << Ver.ParentPkg().Name() << ' ' << Ver.VerStr() << endl; - - pkgExtract Extract(Db.GetFLCache(),Ver); - - if (Fake != 0) - { - pkgExtract::Item Itm; - memset(&Itm,0,sizeof(Itm)); - FILE *F = fopen(Fake,"r"); - while (feof(F) == 0) - { - char Line[300]; - fgets(Line,sizeof(Line),F); - Itm.Name = _strstrip(Line); - Itm.Type = pkgDirStream::Item::File; - if (Line[strlen(Line)-1] == '/') - Itm.Type = pkgDirStream::Item::Directory; - - int Fd; - if (Extract.DoItem(Itm,Fd) == false) { - fclose(F); - return false; - } - } - fclose(F); - } - else - if (Deb.ExtractArchive(Extract) == false) - return false; - } - return true; -} - -int main(int argc,char *argv[]) -{ - pkgInitConfig(*_config); - pkgInitSystem(*_config,_system); - _config->Set("Dir::State::status","/tmp/testing/status"); - - Go(argc,argv); - - if (_error->PendingError() == true) - { - _error->DumpErrors(); - return 0; - } -} diff --git a/test/libapt/assert.h b/test/libapt/assert.h index a07be4b57..fdf6740c6 100644 --- a/test/libapt/assert.h +++ b/test/libapt/assert.h @@ -1,6 +1,7 @@ #include <iostream> #define equals(x,y) assertEquals(y, x, __LINE__) +#define equalsNot(x,y) assertEqualsNot(y, x, __LINE__) template < typename X, typename Y > void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) { @@ -14,6 +15,13 @@ void assertEquals(X expect, Y get, unsigned long const &line) { OutputAssertEqual(expect, "==", get, line); } +template < typename X, typename Y > +void assertEqualsNot(X expect, Y get, unsigned long const &line) { + if (expect != get) + return; + OutputAssertEqual(expect, "!=", get, line); +} + void assertEquals(unsigned int const &expect, int const &get, unsigned long const &line) { if (get < 0) OutputAssertEqual(expect, "==", get, line); @@ -80,6 +88,19 @@ void assertEqualsOr3(X expect1, X expect2, X expect3, Y get, unsigned long const OutputAssertEqualOr3(expect1, expect2, expect3, "==", get, line); } +#define equalsOr4(v,w,x,y,z) assertEqualsOr4(w, x, y, z, v, __LINE__) + +template < typename X, typename Y > +void OutputAssertEqualOr4(X expect1, X expect2, X expect3, X expect4, char const* compare, Y get, unsigned long const &line) { + std::cerr << "Test FAILED: »" << expect1 << "« or »" << expect2 << "« or »" << expect3 << "« or »" << expect4 << "« " << compare << " »" << get << "« at line " << line << std::endl; +} + +template < typename X, typename Y > +void assertEqualsOr4(X expect1, X expect2, X expect3, X expect4, Y get, unsigned long const &line) { + if (expect1 == get || expect2 == get || expect3 == get || expect4 == get) + return; + OutputAssertEqualOr4(expect1, expect2, expect3, expect4, "==", get, line); +} // simple helper to quickly output a vectors template < typename X > diff --git a/test/libapt/commandline_test.cc b/test/libapt/commandline_test.cc new file mode 100644 index 000000000..de8a30bd6 --- /dev/null +++ b/test/libapt/commandline_test.cc @@ -0,0 +1,32 @@ +#include <apt-pkg/cmndline.h> + +#include "assert.h" + +int main() +{ + CommandLine::Args Args[] = { + { 't', 0, "Test::Worked", 0 }, + { 'z', "zero", "Test::Zero", 0 }, + {0,0,0,0} + }; + CommandLine CmdL(Args,_config); + + char const * argv[] = { "test", "--zero", "-t" }; + CmdL.Parse(3 , argv); + equals(true, _config->FindB("Test::Worked", false)); + equals(true, _config->FindB("Test::Zero", false)); + + _config->Clear("Test"); + equals(false, _config->FindB("Test::Worked", false)); + equals(false, _config->FindB("Test::Zero", false)); + + _config->Set("Test::Zero", true); + equals(true, _config->FindB("Test::Zero", false)); + + char const * argv2[] = { "test", "--no-zero", "-t" }; + CmdL.Parse(3 , argv2); + equals(true, _config->FindB("Test::Worked", false)); + equals(false, _config->FindB("Test::Zero", false)); + + return 0; +} diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc index 9a3e2c118..87d5699ef 100644 --- a/test/libapt/configuration_test.cc +++ b/test/libapt/configuration_test.cc @@ -80,6 +80,24 @@ int main(int argc,const char *argv[]) { equals(Cnf.FindFile("Dir::State"), "/srv/sid/var/lib/apt"); equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude"); + Cnf.Set("RootDir", "/"); + equals(Cnf.FindFile("Dir::State"), "/srv/sid/var/lib/apt"); + equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude"); + Cnf.Set("RootDir", "//./////.////"); + equals(Cnf.FindFile("Dir::State"), "/srv/sid/var/lib/apt"); + equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude"); + Cnf.Set("RootDir", "/rootdir"); + equals(Cnf.FindFile("Dir::State"), "/rootdir/srv/sid/var/lib/apt"); + equals(Cnf.FindFile("Dir::Aptitude::State"), "/rootdir/srv/sid/var/lib/aptitude"); + Cnf.Set("RootDir", "/rootdir/"); + equals(Cnf.FindFile("Dir::State"), "/rootdir/srv/sid/var/lib/apt"); + equals(Cnf.FindFile("Dir::Aptitude::State"), "/rootdir/srv/sid/var/lib/aptitude"); + + Cnf.Set("Dir::State", "/dev/null"); + Cnf.Set("Dir::State::lists", "lists/"); + equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null"); + equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null"); + //FIXME: Test for configuration file parsing; // currently only integration/ tests test them implicitly diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc index a1c801ea2..cef89bde6 100644 --- a/test/libapt/getlanguages_test.cc +++ b/test/libapt/getlanguages_test.cc @@ -126,18 +126,26 @@ int main(int argc,char *argv[]) _config->Set("Dir::State::lists", argv[1]); vec = APT::Configuration::getLanguages(true, false, env); - equals(vec.size(), 7); + equals(vec.size(), 8); equals(vec[0], "de_DE"); equals(vec[1], "de"); equals(vec[2], "en"); equals(vec[3], "none"); - equalsOr3(vec[4], "pt", "tr", "ast_DE"); - equalsOr3(vec[5], "tr", "pt", "ast_DE"); - equalsOr3(vec[6], "tr", "pt", "ast_DE"); + equalsOr4(vec[4], "pt", "tr", "ast_DE", "tlh_DE"); + equalsOr4(vec[5], "tr", "pt", "ast_DE", "tlh_DE"); + equalsOr4(vec[6], "tr", "pt", "ast_DE", "tlh_DE"); + equalsOr4(vec[7], "tr", "pt", "ast_DE", "tlh_DE"); + equalsNot(vec[4], vec[5]); + equalsNot(vec[4], vec[6]); + equalsNot(vec[4], vec[7]); + equalsNot(vec[5], vec[6]); + equalsNot(vec[5], vec[7]); + equalsNot(vec[6], vec[7]); _config->Set("Acquire::Languages", "none"); vec = APT::Configuration::getLanguages(true, false, env); - equals(vec.size(), 0); + equals(vec.size(), 1); + equals(vec[0], "none"); _config->Set("Acquire::Languages", ""); _config->Set("Dir::State::lists", "/non-existing-dir"); @@ -161,7 +169,8 @@ int main(int argc,char *argv[]) _config->Set("Acquire::Languages", "none"); env[0] = "de_DE.UTF-8"; vec = APT::Configuration::getLanguages(true, false, env); - equals(vec.size(), 0); + equals(vec.size(), 1); + equals(vec[0], "none"); _config->Set("Acquire::Languages", ""); //FIXME: Remove support for this deprecated setting diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc index 396e4cf6b..e2d0aec5b 100644 --- a/test/libapt/hashsums_test.cc +++ b/test/libapt/hashsums_test.cc @@ -42,6 +42,28 @@ template <class T> void TestMill(const char *Out) int main(int argc, char** argv) { + // test HashSumValue which doesn't calculate but just stores sums + { + string md5sum = argv[2]; + MD5SumValue md5(md5sum); + equals(md5.Value(), md5sum); + } + { + string sha1sum = argv[3]; + SHA1SumValue sha1(sha1sum); + equals(sha1.Value(), sha1sum); + } + { + string sha2sum = argv[4]; + SHA256SumValue sha2(sha2sum); + equals(sha2.Value(), sha2sum); + } + { + string sha2sum = argv[5]; + SHA512SumValue sha2(sha2sum); + equals(sha2.Value(), sha2sum); + } + // From FIPS PUB 180-1 Test<SHA1Summation>("","da39a3ee5e6b4b0d3255bfef95601890afd80709"); Test<SHA1Summation>("abc","a9993e364706816aba3e25717850c26c9cd0d89d"); diff --git a/test/libapt/makefile b/test/libapt/makefile index 1952051e2..b2e6db2dd 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -34,6 +34,12 @@ SOURCE = getlistoffilesindir_test.cc include $(PROGRAM_H) # Program for testing CommandLine reconstruction +PROGRAM = Commandline${BASENAME} +SLIBS = -lapt-pkg +SOURCE = commandline_test.cc +include $(PROGRAM_H) + +# Program for testing CommandLine reconstruction PROGRAM = CommandlineAsString${BASENAME} SLIBS = -lapt-pkg SOURCE = commandlineasstring_test.cc diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc index b5d92d9d2..677b1c892 100644 --- a/test/libapt/parsedepends_test.cc +++ b/test/libapt/parsedepends_test.cc @@ -10,7 +10,7 @@ int main(int argc,char *argv[]) { unsigned int Null = 0; bool StripMultiArch = true; bool ParseArchFlags = false; - _config->Set("APT::Architecture","dsk"); + _config->Set("APT::Architecture","amd64"); const char* Depends = "debhelper:any (>= 5.0), " @@ -19,13 +19,13 @@ int main(int argc,char *argv[]) { "libcurl4-gnutls-dev:native | libcurl3-gnutls-dev (>> 7.15.5), " "debiandoc-sgml, " "apt (>= 0.7.25), " - "not-for-me [ !dsk ], " - "only-for-me [ dsk ], " + "not-for-me [ !amd64 ], " + "only-for-me [ amd64 ], " "any-for-me [ any ], " "not-for-darwin [ !darwin-any ], " - "cpu-for-me [ any-dsk ], " + "cpu-for-me [ any-amd64 ], " "os-for-me [ linux-any ], " - "cpu-not-for-me [ any-amd64 ], " + "cpu-not-for-me [ any-armel ], " "os-not-for-me [ kfreebsd-any ], " "overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), " ; diff --git a/test/libapt/run-tests b/test/libapt/run-tests index d4341412d..45a3157f7 100755 --- a/test/libapt/run-tests +++ b/test/libapt/run-tests @@ -65,11 +65,12 @@ do "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-pt" \ "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-se~" \ "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak" \ - "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE" + "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE" \ + "${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 \033[1;35m${name}\033[0m ... " - 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 "\033[1;32mOKAY\033[0m" || echo "\033[1;31mFAILED\033[0m" + 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 elif [ $name = "CompareVersion${EXT}" ]; then tmppath="${DIR}/versions.lst" |