diff options
author | Michael Vogt <egon@debian-devbox> | 2011-07-25 15:54:03 +0200 |
---|---|---|
committer | Michael Vogt <egon@debian-devbox> | 2011-07-25 15:54:03 +0200 |
commit | 35b55cbc1ccebe25a9e3cafd5f4fc1156bf79228 (patch) | |
tree | 190a33e013cbd0cfd96518707a3176aa44a64f13 /test | |
parent | 555a487afb510c561d094f27bb08119694e7388f (diff) | |
parent | 234675b71a2caab5c7cc0dc3b32a241683d3b3d2 (diff) |
merged from lp:~donkult/apt/sid0.8.15.3
Diffstat (limited to 'test')
-rw-r--r-- | test/integration/framework | 22 | ||||
-rwxr-xr-x | test/integration/test-bug-632221-cross-dependency-satisfaction | 183 | ||||
-rw-r--r-- | test/libapt/assert.h | 42 | ||||
-rw-r--r-- | test/libapt/getarchitectures_test.cc | 6 | ||||
-rw-r--r-- | test/libapt/getlanguages_test.cc | 4 |
5 files changed, 251 insertions, 6 deletions
diff --git a/test/integration/framework b/test/integration/framework index 702e352a3..fa451cf4f 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -151,6 +151,7 @@ setupenvironment() { configarchitecture() { local CONFFILE=rootdir/etc/apt/apt.conf.d/01multiarch.conf + rm -f $CONFFILE echo "APT::Architecture \"$1\";" > $CONFFILE shift while [ -n "$1" ]; do @@ -429,6 +430,27 @@ Filename: pool/main/${NAME}/${NAME}_${VERSION}_${arch}.deb" >> $FILE done } +insertsource() { + local RELEASE="$1" + local NAME="$2" + local ARCH="$3" + local VERSION="$4" + local DEPENDENCIES="$5" + local ARCHS="" + local SPATH="aptarchive/dists/${RELEASE}/main/source" + mkdir -p $SPATH + local FILE="${SPATH}/Sources" + echo "Package: $NAME +Binary: $NAME +Version: $VERSION +Maintainer: Joe Sixpack <joe@example.org> +Architecture: $ARCH" >> $FILE + test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE + echo "Files: + d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.dsc + d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz" >> $FILE +} + insertinstalledpackage() { local NAME="$1" local ARCH="$2" diff --git a/test/integration/test-bug-632221-cross-dependency-satisfaction b/test/integration/test-bug-632221-cross-dependency-satisfaction new file mode 100755 index 000000000..58de44843 --- /dev/null +++ b/test/integration/test-bug-632221-cross-dependency-satisfaction @@ -0,0 +1,183 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'armel' + +insertinstalledpackage 'build-essential' 'all' '11.5' + +insertpackage 'unstable' 'doxygen' 'amd64,armel' '1.0' +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' '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' + +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. +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]) +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 + +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. +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:armel (1.0 unstable [armel]) +Inst libc6 (1.0 unstable [amd64]) +Inst libc6-dev:armel (1.0 unstable [armel]) +Inst libc6-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: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 + +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. +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]) +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 + +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. +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:amd64 (1.0 unstable [amd64]) +Inst libc6-dev (1.0 unstable [armel]) +Inst libc6-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]) +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 + +configarchitecture 'amd64' 'armel' + +insertinstalledpackage 'cool' 'amd64' '0.5' +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. +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]) +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 + +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. +Inst amdboot (1.0 unstable [amd64]) +Inst doxygen (1.0 unstable [amd64]) +Inst libc6:armel (1.0 unstable [armel]) +Inst libc6 (1.0 unstable [amd64]) +Inst libc6-dev:armel (1.0 unstable [armel]) +Inst libc6-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: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 + +configarchitecture 'armel' 'amd64' + +# cool 0.5 is not M-A: allowed, so amd64 is not acceptable +testequal 'Reading package lists... +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. +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]) +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 + +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. +Inst amdboot:amd64 (1.0 unstable [amd64]) +Inst doxygen (1.0 unstable [armel]) +Inst libc6 (1.0 unstable [armel]) +Inst libc6:amd64 (1.0 unstable [amd64]) +Inst libc6-dev (1.0 unstable [armel]) +Inst libc6-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 + + diff --git a/test/libapt/assert.h b/test/libapt/assert.h index 5da76ae0a..92b662dfa 100644 --- a/test/libapt/assert.h +++ b/test/libapt/assert.h @@ -1,9 +1,9 @@ #include <iostream> -#define equals(x,y) assertEquals(x, y, __LINE__) +#define equals(x,y) assertEquals(y, x, __LINE__) template < typename X, typename Y > -void OutputAssert(X expect, char const* compare, Y get, unsigned long const &line) { +void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) { std::cerr << "Test FAILED: »" << expect << "« " << compare << " »" << get << "« at line " << line << std::endl; } @@ -11,11 +11,45 @@ template < typename X, typename Y > void assertEquals(X expect, Y get, unsigned long const &line) { if (expect == get) return; - OutputAssert(expect, "==", get, line); + OutputAssertEqual(expect, "==", get, line); } void assertEquals(unsigned int const &expect, int const &get, unsigned long const &line) { if (get < 0) - OutputAssert(expect, "==", get, line); + OutputAssertEqual(expect, "==", get, line); assertEquals<unsigned int const&, unsigned int const&>(expect, get, line); } + +void assertEquals(int const &expect, unsigned int const &get, unsigned long const &line) { + if (expect < 0) + OutputAssertEqual(expect, "==", get, line); + assertEquals<unsigned int const&, unsigned int const&>(expect, get, line); +} + + +#define equalsOr2(x,y,z) assertEqualsOr2(y, z, x, __LINE__) + +template < typename X, typename Y > +void OutputAssertEqualOr2(X expect1, X expect2, char const* compare, Y get, unsigned long const &line) { + std::cerr << "Test FAILED: »" << expect1 << "« or »" << expect2 << "« " << compare << " »" << get << "« at line " << line << std::endl; +} + +template < typename X, typename Y > +void assertEqualsOr2(X expect1, X expect2, Y get, unsigned long const &line) { + if (expect1 == get || expect2 == get) + return; + OutputAssertEqualOr2(expect1, expect2, "==", get, line); +} + +void assertEqualsOr2(unsigned int const &expect1, unsigned int const &expect2, int const &get, unsigned long const &line) { + if (get < 0) + OutputAssertEqualOr2(expect1, expect2, "==", get, line); + assertEqualsOr2<unsigned int const&, unsigned int const&>(expect1, expect2, get, line); +} + +void assertEqualsOr2(int const &expect1, int const &expect2, unsigned int const &get, unsigned long const &line) { + if (expect1 < 0 && expect2 < 0) + OutputAssertEqualOr2(expect1, expect2, "==", get, line); + assertEqualsOr2<unsigned int const&, unsigned int const&>(expect1, expect2, get, line); +} + diff --git a/test/libapt/getarchitectures_test.cc b/test/libapt/getarchitectures_test.cc index 1500caeed..e3ca7bbc2 100644 --- a/test/libapt/getarchitectures_test.cc +++ b/test/libapt/getarchitectures_test.cc @@ -39,6 +39,12 @@ int main(int argc,char *argv[]) _config->Set("APT::Architecture", "armel"); vec = APT::Configuration::getArchitectures(false); equals(vec.size(), 2); + equals(vec[0], "armel"); + equals(vec[1], "i386"); + + _config->Set("APT::Architectures::2", "armel"); + vec = APT::Configuration::getArchitectures(false); + equals(vec.size(), 2); equals(vec[0], "i386"); equals(vec[1], "armel"); diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc index 707142aef..3d63e0e74 100644 --- a/test/libapt/getlanguages_test.cc +++ b/test/libapt/getlanguages_test.cc @@ -138,8 +138,8 @@ int main(int argc,char *argv[]) equals(vec[1], "de"); equals(vec[2], "en"); equals(vec[3], "none"); - equals(vec[4], "pt"); - equals(vec[5], "tr"); + equalsOr2(vec[4], "pt", "tr"); + equalsOr2(vec[5], "tr", "pt"); _config->Set("Dir::State::lists", "/non-existing-dir"); _config->Set("Acquire::Languages::1", "none"); |