diff options
Diffstat (limited to 'test')
47 files changed, 1293 insertions, 341 deletions
diff --git a/test/Makefile b/test/Makefile index da0a49b0c..b42a90b25 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: $(MAKE) -C libapt $@ $(MAKE) -C interactive-helper $@ diff --git a/test/integration/Packages-bug-64141-install-dependencies-for-on-hold b/test/integration/Packages-bug-64141-install-dependencies-for-on-hold deleted file mode 100644 index 7005fa4f4..000000000 --- a/test/integration/Packages-bug-64141-install-dependencies-for-on-hold +++ /dev/null @@ -1,42 +0,0 @@ -Package: apt -Priority: important -Section: admin -Installed-Size: 6048 -Maintainer: APT Development Team <deity@lists.debian.org> -Architecture: i386 -Version: 0.8.10 -Provides: libapt-pkg4.10 -Depends: libc6 (>= 2.10), libdb4.8 -Breaks: oldcrap -Filename: pool/main/a/apt/apt_0.8.10_i386.deb -Size: 2160758 -MD5sum: 5aa2234f7b91056d430669cddf6e6e50 -Description: Advanced front-end for dpkg - -Package: libc6 -Priority: required -Section: libs -Installed-Size: 9356 -Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org> -Architecture: i386 -Source: eglibc -Version: 2.11.2-7 -Provides: glibc-2.11-1 -Filename: pool/main/e/eglibc/libc6_2.11.2-7_i386.deb -Size: 3880868 -MD5sum: c48fd2854fc62125824267d086600793 -Description: Embedded GNU C Library: Shared libraries - -Package: libdb4.8 -Priority: standard -Section: libs -Installed-Size: 1488 -Maintainer: Clint Adams <clint@gnu.org> -Architecture: i386 -Source: db4.8 -Version: 4.8.30-3 -Depends: libc6 (>= 2.3.6-6~) -Filename: pool/main/d/db4.8/libdb4.8_4.8.30-3_i386.deb -Size: 681988 -MD5sum: 0d58c15898a95436d2ec480aa22693ff -Description: Berkeley v4.8 Database Libraries [runtime] diff --git a/test/integration/Packages-pdiff-usage-new b/test/integration/Packages-pdiff-usage-new index 9157596a7..4f374b37f 100644 --- a/test/integration/Packages-pdiff-usage-new +++ b/test/integration/Packages-pdiff-usage-new @@ -1,16 +1,3 @@ -Package: newstuff -Version: 1.0 -Architecture: i386 -Maintainer: Joe Sixpack <joe@example.org> -Installed-Size: 101 -Filename: pool/newstuff_1.0_i386.deb -Size: 101100 -MD5sum: 311aeeadf78324aaff1ceaf3e1f76671 -SHA1: 3c695e028f7a1ae324deeddaaa1242desa81088c -SHA256: b46fd154615edefab321cc56a5cc0e7deaef23e2da3e4f129727fd660f28f050 -Description: some cool and shiny new stuff - This package will appear in the next mirror update - Package: apt Priority: important Section: admin @@ -35,3 +22,16 @@ Description: Advanced front-end for dpkg . APT features complete installation ordering, multiple source capability and several other unique features, see the Users Guide in apt-doc. + +Package: newstuff +Version: 1.0 +Architecture: i386 +Maintainer: Joe Sixpack <joe@example.org> +Installed-Size: 101 +Filename: pool/newstuff_1.0_i386.deb +Size: 101100 +MD5sum: 311aeeadf78324aaff1ceaf3e1f76671 +SHA1: 3c695e028f7a1ae324deeddaaa1242desa81088c +SHA256: b46fd154615edefab321cc56a5cc0e7deaef23e2da3e4f129727fd660f28f050 +Description: some cool and shiny new stuff + This package will appear in the next mirror update diff --git a/test/integration/framework b/test/integration/framework index a2e71760e..fa4a98f58 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -25,7 +25,15 @@ msgnwarn() { echo -n "${CWARNING}W: $1${CNORMAL}" >&2; } msgnmsg() { echo -n "${CMSG}$1${CNORMAL}" >&2; } msgninfo() { echo -n "${CINFO}I: $1${CNORMAL}" >&2; } msgndebug() { echo -n "${CDEBUG}D: $1${CNORMAL}" >&2; } -msgtest() { echo -n "${CINFO}$1 ${CCMD}$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} …${CNORMAL} " >&2; } +msgtest() { + while [ -n "$1" ]; do + echo -n "${CINFO}$1${CCMD} " >&2; + echo -n "$(echo "$2" | sed -e 's/^aptc/apt-c/' -e 's/^aptg/apt-g/' -e 's/^aptf/apt-f/')${CINFO} " >&2; + shift + if [ -n "$1" ]; then shift; else break; fi + done + echo -n "…${CNORMAL} " >&2; +} msgpass() { echo "${CPASS}PASS${CNORMAL}" >&2; } msgskip() { echo "${CWARNING}SKIP${CNORMAL}" >&2; } msgfail() { echo "${CFAIL}FAIL${CNORMAL}" >&2; } @@ -102,14 +110,14 @@ aptitude() { addtrap() { CURRENTTRAP="$CURRENTTRAP $1" - trap "$CURRENTTRAP" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM + trap "$CURRENTTRAP exit;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM } setupenvironment() { TMPWORKINGDIRECTORY=$(mktemp -d) - local TESTDIR=$(readlink -f $(dirname $0)) + TESTDIRECTORY=$(readlink -f $(dirname $0)) msgninfo "Preparing environment for ${CCMD}$(basename $0)${CINFO} in ${TMPWORKINGDIRECTORY}… " - BUILDDIRECTORY="${TESTDIR}/../../build/bin" + BUILDDIRECTORY="${TESTDIRECTORY}/../../build/bin" test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" local OLDWORKINGDIRECTORY=$(pwd) addtrap "cd /; rm -rf $TMPWORKINGDIRECTORY; cd $OLDWORKINGDIRECTORY;" @@ -119,25 +127,19 @@ setupenvironment() { mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d mkdir -p var/cache var/lib var/log mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers - local STATUSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/') - if [ -f "${TESTDIR}/${STATUSFILE}" ]; then - cp "${TESTDIR}/${STATUSFILE}" var/lib/dpkg/status - else - touch var/lib/dpkg/status - fi touch var/lib/dpkg/available mkdir -p usr/lib/apt ln -s ${BUILDDIRECTORY}/methods usr/lib/apt/methods cd .. local PACKAGESFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Packages-/' -e 's/^skip-/Packages-/') - if [ -f "${TESTDIR}/${PACKAGESFILE}" ]; then - cp "${TESTDIR}/${PACKAGESFILE}" aptarchive/Packages + if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then + cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages fi local SOURCESSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/Sources-/' -e 's/^skip-/Sources-/') - if [ -f "${TESTDIR}/${SOURCESSFILE}" ]; then - cp "${TESTDIR}/${SOURCESSFILE}" aptarchive/Sources + if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then + cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources fi - cp $(find $TESTDIR -name '*.pub' -o -name '*.sec') keys/ + cp $(find $TESTDIRECTORY -name '*.pub' -o -name '*.sec') keys/ ln -s ${TMPWORKINGDIRECTORY}/keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" > aptconfig.conf echo "Dir::state::status \"${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status\";" >> aptconfig.conf @@ -149,6 +151,9 @@ 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 + 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 @@ -156,15 +161,58 @@ setupenvironment() { msgdone "info" } +getarchitecture() { + if [ "$1" = "native" -o -z "$1" ]; then + eval `aptconfig shell ARCH APT::Architecture` + if [ -n "$ARCH" ]; then + echo $ARCH + else + dpkg --print-architecture + fi + else + echo $1 + fi +} + +getarchitectures() { + echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')" +} + configarchitecture() { local CONFFILE=rootdir/etc/apt/apt.conf.d/01multiarch.conf rm -f $CONFFILE - echo "APT::Architecture \"$1\";" > $CONFFILE + echo "APT::Architecture \"$(getarchitecture $1)\";" > $CONFFILE shift while [ -n "$1" ]; do - echo "APT::Architectures:: \"$1\";" >> $CONFFILE + echo "APT::Architectures:: \"$(getarchitecture $1)\";" >> $CONFFILE shift done + configdpkg +} + +configdpkg() { + if [ ! -e rootdir/var/lib/dpkg/status ]; then + local STATUSFILE=$(echo "$(basename $0)" | sed -e 's/^test-/status-/' -e 's/^skip-/status-/') + if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then + cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status + else + echo -n > rootdir/var/lib/dpkg/status + fi + fi + if $(which dpkg) --assert-multi-arch; 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 + 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, + # but just to be sure we choose one above the required version + insertinstalledpackage 'dpkg' "all" '1.16.2+fake' + fi + fi + fi } setupsimplenativepackage() { @@ -275,7 +323,7 @@ Package: $NAME" > ${BUILDDIR}/debian/control echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist done - for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do + for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do rm -rf ${BUILDDIR}/debian/tmp mkdir -p ${BUILDDIR}/debian/tmp/DEBIAN ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} ${BUILDDIR}/debian/tmp/usr/bin cp ${BUILDDIR}/debian/copyright ${BUILDDIR}/debian/changelog ${BUILDDIR}/FEATURES ${BUILDDIR}/debian/tmp/usr/share/doc/${NAME} @@ -298,6 +346,7 @@ buildpackage() { local BUILDDIR=$1 local RELEASE=$2 local SECTION=$3 + local ARCH=$(getarchitecture $4) msgninfo "Build package $(echo "$BUILDDIR" | grep -o '[^/]*$') for ${RELEASE} in ${SECTION}… " cd $BUILDDIR if [ "$ARCH" = "all" ]; then @@ -328,7 +377,7 @@ createaptftparchiveconfig() { 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 - ARCHS="$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')" + ARCHS="$(getarchitectures)" fi echo -n 'Dir { ArchiveDir "' >> ftparchive.conf @@ -408,9 +457,9 @@ insertpackage() { local DEPENDENCIES="$5" local PRIORITY="${6:-optional}" local ARCHS="" - for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do + for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do if [ "$arch" = "all" ]; then - ARCHS="$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')" + ARCHS="$(getarchitectures)" else ARCHS="$arch" fi @@ -464,8 +513,9 @@ insertinstalledpackage() { local VERSION="$3" local DEPENDENCIES="$4" local PRIORITY="${5:-optional}" - local FILE="rootdir/var/lib/dpkg/status" - for arch in $(echo "$ARCH" | sed -e 's#,#\n#g'); do + local FILE='rootdir/var/lib/dpkg/status' + local INFO='rootdir/var/lib/dpkg/info' + for arch in $(echo "$ARCH" | sed -e 's#,#\n#g' | sed -e "s#^native\$#$(getarchitecture 'native')#"); do echo "Package: $NAME Status: install ok installed Priority: $PRIORITY @@ -480,6 +530,11 @@ Version: $VERSION" >> $FILE YOU did something horribly wrong! They are autogenerated und used only by testcases for APT and surf no other propose… " >> $FILE + if [ "$(dpkg-query -W --showformat='${Multi-Arch}')" = 'same' ]; then + echo -n > ${INFO}/${NAME}:${arch}.list + else + echo -n > ${INFO}/${NAME}.list + fi done } @@ -520,9 +575,6 @@ generatereleasefiles() { # both should be given in notation date/touch can understand msgninfo "\tGenerate Release files… " if [ -e aptarchive/dists ]; then - for dir in $(find ./aptarchive/dists -mindepth 3 -maxdepth 3 -type d -name 'i18n'); do - aptftparchive -qq release $dir -o APT::FTPArchive::Release::Patterns::='Translation-*' > $dir/Index - done for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do local SUITE="$(echo "$dir" | cut -d'/' -f 4)" local CODENAME="$(getcodenamefromsuite $SUITE)" @@ -715,8 +767,7 @@ N: Can't select versions from package '$1' as it is purely virtual" N: No packages found" local COMPAREFILE=$(mktemp) addtrap "rm $COMPAREFILE;" - local ARCH=$(dpkg-architecture -qDEB_HOST_ARCH_CPU) - eval `apt-config shell ARCH APT::Architecture` + local ARCH="$(getarchitecture 'native')" echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' > $COMPAREFILE aptcache show -q=0 $PACKAGE 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail } diff --git a/test/integration/skip-avoid-avoiding-breaks-predepends b/test/integration/skip-avoid-avoiding-breaks-predepends new file mode 100755 index 000000000..a47e8bc2b --- /dev/null +++ b/test/integration/skip-avoid-avoiding-breaks-predepends @@ -0,0 +1,21 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'native' + +insertinstalledpackage 'looping' 'native' '1' +insertinstalledpackage 'loop1' 'native' '1' 'Depends: loop2 (= 1)' +insertinstalledpackage 'loop2' 'native' '1' 'Depends: loop1 (= 1)' + +buildsimplenativepackage 'looping' 'native' '1.15.7.2' 'stable' 'Breaks: loop2 (<= 1)' +buildsimplenativepackage 'loop1' 'native' '2' 'stable' 'Depends: loop2 (= 2)' +buildsimplenativepackage 'loop2' 'native' '2' 'stable' 'Depends: loop1 (= 2) +Pre-Depends: looping (>= 1.15)' + +setupaptarchive + +aptget dist-upgrade -y -o Debug::pkgOrderList=1 #-qq 2>&1 > /dev/null +testdpkginstalled looping loop1 loop2 diff --git a/test/integration/status-bug-64141-install-dependencies-for-on-hold b/test/integration/status-bug-64141-install-dependencies-for-on-hold deleted file mode 100644 index c82ebd19c..000000000 --- a/test/integration/status-bug-64141-install-dependencies-for-on-hold +++ /dev/null @@ -1,33 +0,0 @@ -Package: apt -Status: install ok installed -Priority: important -Section: admin -Installed-Size: 6048 -Maintainer: APT Development Team <deity@lists.debian.org> -Architecture: i386 -Version: 0.8.9 -Provides: libapt-pkg4.10 -Depends: libc6 (>= 2.3.4) -Description: Advanced front-end for dpkg - -Package: libc6 -Status: install ok installed -Priority: required -Section: libs -Installed-Size: 9356 -Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org> -Architecture: i386 -Source: eglibc -Version: 2.3.5-7 -Provides: glibc-2.11-1 -Description: Embedded GNU C Library: Shared libraries - -Package: oldcrap -Status: install ok installed -Priority: extra -Section: oldlibs -Installed-Size: 1 -Maintainer: Joe Sixpack <joe@example.org> -Architecture: all -Version: 1-1 -Description: Old crappy nothing package diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download index 7db93c32f..4edb7c173 100755 --- a/test/integration/test-apt-get-download +++ b/test/integration/test-apt-get-download @@ -13,13 +13,12 @@ buildsimplenativepackage 'apt' 'all' '2.0' 'unstable' setupaptarchive testdownload() { - msgtest 'Test download of package file' $1 - if [ -z "$3" ]; then - aptget download ${2} - else - aptget download ${2}/${3} + local APT="$2" + if [ -n "$3" ]; then + APT="${APT}/${3}" fi - test -f $1 && msgpass || msgfail + msgtest "Test download of package file $1 with" "$APT" + aptget -qq download ${APT} && test -f $1 && msgpass || msgfail } testdownload apt_1.0_all.deb apt stable diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed index 78c0801f2..8c434b3ce 100755 --- a/test/integration/test-bug-549968-install-depends-of-not-installed +++ b/test/integration/test-bug-549968-install-depends-of-not-installed @@ -14,13 +14,13 @@ setupaptarchive # We check the Markers here as the autoremove nuker will also # prevent it, but to late - its better to fail earlier -testequal 'Reading package lists... +testequal "Reading package lists... Building dependency tree... MarkInstall coolstuff [ i386 ] < none -> 1.0 > ( other ) FU=1 Ignore MarkInstall of extracoolstuff [ i386 ] < none -> 1.0 > ( other ) as its mode (Keep) is protected -Package extracoolstuff is not installed, so not removed +Package 'extracoolstuff' is not installed, so not removed The following NEW packages will be installed: coolstuff 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Inst coolstuff (1.0 unstable [all]) -Conf coolstuff (1.0 unstable [all])' aptget install coolstuff extracoolstuff- -o Debug::pkgDepCache::Marker=1 -s +Conf coolstuff (1.0 unstable [all])" aptget install coolstuff extracoolstuff- -o Debug::pkgDepCache::Marker=1 -s diff --git a/test/integration/test-bug-590041-prefer-non-virtual-packages b/test/integration/test-bug-590041-prefer-non-virtual-packages index 3e2693f85..e0dd7737f 100755 --- a/test/integration/test-bug-590041-prefer-non-virtual-packages +++ b/test/integration/test-bug-590041-prefer-non-virtual-packages @@ -3,7 +3,7 @@ set -e . $(readlink -f $(dirname $0))/framework setupenvironment -configarchitecture "i386" "armel" +configarchitecture 'i386' 'armel' pkglibc6="Package: libc6 Architecture: armel 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 5c103da6f..bb1ac0e54 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -13,7 +13,7 @@ setupflataptarchive testaptgetupdate() { rm -rf rootdir/var/lib/apt aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true - sed -i -e '/^Fetched / d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff + sed -i -e '/^Fetched / d' -e '/Ign / d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff GIVEN="$1" shift msgtest "Test for correctness of" "apt-get update with $*" @@ -78,7 +78,6 @@ testoverfile() { createemptyfile 'en' testaptgetupdate "Get:1 file: InRelease [] -Ign file: Translation-en Reading package lists..." "empty file en.$COMPRESS over file" createemptyarchive 'en' @@ -89,12 +88,10 @@ Reading package lists..." "empty archive en.$COMPRESS over file" # FIXME: Why omits the file transport the Packages Get line? #Get:3 file: Packages [] testaptgetupdate "Get:1 file: InRelease [] -Ign file: Translation-en Reading package lists..." "empty archive Packages.$COMPRESS over file" createemptyfile 'Packages' testaptgetupdate "Get:1 file: InRelease [] -Ign file: Translation-en Err file: Packages Empty files can't be valid archives W: Failed to fetch ${COMPRESSOR}:$(readlink -f aptarchive/Packages.$COMPRESS) Empty files can't be valid archives @@ -109,7 +106,6 @@ testoverhttp() { testaptgetupdate "Get:1 http://localhost InRelease [] Get:2 http://localhost Packages [] Get:3 http://localhost Translation-en -Ign http://localhost Translation-en Reading package lists..." "empty file en.$COMPRESS over http" createemptyarchive 'en' @@ -121,14 +117,12 @@ Reading package lists..." "empty archive en.$COMPRESS over http" createemptyarchive 'Packages' testaptgetupdate "Get:1 http://localhost InRelease [] Get:2 http://localhost Packages [] -Ign http://localhost Translation-en Reading package lists..." "empty archive Packages.$COMPRESS over http" createemptyfile 'Packages' #FIXME: we should response with a good error message instead testaptgetupdate "Get:1 http://localhost InRelease [] Get:2 http://localhost Packages -Ign http://localhost Translation-en Err http://localhost Packages Empty files can't be valid archives W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:8080_Packages) Empty files can't be valid archives diff --git a/test/integration/test-bug-596498-trusted-unsigned-repo b/test/integration/test-bug-596498-trusted-unsigned-repo new file mode 100755 index 000000000..6ebc4a3bb --- /dev/null +++ b/test/integration/test-bug-596498-trusted-unsigned-repo @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'i386' + +buildsimplenativepackage 'cool' 'i386' '1.0' 'unstable' + +setupaptarchive + +aptgetupdate() { + rm -rf rootdir/var/lib/apt/ rootdir/var/cache/apt/*.bin + aptget update -qq +} + +PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)" +DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.list' + +testequal "$PKGTEXT +Download complete and in download only mode" aptget install cool --assume-no -d + +sed -i -e 's#deb#deb [trusted=no]#' $DEBFILE +aptgetupdate + +testequal "$PKGTEXT +WARNING: The following packages cannot be authenticated! + cool +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 +sed -i -e 's#deb \[trusted=no\]#deb#' $DEBFILE +aptgetupdate + +testequal "$PKGTEXT +WARNING: The following packages cannot be authenticated! + cool +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 +aptgetupdate + +testequal "$PKGTEXT +Download complete and in download only mode" aptget install cool --assume-no -d diff --git a/test/integration/test-bug-601016-description-translation b/test/integration/test-bug-601016-description-translation index 44ab91900..03fddbfda 100755 --- a/test/integration/test-bug-601016-description-translation +++ b/test/integration/test-bug-601016-description-translation @@ -4,7 +4,7 @@ set -e TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'i386' 'amd64' # we need a valid locale here, otherwise the language configuration # will be overridden by LC_ALL=C @@ -22,8 +22,22 @@ Size: 2140230 MD5sum: 74769bfbcef9ebc4fa74f7a5271b9c08 Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c" +PACKAGESTANZA2='Package: apt +Priority: important +Section: admin +Installed-Size: 5984 +Maintainer: APT Development Team <deity@lists.debian.org> +Architecture: amd64 +Version: 0.8.7 +Filename: pool/main/a/apt/apt_0.8.7_amd64.deb +Size: 2210342 +MD5sum: 4a869bfbdef9ebc9fa74f7a5271e8d1a +Description-md5: d41ee493aa9fcc6cbc9ce4eb7069959c' echo "$PACKAGESTANZA +Description: Advanced front-end for dpkg + +$PACKAGESTANZA2 Description: Advanced front-end for dpkg" > aptarchive/Packages echo "Package: apt @@ -53,6 +67,13 @@ Description-${LOCALE}: Mächtige Oberfläche für dpkg APT-Dselect-Methode. Beides sind einfache und sicherere Wege, um Pakete zu installieren und Upgrades durchzuführen. " +LOCALESTANZA2="$PACKAGESTANZA2 +Description-${LOCALE}: Mächtige Oberfläche für dpkg + Das Paket bietet dem Nutzer technisch führende Methoden für den Zugriff + auf den dpkg-Paketmanager. Es beinhaltet das apt-get-Werkzeug und die + APT-Dselect-Methode. Beides sind einfache und sicherere Wege, + um Pakete zu installieren und Upgrades durchzuführen. +" testrun() { echo "Acquire::Languages { \"${LOCALE}\"; \"en\"; };" > rootdir/etc/apt/apt.conf.d/00languages @@ -60,6 +81,8 @@ testrun() { rm -rf rootdir/var/lib/apt/lists setupaptarchive testequal "$LOCALESTANZA" aptcache show apt -o Test=File-${LOCALE} + testequal "$LOCALESTANZA" aptcache show apt:i386 -o Test=File-${LOCALE} + testequal "$LOCALESTANZA2" aptcache show apt:amd64 -o Test=File-${LOCALE} testequal "$NOLONGSTANZA" aptcache show apt -o Acquire::Languages="ww" -o Test=File-${LOCALE} testequal "$LOCALESTANZA" aptcache show apt -o Acquire::Languages::="ww" -o Test=File-${LOCALE} LC_ALL=C testequal "$ENGLISHSTANZA" aptcache show apt -o Test=File-${LOCALE} @@ -73,6 +96,9 @@ testrun() { testrun echo "$PACKAGESTANZA +Description: Advanced front-end for dpkg + +$PACKAGESTANZA2 Description: Advanced front-end for dpkg" > aptarchive/Packages echo "Package: apt @@ -88,5 +114,11 @@ Description-en: Advanced front-end for dpkg It provides the apt-get utility and APT dselect method that provides a simpler, safer way to install and upgrade packages. " +ENGLISHSTANZA2="$PACKAGESTANZA2 +Description-en: Advanced front-end for dpkg + This is Debian's next generation front-end for the dpkg package manager. + It provides the apt-get utility and APT dselect method that provides a + simpler, safer way to install and upgrade packages. +" testrun diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts index b8cfe59e2..530012e5d 100755 --- a/test/integration/test-bug-612099-multiarch-conflicts +++ b/test/integration/test-bug-612099-multiarch-conflicts @@ -4,9 +4,7 @@ set -e TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" "amd64" - -buildsimplenativepackage 'peace-dpkg' 'all' '1.0' 'stable' +configarchitecture 'i386' 'amd64' buildsimplenativepackage 'libc6' 'i386' '1.0' 'stable' buildsimplenativepackage 'libc6' 'amd64' '1.0' 'stable' @@ -17,11 +15,8 @@ buildsimplenativepackage 'foobar' 'amd64' '1.0' 'stable' 'Depends: libc6' setupaptarchive -aptget install peace-dpkg:i386 -y -qq 2>&1 > /dev/null -testdpkginstalled peace-dpkg - aptget install libc6:i386 -t stable -y -qq 2>&1 > /dev/null -testdpkginstalled libc6 +testdpkginstalled libc6:i386 testequal 'Reading package lists... Building dependency tree... Reading state information... @@ -80,8 +75,13 @@ The following packages will be upgraded: 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Inst libc6 [1.0] (2.0 testing [all]) Conf libc6 (2.0 testing [all])' aptget upgrade -t testing -s -aptget upgrade -y -qq 2>&1 > /dev/null -testdpkginstalled libc6 +# 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 +testdpkginstalled libc6:all testequal 'Reading package lists... Building dependency tree... @@ -130,7 +130,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 -testdpkginstalled libc6-same +testdpkginstalled libc6-same:i386 testequal 'Reading package lists... Building dependency tree... @@ -173,8 +173,14 @@ The following packages will be upgraded: 1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Inst libc6-same [1.0] (2.0 testing [all]) Conf libc6-same (2.0 testing [all])' aptget upgrade -t testing -s -aptget upgrade -y -qq 2>&1 > /dev/null -testdpkginstalled libc6-same +# 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 +testdpkginstalled libc6-same:all + testequal "Reading package lists... Building dependency tree... diff --git a/test/integration/test-bug-612958-use-dpkg-multiarch-config b/test/integration/test-bug-612958-use-dpkg-multiarch-config index 4f31c3953..18b964636 100755 --- a/test/integration/test-bug-612958-use-dpkg-multiarch-config +++ b/test/integration/test-bug-612958-use-dpkg-multiarch-config @@ -56,4 +56,22 @@ testfail 'dpkg config' 'armel' echo '#! /bin/sh echo "amd64 armel"' > ./dpkg-printer +testpass 'dpkg config' 'i386' +testpass 'dpkg config' 'amd64' +testpass 'dpkg config' 'armel' + +echo '#! /bin/sh +echo "amd64 +armel"' > ./dpkg-printer + +testpass 'dpkg config' 'i386' +testpass 'dpkg config' 'amd64' testpass 'dpkg config' 'armel' + +echo '#! /bin/sh +echo "amd64 +i386"' > ./dpkg-printer + +testpass 'dpkg config' 'i386' +testpass 'dpkg config' 'amd64' +testfail 'dpkg config' 'armel' diff --git a/test/integration/test-bug-618288-multiarch-same-lockstep b/test/integration/test-bug-618288-multiarch-same-lockstep index a05f03df4..fde075172 100755 --- a/test/integration/test-bug-618288-multiarch-same-lockstep +++ b/test/integration/test-bug-618288-multiarch-same-lockstep @@ -16,17 +16,22 @@ 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 -testequal 'Reading package lists... -Building dependency tree... -The following packages will be upgraded: - apt:i386 apt2 libsame libsame:i386 -4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. -Inst libsame:i386 [1] (2 unstable [i386]) [libsame:amd64 on libsame:i386] [libsame:i386 on libsame:amd64] [libsame:amd64 apt:i386 ] -Inst libsame [1] (2 unstable [amd64]) [apt2:amd64 apt:i386 ] -Conf libsame:i386 (2 unstable [i386]) [apt2:amd64 apt:i386 ] -Conf libsame (2 unstable [amd64]) [apt2:amd64 apt:i386 ] -Inst apt2 [1] (2 unstable [amd64]) [apt:i386 ] -Conf apt2 (2 unstable [amd64]) [apt:i386 ] -Inst apt:i386 [1] (2 unstable [i386]) -Conf apt:i386 (2 unstable [i386])' aptget dist-upgrade -s +# 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)" +LS_U_INT="$(grep -o -n '^Inst libsame:i386 ' output.apt | cut -d: -f1)" +LS_C_AMD="$(grep -o -n '^Conf libsame ' output.apt | cut -d: -f1)" +LS_C_INT="$(grep -o -n '^Conf libsame:i386 ' output.apt | cut -d: -f1)" + +msgtest 'Test if libsame:amd64 unpack before configure' +test "$LS_U_AMD" -lt "$LS_C_AMD" && msgpass || msgfail + +msgtest 'Test if libsame:i386 unpack before configure' +test "$LS_U_INT" -lt "$LS_C_INT" && msgpass || msgfail + +msgtest 'Test if libsame:amd64 unpack is before libsame:i386 configure' +test "$LS_U_AMD" -lt "$LS_C_INT" && msgpass || msgfail + +msgtest 'Test if libsame:i386 unpack is before libsame:amd64 configure' +test "$LS_U_INT" -lt "$LS_C_AMD" && msgpass || msgfail diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling index a1e708d2e..d146b943c 100755 --- a/test/integration/test-bug-624218-Translation-file-handling +++ b/test/integration/test-bug-624218-Translation-file-handling @@ -42,16 +42,9 @@ 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 -sed -i '/i18n\/Index$/ d' $(find aptarchive -name 'Release') +sed -i '/i18n\/Translation-.*$/ d' $(find aptarchive -name 'Release') signreleasefiles -# we have to try as not every archive includes the i18n Index in the Release file - if it has one at all -msgtest 'Download no Translation- if forced language is non-existent' 'with not-announced Index' -aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass -rm -rf rootdir/var/lib/apt/lists - -find aptarchive -name 'Index' -delete - msgtest 'Download of en as forced language' 'without Index' aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail rm -rf rootdir/var/lib/apt/lists diff --git a/test/integration/test-bug-632221-cross-dependency-satisfaction b/test/integration/test-bug-632221-cross-dependency-satisfaction index 4299f052f..30df48604 100755 --- a/test/integration/test-bug-632221-cross-dependency-satisfaction +++ b/test/integration/test-bug-632221-cross-dependency-satisfaction @@ -6,43 +6,51 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture 'amd64' 'armel' -insertinstalledpackage 'build-essential' 'all' '11.5' +insertinstalledpackage 'build-essential' 'all' '11.5' 'Multi-Arch: foreign' -insertpackage 'unstable' 'doxygen' 'amd64,armel' '1.0' +insertpackage 'unstable' 'doxygen' 'amd64,armel' '1.0' 'Multi-Arch: foreign' insertpackage 'unstable' 'libc6' 'amd64,armel' '1.0' 'Multi-Arch: same' insertpackage 'unstable' 'libc6-dev' 'amd64,armel' '1.0' 'Depends: libc6 Multi-Arch: same' +insertpackage 'unstable' 'libfwibble1' 'amd64,armel' '1.0' 'Depends: libc6 +Multi-Arch: same' +insertpackage 'unstable' 'libfwibble-dev' 'amd64,armel' '1.0' 'Depends: libfwibble1' 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' -insertsource 'unstable' 'apt' 'any' '0.8.15' 'Build-Depends: doxygen, libc6-dev, libc6-dev:native, cool:any, amdboot:amd64, foreigner' +insertsource 'unstable' 'apt' 'any' '0.8.15' 'Build-Depends: doxygen, libc6-dev, libc6-dev:native, cool:any, amdboot:amd64, foreigner, libfwibble-dev' setupaptarchive testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: - amdboot cool doxygen foreigner libc6 libc6-dev -0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded. + amdboot cool doxygen foreigner libc6 libc6-dev libfwibble-dev libfwibble1 +0 upgraded, 8 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]) Inst foreigner (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]) Conf amdboot (1.0 unstable [amd64]) Conf cool (1.0 unstable [amd64]) Conf doxygen (1.0 unstable [amd64]) Conf foreigner (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [amd64]) -Conf libc6-dev (1.0 unstable [amd64])' aptget build-dep apt -s +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 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 -0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded. + libfwibble-dev:armel libfwibble1:armel +0 upgraded, 10 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]) @@ -51,6 +59,8 @@ Inst libc6 (1.0 unstable [amd64]) Inst libc6:armel (1.0 unstable [armel]) Inst libc6-dev (1.0 unstable [amd64]) 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 cool (1.0 unstable [amd64]) Conf doxygen (1.0 unstable [amd64]) @@ -58,34 +68,41 @@ Conf foreigner (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [amd64]) Conf libc6:armel (1.0 unstable [armel]) Conf libc6-dev (1.0 unstable [amd64]) -Conf libc6-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a armel +Conf libc6-dev:armel (1.0 unstable [armel]) +Conf libfwibble1:armel (1.0 unstable [armel]) +Conf libfwibble-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a armel 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 -0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded. + amdboot:amd64 cool doxygen foreigner libc6 libc6-dev libfwibble-dev + libfwibble1 +0 upgraded, 8 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]) Inst foreigner (1.0 unstable [armel]) Inst libc6 (1.0 unstable [armel]) 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 cool (1.0 unstable [armel]) Conf doxygen (1.0 unstable [armel]) Conf foreigner (1.0 unstable [armel]) Conf libc6 (1.0 unstable [armel]) -Conf libc6-dev (1.0 unstable [armel])' aptget build-dep apt -s +Conf libc6-dev (1.0 unstable [armel]) +Conf libfwibble1 (1.0 unstable [armel]) +Conf libfwibble-dev (1.0 unstable [armel])' aptget build-dep apt -s 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 -0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded. + libc6-dev libfwibble-dev:amd64 libfwibble1:amd64 +0 upgraded, 10 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]) @@ -94,6 +111,8 @@ Inst libc6:amd64 (1.0 unstable [amd64]) Inst libc6 (1.0 unstable [armel]) 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]) Conf amdboot:amd64 (1.0 unstable [amd64]) Conf cool (1.0 unstable [armel]) Conf doxygen (1.0 unstable [armel]) @@ -101,7 +120,9 @@ Conf foreigner (1.0 unstable [armel]) Conf libc6:amd64 (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [armel]) Conf libc6-dev:amd64 (1.0 unstable [amd64]) -Conf libc6-dev (1.0 unstable [armel])' aptget build-dep apt -s -a 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 configarchitecture 'amd64' 'armel' @@ -111,34 +132,43 @@ insertinstalledpackage 'foreigner' 'armel' '0.5' testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: - amdboot doxygen libc6 libc6-dev -0 upgraded, 4 newly installed, 0 to remove and 2 not upgraded. + amdboot doxygen libc6 libc6-dev libfwibble-dev libfwibble1 +0 upgraded, 6 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]) 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])' aptget build-dep apt -s +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 testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: amdboot doxygen libc6 libc6:armel libc6-dev libc6-dev:armel -0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded. + libfwibble-dev:armel libfwibble1:armel +0 upgraded, 8 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:armel (1.0 unstable [armel]) Inst libc6-dev (1.0 unstable [amd64]) 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 doxygen (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [amd64]) Conf libc6:armel (1.0 unstable [armel]) Conf libc6-dev (1.0 unstable [amd64]) -Conf libc6-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a armel +Conf libc6-dev:armel (1.0 unstable [armel]) +Conf libfwibble1:armel (1.0 unstable [armel]) +Conf libfwibble-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a armel configarchitecture 'armel' 'amd64' @@ -148,36 +178,45 @@ 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 -0 upgraded, 5 newly installed, 1 to remove and 1 not upgraded. + amdboot:amd64 cool doxygen libc6 libc6-dev libfwibble-dev libfwibble1 +0 upgraded, 7 newly installed, 1 to remove and 1 not upgraded. Remv cool:amd64 [0.5] Inst amdboot:amd64 (1.0 unstable [amd64]) Inst cool (1.0 unstable [armel]) Inst doxygen (1.0 unstable [armel]) Inst libc6 (1.0 unstable [armel]) 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 cool (1.0 unstable [armel]) Conf doxygen (1.0 unstable [armel]) Conf libc6 (1.0 unstable [armel]) -Conf libc6-dev (1.0 unstable [armel])' aptget build-dep apt -s +Conf libc6-dev (1.0 unstable [armel]) +Conf libfwibble1 (1.0 unstable [armel]) +Conf libfwibble-dev (1.0 unstable [armel])' aptget build-dep apt -s 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 -0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded. + libfwibble-dev:amd64 libfwibble1:amd64 +0 upgraded, 8 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]) Inst libc6 (1.0 unstable [armel]) 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]) Conf amdboot:amd64 (1.0 unstable [amd64]) Conf doxygen (1.0 unstable [armel]) Conf libc6:amd64 (1.0 unstable [amd64]) Conf libc6 (1.0 unstable [armel]) Conf libc6-dev:amd64 (1.0 unstable [amd64]) -Conf libc6-dev (1.0 unstable [armel])' aptget build-dep apt -s -a 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 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 4633ffcc3..e2d206fdd 100755 --- a/test/integration/test-bug-64141-install-dependencies-for-on-hold +++ b/test/integration/test-bug-64141-install-dependencies-for-on-hold @@ -4,7 +4,19 @@ set -e TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'native' 'strange-arch' + +insertpackage 'unstable' 'unrelated' 'strange-arch' '1' + +insertinstalledpackage 'apt' 'native' '0.8.9' 'Depends: libc6 (>= 2.3.4)' +insertinstalledpackage 'libc6' 'native' '2.4.1-1' +insertinstalledpackage 'oldcrap' 'all' '1-1' + +insertpackage 'unstable' 'apt' 'native' '0.8.10' 'Depends: libc6 (>= 2.10), libdb4.8 +Breaks: oldcrap' +insertpackage 'unstable' 'libc6' 'native' '2.11.2-7' +insertpackage 'unstable' 'libdb4.8' 'native' '4.8.30-3' + setupaptarchive testequal 'Reading package lists... @@ -16,11 +28,10 @@ The following NEW packages will be installed: The following packages will be upgraded: apt libc6 2 upgraded, 1 newly installed, 1 to remove and 0 not upgraded. -Need to get 0 B/6724 kB of archives. -After this operation, 1523 kB of additional disk space will be used. +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 -echo 'apt hold' | dpkg --set-selections +aptmark hold apt -qq testequal 'Reading package lists... Building dependency tree... @@ -29,6 +40,5 @@ The following packages have been kept back: The following packages will be upgraded: libc6 1 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. -Need to get 0 B/3881 kB of archives. 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 -o Test='hold-back-apt' diff --git a/test/integration/test-bug-657695-resolver-breaks-on-virtuals b/test/integration/test-bug-657695-resolver-breaks-on-virtuals new file mode 100755 index 000000000..e9b27cfcd --- /dev/null +++ b/test/integration/test-bug-657695-resolver-breaks-on-virtuals @@ -0,0 +1,51 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' + +insertinstalledpackage 'xserver-xorg-core' 'amd64' '2:1.7.6-2ubuntu7.10' +for i in $(seq 1 50); do + insertinstalledpackage "xserver-xorg-video-driver$i" 'amd64' '1.0' 'Provides: xserver-xorg-video-6' +done + +insertpackage 'unstable' 'xserver-xorg-core' 'amd64' '2:1.11.3-0ubuntu9' 'Breaks: xserver-xorg-video-6' + + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + xserver-xorg-video-driver1 xserver-xorg-video-driver10 + xserver-xorg-video-driver11 xserver-xorg-video-driver12 + xserver-xorg-video-driver13 xserver-xorg-video-driver14 + xserver-xorg-video-driver15 xserver-xorg-video-driver16 + xserver-xorg-video-driver17 xserver-xorg-video-driver18 + xserver-xorg-video-driver19 xserver-xorg-video-driver2 + xserver-xorg-video-driver20 xserver-xorg-video-driver21 + xserver-xorg-video-driver22 xserver-xorg-video-driver23 + xserver-xorg-video-driver24 xserver-xorg-video-driver25 + xserver-xorg-video-driver26 xserver-xorg-video-driver27 + xserver-xorg-video-driver28 xserver-xorg-video-driver29 + xserver-xorg-video-driver3 xserver-xorg-video-driver30 + xserver-xorg-video-driver31 xserver-xorg-video-driver32 + xserver-xorg-video-driver33 xserver-xorg-video-driver34 + xserver-xorg-video-driver35 xserver-xorg-video-driver36 + xserver-xorg-video-driver37 xserver-xorg-video-driver38 + xserver-xorg-video-driver39 xserver-xorg-video-driver4 + xserver-xorg-video-driver40 xserver-xorg-video-driver41 + xserver-xorg-video-driver42 xserver-xorg-video-driver43 + xserver-xorg-video-driver44 xserver-xorg-video-driver45 + xserver-xorg-video-driver46 xserver-xorg-video-driver47 + xserver-xorg-video-driver48 xserver-xorg-video-driver49 + xserver-xorg-video-driver5 xserver-xorg-video-driver50 + xserver-xorg-video-driver6 xserver-xorg-video-driver7 + xserver-xorg-video-driver8 xserver-xorg-video-driver9 +The following packages will be upgraded: + xserver-xorg-core +1 upgraded, 0 newly installed, 50 to remove and 0 not upgraded. +After this operation, 2150 kB disk space will be freed. +E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop new file mode 100755 index 000000000..4407fbd9d --- /dev/null +++ b/test/integration/test-conflicts-loop @@ -0,0 +1,36 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +insertinstalledpackage 'openjdk-6-jre' 'i386' '6b16-1.8-0ubuntu1' +insertpackage 'unstable' 'openjdk-6-jre' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre-headless (<< 6b17~pre3-1), openjdk-6-jre-lib (<< 6b17~pre3-1)' +insertinstalledpackage 'openjdk-6-jre-lib' 'i386' '6b16-1.8-0ubuntu1' +insertpackage 'unstable' 'openjdk-6-jre-lib' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre (<< 6b17~pre3-1), openjdk-6-jre-headless (<< 6b17~pre3-1)' +insertinstalledpackage 'openjdk-6-jre-headless' 'i386' '6b16-1.8-0ubuntu1' +insertpackage 'unstable' 'openjdk-6-jre-headless' 'i386' '6b20-1.9.8-0ubuntu1~10.04.1' 'Conflicts: openjdk-6-jre (<< 6b17~pre3-1), openjdk-6-jre-lib (<< 6b17~pre3-1)' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following packages will be upgraded: + openjdk-6-jre openjdk-6-jre-headless openjdk-6-jre-lib + openjdk-6-jre-lib:i386 conflicts with openjdk-6-jre:i386 + openjdk-6-jre:i386 conflicts with openjdk-6-jre-headless:i386 + openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre:i386 +3 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. +Remv openjdk-6-jre [6b16-1.8-0ubuntu1] + openjdk-6-jre-headless:i386 conflicts with openjdk-6-jre-lib:i386 +Remv openjdk-6-jre-lib [6b16-1.8-0ubuntu1] +Inst openjdk-6-jre-headless [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) + openjdk-6-jre:i386 conflicts with openjdk-6-jre-lib:i386 + openjdk-6-jre:i386 conflicts with openjdk-6-jre-lib:i386 +Inst openjdk-6-jre [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) +Inst openjdk-6-jre-lib [6b16-1.8-0ubuntu1] (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) +Conf openjdk-6-jre-lib (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) +Conf openjdk-6-jre (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386]) +Conf openjdk-6-jre-headless (6b20-1.9.8-0ubuntu1~10.04.1 unstable [i386])' aptget dist-upgrade -s -o APT::Immediate-Configure-All=true diff --git a/test/integration/test-disappearing-packages b/test/integration/test-disappearing-packages index 82ba9e592..0e0e9618d 100755 --- a/test/integration/test-disappearing-packages +++ b/test/integration/test-disappearing-packages @@ -4,12 +4,12 @@ set -e TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'native' -buildsimplenativepackage "old-pkg" "i386" "1.0" "stable" +buildsimplenativepackage "old-pkg" "native" "1.0" "stable" buildsimplenativepackage "unrelated" "all" "0.5" "unstable" -setupsimplenativepackage "new-pkg" "i386" "2.0" "unstable" "Provides: old-pkg +setupsimplenativepackage "new-pkg" "native" "2.0" "unstable" "Provides: old-pkg Replaces: old-pkg Conflicts: old-pkg (<< 2.0)" BUILDDIR="incoming/new-pkg-2.0" @@ -43,12 +43,12 @@ Note: This is done automatic and on purpose by dpkg." > $COMPAREFILE $CMD 2>&1 | tail -n 4 | diff $COMPAREFILE - && msgpass || msgfail rm $COMPAREFILE -sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' +sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e "s#:$(getarchitecture 'native') #:native #" testfileequal "rootdir/var/log/apt/history.log" " -Install: old-pkg:i386 (1.0) +Install: old-pkg:native (1.0) -Install: new-pkg:i386 (2.0, automatic) -Upgrade: old-pkg:i386 (1.0, 2.0) +Install: new-pkg:native (2.0, automatic) +Upgrade: old-pkg:native (1.0, 2.0) Disappeared: old-pkg (1.0)" testmarkedauto # new-pkg should have get the manual flag from old-pkg diff --git a/test/integration/test-dpkg-assert-multi-arch b/test/integration/test-dpkg-assert-multi-arch new file mode 100755 index 000000000..177d7489b --- /dev/null +++ b/test/integration/test-dpkg-assert-multi-arch @@ -0,0 +1,97 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +buildsimplenativepackage 'native-pkg' 'amd64' '1.0' 'stable' +buildsimplenativepackage 'foreign-pkg' 'i386' '0.5' 'stable' 'Multi-Arch: foreign' +buildsimplenativepackage 'same-lib' 'amd64,i386' '0.5' 'stable' 'Multi-Arch: same' +buildsimplenativepackage 'all-pkg' 'all' '2.0' 'stable' +buildsimplenativepackage 'all-foreign-pkg' 'all' '2.0' 'stable' 'Multi-Arch: foreign' + +setupaptarchive + +testqualifier() { + msgtest 'Test with' $1 'for correct qualifier mode' $2 + GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -v -- '--unpack' | sed -e 's/^.*--[^u][^ ]* \([^ ]*\).*$/\1/')" + if [ "$GIVEN" = "$2" ]; then + msgpass + else + echo + echo "$GIVEN" + msgfail + fi +} + +# non-multiarch or "ubuntus" old multiarchified dpkg +echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper +echo '#! /bin/sh +if echo "$*" | grep -q -- "--assert-multi-arch"; then + echo >&2 'dpkg: Fehler: unbekannte Option --assert-multi-arch' + echo >&1 'dpkg: Info: unbekannte Option --assert-multi-arch' + return 2; +fi +return $*' > ./dpkg-wrapper +chmod +x ./dpkg-wrapper + +testqualifier 'native-pkg' 'native-pkg' +testqualifier 'native-pkg:amd64' 'native-pkg' +testqualifier 'foreign-pkg' 'foreign-pkg:i386' +testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386' +testqualifier 'same-lib' 'same-lib' +testqualifier 'same-lib:amd64' 'same-lib' +testqualifier 'same-lib:i386' 'same-lib:i386' +testqualifier 'all-pkg' 'all-pkg' +testqualifier 'all-pkg:amd64' 'all-pkg' +testqualifier 'all-foreign-pkg' 'all-foreign-pkg' +testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg' +insertinstalledpackage 'all-pkg' 'amd64' '1.0' +insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign' +testqualifier 'all-pkg' 'all-pkg' +testqualifier 'all-pkg:amd64' 'all-pkg' +testqualifier 'all-foreign-pkg' 'all-foreign-pkg' +testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg' +insertinstalledpackage 'always-all-pkg' 'all' '1.0' +insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign' +testqualifier 'all-pkg-' 'all-pkg' +testqualifier 'all-foreign-pkg-' 'all-foreign-pkg' +testqualifier 'always-all-pkg-' 'always-all-pkg' +testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg' + +# multiarch dpkg (new interface version) + +rm rootdir/var/lib/dpkg/status +touch rootdir/var/lib/dpkg/status +echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper +echo '#! /bin/sh +if echo "$*" | grep -q -- "--assert-multi-arch"; then + return 0; +fi +return $*' > ./dpkg-wrapper + +testqualifier 'native-pkg' 'native-pkg:amd64' +testqualifier 'native-pkg:amd64' 'native-pkg:amd64' +testqualifier 'foreign-pkg' 'foreign-pkg:i386' +testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386' +testqualifier 'same-lib' 'same-lib:amd64' +testqualifier 'same-lib:amd64' 'same-lib:amd64' +testqualifier 'same-lib:i386' 'same-lib:i386' +testqualifier 'all-pkg' 'all-pkg:all' +testqualifier 'all-pkg:amd64' 'all-pkg:all' +testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all' +testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all' +insertinstalledpackage 'all-pkg' 'amd64' '1.0' +insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign' +testqualifier 'all-pkg' 'all-pkg:all' +testqualifier 'all-pkg:amd64' 'all-pkg:all' +testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all' +testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all' +insertinstalledpackage 'always-all-pkg' 'all' '1.0' +insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign' +testqualifier 'all-pkg-' 'all-pkg:amd64' +testqualifier 'all-foreign-pkg-' 'all-foreign-pkg:amd64' +testqualifier 'always-all-pkg-' 'always-all-pkg:all' +testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg:all' diff --git a/test/integration/test-handling-broken-orgroups b/test/integration/test-handling-broken-orgroups index d88ad0000..20b314074 100755 --- a/test/integration/test-handling-broken-orgroups +++ b/test/integration/test-handling-broken-orgroups @@ -58,7 +58,7 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: coolstuff-broken : Depends: cool2 but it is not installable or stuff2 but it is not installable -E: Broken packages' aptget install coolstuff-broken -s +E: Unable to correct problems, you have held broken packages.' aptget install coolstuff-broken -s testequal 'Reading package lists... Building dependency tree... @@ -105,4 +105,4 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: coolstuff-provided-broken : Depends: cool2 but it is not installable or stuff-abi-2 -E: Broken packages' aptget install coolstuff-provided-broken -s +E: Unable to correct problems, you have held broken packages.' aptget install coolstuff-provided-broken -s diff --git a/test/integration/test-implicit-conflicts-real-not-virtual b/test/integration/test-implicit-conflicts-real-not-virtual new file mode 100755 index 000000000..c9fca4edf --- /dev/null +++ b/test/integration/test-implicit-conflicts-real-not-virtual @@ -0,0 +1,56 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertpackage 'unstable-mp' 'crda' 'i386,amd64' '1.1.1-1ubuntu4mp' 'Provides: wireless-crda +Multi-Arch: foreign' +insertpackage 'unstable-m' 'crda' 'i386,amd64' '1.1.1-1ubuntu4m' 'Multi-Arch: foreign' +insertpackage 'unstable-p' 'crda' 'i386,amd64' '1.1.1-1ubuntu4p' 'Provides: wireless-crda' +insertpackage 'unstable' 'wireless-crda' 'i386,amd64' '1.16' + + +insertinstalledpackage 'wireless-crda' 'amd64' '1.14' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + crda +0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst crda (1.1.1-1ubuntu4m unstable-m [amd64]) +Conf crda (1.1.1-1ubuntu4m unstable-m [amd64])' aptget install crda -s -t unstable-m + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + crda +0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst crda (1.1.1-1ubuntu4p unstable-p [amd64]) +Conf crda (1.1.1-1ubuntu4p unstable-p [amd64])' aptget install crda -s -t unstable-p + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + crda +0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst crda (1.1.1-1ubuntu4mp unstable-mp [amd64]) +Conf crda (1.1.1-1ubuntu4mp unstable-mp [amd64])' aptget install crda -s -t unstable-mp + +rm rootdir/var/lib/dpkg/status +insertinstalledpackage 'crda' 'amd64' '1.1.1-1ubuntu4mp' 'Provides: wireless-crda +Conflicts: wireless-crda (<< 1.15) +Replaces: wireless-crda ( << 1.15) +Multi-arch: foreign' + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + wireless-crda +0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst wireless-crda (1.16 unstable [amd64]) +Conf wireless-crda (1.16 unstable [amd64])' aptget install wireless-crda -s -t unstable diff --git a/test/integration/test-multiarch-foreign b/test/integration/test-multiarch-foreign new file mode 100755 index 000000000..332466d96 --- /dev/null +++ b/test/integration/test-multiarch-foreign @@ -0,0 +1,150 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' 'armel' + +insertpackage 'unstable' 'cool-foo' 'amd64,i386' '1.0' 'Depends: foo' +insertpackage 'unstable' 'foo' 'amd64,i386,armel' '1.0' 'Multi-Arch: foreign' + +insertpackage 'unstable' 'cool-bar' 'amd64,i386' '1.0' 'Depends: bar-provider' +insertpackage 'unstable' 'bar' 'amd64,i386,armel' '1.0' 'Provides: bar-provider +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: + cool-foo:i386 foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [amd64]) +Inst cool-foo:i386 (1.0 unstable [i386]) +Conf foo (1.0 unstable [amd64]) +Conf cool-foo:i386 (1.0 unstable [i386])' aptget install cool-foo:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + foo +The following NEW packages will be installed: + cool-foo foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [amd64]) +Inst cool-foo (1.0 unstable [amd64]) +Conf foo (1.0 unstable [amd64]) +Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + cool-foo foo +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo (1.0 unstable [amd64]) +Inst cool-foo (1.0 unstable [amd64]) +Conf foo (1.0 unstable [amd64]) +Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + cool-foo foo:i386 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo:i386 (1.0 unstable [i386]) +Inst cool-foo (1.0 unstable [amd64]) +Conf foo:i386 (1.0 unstable [i386]) +Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + cool-foo foo:armel +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst foo:armel (1.0 unstable [armel]) +Inst cool-foo (1.0 unstable [amd64]) +Conf foo:armel (1.0 unstable [armel]) +Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo:amd64 foo:armel -s + + + + + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + bar +The following NEW packages will be installed: + bar cool-bar:i386 +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [amd64]) +Inst cool-bar:i386 (1.0 unstable [i386]) +Conf bar (1.0 unstable [amd64]) +Conf cool-bar:i386 (1.0 unstable [i386])' aptget install cool-bar:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following extra packages will be installed: + bar +The following NEW packages will be installed: + bar cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [amd64]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar (1.0 unstable [amd64]) +Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [amd64]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar (1.0 unstable [amd64]) +Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:amd64 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar:i386 cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar:i386 (1.0 unstable [i386]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar:i386 (1.0 unstable [i386]) +Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:i386 -s + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + bar:armel cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar:armel (1.0 unstable [armel]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar:armel (1.0 unstable [armel]) +Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar:amd64 bar:armel -s + +testequal "Reading package lists... +Building dependency tree... +Note, selecting 'bar' instead of 'bar-provider' +The following NEW packages will be installed: + bar cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar (1.0 unstable [amd64]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar (1.0 unstable [amd64]) +Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider -s -q=0 + +testequal "Reading package lists... +Building dependency tree... +Note, selecting 'bar:i386' instead of 'bar-provider:i386' +The following NEW packages will be installed: + bar:i386 cool-bar +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst bar:i386 (1.0 unstable [i386]) +Inst cool-bar (1.0 unstable [amd64]) +Conf bar:i386 (1.0 unstable [i386]) +Conf cool-bar (1.0 unstable [amd64])" aptget install cool-bar bar-provider:i386 -s -q=0 diff --git a/test/integration/test-ordering-ignore-not-matching-breaks b/test/integration/test-ordering-ignore-not-matching-breaks new file mode 100755 index 000000000..c9fca4edf --- /dev/null +++ b/test/integration/test-ordering-ignore-not-matching-breaks @@ -0,0 +1,56 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertpackage 'unstable-mp' 'crda' 'i386,amd64' '1.1.1-1ubuntu4mp' 'Provides: wireless-crda +Multi-Arch: foreign' +insertpackage 'unstable-m' 'crda' 'i386,amd64' '1.1.1-1ubuntu4m' 'Multi-Arch: foreign' +insertpackage 'unstable-p' 'crda' 'i386,amd64' '1.1.1-1ubuntu4p' 'Provides: wireless-crda' +insertpackage 'unstable' 'wireless-crda' 'i386,amd64' '1.16' + + +insertinstalledpackage 'wireless-crda' 'amd64' '1.14' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + crda +0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst crda (1.1.1-1ubuntu4m unstable-m [amd64]) +Conf crda (1.1.1-1ubuntu4m unstable-m [amd64])' aptget install crda -s -t unstable-m + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + crda +0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst crda (1.1.1-1ubuntu4p unstable-p [amd64]) +Conf crda (1.1.1-1ubuntu4p unstable-p [amd64])' aptget install crda -s -t unstable-p + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + crda +0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst crda (1.1.1-1ubuntu4mp unstable-mp [amd64]) +Conf crda (1.1.1-1ubuntu4mp unstable-mp [amd64])' aptget install crda -s -t unstable-mp + +rm rootdir/var/lib/dpkg/status +insertinstalledpackage 'crda' 'amd64' '1.1.1-1ubuntu4mp' 'Provides: wireless-crda +Conflicts: wireless-crda (<< 1.15) +Replaces: wireless-crda ( << 1.15) +Multi-arch: foreign' + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + wireless-crda +0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded. +Inst wireless-crda (1.16 unstable [amd64]) +Conf wireless-crda (1.16 unstable [amd64])' aptget install wireless-crda -s -t unstable diff --git a/test/integration/test-package-reinstallation b/test/integration/test-package-reinstallation new file mode 100755 index 000000000..b4f2061ec --- /dev/null +++ b/test/integration/test-package-reinstallation @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +insertinstalledpackage 'libc-bin' 'i386' '2.13-8' 'Replaces: libc6' +insertpackage 'unstable' 'libc-bin' 'i386' '2.13-8' 'Replaces: libc6' +insertinstalledpackage 'libc6' 'i386' '2.13-8' 'Depends: libc-bin (= 2.13-8)' +insertpackage 'unstable' 'libc6' 'i386' '2.13-8' 'Depends: libc-bin (= 2.13-8)' +insertinstalledpackage 'apt' 'i386' '0.8.15' 'Depends: libc6' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded. +Inst libc-bin [2.13-8] (2.13-8 unstable [i386]) +Conf libc-bin (2.13-8 unstable [i386]) +Inst libc6 [2.13-8] (2.13-8 unstable [i386]) +Conf libc6 (2.13-8 unstable [i386])' aptget install --reinstall libc6 libc-bin -s diff --git a/test/integration/test-pin-non-existent-package b/test/integration/test-pin-non-existent-package index c91e77844..35de22115 100755 --- a/test/integration/test-pin-non-existent-package +++ b/test/integration/test-pin-non-existent-package @@ -6,7 +6,7 @@ TESTDIR=$(readlink -f $(dirname $0)) setupenvironment configarchitecture "i386" -insertpackage 'unstable' 'apt' 'i386' '0.8.15' +insertpackage 'unstable' 'rapt' 'i386' '0.8.15' insertpackage 'unstable' 'arch' 'i386' '1.0' setupaptarchive @@ -22,40 +22,40 @@ testcandidate() { fi } -testcandidate apt '0.8.15' +testcandidate rapt '0.8.15' testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 testequal 'Reading package lists... Building dependency tree... -0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only -echo 'Package: apt +echo 'Package: rapt Pin: release a=unstable Pin-Priority: -1' > rootdir/etc/apt/preferences -testcandidate apt '(none)' +testcandidate rapt '(none)' testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 testequal 'Reading package lists... Building dependency tree... -0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only echo ' Package: doesntexist Pin: release a=unstable Pin-Priority: 1000' >> rootdir/etc/apt/preferences -testcandidate apt '(none)' +testcandidate rapt '(none)' echo ' -Package: apt +Package: rapt Pin: release a=unstable Pin-Priority: 1000' >> rootdir/etc/apt/preferences -testcandidate apt '(none)' +testcandidate rapt '(none)' testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0 testequal 'Reading package lists... Building dependency tree... -0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only echo 'Package: arch:amd64 Pin: release a=unstable diff --git a/test/integration/test-provides-gone-with-upgrade b/test/integration/test-provides-gone-with-upgrade new file mode 100755 index 000000000..70384ce29 --- /dev/null +++ b/test/integration/test-provides-gone-with-upgrade @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +insertinstalledpackage 'apt' 'i386' '0.8.14' 'Provides: libapt-pkg4.10' +insertpackage 'unstable' 'apt' 'i386' '0.8.15' 'Depends: libapt-pkg4.10' +insertpackage 'unstable' 'libapt-pkg4.10' 'i386' '0.8.15' 'Breaks: apt (<< 0.8.15) +Replaces: apt (<< 0.8.15)' + +setupaptarchive + +testequal 'Reading package lists... +Building dependency tree... +The following NEW packages will be installed: + libapt-pkg4.10 +The following packages will be upgraded: + apt +1 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +Inst apt [0.8.14] (0.8.15 unstable [i386]) [] +Inst libapt-pkg4.10 (0.8.15 unstable [i386]) +Conf libapt-pkg4.10 (0.8.15 unstable [i386]) +Conf apt (0.8.15 unstable [i386])' aptget dist-upgrade -s diff --git a/test/integration/test-release-candidate-switching b/test/integration/test-release-candidate-switching index b6dbe99db..0970cb935 100755 --- a/test/integration/test-release-candidate-switching +++ b/test/integration/test-release-candidate-switching @@ -416,4 +416,4 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: uninstallablepkg : Depends: libmtp8 (>= 10:0.20.1) but it is not going to be installed Depends: amarok-utils (= 2.3.2-2+exp) but 2.3.1-1+sid is to be installed -E: Broken packages" aptget install uninstallablepkg/experimental --trivial-only -V -q=0 +E: Unable to correct problems, you have held broken packages." aptget install uninstallablepkg/experimental --trivial-only -V -q=0 diff --git a/test/integration/test-suggest-installed-multiarch-silbing b/test/integration/test-suggest-installed-multiarch-silbing new file mode 100755 index 000000000..d55d250aa --- /dev/null +++ b/test/integration/test-suggest-installed-multiarch-silbing @@ -0,0 +1,80 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' 'armel' + +insertinstalledpackage 'foo' 'i386' '1' +insertpackage 'unstable' 'foo' 'amd64,i386' '1' + +insertinstalledpackage 'foo2' 'i386' '1' +insertpackage 'unstable' 'foo2' 'i386' '1' + +insertinstalledpackage 'foo3' 'amd64' '1' +insertpackage 'unstable' 'foo3' 'amd64,i386' '1' + +insertinstalledpackage 'samefoo' 'i386,amd64' '1' 'Multi-Arch: same' +insertpackage 'unstable' 'samefoo' 'amd64,i386,armel' '1' 'Multi-Arch: same' + +insertinstalledpackage 'samefoo2' 'i386' '1' 'Multi-Arch: same' +insertpackage 'unstable' 'samefoo2' 'amd64,i386,armel' '1' 'Multi-Arch: same' + +insertinstalledpackage 'mozplugger' 'i386' '1' 'Depends: iceweasel | fireweasel' +insertinstalledpackage 'fireweasel' 'i386' '1' +insertpackage 'unstable' 'mozplugger' 'i386,amd64' '1' 'Depends: iceweasel | fireweasel' + +setupaptarchive + +testequal "Reading package lists... +Building dependency tree... +Package 'foo' is not installed, so not removed. Did you mean 'foo:i386'? +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove foo -s + +testequal "Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + foo2:i386 +0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. +Remv foo2:i386 [1]" aptget remove foo2 -s + +testequal "Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + foo3 +0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. +Remv foo3 [1]" aptget remove foo3 -s + +testequal "Reading package lists... +Building dependency tree... +Package 'foo3:i386' is not installed, so not removed. Did you mean 'foo3'? +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove foo3:i386 -s + +testequalor2 "Reading package lists... +Building dependency tree... +Package 'samefoo:armel' is not installed, so not removed. Did you mean 'samefoo'? +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." "Reading package lists... +Building dependency tree... +Package 'samefoo:armel' is not installed, so not removed. Did you mean 'samefoo:i386'? +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove samefoo:armel -s + +testequal "Reading package lists... +Building dependency tree... +Package 'samefoo2' is not installed, so not removed. Did you mean 'samefoo2:i386'? +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove samefoo2 -s + +testequal "Reading package lists... +Building dependency tree... +Package 'samefoo2:armel' is not installed, so not removed. Did you mean 'samefoo2:i386'? +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove samefoo2:armel -s + +testequal "Reading package lists... +Building dependency tree... +Package 'iceweasel' is not installed, so not removed +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove iceweasel -s + +testequal "Reading package lists... +Building dependency tree... +Package 'fireweasel' is not installed, so not removed. Did you mean 'fireweasel:i386'? +0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove fireweasel:amd64 -s diff --git a/test/integration/test-ubuntu-bug-761175-remove-purge b/test/integration/test-ubuntu-bug-761175-remove-purge index 93b67fc02..f55c6e909 100755 --- a/test/integration/test-ubuntu-bug-761175-remove-purge +++ b/test/integration/test-ubuntu-bug-761175-remove-purge @@ -4,14 +4,14 @@ set -e TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture 'i386' +configarchitecture 'native' -setupsimplenativepackage 'compiz-core' 'i386' '1.0' 'unstable' +setupsimplenativepackage 'compiz-core' 'native' '1.0' 'unstable' BUILDDIR='incoming/compiz-core-1.0' mkdir -p ${BUILDDIR}/debian/compiz-core/etc echo 'foo=bar;' > ${BUILDDIR}/compiz.conf echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install -buildpackage "$BUILDDIR" 'unstable' 'main' +buildpackage "$BUILDDIR" 'unstable' 'main' 'native' rm -rf "$BUILDDIR" setupaptarchive @@ -27,7 +27,7 @@ aptget remove compiz-core -y -qq 2>&1 >/dev/null && msgpass || msgfail testdpkgnotinstalled compiz-core msgtest 'Check that conffiles are still around for' 'compiz-core' -dpkg -l compiz-core | grep '^rc' 2>&1 >/dev/null && msgpass || msgfail +dpkg -l compiz-core | grep -q '^rc' && msgpass || msgfail testequal 'Reading package lists... Building dependency tree... diff --git a/test/integration/test-ubuntu-bug-859188-multiarch-reinstall b/test/integration/test-ubuntu-bug-859188-multiarch-reinstall new file mode 100755 index 000000000..0fdf97485 --- /dev/null +++ b/test/integration/test-ubuntu-bug-859188-multiarch-reinstall @@ -0,0 +1,28 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' 'armel' + +buildsimplenativepackage 'libsame' 'amd64,i386,armel' '1.0' 'unstable' 'Multi-Arch: same' + +# FIXME: hack around dpkg's current inability to handle multiarch, a clean install would be better… +insertinstalledpackage 'libsame' 'amd64,i386' '1.0' 'Multi-Arch: same' +sed -e 's#/installed#/unstable#' -e 's#Installed-Size: 42#Installed-Size: 1#' -i rootdir/var/lib/dpkg/status + +setupaptarchive + +REINSTALL='Reading package lists... +Building dependency tree... +0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded. +Inst libsame [1.0] (1.0 unstable [amd64]) +Inst libsame:i386 [1.0] (1.0 unstable [i386]) +Conf libsame (1.0 unstable [amd64]) +Conf libsame:i386 (1.0 unstable [i386])' + +testequal "$REINSTALL" aptget install --reinstall libsame -s +testequal "$REINSTALL" aptget install --reinstall libsame:amd64 -s +testequal "$REINSTALL" aptget install --reinstall libsame:i386 -s +testequal "$REINSTALL" aptget install --reinstall libsame:amd64 libsame:i386 -s diff --git a/test/interactive-helper/extract-control.cc b/test/interactive-helper/extract-control.cc index 29dcbf371..3f7feabcb 100644 --- a/test/interactive-helper/extract-control.cc +++ b/test/interactive-helper/extract-control.cc @@ -1,5 +1,6 @@ #include <apt-pkg/debfile.h> #include <apt-pkg/error.h> +#include <apt-pkg/fileutl.h> #include <iostream> #include <unistd.h> @@ -20,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..10d1e44ec 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) diff --git a/test/interactive-helper/test_udevcdrom.cc b/test/interactive-helper/test_udevcdrom.cc index dc25ab357..88f5f0153 100644 --- a/test/interactive-helper/test_udevcdrom.cc +++ b/test/interactive-helper/test_udevcdrom.cc @@ -2,12 +2,15 @@ #include <stdio.h> #include <assert.h> +#include <vector> +#include <iostream> + int main() { pkgUdevCdromDevices c; assert(c.Dlopen()); - vector<CdromDevice> l; + std::vector<CdromDevice> l; l = c.Scan(); assert(l.empty() == false); for (size_t i = 0; i < l.size(); ++i) diff --git a/test/interactive-helper/testextract.cc b/test/interactive-helper/testextract.cc deleted file mode 100644 index b790df618..000000000 --- a/test/interactive-helper/testextract.cc +++ /dev/null @@ -1,101 +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 <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 ce5accc1c..a07be4b57 100644 --- a/test/libapt/assert.h +++ b/test/libapt/assert.h @@ -26,6 +26,18 @@ void assertEquals(int const &expect, unsigned int const &get, unsigned long cons assertEquals<unsigned int const&, unsigned int const&>(expect, get, line); } +void assertEquals(unsigned long const &expect, int const &get, unsigned long const &line) { + if (get < 0) + OutputAssertEqual(expect, "==", get, line); + assertEquals<unsigned long const&, unsigned long const&>(expect, get, line); +} + +void assertEquals(int const &expect, unsigned long const &get, unsigned long const &line) { + if (expect < 0) + OutputAssertEqual(expect, "==", get, line); + assertEquals<unsigned long const&, unsigned long const&>(expect, get, line); +} + #define equalsOr2(x,y,z) assertEqualsOr2(y, z, x, __LINE__) diff --git a/test/libapt/cdromfindpackages_test.cc b/test/libapt/cdromfindpackages_test.cc new file mode 100644 index 000000000..e9f5a51b0 --- /dev/null +++ b/test/libapt/cdromfindpackages_test.cc @@ -0,0 +1,86 @@ +#include <apt-pkg/cdrom.h> +#include <apt-pkg/error.h> + +#include <algorithm> +#include <string> +#include <vector> + +#include "assert.h" + +class Cdrom : public pkgCdrom { + public: + bool FindPackages(std::string const &CD, + std::vector<std::string> &List, + std::vector<std::string> &SList, + std::vector<std::string> &SigList, + std::vector<std::string> &TransList, + std::string &InfoDir) { + bool const result = pkgCdrom::FindPackages(CD, List, SList, SigList, TransList, InfoDir, NULL, 0); + std::sort(List.begin(), List.end()); + std::sort(SList.begin(), SList.end()); + std::sort(SigList.begin(), SigList.end()); + std::sort(TransList.begin(), TransList.end()); + return result; + } + + bool DropRepeats(std::vector<std::string> &List, char const *Name) { + return pkgCdrom::DropRepeats(List, Name); + } +}; + +int main(int argc, char const *argv[]) { + if (argc != 2) { + std::cout << "One parameter expected - given " << argc << std::endl; + return 100; + } + + Cdrom cd; + std::vector<std::string> Packages, Sources, Signatur, Translation; + std::string InfoDir; + std::string path = argv[1]; + equals(true, cd.FindPackages(path, Packages, Sources, Signatur, Translation, InfoDir)); + equals(4, Packages.size()); + equals(path + "/dists/sid/main/binary-i386/", Packages[0]); + equals(path + "/dists/stable/contrib/binary-amd64/", Packages[1]); + equals(path + "/dists/stable/main/binary-i386/", Packages[2]); + equals(path + "/dists/unstable/main/binary-i386/", Packages[3]); + equals(3, Sources.size()); + equals(path + "/dists/sid/main/source/", Sources[0]); + equals(path + "/dists/stable/main/source/", Sources[1]); + equals(path + "/dists/unstable/main/source/", Sources[2]); + equals(3, Signatur.size()); + equals(path + "/dists/sid/", Signatur[0]); + equals(path + "/dists/stable/", Signatur[1]); + equals(path + "/dists/unstable/", Signatur[2]); + equals(4, Translation.size()); + equals(path + "/dists/sid/main/i18n/Translation-de", Translation[0]); + equals(path + "/dists/sid/main/i18n/Translation-en", Translation[1]); + equals(path + "/dists/unstable/main/i18n/Translation-de", Translation[2]); + equals(path + "/dists/unstable/main/i18n/Translation-en", Translation[3]); + equals(path + "/.disk/", InfoDir); + + cd.DropRepeats(Packages, "Packages"); + cd.DropRepeats(Sources, "Sources"); + _error->PushToStack(); + cd.DropRepeats(Signatur, "InRelease"); + cd.DropRepeats(Signatur, "Release.gpg"); + _error->RevertToStack(); + _error->DumpErrors(); + cd.DropRepeats(Translation, ""); + + equals(3, Packages.size()); + equals(path + "/dists/stable/contrib/binary-amd64/", Packages[0]); + equals(path + "/dists/stable/main/binary-i386/", Packages[1]); + equals(path + "/dists/unstable/main/binary-i386/", Packages[2]); + equals(2, Sources.size()); + equals(path + "/dists/stable/main/source/", Sources[0]); + equals(path + "/dists/unstable/main/source/", Sources[1]); + equals(2, Signatur.size()); + equals(path + "/dists/stable/", Signatur[0]); + equals(path + "/dists/unstable/", Signatur[1]); + equals(2, Translation.size()); + equals(path + "/dists/unstable/main/i18n/Translation-de", Translation[0]); + equals(path + "/dists/unstable/main/i18n/Translation-en", Translation[1]); + + return 0; +} diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc index 5b23d17fb..9a3e2c118 100644 --- a/test/libapt/configuration_test.cc +++ b/test/libapt/configuration_test.cc @@ -71,6 +71,15 @@ int main(int argc,const char *argv[]) { equals(Cnf.Find("APT2::Version", "33"), "33"); equals(Cnf.FindI("APT2::Version", 33), 33); + equals(Cnf.FindFile("Dir::State"), ""); + equals(Cnf.FindFile("Dir::Aptitude::State"), ""); + Cnf.Set("Dir", "/srv/sid"); + equals(Cnf.FindFile("Dir::State"), ""); + Cnf.Set("Dir::State", "var/lib/apt"); + Cnf.Set("Dir::Aptitude::State", "var/lib/aptitude"); + equals(Cnf.FindFile("Dir::State"), "/srv/sid/var/lib/apt"); + equals(Cnf.FindFile("Dir::Aptitude::State"), "/srv/sid/var/lib/aptitude"); + //FIXME: Test for configuration file parsing; // currently only integration/ tests test them implicitly diff --git a/test/libapt/getlistoffilesindir_test.cc b/test/libapt/getlistoffilesindir_test.cc index 5ee014cca..b2c95e840 100644 --- a/test/libapt/getlistoffilesindir_test.cc +++ b/test/libapt/getlistoffilesindir_test.cc @@ -7,7 +7,7 @@ #include <stdio.h> #include <iostream> -#define P(x) string(argv[1]).append("/").append(x) +#define P(x) std::string(argv[1]).append("/").append(x) int main(int argc,char *argv[]) { diff --git a/test/libapt/globalerror_test.cc b/test/libapt/globalerror_test.cc index 5d27414f9..72044d493 100644 --- a/test/libapt/globalerror_test.cc +++ b/test/libapt/globalerror_test.cc @@ -3,9 +3,12 @@ #include "assert.h" #include <string> #include <errno.h> +#include <string.h> int main(int argc,char *argv[]) { + std::string const textOfErrnoZero(strerror(0)); + equals(_error->empty(), true); equals(_error->PendingError(), false); equals(_error->Notice("%s Notice", "A"), false); @@ -80,7 +83,7 @@ int main(int argc,char *argv[]) equals(_error->PendingError(), true); equals(_error->PopMessage(text), true); equals(_error->PendingError(), false); - equals(text, "Something horrible happend 2 times - errno (0: Success)"); + equals(text, std::string("Something horrible happend 2 times - errno (0: ").append(textOfErrnoZero).append(")")); equals(_error->empty(), true); std::string longText; @@ -92,7 +95,7 @@ int main(int argc,char *argv[]) equals(_error->Errno("errno", "%s horrible %s %d times", longText.c_str(), "happend", 2), false); equals(_error->PopMessage(text), true); - equals(text, std::string(longText).append(" horrible happend 2 times - errno (0: Success)")); + equals(text, std::string(longText).append(" horrible happend 2 times - errno (0: ").append(textOfErrnoZero).append(")")); equals(_error->Warning("Репозиторий не обновлён и будут %d %s", 4, "test"), false); equals(_error->PopMessage(text), false); diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc new file mode 100644 index 000000000..396e4cf6b --- /dev/null +++ b/test/libapt/hashsums_test.cc @@ -0,0 +1,156 @@ +#include <apt-pkg/md5.h> +#include <apt-pkg/sha1.h> +#include <apt-pkg/sha2.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/hashes.h> +#include <iostream> + +#include <stdio.h> + +#include "assert.h" + +template <class T> void Test(const char *In,const char *Out) +{ + T Sum; + Sum.Add(In); + equals(Sum.Result().Value(), Out); +} + +template <class T> void TestMill(const char *Out) +{ + T Sum; + + const unsigned char As[] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + unsigned Count = 1000000; + for (; Count != 0;) + { + if (Count >= 64) + { + Sum.Add(As,64); + Count -= 64; + } + else + { + Sum.Add(As,Count); + Count = 0; + } + } + + if (stringcasecmp(Sum.Result().Value(), Out) != 0) + abort(); +} + +int main(int argc, char** argv) +{ + // From FIPS PUB 180-1 + Test<SHA1Summation>("","da39a3ee5e6b4b0d3255bfef95601890afd80709"); + Test<SHA1Summation>("abc","a9993e364706816aba3e25717850c26c9cd0d89d"); + Test<SHA1Summation>("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + "84983e441c3bd26ebaae4aa1f95129e5e54670f1"); + TestMill<SHA1Summation>("34aa973cd4c4daa4f61eeb2bdbad27316534016f"); + + // MD5 tests from RFC 1321 + Test<MD5Summation>("","d41d8cd98f00b204e9800998ecf8427e"); + Test<MD5Summation>("a","0cc175b9c0f1b6a831c399e269772661"); + Test<MD5Summation>("abc","900150983cd24fb0d6963f7d28e17f72"); + Test<MD5Summation>("message digest","f96b697d7cb7938d525a2f31aaf161d0"); + Test<MD5Summation>("abcdefghijklmnopqrstuvwxyz","c3fcd3d76192e4007dfb496cca67e13b"); + Test<MD5Summation>("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", + "d174ab98d277d9f5a5611c2c9f419d9f"); + Test<MD5Summation>("12345678901234567890123456789012345678901234567890123456789012345678901234567890", + "57edf4a22be3c955ac49da2e2107b67a"); + + // SHA-256, From FIPS 180-2 + Test<SHA256Summation>("", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"); + Test<SHA256Summation>("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", + "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1"); + + // SHA-512 + Test<SHA512Summation>("", + "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce" + "47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"); + Test<SHA512Summation>( + "abc", + "ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" + "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f"); + + + Test<MD5Summation>("The quick brown fox jumps over the lazy dog", "9e107d9d372bb6826bd81d3542a419d6"); + Test<MD5Summation>("The quick brown fox jumps over the lazy dog.", "e4d909c290d0fb1ca068ffaddf22cbd0"); + Test<SHA1Summation>("The quick brown fox jumps over the lazy dog", "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"); + Test<SHA1Summation>("The quick brown fox jumps over the lazy cog", "de9f2c7fd25e1b3afad3e85a0bd17d9b100db4b3"); + Test<SHA256Summation>("The quick brown fox jumps over the lazy dog", "d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592"); + Test<SHA256Summation>("The quick brown fox jumps over the lazy dog.", "ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c"); + Test<SHA512Summation>("The quick brown fox jumps over the lazy dog", "07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb64" + "2e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6"); + Test<SHA512Summation>("The quick brown fox jumps over the lazy dog.", "91ea1245f20d46ae9a037a989f54f1f790f0a47607eeb8a14d12890cea77a1bb" + "c6c7ed9cf205e67b7f2b8fd4c7dfd3a7a8617e45f3c463d481c7e586c39ac1ed"); + + FILE* fd = fopen(argv[1], "r"); + if (fd == NULL) { + std::cerr << "Can't open file for 1. testing: " << argv[1] << std::endl; + return 1; + } + { + Hashes hashes; + hashes.AddFD(fileno(fd)); + equals(argv[2], hashes.MD5.Result().Value()); + equals(argv[3], hashes.SHA1.Result().Value()); + equals(argv[4], hashes.SHA256.Result().Value()); + equals(argv[5], hashes.SHA512.Result().Value()); + } + fseek(fd, 0L, SEEK_END); + unsigned long sz = ftell(fd); + fseek(fd, 0L, SEEK_SET); + { + Hashes hashes; + hashes.AddFD(fileno(fd), sz); + equals(argv[2], hashes.MD5.Result().Value()); + equals(argv[3], hashes.SHA1.Result().Value()); + equals(argv[4], hashes.SHA256.Result().Value()); + equals(argv[5], hashes.SHA512.Result().Value()); + } + fseek(fd, 0L, SEEK_SET); + { + MD5Summation md5; + md5.AddFD(fileno(fd)); + equals(argv[2], md5.Result().Value()); + } + fseek(fd, 0L, SEEK_SET); + { + SHA1Summation sha1; + sha1.AddFD(fileno(fd)); + equals(argv[3], sha1.Result().Value()); + } + fseek(fd, 0L, SEEK_SET); + { + SHA256Summation sha2; + sha2.AddFD(fileno(fd)); + equals(argv[4], sha2.Result().Value()); + } + fseek(fd, 0L, SEEK_SET); + { + SHA512Summation sha2; + sha2.AddFD(fileno(fd)); + equals(argv[5], sha2.Result().Value()); + } + fclose(fd); + + // test HashString code + { + HashString sha2("SHA256", argv[4]); + equals(sha2.VerifyFile(argv[1]), true); + } + { + HashString sha2("SHA512", argv[5]); + equals(sha2.VerifyFile(argv[1]), true); + } + { + HashString sha2("SHA256:" + std::string(argv[4])); + equals(sha2.VerifyFile(argv[1]), true); + } + + return 0; +} + + diff --git a/test/libapt/makefile b/test/libapt/makefile index b3f2f4274..1952051e2 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -51,6 +51,12 @@ SLIBS = -lapt-pkg SOURCE = globalerror_test.cc include $(PROGRAM_H) +# test the different Hashsum classes +PROGRAM = HashSums${BASENAME} +SLIBS = -lapt-pkg +SOURCE = hashsums_test.cc +include $(PROGRAM_H) + # test the strutils stuff PROGRAM = StrUtil${BASENAME} SLIBS = -lapt-pkg @@ -68,3 +74,9 @@ PROGRAM = Configuration${BASENAME} SLIBS = -lapt-pkg SOURCE = configuration_test.cc include $(PROGRAM_H) + +# test cdroms core FindPackages +PROGRAM = CdromFindPackages${BASENAME} +SLIBS = -lapt-pkg +SOURCE = cdromfindpackages_test.cc +include $(PROGRAM_H) diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc index 7b496878d..b5d92d9d2 100644 --- a/test/libapt/parsedepends_test.cc +++ b/test/libapt/parsedepends_test.cc @@ -4,8 +4,8 @@ #include "assert.h" int main(int argc,char *argv[]) { - string Package; - string Version; + std::string Package; + std::string Version; unsigned int Op = 5; unsigned int Null = 0; bool StripMultiArch = true; diff --git a/test/libapt/run-tests b/test/libapt/run-tests index 9dad36f5b..4ea9a916d 100755 --- a/test/libapt/run-tests +++ b/test/libapt/run-tests @@ -66,8 +66,42 @@ do "${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" + 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 elif [ $name = "CompareVersion${EXT}" ]; then tmppath="${DIR}/versions.lst" + elif [ $name = "CdromFindPackages${EXT}" ]; then + tmppath=$(mktemp -d) + mkdir -p "${tmppath}/.disk" "${tmppath}/pool" \ + "${tmppath}/dists/stable/main/binary-i386" \ + "${tmppath}/dists/stable/main/source" \ + "${tmppath}/dists/stable/contrib/binary-amd64" \ + "${tmppath}/dists/stable/contrib/binary-all" \ + "${tmppath}/dists/unstable/main/binary-i386" \ + "${tmppath}/dists/unstable/main/i18n" \ + "${tmppath}/dists/unstable/main/source" \ + "${tmppath}/dists/broken/non-free/source" + touch "${tmppath}/dists/broken/.aptignr" \ + "${tmppath}/dists/stable/main/binary-i386/Packages" \ + "${tmppath}/dists/stable/main/binary-i386/Packages.bz2" \ + "${tmppath}/dists/stable/main/source/Sources.xz" \ + "${tmppath}/dists/stable/contrib/binary-amd64/Packages" \ + "${tmppath}/dists/stable/contrib/binary-amd64/Packages.gz" \ + "${tmppath}/dists/stable/contrib/binary-all/Packages" \ + "${tmppath}/dists/unstable/main/binary-i386/Packages.xz" \ + "${tmppath}/dists/unstable/main/binary-i386/Packages.lzma" \ + "${tmppath}/dists/unstable/main/i18n/Translation-en" \ + "${tmppath}/dists/unstable/main/i18n/Translation-de.bz2" \ + "${tmppath}/dists/unstable/main/source/Sources.xz" \ + "${tmppath}/dists/broken/non-free/source/Sources.gz" \ + "${tmppath}/dists/stable/Release.gpg" \ + "${tmppath}/dists/stable/Release" \ + "${tmppath}/dists/unstable/InRelease" \ + "${tmppath}/dists/broken/Release.gpg" + ln -s "${tmppath}/dists/unstable" "${tmppath}/dists/sid" fi echo -n "Testing with ${NAME} " @@ -76,5 +110,4 @@ do if [ -n "$tmppath" -a -d "$tmppath" ]; then rm -rf "$tmppath" fi - done diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc index af6eb2cc6..bfe0d7222 100644 --- a/test/libapt/strutil_test.cc +++ b/test/libapt/strutil_test.cc @@ -4,7 +4,7 @@ int main(int argc,char *argv[]) { - string input, output, expected; + std::string input, output, expected; // no input input = "foobar"; |