summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework28
-rwxr-xr-xtest/integration/test-apt-get-download11
-rwxr-xr-xtest/integration/test-bug-590041-prefer-non-virtual-packages2
-rwxr-xr-xtest/integration/test-bug-595691-empty-and-broken-archive-files8
-rwxr-xr-xtest/integration/test-bug-601016-description-translation34
-rwxr-xr-xtest/integration/test-bug-612099-multiarch-conflicts7
-rwxr-xr-xtest/integration/test-bug-624218-Translation-file-handling87
-rwxr-xr-xtest/integration/test-disappearing-packages14
-rwxr-xr-xtest/integration/test-ubuntu-bug-761175-remove-purge8
-rw-r--r--test/interactive-helper/extract-control.cc1
-rw-r--r--test/interactive-helper/test_udevcdrom.cc5
-rw-r--r--test/interactive-helper/testextract.cc2
-rw-r--r--test/libapt/assert.h27
-rw-r--r--test/libapt/getlanguages_test.cc12
-rw-r--r--test/libapt/getlistoffilesindir_test.cc2
-rw-r--r--test/libapt/hashsums_test.cc2
-rw-r--r--test/libapt/parsedepends_test.cc4
-rwxr-xr-xtest/libapt/run-tests3
-rw-r--r--test/libapt/strutil_test.cc2
19 files changed, 210 insertions, 49 deletions
diff --git a/test/integration/framework b/test/integration/framework
index a2e71760e..b55f793a4 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -149,6 +149,7 @@ setupenvironment() {
echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
+ echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it…
echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
echo 'quiet::NoUpdate "true";' >> aptconfig.conf
export LC_ALL=C
@@ -156,13 +157,26 @@ 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-architecture -qDEB_BUILD_ARCH
+ fi
+ else
+ echo $1
+ fi
+}
+
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
}
@@ -275,7 +289,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 +312,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
@@ -408,7 +423,7 @@ 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' ' ')"
else
@@ -465,7 +480,7 @@ insertinstalledpackage() {
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
+ 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
@@ -715,8 +730,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/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-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-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..dd9efb785 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,9 +15,6 @@ 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
testequal 'Reading package lists...
diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling
new file mode 100755
index 000000000..a1e708d2e
--- /dev/null
+++ b/test/integration/test-bug-624218-Translation-file-handling
@@ -0,0 +1,87 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'
+
+setupaptarchive
+
+changetowebserver
+
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'No download of non-existent locals' 'with Index'
+LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of existent locals' 'with Index'
+LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of en in LC_ALL=C' 'with Index'
+LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of en as forced language' 'with Index'
+aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of nothing else in forced language' 'with Index'
+aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download no Translation- if forced language is non-existent' 'with Index'
+aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+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')
+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
+
+msgtest 'Download of nothing else in forced language' 'without Index'
+aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of ast_DE as forced language' 'without Index'
+aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-ast_DE$' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of nothing else in forced language' 'without Index'
+aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-[^a][^s]' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+msgtest 'Download of nothing if none is forced' 'without Index'
+aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
+
+mkdir -p rootdir/var/lib/apt/lists
+touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE
+
+msgtest 'Download of builtin files' 'without Index'
+aptget update | grep -q -e 'Translation-ast_DE' && msgpass || msgfail
+rm -rf rootdir/var/lib/apt/lists
+
+mkdir -p rootdir/var/lib/apt/lists
+touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE
+
+msgtest 'Download of nothing (even builtin) if none is forced' 'without Index'
+aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
+rm -rf rootdir/var/lib/apt/lists
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-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/interactive-helper/extract-control.cc b/test/interactive-helper/extract-control.cc
index 29dcbf371..a1b3600aa 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>
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
index b790df618..f7ddb72f0 100644
--- a/test/interactive-helper/testextract.cc
+++ b/test/interactive-helper/testextract.cc
@@ -6,6 +6,8 @@
#include <apt-pkg/extract.h>
#include <apt-pkg/init.h>
#include <apt-pkg/strutl.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgsystem.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/test/libapt/assert.h b/test/libapt/assert.h
index fae9b6c64..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__)
@@ -54,6 +66,21 @@ void assertEqualsOr2(int const &expect1, int const &expect2, unsigned int const
}
+#define equalsOr3(w,x,y,z) assertEqualsOr3(x, y, z, w, __LINE__)
+
+template < typename X, typename Y >
+void OutputAssertEqualOr3(X expect1, X expect2, X expect3, char const* compare, Y get, unsigned long const &line) {
+ std::cerr << "Test FAILED: »" << expect1 << "« or »" << expect2 << "« or »" << expect3 << "« " << compare << " »" << get << "« at line " << line << std::endl;
+}
+
+template < typename X, typename Y >
+void assertEqualsOr3(X expect1, X expect2, X expect3, Y get, unsigned long const &line) {
+ if (expect1 == get || expect2 == get || expect3 == get)
+ return;
+ OutputAssertEqualOr3(expect1, expect2, expect3, "==", get, line);
+}
+
+
// simple helper to quickly output a vectors
template < typename X >
void dumpVector(X vec) {
diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc
index f6aa7a697..a1c801ea2 100644
--- a/test/libapt/getlanguages_test.cc
+++ b/test/libapt/getlanguages_test.cc
@@ -126,13 +126,19 @@ int main(int argc,char *argv[])
_config->Set("Dir::State::lists", argv[1]);
vec = APT::Configuration::getLanguages(true, false, env);
- equals(vec.size(), 6);
+ equals(vec.size(), 7);
equals(vec[0], "de_DE");
equals(vec[1], "de");
equals(vec[2], "en");
equals(vec[3], "none");
- equalsOr2(vec[4], "pt", "tr");
- equalsOr2(vec[5], "tr", "pt");
+ equalsOr3(vec[4], "pt", "tr", "ast_DE");
+ equalsOr3(vec[5], "tr", "pt", "ast_DE");
+ equalsOr3(vec[6], "tr", "pt", "ast_DE");
+
+ _config->Set("Acquire::Languages", "none");
+ vec = APT::Configuration::getLanguages(true, false, env);
+ equals(vec.size(), 0);
+ _config->Set("Acquire::Languages", "");
_config->Set("Dir::State::lists", "/non-existing-dir");
_config->Set("Acquire::Languages::1", "none");
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/hashsums_test.cc b/test/libapt/hashsums_test.cc
index 2cb71cc38..396e4cf6b 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -146,7 +146,7 @@ int main(int argc, char** argv)
equals(sha2.VerifyFile(argv[1]), true);
}
{
- HashString sha2("SHA256:"+string(argv[4]));
+ HashString sha2("SHA256:" + std::string(argv[4]));
equals(sha2.VerifyFile(argv[1]), true);
}
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 8cb2e049c..ada2dc38b 100755
--- a/test/libapt/run-tests
+++ b/test/libapt/run-tests
@@ -64,7 +64,8 @@ do
touch "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tr" \
"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-pt" \
"${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-se~" \
- "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak"
+ "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-st.bak" \
+ "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-ast_DE"
elif [ $name = "HashSums${EXT}" ]; then
TMP="$(mktemp)"
dmesg > $TMP
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";