summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-01-16 22:17:23 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2012-01-16 22:17:23 +0100
commite70c1d067335bfa686fa0c6e75e32afb095e1aaa (patch)
treee985e74ed4d613126b24839d710e4b49db753824 /test
parente75aa33384d52635fba502bed628bc68f9cb5066 (diff)
parent85e1885525977809ff6a3b70abb84d3a63e41817 (diff)
merged from debian-experimental2
Diffstat (limited to 'test')
-rw-r--r--test/integration/Packages-pdiff-usage-new26
-rw-r--r--test/integration/framework2
-rwxr-xr-xtest/integration/test-dpkg-assert-multi-arch53
-rwxr-xr-xtest/integration/test-implicit-conflicts-real-not-virtual56
-rwxr-xr-xtest/integration/test-multiarch-foreign150
-rw-r--r--test/libapt/cdromfindpackages_test.cc86
-rw-r--r--test/libapt/makefile6
-rwxr-xr-xtest/libapt/run-tests29
8 files changed, 394 insertions, 14 deletions
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 b55f793a4..2ea1844f0 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -102,7 +102,7 @@ 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() {
diff --git a/test/integration/test-dpkg-assert-multi-arch b/test/integration/test-dpkg-assert-multi-arch
new file mode 100755
index 000000000..b1ec73e18
--- /dev/null
+++ b/test/integration/test-dpkg-assert-multi-arch
@@ -0,0 +1,53 @@
+#!/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'
+
+setupaptarchive
+
+testqualifier() {
+ msgtest 'Test for correct qualifier mode' $2
+ GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -- '--configure' | sed -e 's/^.*--configure \([^ ]*\).*$/\1/')"
+ test "$GIVEN" = "$2" && msgpass || msgfail
+}
+
+# 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
+ 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'
+
+# multiarch dpkg (new interface version)
+
+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'
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/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/makefile b/test/libapt/makefile
index d3dddaeed..1952051e2 100644
--- a/test/libapt/makefile
+++ b/test/libapt/makefile
@@ -74,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/run-tests b/test/libapt/run-tests
index ada2dc38b..5fff4ecca 100755
--- a/test/libapt/run-tests
+++ b/test/libapt/run-tests
@@ -75,6 +75,35 @@ do
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} "