From 6874a1a88255fe0ab1b501961ce1fec26ee718a7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 9 Sep 2010 19:54:22 +0200 Subject: add a simple testcase for the previously fixed bug 595691 to check in future that APT plays considerable well with empty archives --- .../test-bug-595691-empty-and-broken-archive-files | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 test/integration/test-bug-595691-empty-and-broken-archive-files (limited to 'test/integration') diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files new file mode 100755 index 000000000..234073759 --- /dev/null +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -0,0 +1,91 @@ +#!/bin/sh +set -e + +local TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" + +buildaptarchive +setupflataptarchive + +testaptgetupdate() { + aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true + sed -i -e '/^Fetched / d' -e 's#\[[0-9]*[kMGTPY]*B\]#\[\]#' testaptgetupdate.diff + GIVEN="$1" + shift + msgtest "Test for correctness of" "apt-get update with $*" + if [ -z "$GIVEN" ]; then + echo -n "" | checkdiff - testaptgetupdate.diff && msgpass || msgfail + else + echo "$GIVEN" | checkdiff - testaptgetupdate.diff && msgpass || msgfail + fi + rm testaptgetupdate.diff +} + +touch aptarchive/en.bz2 + +testaptgetupdate "Ign file: Release.gpg +Ign file:$(readlink -f aptarchive)/ Translation-en +Get:1 file: Release [] +Reading package lists..." "empty file en.bz2 over file" + +rm aptarchive/en.bz2 +echo -n "" | bzip2 > aptarchive/en.bz2 + +testaptgetupdate "Ign file: Release.gpg +Get:1 file: Release [] +Reading package lists..." "empty archive en.bz2 over file" + +rm aptarchive/en.bz2 + +# do the same again with http instead of file +changetowebserver + +touch aptarchive/en.bz2 + +testaptgetupdate "Ign http://localhost Release.gpg +Get:1 http://localhost/ Translation-en +Get:2 http://localhost Release [] +Ign http://localhost/ Translation-en +Get:3 http://localhost Packages [] +Reading package lists..." "empty file en.bz2 over http" + +rm aptarchive/en.bz2 +echo -n "" | bzip2 > aptarchive/en.bz2 + +testaptgetupdate "Ign http://localhost Release.gpg +Get:1 http://localhost/ Translation-en [] +Get:2 http://localhost Release [] +Ign http://localhost Packages/DiffIndex +Get:3 http://localhost Packages [] +Reading package lists..." "empty archive en.bz2 over http" + +rm aptarchive/en.bz2 + +rm aptarchive/Packages +touch aptarchive/Packages +buildaptarchivefromfiles + +testaptgetupdate "Ign http://localhost Release.gpg +Ign http://localhost/ Translation-en +Get:1 http://localhost Release [] +Ign http://localhost Packages/DiffIndex +Get:2 http://localhost Packages [] +Reading package lists..." "empty archive Packages over http" + +find aptarchive/ -name 'Packages*' -type f -delete +touch aptarchive/Packages.bz2 +aptftparchive release aptarchive/ > aptarchive/Release + +#FIXME: we should response with a good error message instead +testaptgetupdate "Ign http://localhost Release.gpg +Ign http://localhost/ Translation-en +Get:1 http://localhost Release [] +Ign http://localhost Packages/DiffIndex +Get:2 http://localhost Packages +Err http://localhost Packages + Undetermined Error +W: Failed to fetch http://localhost:8080/Packages.bz2 Undetermined Error + +E: Some index files failed to download, they have been ignored, or old ones used instead." "empty file Packages over http" -- cgit v1.2.3 From 5ed56f934dd204cc3a1d757ccf5eac23f8374736 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 14 Sep 2010 18:57:46 +0200 Subject: * apt-pkg/policy.cc: - support 100-pinning in Release file with ButAutomaticUpgrades as requested by the backports crew (Closes: #596097) * apt-pkg/deb/deblistparser.cc: - overrule NotAutomatic in case of ButAutomaticUpgrades --- test/integration/Packages-policy-pinning | 12 ++ test/integration/framework | 2 +- test/integration/test-policy-pinning | 228 +++++++++++++++++++++++++++++++ 3 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 test/integration/Packages-policy-pinning create mode 100755 test/integration/test-policy-pinning (limited to 'test/integration') diff --git a/test/integration/Packages-policy-pinning b/test/integration/Packages-policy-pinning new file mode 100644 index 000000000..a9334e9dd --- /dev/null +++ b/test/integration/Packages-policy-pinning @@ -0,0 +1,12 @@ +Package: oldstuff +Version: 1.0 +Architecture: i386 +Maintainer: Joe Sixpack +Installed-Size: 100 +Filename: pool/oldstuff_1.0_i386.deb +Size: 100000 +MD5sum: 311aeeadf78324aaff54c9b4e1f76671 +SHA1: 3c695e028f74d5c544deeddaaa1242desa81088c +SHA256: b46fd1546151c545fe4bfa56a5cc0e7deaef23e2da3e4f129727fd660f28f050 +Description: some old but cool stuff + This package will disappear in the next mirror update diff --git a/test/integration/framework b/test/integration/framework index 8a5973d4b..59d2f0e85 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -211,7 +211,7 @@ buildpackage() { fi local BUILT="$(dpkg-buildpackage -uc -us -a$ARCH 2> /dev/null)" local PKGS="$( echo "$BUILT" | grep '^dpkg-deb: building package' | cut -d'/' -f 2 | sed -e "s#'\.##")" - local SRCS="$( echo "$BUILT" | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._-]*$')" + local SRCS="$( echo "$BUILT" | grep '^dpkg-source: info: building' | grep -o '[a-z0-9._+~-]*$')" cd - > /dev/null for PKG in $PKGS; do echo "pool/${PKG}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning new file mode 100755 index 000000000..97447b330 --- /dev/null +++ b/test/integration/test-policy-pinning @@ -0,0 +1,228 @@ +#!/bin/sh +set -e + +local TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture "i386" + +buildaptarchive +setupflataptarchive + +STATUS=$(readlink -f rootdir/var/lib/dpkg/status) +APTARCHIVE=$(readlink -f aptarchive) + +testequalpolicy() { + local SP="$1" + local AP="$2" + shift 2 + testequal "Package files: + $(echo "$SP" | awk '{ printf("%3s\n",$0) }') ${STATUS} + release a=now + $(echo "$AP" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ Packages + release c= +Pinned packages:" aptcache policy $* +} + +aptget update -qq +testequalpolicy 100 500 +testequalpolicy 990 500 -t now + +sed -i aptarchive/Release -e 1i"NotAutomatic: yes" +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicy 100 1 -o Test=NotAutomatic +testequalpolicy 990 1 -o Test=NotAutomatic -t now + +sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes" +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicy 100 100 -o Test=ButAutomaticUpgrades +testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now + +sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d' +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicy 100 500 -o Test=Automatic +testequalpolicy 990 500 -o Test=Automatic -t now + +buildsimplenativepackage "coolstuff" "all" "1.0" "stable" +buildsimplenativepackage "coolstuff" "all" "2.0~bpo1" "backports" + +setupaptarchive + +testequalpolicycoolstuff() { + local INSTALLED="${1:-(none)}" + local CANDIDATE="${2:-(none)}" + local AB="$3" + local AS="$4" + local PB="$5" + local PINVERSION="$6" + if [ -n "$PINVERSION" ]; then + PINVERSION="Package pin: $PINVERSION + " + fi + local IS="" + local IB="" + local SB="" + local SS="" + [ "$1" = "2.0~bpo1" ] && IB="***" && SB=" + 100 $STATUS" || IB=" " + [ "$1" = "1.0" ] && IS="***" && SS=" + 100 $STATUS" || IS=" " + local BPO1ARCHIVE="" + local BPO2ARCHIVE="" + if [ ! "$7" = "2.0~bpo2" ]; then + BPO1ARCHIVE=" $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages" + else + BPO2ARCHIVE=" + 2.0~bpo2 $PB + $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages" + SB="$(echo "$SB" | tail -n 1)" + shift + fi + shift 6 + testequal "coolstuff: + Installed: $INSTALLED + Candidate: $CANDIDATE + ${PINVERSION}Version table:${BPO2ARCHIVE} + $IB 2.0~bpo1 $PB +${BPO1ARCHIVE}$SB + $IS 1.0 $PB + $(echo "$AS" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ stable/main i386 Packages$SS" \ + aptcache policy coolstuff -o Policy=${INSTALLED}-${CANDIDATE}-${AB}-${AS}-${PB} $* +} + +testequalpolicycoolstuff "" "2.0~bpo1" 500 500 0 "" +testequalpolicycoolstuff "" "1.0" 500 990 0 "" -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -t backports +echo "Package: * +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=GlobalPin +testequalpolicycoolstuff "" "1.0" 200 990 0 "" -o Test=GlobalPin -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=GlobalPin -t backports +echo "Package: * +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=GlobalPin +testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=GlobalPin -t stable +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +#FIXME: policy can't differentiate between two sources where one has a package specific pin in place +# testequalpolicycoolstuff "" "1.0" 500 500 200 "2.0~bpo1" -o Test=PackagePin +# testequalpolicycoolstuff "" "1.0" 990 500 200 "2.0~bpo1" -o Test=PackagePin -t backports +testequalpolicycoolstuff "" "1.0" 500 990 200 "2.0~bpo1" -o Test=PackagePin -t stable +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 500 500 600 "2.0~bpo1" -o Test=PackagePin +testequalpolicycoolstuff "" "1.0" 500 990 600 "2.0~bpo1" -o Test=PackagePin -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=PackagePin -t backports + +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: -1" > rootdir/etc/apt/preferences +# testequalpolicycoolstuff "" "1.0" 500 500 -1 "2.0~bpo1" -o Test=PackagePin +# testequalpolicycoolstuff "" "1.0" 990 500 -1 "2.0~bpo1" -o Test=PackagePin -t backports +# testequalpolicycoolstuff "" "1.0" 500 990 -1 "2.0~bpo1" -o Test=PackagePin -t stable + +rm rootdir/etc/apt/preferences +sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes" +signreleasefiles +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicycoolstuff "" "1.0" 1 500 0 "" -o Test=NotAutomatic +testequalpolicycoolstuff "" "1.0" 1 990 0 "" -o Test=NotAutomatic -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=NotAutomatic -t backports +echo "Package: * +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=NotAutomatic +echo "Package: * +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=NotAutomatic +testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=NotAutomatic -t stable +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "1.0" 1 500 200 "2.0~bpo1" -o Test=NotAutomatic +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 1 500 600 "2.0~bpo1" -o Test=NotAutomatic +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=NotAutomatic -t backports +testequalpolicycoolstuff "" "1.0" 1 990 600 "2.0~bpo1" -o Test=NotAutomatic -t stable + +rm rootdir/etc/apt/preferences +sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes" +signreleasefiles +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicycoolstuff "" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports +echo "Package: * +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "1.0" 200 500 0 "" -o Test=ButAutomaticUpgrades +echo "Package: * +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 600 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "" "1.0" 600 990 0 "" -o Test=ButAutomaticUpgrades -t stable +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 200" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "1.0" 100 500 200 "2.0~bpo1" -o Test=ButAutomaticUpgrades +echo "Package: coolstuff +Pin: release n=backports +Pin-Priority: 600" > rootdir/etc/apt/preferences +testequalpolicycoolstuff "" "2.0~bpo1" 100 500 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t backports +testequalpolicycoolstuff "" "1.0" 100 990 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t stable + +rm rootdir/etc/apt/preferences +aptget install coolstuff -qq > /dev/null 2> /dev/null +testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades +aptget dist-upgrade -qq > /dev/null 2> /dev/null +testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "1.0" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "1.0" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports + +aptget install coolstuff -t backports -qq > /dev/null 2> /dev/null +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades +aptget dist-upgrade -qq > /dev/null 2> /dev/null +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports + +rm incoming/backports.main.pkglist incoming/backports.main.srclist +buildsimplenativepackage "coolstuff" "all" "2.0~bpo2" "backports" +setupaptarchive + +sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes" +signreleasefiles +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 500 0 "" "2.0~bpo2" -o Test=NotAutomatic +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 1 990 0 "" "2.0~bpo2" -o Test=NotAutomatic -t stable +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=NotAutomatic -t backports + +sed -i aptarchive/dists/backports/Release -e 1i"ButAutomaticUpgrades: yes" +signreleasefiles +rm rootdir/var/cache/apt/srcpkgcache.bin rootdir/var/cache/apt/pkgcache.bin +aptget update -qq + +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 100 990 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t stable +testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo2" 990 500 0 "" "2.0~bpo2" -o Test=ButAutomaticUpgrades -t backports -- cgit v1.2.3 From 1054d76b2519efc858a9d23301495a763c1f8230 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 29 Sep 2010 18:34:48 +0200 Subject: fix the testcases which were broken by the new space between number and unit --- test/integration/test-bug-591882-conkeror | 8 ++++---- test/integration/test-bug-595691-empty-and-broken-archive-files | 2 +- test/integration/test-ubuntu-bug-614993 | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'test/integration') diff --git a/test/integration/test-bug-591882-conkeror b/test/integration/test-bug-591882-conkeror index b1dbb3a0a..27a217b5f 100755 --- a/test/integration/test-bug-591882-conkeror +++ b/test/integration/test-bug-591882-conkeror @@ -34,8 +34,8 @@ The following packages will be upgraded: perl-base perl-modules readline-common sed ttf-dejavu-core ucf whiptail x11-common zlib1g 87 upgraded, 26 newly installed, 5 to remove and 0 not upgraded. -Need to get 0B/54.4MB of archives. -After this operation, 12.4MB of additional disk space will be used. +Need to get 0 B/54.4 MB of archives. +After this operation, 12.4 MB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." UPGRADESUCCESS="Reading package lists... @@ -66,8 +66,8 @@ The following packages will be upgraded: perl-base perl-modules readline-common sed ttf-dejavu-core ucf whiptail x11-common zlib1g 88 upgraded, 30 newly installed, 4 to remove and 0 not upgraded. -Need to get 0B/62.9MB of archives. -After this operation, 36.0MB of additional disk space will be used. +Need to get 0 B/62.9 MB of archives. +After this operation, 36.0 MB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." # Test that the old behavior can be restored with the option 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 234073759..d982a4981 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -11,7 +11,7 @@ setupflataptarchive testaptgetupdate() { 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 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff GIVEN="$1" shift msgtest "Test for correctness of" "apt-get update with $*" diff --git a/test/integration/test-ubuntu-bug-614993 b/test/integration/test-ubuntu-bug-614993 index f54909bc2..d70c65ba2 100755 --- a/test/integration/test-ubuntu-bug-614993 +++ b/test/integration/test-ubuntu-bug-614993 @@ -52,8 +52,8 @@ The following packages will be upgraded: xserver-xorg-video-tseng xserver-xorg-video-vesa xserver-xorg-video-vmware xserver-xorg-video-voodoo 41 upgraded, 5 newly installed, 1 to remove and 3 not upgraded. -Need to get 0B/5505kB of archives. -After this operation, 2294kB disk space will be freed. +Need to get 0 B/5505 kB of archives. +After this operation, 2294 kB disk space will be freed. E: Trivial Only specified but this is not a trivial operation." testequal "$UPGRADE" aptget install xserver-xorg --trivial-only -- cgit v1.2.3 From 01a6e24cd1b601df2f20190b6118c4616e7fedf2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 29 Sep 2010 19:55:04 +0200 Subject: * apt-pkg/depcache.cc: - do not check endpointer packages instead of only those which prevented NeverAutoRemove settings from having an effect (Closes: #598452) --- test/integration/framework | 24 ++++++++++++++++++++++++ test/integration/test-autoremove | 40 ++++++++++++++++++++++++++++++++-------- 2 files changed, 56 insertions(+), 8 deletions(-) (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index 59d2f0e85..c09afcbad 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -499,3 +499,27 @@ testnopackage() { fi msgpass } + +testdpkginstalled() { + msgtest "Test for correctly installed package(s) with" "dpkg -l $*" + local PKGS="$(dpkg -l $* | grep '^[a-z]' | grep '^[^i]' | wc -l)" + if [ "$PKGS" != 0 ]; then + echo $PKGS + dpkg -l $* | grep '^[a-z]' + msgfail + return 1 + fi + msgpass +} + +testdpkgnoninstalled() { + msgtest "Test for correctly non-installed package(s) with" "dpkg -l $*" + local PKGS="$(dpkg -l $* | grep '^[a-z]' | grep '^[^u]' | wc -l)" + if [ "$PKGS" != 0 ]; then + echo + dpkg -l $* | grep '^[a-z]' + msgfail + return 1 + fi + msgpass +} diff --git a/test/integration/test-autoremove b/test/integration/test-autoremove index fb39e979a..7127b3d82 100755 --- a/test/integration/test-autoremove +++ b/test/integration/test-autoremove @@ -4,26 +4,50 @@ set -e local TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment -configarchitecture "i386" +configarchitecture 'i386' -buildsimplenativepackage "unrelated" "all" "1" "unstable" -buildsimplenativepackage "po-debconf" "all" "1.0.16" "unstable" -buildsimplenativepackage "debhelper" "all" "8.0.0" "unstable" "Depends: po-debconf" +buildsimplenativepackage 'unrelated' 'all' '1' 'unstable' +buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable' +buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf' setupaptarchive aptget install unrelated debhelper -qq 2>&1 > /dev/null +testdpkginstalled 'unrelated' 'debhelper' 'po-debconf' -testfileequal "rootdir/var/lib/apt/extended_states" "Package: po-debconf +testfileequal 'rootdir/var/lib/apt/extended_states' 'Package: po-debconf Architecture: i386 Auto-Installed: 1 -" +' aptget remove debhelper -y -qq 2>&1 > /dev/null +testdpkgnoninstalled 'debhelper' +testdpkginstalled 'po-debconf unrelated' + +echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove +testequal 'Reading package lists... +Building dependency tree... +Reading state information... +The following packages will be REMOVED: + po-debconf +0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. +Remv po-debconf [1.0.16]' aptget autoremove -s +testdpkginstalled 'po-debconf' + +echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove aptget autoremove -y -qq 2>&1 > /dev/null +testdpkginstalled 'po-debconf' -testfileequal "rootdir/var/lib/apt/extended_states" "" +echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove +aptget autoremove -y -qq 2>&1 > /dev/null +testdpkginstalled "po-debconf" + +rm rootdir/etc/apt/apt.conf.d/00autoremove +aptget autoremove -y -qq 2>&1 > /dev/null +testdpkgnoninstalled 'po-debconf' + +testfileequal 'rootdir/var/lib/apt/extended_states' '' sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -testfileequal "rootdir/var/log/apt/history.log" ' +testfileequal 'rootdir/var/log/apt/history.log' ' Install: unrelated:i386 (1), debhelper:i386 (8.0.0), po-debconf:i386 (1.0.16, automatic) Remove: debhelper:i386 (8.0.0) -- cgit v1.2.3 From 0c6aa02ecfbb1b1ecac519527467befae36b7c40 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 2 Oct 2010 09:19:31 +0200 Subject: * apt-pkg/depcache.cc: - do not remove packages which the user requested for installation explicitly while satisfying other install requests (Closes: #598669) --- ...ages-bug-598669-install-postfix-gets-exim-heavy | 30 ++++++++++++++++++++++ ...atus-bug-598669-install-postfix-gets-exim-heavy | 30 ++++++++++++++++++++++ ...test-bug-598669-install-postfix-gets-exim-heavy | 19 ++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 test/integration/Packages-bug-598669-install-postfix-gets-exim-heavy create mode 100644 test/integration/status-bug-598669-install-postfix-gets-exim-heavy create mode 100755 test/integration/test-bug-598669-install-postfix-gets-exim-heavy (limited to 'test/integration') diff --git a/test/integration/Packages-bug-598669-install-postfix-gets-exim-heavy b/test/integration/Packages-bug-598669-install-postfix-gets-exim-heavy new file mode 100644 index 000000000..a249d6ed3 --- /dev/null +++ b/test/integration/Packages-bug-598669-install-postfix-gets-exim-heavy @@ -0,0 +1,30 @@ +Package: exim4-daemon-heavy +Priority: optional +Section: mail +Installed-Size: 1060 +Maintainer: Exim4 Maintainers +Architecture: i386 +Source: exim4 +Version: 4.72-1 +Replaces: mail-transport-agent +Provides: mail-transport-agent +Conflicts: mail-transport-agent +Filename: pool/main/e/exim4/exim4-daemon-heavy_4.72-1_i386.deb +Size: 508988 +MD5sum: 7adf3b0ef8f134e70d19ee216e6f4452 +Description: Exim MTA (v4) daemon with extended features, including exiscan-acl + +Package: postfix +Priority: extra +Section: mail +Installed-Size: 3196 +Maintainer: LaMont Jones +Architecture: i386 +Version: 2.7.1-1 +Replaces: mail-transport-agent +Provides: mail-transport-agent +Conflicts: mail-transport-agent +Filename: pool/main/p/postfix/postfix_2.7.1-1_i386.deb +Size: 1325662 +MD5sum: 1ef63b6a62b4be120a9cdc312b81a698 +Description: High-performance mail transport agent diff --git a/test/integration/status-bug-598669-install-postfix-gets-exim-heavy b/test/integration/status-bug-598669-install-postfix-gets-exim-heavy new file mode 100644 index 000000000..fcf21dc45 --- /dev/null +++ b/test/integration/status-bug-598669-install-postfix-gets-exim-heavy @@ -0,0 +1,30 @@ +Package: exim4-daemon-light +Status: install ok installed +Priority: standard +Section: mail +Installed-Size: 952 +Maintainer: Exim4 Maintainers +Architecture: i386 +Source: exim4 +Version: 4.72-1 +Replaces: mail-transport-agent +Provides: mail-transport-agent +Conflicts: mail-transport-agent +Filename: pool/main/e/exim4/exim4-daemon-light_4.72-1_i386.deb +Size: 459500 +MD5sum: f32ccafef44bed2efcd526cd6501307d +Description: lightweight Exim MTA (v4) daemon + +Package: exim4 +Status: install ok installed +Priority: standard +Section: mail +Installed-Size: 60 +Maintainer: Exim4 Maintainers +Architecture: all +Version: 4.72-1 +Depends: exim4-daemon-light | exim4-daemon-heavy +Filename: pool/main/e/exim4/exim4_4.72-1_all.deb +Size: 7738 +MD5sum: 2f473b82bbabac9718ff3e755eaf85c1 +Description: metapackage to ease Exim MTA (v4) installation diff --git a/test/integration/test-bug-598669-install-postfix-gets-exim-heavy b/test/integration/test-bug-598669-install-postfix-gets-exim-heavy new file mode 100755 index 000000000..3fee63bbb --- /dev/null +++ b/test/integration/test-bug-598669-install-postfix-gets-exim-heavy @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +local TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture "i386" +setupaptarchive + +testequal "Reading package lists... +Building dependency tree... +The following packages will be REMOVED: + exim4 exim4-daemon-light +The following NEW packages will be installed: + postfix +0 upgraded, 1 newly installed, 2 to remove and 0 not upgraded. +Need to get 0 B/1326 kB of archives. +After this operation, 2236 kB of additional disk space will be used. +E: Trivial Only specified but this is not a trivial operation." aptget install postfix --trivial-only -- cgit v1.2.3 From 4b2a4ab8abb9f9b6ce262882480eee945a041d14 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 13 Oct 2010 12:23:25 +0200 Subject: merge fix for testrun on amd64 --- test/integration/framework | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index d832bedbe..95fce1247 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -64,6 +64,8 @@ runapt() { msgdebug "Executing: ${CCMD}$*${CDEBUG} " if [ -f ./aptconfig.conf ]; then APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* + elif [ -f ../aptconfig.conf ]; then + APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* else LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* fi -- cgit v1.2.3 From 9962ae934b367294a57b27d58f7cdb4e2d54ce04 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 13 Oct 2010 15:22:48 +0200 Subject: tests/integration/test-*: remove a bunch of "local" that are used outside funtions (bash complains) --- test/integration/run-tests | 2 +- test/integration/test-autoremove | 2 +- test/integration/test-bug-590438-broken-provides-thanks-to-remove-order | 2 +- test/integration/test-bug-591882-conkeror | 2 +- test/integration/test-bug-595691-empty-and-broken-archive-files | 2 +- test/integration/test-bug-598669-install-postfix-gets-exim-heavy | 2 +- test/integration/test-compressed-indexes | 2 +- test/integration/test-disappearing-packages | 2 +- test/integration/test-pdiff-usage | 2 +- test/integration/test-policy-pinning | 2 +- test/integration/test-ubuntu-bug-614993 | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) (limited to 'test/integration') diff --git a/test/integration/run-tests b/test/integration/run-tests index cb74f21e7..c7ea0a61a 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -1,7 +1,7 @@ #!/bin/sh set -e -local DIR=$(readlink -f $(dirname $0)) +DIR=$(readlink -f $(dirname $0)) for testcase in $(run-parts --list $DIR | grep '/test-'); do echo "\033[1;32mRun Testcase \033[1;35m$(basename ${testcase})\033[0m" ${testcase} diff --git a/test/integration/test-autoremove b/test/integration/test-autoremove index 7127b3d82..1ca325b29 100755 --- a/test/integration/test-autoremove +++ b/test/integration/test-autoremove @@ -1,7 +1,7 @@ #!/bin/sh set -e -local TESTDIR=$(readlink -f $(dirname $0)) +TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment configarchitecture 'i386' diff --git a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order index 9fd7741f4..3be0bec48 100755 --- a/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order +++ b/test/integration/test-bug-590438-broken-provides-thanks-to-remove-order @@ -1,7 +1,7 @@ #!/bin/sh set -e -local TESTDIR=$(readlink -f $(dirname $0)) +TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment diff --git a/test/integration/test-bug-591882-conkeror b/test/integration/test-bug-591882-conkeror index 27a217b5f..e1c0b42d1 100755 --- a/test/integration/test-bug-591882-conkeror +++ b/test/integration/test-bug-591882-conkeror @@ -1,7 +1,7 @@ #!/bin/sh set -e -local TESTDIR=$(readlink -f $(dirname $0)) +TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment configarchitecture "i386" 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 d982a4981..2f127221a 100755 --- a/test/integration/test-bug-595691-empty-and-broken-archive-files +++ b/test/integration/test-bug-595691-empty-and-broken-archive-files @@ -1,7 +1,7 @@ #!/bin/sh set -e -local TESTDIR=$(readlink -f $(dirname $0)) +TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment configarchitecture "i386" diff --git a/test/integration/test-bug-598669-install-postfix-gets-exim-heavy b/test/integration/test-bug-598669-install-postfix-gets-exim-heavy index 3fee63bbb..c3a77f346 100755 --- a/test/integration/test-bug-598669-install-postfix-gets-exim-heavy +++ b/test/integration/test-bug-598669-install-postfix-gets-exim-heavy @@ -1,7 +1,7 @@ #!/bin/sh set -e -local TESTDIR=$(readlink -f $(dirname $0)) +TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment configarchitecture "i386" diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes index 0b73f4c35..97a1453f7 100755 --- a/test/integration/test-compressed-indexes +++ b/test/integration/test-compressed-indexes @@ -1,7 +1,7 @@ #!/bin/sh set -e -local TESTDIR=$(readlink -f $(dirname $0)) +TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment diff --git a/test/integration/test-disappearing-packages b/test/integration/test-disappearing-packages index ebf2bb14f..12d215d7a 100755 --- a/test/integration/test-disappearing-packages +++ b/test/integration/test-disappearing-packages @@ -1,7 +1,7 @@ #!/bin/sh set -e -local TESTDIR=$(readlink -f $(dirname $0)) +TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment configarchitecture "i386" diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage index 85cbe9082..a70b6122c 100755 --- a/test/integration/test-pdiff-usage +++ b/test/integration/test-pdiff-usage @@ -1,7 +1,7 @@ #!/bin/sh set -e -local TESTDIR=$(readlink -f $(dirname $0)) +TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning index 97447b330..fa356ed54 100755 --- a/test/integration/test-policy-pinning +++ b/test/integration/test-policy-pinning @@ -1,7 +1,7 @@ #!/bin/sh set -e -local TESTDIR=$(readlink -f $(dirname $0)) +TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment diff --git a/test/integration/test-ubuntu-bug-614993 b/test/integration/test-ubuntu-bug-614993 index d70c65ba2..49955f231 100755 --- a/test/integration/test-ubuntu-bug-614993 +++ b/test/integration/test-ubuntu-bug-614993 @@ -1,7 +1,7 @@ #!/bin/sh set -e -local TESTDIR=$(readlink -f $(dirname $0)) +TESTDIR=$(readlink -f $(dirname $0)) . $TESTDIR/framework setupenvironment configarchitecture "amd64" -- cgit v1.2.3 From 94eb3bee531ae1f3042eb8378e383b34dd083851 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 13 Oct 2010 15:30:47 +0200 Subject: test/integration/framework: set proper dir::state::status --- test/integration/framework | 1 + 1 file changed, 1 insertion(+) (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index e2c5234e2..2422f0886 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -113,6 +113,7 @@ setupenvironment() { cp $(find $TESTDIR -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 echo "Debug::NoLocking \"true\";" >> aptconfig.conf echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf -- cgit v1.2.3