summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework339
-rwxr-xr-xtest/integration/skip-aptwebserver25
-rwxr-xr-xtest/integration/test-00-commands-have-help63
-rwxr-xr-xtest/integration/test-acquire-same-file-multiple-times80
-rwxr-xr-xtest/integration/test-acquire-same-repository-multiple-times81
-rwxr-xr-xtest/integration/test-allow-scores-for-all-dependency-types49
-rwxr-xr-xtest/integration/test-apt-acquire-additional-files95
-rwxr-xr-xtest/integration/test-apt-by-hash-update14
-rwxr-xr-xtest/integration/test-apt-cache124
-rwxr-xr-xtest/integration/test-apt-cdrom32
-rwxr-xr-xtest/integration/test-apt-cli-list21
-rwxr-xr-xtest/integration/test-apt-cli-search25
-rwxr-xr-xtest/integration/test-apt-cli-show19
-rwxr-xr-xtest/integration/test-apt-cli-update9
-rwxr-xr-xtest/integration/test-apt-cli-upgrade6
-rwxr-xr-xtest/integration/test-apt-config36
-rwxr-xr-xtest/integration/test-apt-download-progress42
-rwxr-xr-xtest/integration/test-apt-extracttemplates69
-rwxr-xr-xtest/integration/test-apt-ftparchive-cachedb46
-rwxr-xr-xtest/integration/test-apt-ftparchive-cachedb-lp12744668
-rwxr-xr-xtest/integration/test-apt-ftparchive-src-cachedb84
-rwxr-xr-xtest/integration/test-apt-get-autoremove6
-rwxr-xr-xtest/integration/test-apt-get-build-dep6
-rwxr-xr-xtest/integration/test-apt-get-changelog104
-rwxr-xr-xtest/integration/test-apt-get-download2
-rwxr-xr-xtest/integration/test-apt-get-install-deb21
-rwxr-xr-xtest/integration/test-apt-get-source62
-rwxr-xr-xtest/integration/test-apt-get-source-arch39
-rwxr-xr-xtest/integration/test-apt-get-source-authenticated3
-rwxr-xr-xtest/integration/test-apt-get-source-multisources18
-rwxr-xr-xtest/integration/test-apt-get-update-unauth-warning59
-rwxr-xr-xtest/integration/test-apt-get-upgrade92
-rwxr-xr-xtest/integration/test-apt-helper59
-rwxr-xr-xtest/integration/test-apt-https-no-redirect15
-rwxr-xr-xtest/integration/test-apt-key11
-rwxr-xr-xtest/integration/test-apt-key-net-update4
-rwxr-xr-xtest/integration/test-apt-mark101
-rwxr-xr-xtest/integration/test-apt-progress-fd79
-rwxr-xr-xtest/integration/test-apt-progress-fd-deb82221
-rwxr-xr-xtest/integration/test-apt-progress-fd-error2
-rwxr-xr-xtest/integration/test-apt-sources-deb82255
-rwxr-xr-xtest/integration/test-apt-tagfile-fields-order82
-rwxr-xr-xtest/integration/test-apt-translation-has-no-packages6
-rwxr-xr-xtest/integration/test-apt-update-expected-size93
-rwxr-xr-xtest/integration/test-apt-update-file29
-rwxr-xr-xtest/integration/test-apt-update-ims178
-rwxr-xr-xtest/integration/test-apt-update-nofallback24
-rwxr-xr-xtest/integration/test-apt-update-not-modified161
-rwxr-xr-xtest/integration/test-apt-update-rollback25
-rwxr-xr-xtest/integration/test-apt-update-stale13
-rwxr-xr-xtest/integration/test-apt-update-transactions43
-rwxr-xr-xtest/integration/test-architecture-specification-parsing20
-rwxr-xr-xtest/integration/test-authentication-basic6
-rwxr-xr-xtest/integration/test-bug-470115-new-and-tighten-recommends20
-rwxr-xr-xtest/integration/test-bug-507998-dist-upgrade-recommends2
-rwxr-xr-xtest/integration/test-bug-543966-downgrade-below-1000-pin92
-rwxr-xr-xtest/integration/test-bug-549968-install-depends-of-not-installed2
-rwxr-xr-xtest/integration/test-bug-590041-prefer-non-virtual-packages8
-rwxr-xr-xtest/integration/test-bug-590438-broken-provides-thanks-to-remove-order2
-rwxr-xr-xtest/integration/test-bug-591882-conkeror4
-rwxr-xr-xtest/integration/test-bug-593360-modifiers-in-names16
-rwxr-xr-xtest/integration/test-bug-595691-empty-and-broken-archive-files33
-rwxr-xr-xtest/integration/test-bug-596498-trusted-unsigned-repo20
-rwxr-xr-xtest/integration/test-bug-598669-install-postfix-gets-exim-heavy2
-rwxr-xr-xtest/integration/test-bug-601961-install-info6
-rwxr-xr-xtest/integration/test-bug-602412-dequote-redirect8
-rwxr-xr-xtest/integration/test-bug-604222-new-and-autoremove10
-rwxr-xr-xtest/integration/test-bug-605394-versioned-or-groups2
-rwxr-xr-xtest/integration/test-bug-611729-mark-as-manual6
-rwxr-xr-xtest/integration/test-bug-612099-multiarch-conflicts30
-rwxr-xr-xtest/integration/test-bug-612557-garbage-upgrade6
-rwxr-xr-xtest/integration/test-bug-613420-new-garbage-dependency2
-rwxr-xr-xtest/integration/test-bug-618848-always-respect-user-requests2
-rwxr-xr-xtest/integration/test-bug-624218-Translation-file-handling54
-rwxr-xr-xtest/integration/test-bug-632221-cross-dependency-satisfaction30
-rwxr-xr-xtest/integration/test-bug-64141-install-dependencies-for-on-hold4
-rwxr-xr-xtest/integration/test-bug-657695-resolver-breaks-on-virtuals2
-rwxr-xr-xtest/integration/test-bug-661537-build-profiles-support8
-rwxr-xr-xtest/integration/test-bug-675449-essential-are-protected10
-rwxr-xr-xtest/integration/test-bug-679371-apt-get-autoclean-multiarch2
-rwxr-xr-xtest/integration/test-bug-680041-apt-mark-holds-correctly20
-rwxr-xr-xtest/integration/test-bug-683786-build-dep-on-virtual-packages18
-rwxr-xr-xtest/integration/test-bug-686346-package-missing-architecture10
-rwxr-xr-xtest/integration/test-bug-689582-100-char-long-path-names2
-rwxr-xr-xtest/integration/test-bug-691453-apt-cache-search-multi-pattern12
-rwxr-xr-xtest/integration/test-bug-709560-set-candidate-release2
-rwxr-xr-xtest/integration/test-bug-712435-missing-descriptions18
-rwxr-xr-xtest/integration/test-bug-717891-abolute-uris-for-proxies2
-rwxr-xr-xtest/integration/test-bug-718329-support-data.tar-uncompressed (renamed from test/integration/test-apt-bug-718329-support-data.tar)9
-rwxr-xr-xtest/integration/test-bug-719263-print-uris-removes-authentication2
-rwxr-xr-xtest/integration/test-bug-720597-build-dep-purge4
-rwxr-xr-xtest/integration/test-bug-722207-print-uris-even-if-very-quiet23
-rwxr-xr-xtest/integration/test-bug-723586-any-stripped-in-single-arch10
-rwxr-xr-xtest/integration/test-bug-728500-tempdir2
-rwxr-xr-xtest/integration/test-bug-732746-preferences2
-rwxr-xr-xtest/integration/test-bug-735967-lib32-to-i386-unavailable8
-rwxr-xr-xtest/integration/test-bug-738785-switch-protocol31
-rwxr-xr-xtest/integration/test-bug-745036-new-foreign-invalidates-cache2
-rwxr-xr-xtest/integration/test-bug-745046-candidate-propagation-fails4
-rwxr-xr-xtest/integration/test-bug-753297-upgradable4
-rwxr-xr-xtest/integration/test-bug-758153-versioned-provides-support88
-rwxr-xr-xtest/integration/test-bug-769609-triggers-still-pending-after-run75
-rwxr-xr-xtest/integration/test-bug-770291-reinstall98
-rwxr-xr-xtest/integration/test-bug-778375-server-has-no-reason-phrase40
-rwxr-xr-xtest/integration/test-bug-782777-single-arch-weirdness72
-rwxr-xr-xtest/integration/test-bug-lp1445239-download-loop29
-rwxr-xr-xtest/integration/test-bug-multiarch-upgrade2
-rwxr-xr-xtest/integration/test-cachecontainer-architecture-specification32
-rwxr-xr-xtest/integration/test-compressed-indexes28
-rwxr-xr-xtest/integration/test-conflicts-loop2
-rwxr-xr-xtest/integration/test-conflicts-real-multiarch-same6
-rwxr-xr-xtest/integration/test-cve-2013-1051-InRelease-parsing23
-rwxr-xr-xtest/integration/test-essential-force-loopbreak2
-rwxr-xr-xtest/integration/test-external-dependency-solver-protocol36
-rwxr-xr-xtest/integration/test-failing-maintainer-scripts46
-rwxr-xr-xtest/integration/test-handling-broken-orgroups14
-rwxr-xr-xtest/integration/test-ignore-provides-if-versioned-breaks18
-rwxr-xr-xtest/integration/test-ignore-provides-if-versioned-conflicts18
-rwxr-xr-xtest/integration/test-implicit-conflicts-real-not-virtual8
-rwxr-xr-xtest/integration/test-kernel-helper-autoremove13
-rwxr-xr-xtest/integration/test-method-rred194
-rwxr-xr-xtest/integration/test-multiarch-foreign169
-rwxr-xr-xtest/integration/test-no-fds-leaked-to-maintainer-scripts119
-rwxr-xr-xtest/integration/test-ordering-ignore-not-matching-breaks8
-rwxr-xr-xtest/integration/test-package-reinstallation2
-rwxr-xr-xtest/integration/test-partial-file-support75
-rwxr-xr-xtest/integration/test-pdiff-usage108
-rwxr-xr-xtest/integration/test-pin-non-existent-package12
-rwxr-xr-xtest/integration/test-policy-pinning106
-rwxr-xr-xtest/integration/test-prefer-higher-priority-providers14
-rwxr-xr-xtest/integration/test-prefer-native-architecture-over-higher-priority2
-rwxr-xr-xtest/integration/test-prevent-markinstall-multiarch-same-versionscrew6
-rwxr-xr-xtest/integration/test-provides-gone-with-upgrade2
-rwxr-xr-xtest/integration/test-release-candidate-switching32
-rwxr-xr-xtest/integration/test-releasefile-date-older62
-rwxr-xr-xtest/integration/test-releasefile-valid-until37
-rwxr-xr-xtest/integration/test-releasefile-verification104
-rwxr-xr-xtest/integration/test-resolve-by-keep-new-recommends2
-rwxr-xr-xtest/integration/test-sourceslist-trusted-options4
-rwxr-xr-xtest/integration/test-specific-architecture-dependencies172
-rwxr-xr-xtest/integration/test-suggest-installed-multiarch-silbing16
-rwxr-xr-xtest/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum48
-rwxr-xr-xtest/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings12
-rwxr-xr-xtest/integration/test-ubuntu-bug-1304403-obsolete-priority-standard4
-rwxr-xr-xtest/integration/test-ubuntu-bug-346386-apt-get-update-paywall3
-rwxr-xr-xtest/integration/test-ubuntu-bug-6149932
-rwxr-xr-xtest/integration/test-ubuntu-bug-761175-remove-purge63
-rwxr-xr-xtest/integration/test-ubuntu-bug-784473-InRelease-one-message-only2
-rwxr-xr-xtest/integration/test-ubuntu-bug-802901-multiarch-early-remove2
-rwxr-xr-xtest/integration/test-ubuntu-bug-806274-install-suggests8
-rwxr-xr-xtest/integration/test-ubuntu-bug-859188-multiarch-reinstall8
-rwxr-xr-xtest/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering2
-rwxr-xr-xtest/integration/test-unpack-different-version-unpacked14
-rwxr-xr-xtest/integration/test-xorg-break-providers6
-rw-r--r--test/interactive-helper/aptwebserver.cc328
-rw-r--r--test/libapt/acqprogress_test.cc178
-rw-r--r--test/libapt/cdrom_test.cc3
-rw-r--r--test/libapt/fileutl_test.cc38
-rw-r--r--test/libapt/hashsums_test.cc27
-rw-r--r--test/libapt/indexcopytosourcelist_test.cc2
-rw-r--r--test/libapt/makefile10
-rw-r--r--test/libapt/sourcelist_test.cc2
-rw-r--r--test/libapt/strutil_test.cc22
-rw-r--r--test/libapt/tagfile_test.cc6
-rw-r--r--test/libapt/tagsection_test.cc270
-rw-r--r--test/libapt/uri_test.cc51
166 files changed, 4714 insertions, 1567 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 153c5bb25..5d949009f 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -3,7 +3,7 @@
EXIT_CODE=0
# we all like colorful messages
-if [ "$MSGCOLOR" != 'NO' ]; then
+if [ "$MSGCOLOR" != 'NO' ] && [ "$MSGCOLOR" != 'ALWAYS' ]; then
if [ ! -t 1 ]; then # but check that we output to a terminal
export MSGCOLOR='NO'
fi
@@ -128,15 +128,23 @@ aptwebserver() { runapt "${APTWEBSERVERBINDIR}/aptwebserver" "$@"; }
aptitude() { runapt aptitude "$@"; }
aptextracttemplates() { runapt apt-extracttemplates "$@"; }
aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; }
+aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; }
dpkg() {
- command dpkg --root=${TMPWORKINGDIRECTORY}/rootdir --force-not-root --force-bad-path --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log "$@"
+ "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@"
}
dpkgcheckbuilddeps() {
command dpkg-checkbuilddeps --admindir=${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg "$@"
}
gdb() {
- local CMD="$1"
+ local CMD
+ case "$1" in
+ aptget) CMD="apt-get";;
+ aptcache) CMD="apt-cache";;
+ aptmark) CMD="apt-mark";;
+ apthelper) CMD="apt-helper";;
+ *) CMD="$1";;
+ esac
shift
runapt command gdb --quiet -ex run "${BUILDDIRECTORY}/$CMD" --args "${BUILDDIRECTORY}/$CMD" "$@"
}
@@ -188,12 +196,14 @@ setupenvironment() {
TESTDIRECTORY=$(readlink -f $(dirname $0))
# allow overriding the default BUILDDIR location
+ SOURCEDIRECTORY=${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}
BUILDDIRECTORY=${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}
LIBRARYPATH=${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}
METHODSDIR=${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}
APTHELPERBINDIR=${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}
APTWEBSERVERBINDIR=${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}
APTINTERNALSOLVER=${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}
+ APTDUMPSOLVER=${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/apt-dump-solver"}
test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
# -----
@@ -201,7 +211,7 @@ setupenvironment() {
mkdir rootdir aptarchive keys
cd rootdir
mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d
- mkdir -p usr/bin var/cache var/lib/apt var/log tmp
+ mkdir -p usr/bin var/cache var/lib var/log tmp
mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers
touch var/lib/dpkg/available
mkdir -p usr/lib/apt
@@ -234,9 +244,8 @@ setupenvironment() {
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::Methods \"${METHODSDIR}\";" >> aptconfig.conf
+ echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf
# store apt-key were we can access it, even if we run it as a different user
# destroys coverage reporting though, so just do it for root for now
if [ "$(id -u)" = '0' ]; then
@@ -246,22 +255,37 @@ setupenvironment() {
else
echo "Dir::Bin::apt-key \"${BUILDDIRECTORY}/apt-key\";" >> aptconfig.conf
fi
- echo "Dir::Bin::dpkg \"fakeroot\";" >> aptconfig.conf
- echo "DPKG::options:: \"dpkg\";" >> aptconfig.conf
- 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 ! command dpkg --assert-multi-arch >/dev/null 2>&1; 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
- echo 'quiet::NoStatistic "true";' >> aptconfig.conf
- # too distracting for users, but helpful to detect changes
- echo 'Acquire::Progress::Ignore::ShowErrorText "true";' >> aptconfig.conf
- # in testcases, it can appear as if localhost has a rotation setup,
- # hide this as we can't really deal with it properly
- echo 'Acquire::Failure::ShowIP "false";' >> aptconfig.conf
+
+ cat << EOF > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg"
+#!/bin/sh
+set -e
+if [ -r "${TMPWORKINGDIRECTORY}/noopchroot.so" ]; then
+ if [ -n "\$LD_PRELOAD" ]; then
+ export LD_PRELOAD="${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}"
+ else
+ export LD_PRELOAD="${TMPWORKINGDIRECTORY}/noopchroot.so"
+ fi
+fi
+exec fakeroot dpkg --root="${TMPWORKINGDIRECTORY}/rootdir" \\
+ --log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log \\
+ --force-not-root --force-bad-path "\$@"
+EOF
+ chmod +x "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg"
+ echo "Dir::Bin::dpkg \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg\";" > rootdir/etc/apt/apt.conf.d/99dpkg
+
+ {
+ if ! command dpkg --assert-multi-arch >/dev/null 2>&1; then
+ echo "DPKG::options:: \"--force-architecture\";" # Added to test multiarch before dpkg is ready for it…
+ fi
+ echo 'quiet::NoUpdate "true";'
+ echo 'quiet::NoStatistic "true";'
+ # too distracting for users, but helpful to detect changes
+ echo 'Acquire::Progress::Ignore::ShowErrorText "true";'
+ echo 'Acquire::Progress::Diffpercent "true";'
+ # in testcases, it can appear as if localhost has a rotation setup,
+ # hide this as we can't really deal with it properly
+ echo 'Acquire::Failure::ShowIP "false";'
+ } >> aptconfig.conf
cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem"
if [ "$(id -u)" = '0' ]; then
@@ -271,6 +295,14 @@ setupenvironment() {
echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary
configcompression '.' 'gz' #'bz2' 'lzma' 'xz'
+ # create some files in /tmp and look at user/group to get what this means
+ TEST_DEFAULT_USER="$USER"
+ if [ "$(uname)" = 'GNU/kFreeBSD' ]; then
+ TEST_DEFAULT_GROUP='root'
+ else
+ TEST_DEFAULT_GROUP="$USER"
+ fi
+
# Acquire::AllowInsecureRepositories=false is not yet the default
# but we want it to be the default soon
configallowinsecurerepositories "false";
@@ -299,7 +331,7 @@ getarchitecture() {
}
getarchitectures() {
- echo "$(aptconfig dump | grep APT::Architecture | cut -d'"' -f 2 | sed '/^$/ d' | sort | uniq | tr '\n' ' ')"
+ aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' '
}
getarchitecturesfromcommalist() {
@@ -349,6 +381,47 @@ configdpkg() {
fi
}
+configdpkgnoopchroot() {
+ # create a library to noop chroot() and rewrite maintainer script executions
+ # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown
+ # chroot directory dpkg could chroot into to execute the maintainer scripts
+ msgtest 'Building library to preload to make maintainerscript work in' 'dpkg'
+ cat << EOF > noopchroot.c
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <dlfcn.h>
+
+static char * chrootdir = NULL;
+
+int chroot(const char *path) {
+ printf("WARNING: CHROOTing to %s was ignored!\n", path);
+ free(chrootdir);
+ chrootdir = strdup(path);
+ return 0;
+}
+int execvp(const char *file, char *const argv[]) {
+ static int (*func_execvp) (const char *, char * const []) = NULL;
+ if (func_execvp == NULL)
+ func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp");
+ if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0)
+ return func_execvp(file, argv);
+ printf("REWRITE execvp call %s into %s\n", file, chrootdir);
+ char newfile[strlen(chrootdir) + strlen(file)];
+ strcpy(newfile, chrootdir);
+ strcat(newfile, file);
+ char const * const baseadmindir = "/var/lib/dpkg";
+ char admindir[strlen(chrootdir) + strlen(baseadmindir)];
+ strcpy(admindir, chrootdir);
+ strcat(admindir, baseadmindir);
+ setenv("DPKG_ADMINDIR", admindir, 1);
+ return func_execvp(newfile, argv);
+}
+EOF
+ testsuccess --nomsg gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl
+}
+
configallowinsecurerepositories() {
echo "Acquire::AllowInsecureRepositories \"$1\";" > rootdir/etc/apt/apt.conf.d/allow-insecure-repositories.conf
@@ -450,6 +523,12 @@ Package: $NAME" > debian/control
buildsimplenativepackage() {
local NAME="$1"
+ local NM
+ if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then
+ NM="$(echo "$NAME" | cut -c 1-4)"
+ else
+ NM="$(echo "$NAME" | cut -c 1)"
+ fi
local ARCH="$2"
local VERSION="$3"
local RELEASE="${4:-unstable}"
@@ -471,7 +550,7 @@ buildsimplenativepackage() {
fi
local BUILDDIR=${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}
- msgninfo "Build package ${NAME} in ${VERSION} for ${RELEASE} in ${DISTSECTION}… "
+ msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME"
mkdir -p $BUILDDIR/debian/source
echo "* most suckless software product ever" > ${BUILDDIR}/FEATURES
echo "#!/bin/sh
@@ -503,7 +582,10 @@ Package: $NAME" >> ${BUILDDIR}/debian/control
echo "Description: $DESCRIPTION" >> ${BUILDDIR}/debian/control
echo '3.0 (native)' > ${BUILDDIR}/debian/source/format
- (cd ${BUILDDIR}/..; dpkg-source -b ${NAME}-${VERSION} 2>&1) | sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' \
+ cd ${BUILDDIR}/..
+ testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION}
+ cd - >/dev/null
+ sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' ${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output \
| while read SRC; do
echo "pool/${SRC}" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist
# if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then
@@ -515,6 +597,7 @@ Package: $NAME" >> ${BUILDDIR}/debian/control
done
for arch in $(getarchitecturesfromcommalist "$ARCH"); do
+ msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME"
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}
@@ -526,19 +609,15 @@ Package: $NAME" >> ${BUILDDIR}/debian/control
(cd ${BUILDDIR}; dpkg-gencontrol -DArchitecture=$arch)
(cd ${BUILDDIR}/debian/tmp; md5sum $(find usr/ -type f) > DEBIAN/md5sums)
local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log"
- # ensure the right permissions as dpkg-deb ensists
+ # ensure the right permissions as dpkg-deb insists
chmod 755 ${BUILDDIR}/debian/tmp/DEBIAN
- if ! dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/.. >$LOG 2>&1; then
- cat $LOG
- false
- fi
- rm $LOG
+ testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build ${BUILDDIR}/debian/tmp ${BUILDDIR}/..
echo "pool/${NAME}_${VERSION}_${arch}.deb" >> ${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist
done
- mkdir -p ${BUILDDIR}/../${NAME}_${VERSION}
- cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}/
- cp ${BUILDDIR}/debian/changelog ${BUILDDIR}/../${NAME}_${VERSION}.changelog
+ local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}"
+ mkdir -p $CHANGEPATH
+ cp ${BUILDDIR}/debian/changelog $CHANGEPATH
rm -rf "${BUILDDIR}"
msgdone "info"
}
@@ -550,15 +629,13 @@ buildpackage() {
local ARCH=$(getarchitecture $4)
local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')"
local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")"
- msgninfo "Build package ${PKGNAME} for ${RELEASE} in ${SECTION}… "
+ msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME"
cd $BUILDDIR
if [ "$ARCH" = "all" ]; then
ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)"
fi
- if ! dpkg-buildpackage -uc -us -a$ARCH >$BUILDLOG 2>&1 ; then
- cat $BUILDLOG
- false
- fi
+ testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH
+ cp ${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output $BUILDLOG
local PKGS="$(grep '^dpkg-deb: building package' $BUILDLOG | cut -d'/' -f 2 | sed -e "s#'\.##")"
local SRCS="$(grep '^dpkg-source: info: building' $BUILDLOG | grep -o '[a-z0-9._+~-]*$')"
cd - > /dev/null
@@ -568,7 +645,6 @@ buildpackage() {
for SRC in $SRCS; do
echo "pool/${SRC}" >> ${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist
done
- msgdone "info"
}
buildaptarchive() {
@@ -581,12 +657,8 @@ buildaptarchive() {
createaptftparchiveconfig() {
local COMPRESSORS="$(cut -d' ' -f 1 ${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf | tr '\n' ' ')"
- COMPRESSORS="${COMPRESSORS%* }"
- 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="$(getarchitectures)"
- fi
+ local COMPRESSORS="${COMPRESSORS%* }"
+ local ARCHS="$(getarchitectures)"
echo -n 'Dir {
ArchiveDir "' >> ftparchive.conf
echo -n $(readlink -f .) >> ftparchive.conf
@@ -717,6 +789,8 @@ insertsource() {
local SPATH="aptarchive/dists/${RELEASE}/main/source"
mkdir -p $SPATH
local FILE="${SPATH}/Sources"
+ local DSCFILE="${NAME}_${VERSION}.dsc"
+ local TARFILE="${NAME}_${VERSION}.tar.gz"
echo "Package: $NAME
Binary: $NAME
Version: $VERSION
@@ -724,8 +798,8 @@ 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
+ $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) $DSCFILE
+ $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) $TARFILE
" >> $FILE
}
@@ -771,7 +845,7 @@ buildaptarchivefromincoming() {
[ -e ftparchive.conf ] || createaptftparchiveconfig
[ -e dists ] || buildaptftparchivedirectorystructure
msgninfo "\tGenerate Packages, Sources and Contents files… "
- aptftparchive -qq generate ftparchive.conf
+ testsuccess aptftparchive generate ftparchive.conf
cd - > /dev/null
msgdone "info"
generatereleasefiles "$@"
@@ -779,7 +853,9 @@ buildaptarchivefromincoming() {
buildaptarchivefromfiles() {
msginfo "Build APT archive for ${CCMD}$(basename $0)${CINFO} based on prebuild files…"
- find aptarchive -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do
+ local DIR='aptarchive'
+ if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi
+ find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do
msgninfo "\t${line} file… "
compressfile "$line" "$1"
msgdone "info"
@@ -811,6 +887,7 @@ getcodenamefromsuite() {
}
getreleaseversionfromsuite() { true; }
getlabelfromsuite() { true; }
+getoriginfromsuite() { true; }
generatereleasefiles() {
# $1 is the Date header and $2 is the ValidUntil header to be set
@@ -822,16 +899,21 @@ generatereleasefiles() {
local CODENAME="$(getcodenamefromsuite $SUITE)"
local VERSION="$(getreleaseversionfromsuite $SUITE)"
local LABEL="$(getlabelfromsuite $SUITE)"
+ local ORIGIN="$(getoriginfromsuite $SUITE)"
if [ -n "$VERSION" ]; then
VERSION="-o APT::FTPArchive::Release::Version=${VERSION}"
fi
if [ -n "$LABEL" ]; then
LABEL="-o APT::FTPArchive::Release::Label=${LABEL}"
fi
+ if [ -n "$ORIGIN" ]; then
+ ORIGIN="-o APT::FTPArchive::Release::Origin=${ORIGIN}"
+ fi
aptftparchive -qq release $dir \
-o APT::FTPArchive::Release::Suite="${SUITE}" \
-o APT::FTPArchive::Release::Codename="${CODENAME}" \
${LABEL} \
+ ${ORIGIN} \
${VERSION} \
| sed -e '/0 Release$/ d' > $dir/Release # remove the self reference
if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
@@ -949,7 +1031,17 @@ signreleasefiles() {
msgdone "info"
}
+redatereleasefiles() {
+ local DATE="$(date -d "$1" '+%a, %d %b %Y %H:%M:%S %Z')"
+ for release in $(find aptarchive/ -name 'Release'); do
+ sed -i "s/^Date: .*$/Date: ${DATE}/" $release
+ touch -d "$DATE" $release
+ done
+ signreleasefiles "${2:-Joe Sixpack}"
+}
+
webserverconfig() {
+ local WEBSERVER="${3:-http://localhost:8080}"
local NOCHECK=false
if [ "$1" = '--no-check' ]; then
NOCHECK=true
@@ -961,10 +1053,10 @@ webserverconfig() {
local URI
if [ -n "$2" ]; then
msgtest "Set webserver config option '${1}' to" "$2"
- URI="http://localhost:8080/_config/set/${1}/${2}"
+ URI="${WEBSERVER}/_config/set/${1}/${2}"
else
msgtest 'Clear webserver config option' "${1}"
- URI="http://localhost:8080/_config/clear/${1}"
+ URI="${WEBSERVER}/_config/clear/${1}"
fi
if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then
msgpass
@@ -1069,9 +1161,11 @@ acquire::cdrom::autodetect 0;" > rootdir/etc/apt/apt.conf.d/00cdrom
}
downloadfile() {
- local PROTO="$(echo "$1" | cut -d':' -f 1 )"
- apthelper -o Debug::Acquire::${PROTO}=1 \
- download-file "$1" "$2" 2>&1 || true
+ local PROTO="${1%%:*}"
+ if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \
+ download-file "$1" "$2" "$3" 2>&1 ; then
+ return 1
+ fi
# only if the file exists the download was successful
if [ -r "$2" ]; then
return 0
@@ -1096,9 +1190,9 @@ testfileequal() {
shift
msgtest "Test for correctness of file" "$FILE"
if [ -z "$*" ]; then
- echo -n "" | checkdiff $FILE - && msgpass || msgfail
+ echo -n "" | checkdiff - $FILE && msgpass || msgfail
else
- echo "$*" | checkdiff $FILE - && msgpass || msgfail
+ echo "$*" | checkdiff - $FILE && msgpass || msgfail
fi
}
@@ -1108,6 +1202,7 @@ testempty() {
if "$@" >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then
msgpass
else
+ echo
cat $COMPAREFILE
msgfail
fi
@@ -1186,10 +1281,13 @@ testnopackage() {
fi
}
-testdpkginstalled() {
- msgtest "Test for correctly installed package(s) with" "dpkg -l $*"
- local PKGS="$(dpkg -l "$@" 2>/dev/null | grep '^i' | wc -l)"
- if [ "$PKGS" != $# ]; then
+testdpkgstatus() {
+ local STATE="$1"
+ local NR="$2"
+ shift 2
+ msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*"
+ local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)"
+ if [ "$PKGS" != $NR ]; then
echo >&2 $PKGS
dpkg -l "$@" | grep '^[a-z]' >&2
msgfail
@@ -1198,16 +1296,12 @@ testdpkginstalled() {
fi
}
+testdpkginstalled() {
+ testdpkgstatus 'ii' "$#" "$@"
+}
+
testdpkgnotinstalled() {
- msgtest "Test for correctly not-installed package(s) with" "dpkg -l $*"
- local PKGS="$(dpkg -l "$@" 2> /dev/null | grep '^i' | wc -l)"
- if [ "$PKGS" != 0 ]; then
- echo
- dpkg -l "$@" | grep '^[a-z]' >&2
- msgfail
- else
- msgpass
- fi
+ testdpkgstatus 'ii' '0' "$@"
}
testmarkedauto() {
@@ -1283,7 +1377,7 @@ testwarning() {
else
msgtest 'Test for successful execution with warnings of' "$*"
fi
- local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output"
+ local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output"
if "$@" >${OUTPUT} 2>&1; then
if expr match "$1" '^apt.*' >/dev/null; then
if grep -q -E ' runtime error: ' "$OUTPUT"; then
@@ -1333,15 +1427,49 @@ testfailure() {
aptautotest 'testfailure' "$@"
}
+testsuccessequal() {
+ local CMP="$1"
+ shift
+ testsuccess "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$CMP"
+}
+testwarningequal() {
+ local CMP="$1"
+ shift
+ testwarning "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" "$CMP"
+}
+testfailureequal() {
+ local CMP="$1"
+ shift
+ testfailure "$@"
+ testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" "$CMP"
+}
+
+testfailuremsg() {
+ local CMP="$1"
+ shift
+ testfailure "$@"
+ msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings'
+ grep '^\(W\|E\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailureequal.output" 2>&1 || true
+ if echo "$CMP" | checkdiff - "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailureequal.output"; then
+ msgpass
+ else
+ echo '### Complete output ###'
+ cat "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output"
+ msgfail
+ fi
+}
+
testfilestats() {
msgtest "Test that file $1 has $2 $3" "$4"
if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then
msgpass
else
echo >&2
- ls -l >&2 "$1"
+ ls -ld >&2 "$1" || true
echo -n >&2 "stat(1) reports for $2: "
- stat --format "$2" "$1"
+ stat --format "$2" "$1" || true
msgfail
fi
}
@@ -1376,12 +1504,32 @@ pause() {
}
listcurrentlistsdirectory() {
- find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do
- stat --format '%U:%G:%a:%n' "$line"
- done
- find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do
- stat --format '%U:%G:%a:%s:%y:%n' "$line"
- done
+ {
+ find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do
+ stat --format '%U:%G:%a:%n' "$line"
+ done
+ find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do
+ stat --format '%U:%G:%a:%s:%y:%n' "$line"
+ done
+ } | sort
+}
+
+### convinience hacks ###
+mkdir() {
+ # creating some directories by hand is a tedious task, so make it look simple
+ if [ "$*" = '-p rootdir/var/lib/apt/lists' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" ] ||
+ [ "$*" = '-p rootdir/var/lib/apt/lists/partial' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" ]; then
+ # only the last directory created by mkdir is effected by the -m !
+ command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt"
+ command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"
+ command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial"
+ touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock"
+ if [ "$(id -u)" = '0' ]; then
+ chown _apt:root "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial"
+ fi
+ else
+ command mkdir "$@"
+ fi
}
### The following tests are run by most test methods automatically to check
@@ -1407,10 +1555,39 @@ aptautotest() {
}
aptautotest_aptget_update() {
+ local TESTCALL="$1"
+ while [ -n "$2" ]; do
+ if [ "$2" = '--print-uris' ]; then return; fi # simulation mode
+ shift
+ done
if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi
+ testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755"
+ testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755"
# all copied files are properly chmodded
- for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f); do
- testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:644"
+ for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock'); do
+ testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
done
+ if [ "$TESTCALL" = 'testsuccess' ]; then
+ # failure cases can retain partial files and such
+ testempty find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \)
+ fi
}
aptautotest_apt_update() { aptautotest_aptget_update "$@"; }
+aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; }
+
+testaptautotestnodpkgwarning() {
+ local TESTCALL="$1"
+ while [ -n "$2" ]; do
+ if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode
+ if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode
+ shift
+ done
+ testfailure grep '^dpkg: warning:.*ignor.*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output"
+}
+
+aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; }
+aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; }
+aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; }
+aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; }
+aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; }
+aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; }
diff --git a/test/integration/skip-aptwebserver b/test/integration/skip-aptwebserver
deleted file mode 100755
index 0622941ce..000000000
--- a/test/integration/skip-aptwebserver
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-set -e
-
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
-
-setupenvironment
-configarchitecture 'amd64'
-
-buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
-
-setupaptarchive
-changetowebserver
-
-rm -rf rootdir/var/lib/apt/lists
-aptget update -qq
-testequal 'Hit http://localhost stable InRelease
-Hit http://localhost stable/main Sources
-Hit http://localhost stable/main amd64 Packages
-Hit http://localhost stable/main Translation-en
-Reading package lists...' aptget update
-
-mv rootdir/var/lib/apt/lists/localhost* rootdir/var/lib/apt/lists/partial
-aptget update
-
diff --git a/test/integration/test-00-commands-have-help b/test/integration/test-00-commands-have-help
new file mode 100755
index 000000000..f2317dbdf
--- /dev/null
+++ b/test/integration/test-00-commands-have-help
@@ -0,0 +1,63 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+# this test does double duty: The obvious is checking for --help and co,
+# but it also checks if the binary can find all methods in the library.
+# The later is quite handy for manual testing of non-abibreaking changes
+export LD_BIND_NOW=1
+
+checkversionmessage() {
+ testsuccess grep '^apt .* (' ${1}-help.output
+}
+
+checkhelpmessage() {
+ checkversionmessage "$1"
+ testsuccess grep '^Usage:' ${1}-help.output
+}
+
+checkoptions() {
+ testsuccess $1 --help
+ cp -f rootdir/tmp/testsuccess.output ${1}-help.output
+ checkhelpmessage "$1"
+
+ testsuccess $1 --version
+ cp -f rootdir/tmp/testsuccess.output ${1}-help.output
+ checkversionmessage "$1"
+}
+
+for CMD in 'apt-cache' 'apt-cdrom' 'apt-config' \
+ 'apt-extracttemplates' 'apt-get' 'apt-helper' \
+ 'apt-mark' 'apt-sortpkgs' 'apt' 'apt-ftparchive'; do
+ cmd="$(echo "$CMD" | tr -d '-')"
+ msgtest 'Test for failure with no parameters calling' "$CMD"
+ if $cmd > ${cmd}-help.output 2>&1; then
+ echo
+ cat ${cmd}-help.output
+ msgfail 'zero exit'
+ else
+ msgpass
+ fi
+ checkhelpmessage "$cmd"
+ checkoptions "$cmd"
+done
+
+for CMD in 'apt-dump-solver' 'apt-internal-solver'; do
+ checkoptions "$(echo "$CMD" | tr -d '-')"
+done
+
+# in times of need, we all look for super cow to save the day
+testsuccess aptget moo
+testsuccess aptget moo -q=2
+testsuccess aptget moo moo
+testsuccess aptget moo moo -q=2
+testsuccess aptget moo moo --color
+testsuccess aptget moo moo moo
+testsuccess aptget moo moo moo -q=2
+testsuccess aptget moo moo moo moo
+testsuccess aptget moo moo moo moo -q=2
diff --git a/test/integration/test-acquire-same-file-multiple-times b/test/integration/test-acquire-same-file-multiple-times
new file mode 100755
index 000000000..526765521
--- /dev/null
+++ b/test/integration/test-acquire-same-file-multiple-times
@@ -0,0 +1,80 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+TESTFILE="$TESTDIR/framework"
+cp $TESTFILE aptarchive/foo
+APTARCHIVE="$(readlink -f ./aptarchive)"
+
+filedown() {
+ msgtest 'Downloading the same URI twice over file' "$1"
+ testsuccess --nomsg apthelper download-file file:///$APTARCHIVE/foo ./downloaded/foo1 '' file:///$APTARCHIVE/foo ./downloaded/foo2 '' -o Debug::pkgAcquire::Worker=1
+ cp rootdir/tmp/testsuccess.output download.log
+ #cat download.log
+ testsuccess cmp $TESTFILE ./downloaded/foo1
+ testsuccess cmp ./downloaded/foo1 ./downloaded/foo2
+ #testequal '1' grep -c '200%20URI%20Start' ./download.log
+ testequal '1' grep -c '201%20URI%20Done' ./download.log
+ rm -f ./downloaded/foo1 ./downloaded/foo2
+}
+
+testrun() {
+ $1 'no partial'
+ cp $TESTFILE ./downloaded/foo1
+ $1 'complete partial 1'
+ cp $TESTFILE ./downloaded/foo2
+ $1 'complete partial 2'
+ cp $TESTFILE ./downloaded/foo1
+ cp $TESTFILE ./downloaded/foo2
+ $1 'complete partial 1+2'
+ dd if=$TESTFILE of=./downloaded/foo1 bs=500 count=1 2>/dev/null
+ $1 'partial partial 1'
+ dd if=$TESTFILE of=./downloaded/foo2 bs=500 count=1 2>/dev/null
+ $1 'partial partial 2'
+ dd if=$TESTFILE of=./downloaded/foo1 bs=500 count=1 2>/dev/null
+ dd if=$TESTFILE of=./downloaded/foo2 bs=500 count=1 2>/dev/null
+ $1 'partial partial 1+2'
+}
+testrun 'filedown'
+
+changetowebserver -o aptwebserver::redirect::replace::/foo2=/foo
+
+httpdown() {
+ msgtest 'Downloading the same URI to different files' 'twice over http'
+ testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo1 '' http://localhost:8080/foo ./downloaded/foo2 '' -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1
+ cp rootdir/tmp/testsuccess.output download.log
+ testsuccess cmp $TESTDIR/framework ./downloaded/foo1
+ testsuccess cmp ./downloaded/foo1 ./downloaded/foo2
+ testequal '1' grep -c '200%20URI%20Start' ./download.log
+ testequal '1' grep -c '201%20URI%20Done' ./download.log
+ rm -f ./downloaded/foo1 ./downloaded/foo2
+}
+testrun 'httpdown'
+
+httpredirectdown() {
+ msgtest 'Redirect leads' 'first URI to the second URI'
+ testsuccess --nomsg apthelper download-file http://localhost:8080/foo2 ./downloaded/foo1 '' http://localhost:8080/foo ./downloaded/foo2 '' -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1
+ cp rootdir/tmp/testsuccess.output download.log
+ testsuccess cmp $TESTDIR/framework ./downloaded/foo1
+ testsuccess cmp ./downloaded/foo1 ./downloaded/foo2
+ testequal '1' grep -c '200%20URI%20Start' ./download.log
+ testequal '1' grep -c '103%20Redirect' ./download.log
+ testequal '1' grep -c '201%20URI%20Done' ./download.log
+ rm -f ./downloaded/foo1 ./downloaded/foo2
+}
+testrun 'httpredirectdown'
+
+httpsamedown() {
+ msgtest 'Downloading two files via the same URI to' 'the same file'
+ testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo1 '' http://localhost:8080/foo ./downloaded/foo1 '' -o Debug::pkgAcquire::Worker=1
+ cp rootdir/tmp/testsuccess.output download.log
+ testsuccess cmp $TESTDIR/framework ./downloaded/foo1
+ testequal '1' grep -c '200%20URI%20Start' ./download.log
+ testequal '1' grep -c '201%20URI%20Done' ./download.log
+ rm -f ./downloaded/foo1
+}
+testrun 'httpsamedown'
diff --git a/test/integration/test-acquire-same-repository-multiple-times b/test/integration/test-acquire-same-repository-multiple-times
new file mode 100755
index 000000000..a46e0d73c
--- /dev/null
+++ b/test/integration/test-acquire-same-repository-multiple-times
@@ -0,0 +1,81 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+TESTFILE="$TESTDIR/framework"
+cp $TESTFILE aptarchive/foo
+APTARCHIVE="$(readlink -f ./aptarchive)"
+
+getcodenamefromsuite() { echo "jessie"; }
+buildsimplenativepackage 'foo' 'all' '1.0' 'stable'
+setupaptarchive --no-update
+ln -s "${APTARCHIVE}/dists/stable" "${APTARCHIVE}/dists/jessie"
+for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do
+ sed 's#stable#jessie#g' $FILE > $(echo "$FILE" | sed 's#stable#jessie#g')
+done
+
+# install a slowed down file: otherwise its to fast to reproduce combining
+NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods"
+OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)"
+rm $NEWMETHODS
+mkdir $NEWMETHODS
+for METH in $(find $OLDMETHODS ! -type d); do
+ ln -s $OLDMETHODS/$(basename $METH) $NEWMETHODS
+done
+rm $NEWMETHODS/file
+cat >$NEWMETHODS/file <<EOF
+#!/bin/sh
+while read line; do
+ echo "\$line"
+ if [ -z "\$line" ]; then
+ sleep 0.5
+ fi
+done | $OLDMETHODS/file
+EOF
+chmod +x $NEWMETHODS/file
+
+tworepos() {
+ msgtest "Downloading the same repository twice over $1" "$3"
+ testsuccess --nomsg aptget update -o Debug::pkgAcquire::Worker=1
+ cp rootdir/tmp/testsuccess.output download.log
+ #cat download.log
+ aptget files --format '$(FILENAME)' --no-release-info | sort > file.lst
+ testequal "$(find $(readlink -f ./rootdir/var/lib/apt/lists) -name '*_dists_*' \( ! -name '*InRelease' \) -type f | sort)" cat file.lst
+ testsuccess aptcache policy
+ testequal "foo:
+ Installed: (none)
+ Candidate: 1.0
+ Version table:
+ 1.0 0
+ 500 $1:$2 jessie/main amd64 Packages
+ 500 $1:$2 stable/main amd64 Packages" aptcache policy foo
+ testfailure aptcache show foo/unstable
+ testsuccess aptcache show foo/stable
+ testsuccess aptcache show foo/jessie
+}
+
+tworepos 'file' "$APTARCHIVE" 'no partial'
+testequal '12' grep -c '200%20URI%20Start' ./download.log
+testequal '12' grep -c '201%20URI%20Done' ./download.log
+testequal '6' grep -c '^ @ Queue: Action combined' ./download.log
+tworepos 'file' "$APTARCHIVE" 'hit'
+testequal '6' grep -c '200%20URI%20Start' ./download.log
+testequal '6' grep -c '201%20URI%20Done' ./download.log
+testequal '0' grep -c '^ @ Queue: Action combined' ./download.log
+rm -rf rootdir/var/lib/apt/lists
+
+changetowebserver
+
+tworepos 'http' '//localhost:8080' 'no partial'
+testequal '10' grep -c '200%20URI%20Start' ./download.log
+testequal '10' grep -c '201%20URI%20Done' ./download.log
+testequal '6' grep -c '^ @ Queue: Action combined' ./download.log
+tworepos 'http' '//localhost:8080' 'hit'
+testequal '2' grep -c '200%20URI%20Start' ./download.log
+testequal '4' grep -c '201%20URI%20Done' ./download.log
+testequal '0' grep -c '^ @ Queue: Action combined' ./download.log
+rm -rf rootdir/var/lib/apt/lists
diff --git a/test/integration/test-allow-scores-for-all-dependency-types b/test/integration/test-allow-scores-for-all-dependency-types
index d1bcf1130..56cfc9a69 100755
--- a/test/integration/test-allow-scores-for-all-dependency-types
+++ b/test/integration/test-allow-scores-for-all-dependency-types
@@ -32,12 +32,17 @@ insertpackage 'multipleyes' 'foo' 'amd64' '2.2' 'Conflicts: bar (<= 3)'
# having foo multiple times as conflict is a non-advisable hack in general
insertpackage 'multipleyes' 'bar' 'amd64' '2.2' 'Conflicts: foo (<= 3), foo (<= 3)'
+#774924 - slightly simplified
+insertpackage 'jessie' 'login' 'amd64' '2' 'Pre-Depends: libaudit1 (>= 0)'
+insertpackage 'jessie' 'libaudit1' 'amd64' '2' 'Depends: libaudit-common (>= 0)'
+insertpackage 'jessie' 'libaudit-common' 'amd64' '2' 'Breaks: libaudit0, libaudit1 (<< 2)'
+
cp rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup
setupaptarchive
insertinstalledpackage 'libdb-dev' 'amd64' '5.1.7' 'Depends: libdb5.1-dev'
insertinstalledpackage 'libdb5.1-dev' 'amd64' '5.1.29-7'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be REMOVED:
@@ -52,7 +57,7 @@ Inst libdb-dev [5.1.7] (5.3.0 unversioned [amd64]) []
Inst libdb5.3-dev (5.3.28-3 unversioned [amd64])
Conf libdb5.3-dev (5.3.28-3 unversioned [amd64])
Conf libdb-dev (5.3.0 unversioned [amd64])' aptget dist-upgrade -st unversioned
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be REMOVED:
@@ -71,25 +76,25 @@ Conf libdb-dev (5.3.0 versioned [amd64])' aptget dist-upgrade -st versioned
cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status
insertinstalledpackage 'foo' 'amd64' '1'
insertinstalledpackage 'bar' 'amd64' '1'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages have been kept back:
bar foo
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st unversioned
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages have been kept back:
bar foo
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st versioned
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages have been kept back:
bar foo
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.' aptget dist-upgrade -st multipleno
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be REMOVED:
@@ -101,14 +106,14 @@ Remv foo [1]
Inst bar [1] (2.2 multipleyes [amd64])
Conf bar (2.2 multipleyes [amd64])' aptget dist-upgrade -st multipleyes
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
baz
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Inst baz (2 unversioned [amd64])
Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
@@ -125,14 +130,14 @@ Inst baz (2 versioned [amd64])
Conf foo (2 versioned [amd64])
Conf baz (2 versioned [amd64])' aptget install baz -st versioned
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
baz
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Inst baz (2 unversioned [amd64])
Conf baz (2 unversioned [amd64])' aptget install baz -st unversioned
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
@@ -148,3 +153,27 @@ Inst foo [1] (2 versioned [amd64])
Inst baz (2 versioned [amd64])
Conf foo (2 versioned [amd64])
Conf baz (2 versioned [amd64])' aptget install baz -st versioned
+
+# recreating the exact situation is hard, so we pull tricks to get the score
+cp -f rootdir/var/lib/dpkg/status-backup rootdir/var/lib/dpkg/status
+insertinstalledpackage 'gdm3' 'amd64' '1' 'Depends: libaudit0, libaudit0'
+insertinstalledpackage 'login' 'amd64' '1' 'Essential: yes'
+insertinstalledpackage 'libaudit0' 'amd64' '1'
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be REMOVED:
+ gdm3 libaudit0
+The following NEW packages will be installed:
+ libaudit-common libaudit1
+The following packages will be upgraded:
+ login
+1 upgraded, 2 newly installed, 2 to remove and 0 not upgraded.
+Remv gdm3 [1]
+Remv libaudit0 [1]
+Inst libaudit-common (2 jessie [amd64])
+Conf libaudit-common (2 jessie [amd64])
+Inst libaudit1 (2 jessie [amd64])
+Conf libaudit1 (2 jessie [amd64])
+Inst login [1] (2 jessie [amd64])
+Conf login (2 jessie [amd64])' aptget dist-upgrade -st jessie
diff --git a/test/integration/test-apt-acquire-additional-files b/test/integration/test-apt-acquire-additional-files
new file mode 100755
index 000000000..3465c0a16
--- /dev/null
+++ b/test/integration/test-apt-acquire-additional-files
@@ -0,0 +1,95 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+# note that in --print-uri we talk about .bz2 because that is the default.
+# This doesn't mean it is actually attempt to download it.
+configcompression '.' 'gz'
+
+buildsimplenativepackage 'foo' 'amd64' '1' 'unstable'
+
+setupaptarchive --no-update
+changetowebserver
+
+testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
+'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
+'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
+'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
+
+testsuccessequal "Get:1 http://localhost:8080 unstable InRelease [$(stat -c%s aptarchive/dists/unstable/InRelease) B]
+Get:2 http://localhost:8080 unstable/main Sources [$(stat -c%s aptarchive/dists/unstable/main/source/Sources.gz) B]
+Get:3 http://localhost:8080 unstable/main amd64 Packages [$(stat -c%s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B]
+Get:4 http://localhost:8080 unstable/main Translation-en [$(stat -c%s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
+Reading package lists..." aptget update
+
+testempty find rootdir/var/lib/apt/lists -name '*Contents*'
+
+cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
+APT::Acquire::Targets::deb::Contents {
+ MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
+ ShortDescription "Contents";
+ Description "\$(SITE) \$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
+};
+EOF
+
+testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64)" aptget files --no-release-info --format '$(FILENAME)' 'Created-By: Contents'
+testempty aptget files --format '$(FILENAME)' 'Created-By: Contents'
+# lets fake the existence of a compressed Contents file
+touch ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz
+testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget files --format '$(FILENAME)' 'Created-By: Contents'
+
+testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
+'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
+'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
+'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0
+'http://localhost:8080/dists/unstable/main/Contents-amd64.bz2' localhost:8080_dists_unstable_main_Contents-amd64 0 " aptget update --print-uris
+
+testsuccessequal "Hit:1 http://localhost:8080 unstable InRelease
+Get:2 http://localhost:8080 unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
+Reading package lists..." aptget update
+
+testequal 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64' find rootdir/var/lib/apt/lists -name '*Contents*'
+testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64)" aptget files --format '$(FILENAME)' 'Created-By: Contents'
+testsuccess cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64' 'aptarchive/dists/unstable/main/Contents-amd64'
+
+# no automatic uncompress based on the name please,
+# only if we downloaded a compressed file, but target was uncompressed
+cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
+APT::Acquire::Targets::deb::Contents {
+ MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE).gz";
+ ShortDescription "Contents.gz";
+ Description "\$(SITE) \$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents.gz";
+};
+EOF
+
+# the last line is utter bogus of course, but how should apt know…
+testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
+'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
+'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
+'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0
+'http://localhost:8080/dists/unstable/main/Contents-amd64.gz.bz2' localhost:8080_dists_unstable_main_Contents-amd64.gz 0 " aptget update --print-uris
+
+testsuccessequal "Hit:1 http://localhost:8080 unstable InRelease
+Get:2 http://localhost:8080 unstable/main amd64 Contents.gz [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
+Reading package lists..." aptget update
+
+testequal 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' find rootdir/var/lib/apt/lists -name '*Contents*'
+testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget files --format '$(FILENAME)' 'Created-By: Contents'
+testsuccess cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' 'aptarchive/dists/unstable/main/Contents-amd64.gz'
+
+rm -f rootdir/etc/apt/apt.conf.d/content-target.conf
+
+testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
+'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
+'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
+'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
+
+testsuccessequal "Hit:1 http://localhost:8080 unstable InRelease
+Reading package lists..." aptget update
+
+testempty find rootdir/var/lib/apt/lists -name '*Contents*'
diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update
index d9d0b146f..2229e991d 100755
--- a/test/integration/test-apt-by-hash-update
+++ b/test/integration/test-apt-by-hash-update
@@ -11,8 +11,6 @@ insertpackage 'unstable' 'foo' 'all' '1.0'
setupaptarchive --no-update
-APTARCHIVE=$(readlink -f ./aptarchive)
-
# make Packages *only* accessable by-hash for this test
mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512
(cd aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 &&
@@ -26,24 +24,28 @@ mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512
)
# we moved the Packages file away, normal update won't work
-testfailure aptget upate
+testfailure aptget update
# ensure we do not know about "foo"
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
E: Unable to locate package foo" aptget install -q -s foo
# ensure we can apt-get update by hash
testsuccess aptget update -o APT::Acquire::By-Hash=1 -o Acquire::Languages=none
-# ensure it works
-testequal "Inst foo (1.0 unstable [all])
+ensureitworks() {
+ testsuccessequal "Inst foo (1.0 unstable [all])
Conf foo (1.0 unstable [all])" aptget install -qq -s foo
+}
+ensureitworks
# add magic string to Release file ...
MAGIC="Acquire-By-Hash: true"
sed -i "s#Suite: unstable#Suite: unstable\n$MAGIC#" aptarchive/dists/unstable/Release
signreleasefiles
# ... and verify that it fetches by hash now
+rm -rf rootdir/var/lib/apt/lists
testsuccess aptget update -o Acquire::Languages=none
+ensureitworks
diff --git a/test/integration/test-apt-cache b/test/integration/test-apt-cache
new file mode 100755
index 000000000..97dc0f939
--- /dev/null
+++ b/test/integration/test-apt-cache
@@ -0,0 +1,124 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+DESCR='Some description
+ That has multiple lines'
+insertpackage 'unstable' 'fancy' 'all' '1'
+insertpackage 'unstable,installed' 'foo' 'all' '1' 'Depends: bar
+Conflicts: foobar
+Recommends: cool (>= 2) | cooler (<< 5)' "$DESCR"
+insertpackage 'unstable' 'bar' 'all' '1' 'Depends: bar
+Breaks: foo (<< 1)
+Replaces: foo (<< 1)' "$DESCR"
+
+setupaptarchive
+
+# dpkg is installed by our framework
+testdpkginstalled 'dpkg'
+testempty aptcache unmet dpkg
+
+# FIXME: Find some usecase for unmet as it seems kinda useless/broken
+#testsuccess aptcache unmet
+#testsuccess aptcache unmet foo
+
+# not too useful to test, but makes coverage green…
+testsuccess aptcache stats
+cp rootdir/tmp/testsuccess.output stats.output
+testsuccess test -s stats.output
+testsuccess aptcache xvcg foo
+cp rootdir/tmp/testsuccess.output xvcg.output
+testsuccess test -s xvcg.output
+testsuccess aptcache dotty foo
+cp rootdir/tmp/testsuccess.output dotty.output
+testsuccess test -s dotty.output
+# for this, even the sourcecode says it is useless (expect debugging)
+testsuccess aptcache dump
+cp rootdir/tmp/testsuccess.output dump.output
+testsuccess test -s dump.output
+
+testsuccessequal 'dpkg
+bar
+fancy
+foo' aptcache pkgnames
+testsuccessequal 'bar' aptcache pkgnames bar
+testsuccessequal 'fancy
+foo' aptcache pkgnames f
+
+testsuccessequal " foo | 1 | file:$(readlink -f .)/aptarchive unstable/main amd64 Packages" aptcache madison foo
+
+### depends
+
+testsuccessequal 'foo
+ Depends: bar
+ |Recommends: <cool>
+ Recommends: <cooler>
+ Conflicts: <foobar>
+ Conflicts: <foobar:i386>' aptcache depends foo
+testsuccessequal 'foo
+ Depends: bar
+ Recommends: <cool>
+ Conflicts: <foobar>
+ Conflicts: <foobar:i386>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1
+testsuccessequal 'foo
+ Depends: bar
+ |Recommends: <cool> (>= 2)
+ Recommends: <cooler> (<< 5)
+ Conflicts: <foobar>
+ Conflicts: <foobar:i386>' aptcache depends foo -o APT::Cache::ShowVersion=1
+testsuccessequal 'foo
+ Depends: bar
+ Conflicts: <foobar>
+ Conflicts: <foobar:i386>' aptcache depends foo --no-recommends
+testsuccessequal 'foo
+ Depends: bar' aptcache depends foo --important
+testsuccessequal 'foo
+ Conflicts: <foobar>
+ Conflicts: <foobar:i386>' aptcache depends foo --important --no-depends --conflicts
+testsuccessequal 'foo
+ Depends: bar
+ |Recommends: <cool>
+ Recommends: <cooler>
+ Conflicts: <foobar>
+ Conflicts: <foobar:i386>
+bar
+ Depends: bar
+ Breaks: foo
+ Breaks: <foo:i386>
+ Replaces: foo
+ Replaces: <foo:i386>
+<cool>
+<cooler>
+<foobar>
+<foobar:i386>
+<foo:i386>' aptcache depends foo --recurse
+testsuccessequal 'foo
+ Depends: bar
+bar
+ Depends: bar
+ Replaces: foo
+ Replaces: <foo:i386>
+<foo:i386>' aptcache depends foo --recurse --important --replaces
+
+## rdpends
+
+testsuccessequal 'foo
+Reverse Depends:
+ bar
+ bar' aptcache rdepends foo
+testsuccessequal 'foo
+Reverse Depends:
+ Replaces: bar
+ Breaks: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1
+testsuccessequal 'foo
+Reverse Depends:
+ Replaces: bar (<< 1)
+ Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1
+testsuccessequal 'foo
+Reverse Depends:
+ Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks
diff --git a/test/integration/test-apt-cdrom b/test/integration/test-apt-cdrom
index 3a33219fe..108805daa 100755
--- a/test/integration/test-apt-cdrom
+++ b/test/integration/test-apt-cdrom
@@ -33,6 +33,7 @@ aptcdromlog() {
test ! -e rootdir/media/cdrom || echo "CD-ROM is mounted, but shouldn't be!"
test -e rootdir/media/cdrom-unmounted || echo "Unmounted CD-ROM doesn't exist, but it should!"
}
+aptautotest_aptcdromlog_add() { aptautotest_aptget_update "$@"; }
CDROM_PRE="Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
Unmounting CD-ROM...
@@ -49,12 +50,12 @@ deb-src cdrom:[Debian APT Testdisk 0.8.15]/ stable main
Unmounting CD-ROM...
Repeat this process for the rest of the CDs in your set."
-testequal "$CDROM_PRE
+testsuccessequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
Found label 'Debian APT Testdisk 0.8.15'
$CDROM_POST" aptcdromlog add
-testequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
+testsuccessequal "Using CD-ROM mount point $(readlink -f ./rootdir/media)/cdrom/
Mounting CD-ROM...
Stored label: Debian APT Testdisk 0.8.15
Unmounting CD-ROM..." aptcdromlog ident
@@ -63,13 +64,13 @@ Unmounting CD-ROM..." aptcdromlog ident
ident="$(LC_ALL=C aptcdrom ident 2>&1 )"
CD_ID="$(echo "$ident" | grep "^Identifying" | head -n1 | cut -d" " -f2 | tr --delete '[]')"
CD_LABEL="$(echo "$ident" | grep "^Stored label:" | head -n1 | sed "s/^[^:]*: //")"
-testequal "CD::${CD_ID} \"${CD_LABEL}\";
-CD::${CD_ID}::Label \"${CD_LABEL}\";" cat rootdir/var/lib/apt/cdroms.list
+testfileequal rootdir/var/lib/apt/cdroms.list "CD::${CD_ID} \"${CD_LABEL}\";
+CD::${CD_ID}::Label \"${CD_LABEL}\";"
testcdromusage() {
touch rootdir/var/lib/apt/extended_states
- testequal 'Reading package lists...
+ testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
@@ -84,7 +85,7 @@ Conf testing (0.8.15 stable [amd64])' aptget install testing -s
testsuccess aptget purge testing -y
testdpkgnotinstalled testing
- testequal 'Reading package lists...
+ testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
@@ -114,19 +115,18 @@ Conf testing:i386 (0.8.15 stable [i386])' aptget install testing:i386 -s
testcdromusage
# check Idempotence of apt-cdrom (and disabling of Translation dropping)
-testequal "$CDROM_PRE
+testsuccessequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
$CDROM_POST" aptcdromlog add -o APT::CDROM::DropTranslation=0
# take Translations from previous runs as needed
-testequal "$CDROM_PRE
+testsuccessequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 2 translation indexes and 1 signatures
$CDROM_POST" aptcdromlog add
msgtest 'Test for the german description translation of' 'testing'
aptcache show testing -o Acquire::Languages=de | grep -q '^Description-de: ' && msgpass || msgfail
rm -rf rootdir/var/lib/apt/lists
-mkdir -p rootdir/var/lib/apt/lists/partial
-testequal "$CDROM_PRE
+testsuccessequal "$CDROM_PRE
Found 2 package indexes, 1 source indexes, 1 translation indexes and 1 signatures
$CDROM_POST" aptcdromlog add
msgtest 'Test for the english description translation of' 'testing'
@@ -134,18 +134,20 @@ aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' &&
# ensure cdrom method isn't trying to mount the cdrom
mv rootdir/media/cdrom-unmounted rootdir/media/cdrom-ejected
-# ensure an update doesn't mess with cdrom sources
+msgmsg "ensure an update doesn't mess with cdrom sources"
testsuccess aptget update
-testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...'
+testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease
+Reading package lists...'
mv rootdir/media/cdrom-ejected rootdir/media/cdrom-unmounted
testcdromusage
-# and again to check that it withstands the temptation even if it could mount
+msgmsg 'and again to check that it withstands the temptation even if it could mount'
testsuccess aptget update
-testfileequal rootdir/tmp/testsuccess.output 'Reading package lists...'
+testfileequal rootdir/tmp/testsuccess.output 'Hit:1 cdrom://Debian APT Testdisk 0.8.15 stable InRelease
+Reading package lists...'
testcdromusage
msgmsg 'Check that nothing touched our' 'CD-ROM'
for file in $(find rootdir/media/cdrom-unmounted/dists); do
- testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:555"
+ testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555"
done
diff --git a/test/integration/test-apt-cli-list b/test/integration/test-apt-cli-list
index 1487afd55..d3c44e126 100755
--- a/test/integration/test-apt-cli-list
+++ b/test/integration/test-apt-cli-list
@@ -27,50 +27,49 @@ setupaptarchive
APTARCHIVE=$(readlink -f ./aptarchive)
-testequal "Listing...
+testsuccessequal "Listing...
bar/now 1.0 i386 [installed,local]
baz/unstable 2.0 all [upgradable from: 0.1]
foo/unstable 1.0 all
foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list
-testequal "Listing...
+testsuccessequal "Listing...
foo/unstable 1.0 all
foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list "foo*"
-testequal "Listing...
+testsuccessequal "Listing...
baz/unstable 2.0 all [upgradable from: 0.1]
foobar/unstable 2.0 i386 [upgradable from: 1.0]" apt list --upgradable
# FIXME: hm, hm - does it make sense to have this different? shouldn't
# we use "installed,upgradable" consitently?
-testequal "Listing...
+testsuccessequal "Listing...
bar/now 1.0 i386 [installed,local]
baz/now 0.1 all [installed,upgradable to: 2.0]
foobar/now 1.0 i386 [installed,upgradable to: 2.0]" apt list --installed
-testequal "Listing...
+testsuccessequal "Listing...
bar/now 1.0 i386 [installed,local]
foobar/unstable 2.0 i386 [upgradable from: 1.0]
foobar/now 1.0 i386 [installed,upgradable to: 2.0]
" apt list bar foobar --all-versions
-testequal "Listing...
+testsuccessequal "Listing...
bar/now 1.0 i386 [installed,local]
an autogenerated dummy bar=1.0/installed
" apt list bar --verbose
# test for dpkg ^rc state
insertinstalledpackage 'conf-only' 'i386' '1.0' '' '' 'deinstall ok config-files'
-testequal "Listing...
+testsuccessequal "Listing...
conf-only/now 1.0 i386 [residual-config]" apt list conf-only
# ensure that the users learns about multiple versions too
-testequal "Listing...
+testsuccessequal "Listing...
baz/unstable 2.0 all [upgradable from: 0.1]
N: There are 2 additional versions. Please use the '-a' switch to see them." apt list baz -o quiet=0
# test format strings for machine parseable output
-apt list -qq bar baz -o APT::Cmd::use-format=true -o APT::Cmd::format="\${Package} - \${installed:Version} - \${candidate:Version}" > output.txt
-testequal "bar - 1.0 - 1.0
-baz - 0.1 - 2.0" cat output.txt
+testsuccessequal 'bar - 1.0 - 1.0
+baz - 0.1 - 2.0' apt list -qq bar baz -o APT::Cmd::use-format=true -o APT::Cmd::format="\${Package} - \${installed:Version} - \${candidate:Version}"
diff --git a/test/integration/test-apt-cli-search b/test/integration/test-apt-cli-search
index 8f009d57c..e86661dcb 100755
--- a/test/integration/test-apt-cli-search
+++ b/test/integration/test-apt-cli-search
@@ -25,48 +25,51 @@ setupaptarchive
APTARCHIVE=$(readlink -f ./aptarchive)
+testfailureequal 'E: You must give at least one search pattern' aptcache search
+testfailureequal 'E: You must give at least one search pattern' apt search
+
# with OP progress
-testequal "Sorting...
+testsuccessequal "Sorting...
Full Text Search...
foo/unstable 1.0 all
$DESCR
" apt search xxyyzz
# without op progress
-testequal "foo/unstable 1.0 all
+testsuccessequal "foo/unstable 1.0 all
$DESCR
" apt search -qq xxyyzz
testempty apt search -qq --names-only xxyyzz
# search name
-testequal "foo/unstable 1.0 all
+testsuccessequal "foo/unstable 1.0 all
$DESCR
" apt search -qq foo
-testequal "foo/unstable 1.0 all
+testsuccessequal "foo/unstable 1.0 all
$DESCR
" apt search -qq --names-only foo
# search with multiple words is a AND search
-testequal "foo/unstable 1.0 all
+testsuccessequal "foo/unstable 1.0 all
$DESCR
" apt search -qq aabbcc xxyyzz
-testequal "foo/unstable 1.0 all
+testsuccessequal "foo/unstable 1.0 all
$DESCR
" apt search -qq 'a+b+c+' 'i*xxy{0,2}zz'
# search is not case-sensitive by default
-testequal "foo/unstable 1.0 all
+testsuccessequal "foo/unstable 1.0 all
$DESCR
" apt search -qq uppercase
-testequal "foo/unstable 1.0 all
+testsuccessequal "foo/unstable 1.0 all
$DESCR
" apt search -qq 'up[pP]erc[Aa]se'
# search is done in the long description
-testequal "foo/unstable 1.0 all
+testsuccessequal "foo/unstable 1.0 all
$DESCR
" apt search -qq 'long description'
-testequal "foo/unstable 1.0 all
+testsuccessequal "foo/unstable 1.0 all
$DESCR
Long description of stuff and such, with lines
.
@@ -74,7 +77,7 @@ testequal "foo/unstable 1.0 all
" apt search --full -qq 'long description'
# output is sorted and search word finds both package
-testequal "bar/testing 2.0 i386
+testsuccessequal "bar/testing 2.0 i386
$DESCR2
foo/unstable 1.0 all
diff --git a/test/integration/test-apt-cli-show b/test/integration/test-apt-cli-show
index 4c8e134d6..5f4ef1b48 100755
--- a/test/integration/test-apt-cli-show
+++ b/test/integration/test-apt-cli-show
@@ -24,15 +24,26 @@ APTARCHIVE=$(readlink -f ./aptarchive)
# note that we do not display Description-md5 with the "apt" cmd
# and also show some additional fields that are calculated
-testequal "Package: foo
+testsuccessequal "Package: foo
+Version: 1.0
Priority: optional
Section: other
-Installed-Size: 43.0 kB
Maintainer: Joe Sixpack <joe@example.org>
-Version: 1.0
+Installed-Size: 43.0 kB
Download-Size: unknown
APT-Manual-Installed: yes
-APT-Sources: file:$APTARCHIVE/ unstable/main i386 Packages
+APT-Sources: file:$APTARCHIVE unstable/main i386 Packages
Description: Some description
That has multiple lines
" apt show foo
+
+# this is the default, but disabled by the testcases
+testsuccess apt show foo -o Apt::Cmd::Disable-Script-Warning=0
+cp rootdir/tmp/testsuccess.output aptshow.output
+testsuccess grep '^WARNING: ' aptshow.output
+
+if [ "$(id -u)" != '0' ]; then
+ testsuccess apt install foo -s -o APT::Get::Show-User-Simulation-Note=1
+ cp rootdir/tmp/testsuccess.output aptshow.output
+ testsuccess grep '^NOTE: ' aptshow.output
+fi
diff --git a/test/integration/test-apt-cli-update b/test/integration/test-apt-cli-update
index 987bb9adb..d68ab25e4 100755
--- a/test/integration/test-apt-cli-update
+++ b/test/integration/test-apt-cli-update
@@ -8,10 +8,17 @@ setupenvironment
configarchitecture "i386"
insertpackage 'unstable' 'foo' 'all' '2.0'
+cp rootdir/var/lib/dpkg/status dpkg.status
insertinstalledpackage 'foo' 'all' '1.0'
setupaptarchive --no-update
APTARCHIVE=$(readlink -f ./aptarchive)
-testequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -q
+testfailureequal 'E: The update command takes no arguments' apt update -q arguments
+
+testsuccessequal "1 package can be upgraded. Run 'apt list --upgradable' to see it." apt update -q
+
+cp dpkg.status rootdir/var/lib/dpkg/status
+insertinstalledpackage 'foo' 'all' '2.0'
+testsuccessequal 'All packages are up to date.' apt update -q
diff --git a/test/integration/test-apt-cli-upgrade b/test/integration/test-apt-cli-upgrade
index b6ee2270b..54f2ecd11 100755
--- a/test/integration/test-apt-cli-upgrade
+++ b/test/integration/test-apt-cli-upgrade
@@ -23,7 +23,7 @@ setupaptarchive
APTARCHIVE=$(readlink -f ./aptarchive)
# default is to allow new dependencies
-testequal "The following NEW packages will be installed:
+testsuccessequal "The following NEW packages will be installed:
foo-new-dependency
The following packages will be upgraded:
foo
@@ -33,7 +33,7 @@ Inst foo [1.0] (2.0 unstable [all])
Conf foo-new-dependency (2.0 unstable [all])
Conf foo (2.0 unstable [all])" apt upgrade -qq -s
-# ensure
-testequal "The following packages have been kept back:
+# ensure the 'old' way works as well
+testsuccessequal "The following packages have been kept back:
foo
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." apt upgrade -qq -s --no-new-pkgs
diff --git a/test/integration/test-apt-config b/test/integration/test-apt-config
new file mode 100755
index 000000000..2eea9a0f8
--- /dev/null
+++ b/test/integration/test-apt-config
@@ -0,0 +1,36 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+testsuccess aptconfig dump
+testsuccessequal 'APT::Architecture "amd64";' aptconfig dump APT::Architecture
+testempty aptconfig dump config::which::does::not::exist
+
+testsuccessequal 'APT::Architectures "";
+APT::Architectures:: "amd64";' aptconfig dump APT::Architectures
+testsuccessequal 'APT::Architectures:: "amd64";' aptconfig dump --no-empty APT::Architectures
+testsuccessequal 'amd64' aptconfig dump --no-empty --format='%v%n' APT::Architectures
+
+testempty aptconfig shell
+testfailureequal 'E: Arguments not in pairs' aptconfig shell APT::Architecture
+testempty aptconfig shell APT::Architecture ARCH # incorrect order
+testsuccessequal "ARCH='amd64'" aptconfig shell ARCH APT::Architecture
+
+ROOTDIR="$(readlink -f rootdir)"
+testsuccessequal "CONFIG='apt.conf'" aptconfig shell CONFIG Dir::Etc::main
+testsuccessequal "CONFIG='${ROOTDIR}/etc/apt/apt.conf'" aptconfig shell CONFIG Dir::Etc::main/f
+testsuccessequal "CONFIG='etc/apt/'" aptconfig shell CONFIG Dir::Etc
+testsuccessequal "CONFIG='${ROOTDIR}/etc/apt/'" aptconfig shell CONFIG Dir::Etc/ # old style
+testsuccessequal "CONFIG='${ROOTDIR}/etc/apt/'" aptconfig shell CONFIG Dir::Etc/d
+
+testempty aptconfig dump --no-empty --format='%v%n' APT::Build-Profiles
+export DEB_BUILD_PROFILES='nodoc stage1'
+testsuccessequal 'nodoc
+stage1' aptconfig dump --no-empty --format='%v%n' APT::Build-Profiles
+unset DEB_BUILD_PROFILES
+testempty aptconfig dump --no-empty --format='%v%n' APT::Build-Profiles
diff --git a/test/integration/test-apt-download-progress b/test/integration/test-apt-download-progress
new file mode 100755
index 000000000..7caeca971
--- /dev/null
+++ b/test/integration/test-apt-download-progress
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# ensure downloading sends progress as a regression test for commit 9127d7ae
+#
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+changetohttpswebserver
+
+assertprogress() {
+ T="$1"
+ testsuccess grep "dlstatus:1:0:Retrieving file 1 of 1" "$T"
+ if ! egrep -q "dlstatus:1:[1-9][0-9](\..*)?:Retrieving file 1 of 1" "$T"; then
+ cat "$T"
+ msgfail "Failed to detect download progress"
+ fi
+ testsuccess grep "dlstatus:1:100:Retrieving file 1 of 1" "$T"
+}
+
+# we need to ensure the file is reasonable big so that apt has a chance to
+# actually report progress - but not too big to ensure its not delaying the
+# test too much
+TESTFILE=testfile.big
+testsuccess dd if=/dev/zero of=./aptarchive/$TESTFILE bs=800k count=1
+
+OPT='-o APT::Status-Fd=3 -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1 -o Debug::Acquire::https=1'
+
+msgtest 'download progress works via' 'http'
+exec 3> apt-progress.log
+testsuccess --nomsg apthelper download-file "http://localhost:8080/$TESTFILE" ./downloaded/http-$TESTFILE $OPT -o Acquire::http::Dl-Limit=800
+assertprogress apt-progress.log
+
+msgtest 'download progress works via' 'https'
+exec 3> apt-progress.log
+testsuccess --nomsg apthelper download-file "https://localhost:4433/$TESTFILE" ./downloaded/https-$TESTFILE $OPT -o Acquire::https::Dl-Limit=800
+assertprogress apt-progress.log
+
+# cleanup
+rm -f apt-progress*.log
diff --git a/test/integration/test-apt-extracttemplates b/test/integration/test-apt-extracttemplates
index ae2cc8bc2..5dadc4933 100755
--- a/test/integration/test-apt-extracttemplates
+++ b/test/integration/test-apt-extracttemplates
@@ -8,38 +8,63 @@ setupenvironment
configarchitecture 'amd64'
# apt-extracttemplates needs this
-insertinstalledpackage 'debconf' 'amd64' '1.5'
insertinstalledpackage 'pkg-with-template' 'amd64' '1.0'
# build a simple package that contains a config and a tempalte
mkdir -p DEBIAN
-TEMPLATE_STR="Template: foo/bar
-Type: string
-Description: Some bar var
-"
-echo "$TEMPLATE_STR" > DEBIAN/templates
-
CONFIG_STR="#!/bin/sh
random shell stuff
"
echo "$CONFIG_STR" > DEBIAN/config
-buildsimplenativepackage 'pkg-with-template' 'amd64' '0.8.15' 'stable' '' 'pkg with template' '' '' './DEBIAN'
+testrun() {
+ local TEMPLATE_STR='Template: foo/bar
+Type: string
+Description: Some bar var
+'
+ echo "$TEMPLATE_STR" > DEBIAN/templates
+ buildsimplenativepackage "$1" 'amd64' '0.8.15' 'stable' "$2" 'pkg with template' '' '' './DEBIAN'
+
+ cp dpkg.status rootdir/var/lib/dpkg/status
+ insertinstalledpackage 'debconf' 'amd64' '3'
+
+ # ensure we get the right stuff out of the file
+ rm -rf extracttemplates-out rootdir/var/cache/apt
+ mkdir extracttemplates-out
+ testsuccess aptextracttemplates -t ./extracttemplates-out incoming/${1}*.deb
+ OUT='rootdir/tmp/testsuccess.output'
+ testequal "$1" cut -f1 -d' ' $OUT
+ if [ -n "$2" ]; then
+ testequal '' cut -s -f2 -d' ' $OUT
+ else
+ testequal '1.0' cut -f2 -d' ' $OUT
+ fi
+ TEMPLATE=$(cut -f3 -d' ' $OUT)
+ testfileequal "$TEMPLATE" "$TEMPLATE_STR"
+ CONFIG=$(cut -f4 -d' ' $OUT)
+ testfileequal "$CONFIG" "$CONFIG_STR"
-# ensure we get the right stuff out of the file
-mkdir extracttemplates-out
-OUT="$(aptextracttemplates -t ./extracttemplates-out incoming/pkg-with-template*.deb)"
+ # ensure that the format of the output string has the right number of dots
+ for s in "$CONFIG" "$TEMPLATE"; do
+ NR_DOTS=$(basename "$s" | tr -c -d '.')
+ testequal '..' echo $NR_DOTS
+ done
-PKG=$(printf "$OUT" | cut -f1 -d' ')
-INSTALLED_VER=$(printf "$OUT" | cut -f2 -d' ')
-TEMPLATE=$(printf "$OUT" | cut -f3 -d' ')
-CONFIG=$(printf "$OUT" | cut -f4 -d' ')
+ if [ -n "$2" ]; then
+ rm -rf extracttemplates-out rootdir/var/cache/apt
+ mkdir extracttemplates-out
+ cp dpkg.status rootdir/var/lib/dpkg/status
+ insertinstalledpackage 'debconf' 'amd64' '1'
+ testempty aptextracttemplates -t ./extracttemplates-out incoming/${1}*.deb
+ fi
+}
-testequal "$CONFIG_STR" cat $CONFIG
-testequal "$TEMPLATE_STR" cat $TEMPLATE
+cp rootdir/var/lib/dpkg/status dpkg.status
+testrun 'pkg-with-template' ''
+testrun 'pkg-with-template-depends' 'Depends: debconf (>= 2)'
+testrun 'pkg-with-template-predepends' 'Pre-Depends: debconf (>= 2)'
-# ensure that the format of the output string has the right number of dots
-for s in "$CONFIG" "$TEMPLATE"; do
- NR_DOTS=$(basename "$s" | tr -c -d .)
- testequal ".." echo $NR_DOTS
-done
+# test with no debconf installed
+cp dpkg.status rootdir/var/lib/dpkg/status
+testfailure aptextracttemplates -t ./extracttemplates-out incoming/pkg-with-template-depends*.deb
+testfileequal 'rootdir/tmp/testfailure.output' 'E: Cannot get debconf version. Is debconf installed?'
diff --git a/test/integration/test-apt-ftparchive-cachedb b/test/integration/test-apt-ftparchive-cachedb
index 0e1986bcd..962095320 100755
--- a/test/integration/test-apt-ftparchive-cachedb
+++ b/test/integration/test-apt-ftparchive-cachedb
@@ -3,20 +3,20 @@ set -e
ensure_correct_packages_file() {
testequal "Package: foo
+Architecture: i386
+Version: 1
Priority: optional
Section: others
-$(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | sed 's#^ ##')
Maintainer: Joe Sixpack <joe@example.org>
-Architecture: i386
-Version: 1
-Filename: pool/main/foo_1_i386.deb" head -n8 ./aptarchive/dists/test/main/binary-i386/Packages
+$(dpkg-deb -I ./aptarchive/pool/main/foo_1_i386.deb | grep 'Installed-Size:' | sed 's#^ ##')
+Filename: pool/main/foo_1_i386.deb" head -n8 ./aptarchive/dists/test/main/binary-i386/Packages
}
ensure_correct_contents_file() {
- testequal "usr/bin/foo-i386 others/foo
+ testfileequal ./aptarchive/dists/test/Contents-i386 "usr/bin/foo-i386 others/foo
usr/share/doc/foo/FEATURES others/foo
usr/share/doc/foo/changelog others/foo
-usr/share/doc/foo/copyright others/foo" cat ./aptarchive/dists/test/Contents-i386
+usr/share/doc/foo/copyright others/foo"
}
#
@@ -69,32 +69,38 @@ buildsimplenativepackage 'foo' 'i386' '1' 'test'
mv incoming/* aptarchive/pool/main/
# generate (empty cachedb)
-aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt
+testsuccess aptftparchive generate ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1
+cp rootdir/tmp/testsuccess.output stats-out.txt
ensure_correct_packages_file
ensure_correct_contents_file
-testequal " Misses in Cache: 2
- dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt
+testsuccess grep Misses stats-out.txt
+testfileequal 'rootdir/tmp/testsuccess.output' ' Misses in Cache: 2
+ dists/test/Contents-i386: New 402 B Misses in Cache: 0'
# generate again
-aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt
+testsuccess aptftparchive generate ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1
+cp rootdir/tmp/testsuccess.output stats-out.txt
ensure_correct_packages_file
ensure_correct_contents_file
-testequal " Misses in Cache: 0
- dists/test/Contents-i386: Misses in Cache: 0" grep Misses stats-out.txt
+testsuccess grep Misses stats-out.txt
+testfileequal 'rootdir/tmp/testsuccess.output' ' Misses in Cache: 0
+ dists/test/Contents-i386: Misses in Cache: 0'
# and again (with removing the Packages file)
rm -f ./aptarchive/dists/test/main/binary-i386/*
rm -f ./aptarchive/dists/test/Contents-i386
-aptftparchive generate ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt
+testsuccess aptftparchive generate ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1
+cp rootdir/tmp/testsuccess.output stats-out.txt
ensure_correct_packages_file
ensure_correct_contents_file
-testequal " Misses in Cache: 0
- dists/test/Contents-i386: New 402 B Misses in Cache: 0" grep Misses stats-out.txt
+testsuccess grep Misses stats-out.txt
+testfileequal 'rootdir/tmp/testsuccess.output' ' Misses in Cache: 0
+ dists/test/Contents-i386: New 402 B Misses in Cache: 0'
# and clean
rm -rf aptarchive/pool/main/*
-testequal "packages-main-i386.db" aptftparchive clean ftparchive.conf
-aptftparchive clean ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 > clean-out.txt 2>&1
-testequal "0 Number of unique keys in the tree" grep unique clean-out.txt
-testequal "packages-main-i386.db" grep packages-main-i386.db clean-out.txt
-
+testsuccessequal "packages-main-i386.db" aptftparchive clean ftparchive.conf -q=0
+testsuccess aptftparchive clean ftparchive.conf -q=0 -o Debug::APT::FTPArchive::Clean=1
+cp rootdir/tmp/testsuccess.output clean-out.txt
+testsuccessequal "0 Number of unique keys in the tree" grep unique clean-out.txt
+testsuccessequal "packages-main-i386.db" grep packages-main-i386.db clean-out.txt
diff --git a/test/integration/test-apt-ftparchive-cachedb-lp1274466 b/test/integration/test-apt-ftparchive-cachedb-lp1274466
index 579ae33a6..8b768441a 100755
--- a/test/integration/test-apt-ftparchive-cachedb-lp1274466
+++ b/test/integration/test-apt-ftparchive-cachedb-lp1274466
@@ -26,13 +26,13 @@ testsuccess grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc
testfailure grep 7da58ff901a40ecf42a730dc33198b182e9ba9ec98799fc2c2b6fabeeee40cc12a0e7cadb4b66764235c56e1009dbfe8a9a566fb1eedf47a992d1fff2cc3332c old-format.dump
# regression test for corruption with previous generation of cachedb
-testequal "Package: foo
+testsuccessequal "Package: foo
+Architecture: i386
+Version: 1
Priority: optional
Section: others
-Installed-Size: 29
Maintainer: Joe Sixpack <joe@example.org>
-Architecture: i386
-Version: 1
+Installed-Size: 29
Filename: ./foo_1_i386.deb
Size: 1270
MD5sum: 85d0e908c1a897700e2c5dea72d7e3c0
diff --git a/test/integration/test-apt-ftparchive-src-cachedb b/test/integration/test-apt-ftparchive-src-cachedb
index e7b148530..66a3b7845 100755
--- a/test/integration/test-apt-ftparchive-src-cachedb
+++ b/test/integration/test-apt-ftparchive-src-cachedb
@@ -2,17 +2,17 @@
set -e
assert_correct_sources_file() {
- testequal "Package: bar
+ testsuccessequal "Package: bar
+Format: 3.0 (native)
+Binary: bar
Architecture: all
Version: 1.0
-Binary: bar
-Format: 3.0 (native)
Directory: pool/main
+Package-List:
+ bar deb admin extra
Files:
7b57dd065e51de5905288a5104d4bef5 406 bar_1.0.dsc
d41d8cd98f00b204e9800998ecf8427e 0 bar_1.0.tar.gz
-Package-List:
- bar deb admin extra
Checksums-Sha1:
17a40b76715f393ab7fd6485c9392a02f1adf903 406 bar_1.0.dsc
da39a3ee5e6b4b0d3255bfef95601890afd80709 0 bar_1.0.tar.gz
@@ -24,16 +24,16 @@ Checksums-Sha512:
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 bar_1.0.tar.gz
Package: foo
+Format: 3.0 (native)
+Binary: foo
Architecture: all
Version: 1.0
-Binary: foo
-Format: 3.0 (native)
Directory: pool/main
+Package-List:
+ foo deb admin extra
Files:
d144826e6f02831c1933e910c92cd7e0 171 foo_1.0.dsc
d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz
-Package-List:
- foo deb admin extra
Checksums-Sha1:
979306aa3ccff3d61bba062bb6977e2493c6f907 171 foo_1.0.dsc
da39a3ee5e6b4b0d3255bfef95601890afd80709 0 foo_1.0.tar.gz
@@ -43,7 +43,7 @@ Checksums-Sha256:
Checksums-Sha512:
3da0240fd764657c2f3661b4d750578a9a99b0580591b133756379d48117ebda87a5ed2467f513200d6e7eaf51422cbe91c15720eef7fb4bba2cc8ff81ebc547 171 foo_1.0.dsc
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e 0 foo_1.0.tar.gz
-" aptsortpkgs ./aptarchive/dists/test/main/source/Sources
+" aptsortpkgs ./aptarchive/dists/test/main/source/Sources -o APT::SortPkgs::Source=true
}
create_source_files() {
@@ -106,28 +106,22 @@ mkdir -p aptarchive/dists/test/main/source/
mkdir aptarchive-overrides
mkdir aptarchive-cache
-
-
-# generate with --db option
-(cd aptarchive && aptftparchive --db ./test.db sources pool/main/ \
- -o APT::FTPArchive::ShowCacheMisses=1 \
- > dists/test/main/source/Sources \
- 2> stats-out.txt
- testequal " Misses in Cache: 2" grep Misses stats-out.txt
-)
+msgtest 'generate with --db option'
+cd aptarchive
+aptftparchive --db ./test.db sources pool/main/ -q=0 -o APT::FTPArchive::ShowCacheMisses=1 > dists/test/main/source/Sources 2>stats-out.txt && msgpass || msgfail
+testsuccess grep Misses stats-out.txt
+testfileequal '../rootdir/tmp/testsuccess.output' ' Misses in Cache: 2'
+cd ..
assert_correct_sources_file
-# generate with --db option (again to ensure its in the cache)
-(cd aptarchive && aptftparchive --db ./test.db sources pool/main/ \
- -o APT::FTPArchive::ShowCacheMisses=1 \
- > dists/test/main/source/Sources \
- 2> stats-out.txt
- testequal " Misses in Cache: 0" grep Misses stats-out.txt
-)
+msgtest 'generate with --db option (again to ensure its in the cache)'
+cd aptarchive
+aptftparchive --db ./test.db sources pool/main/ -q=0 -o APT::FTPArchive::ShowCacheMisses=1 > dists/test/main/source/Sources 2>stats-out.txt && msgpass || msgfail
+testsuccess grep Misses stats-out.txt
+testfileequal '../rootdir/tmp/testsuccess.output' ' Misses in Cache: 0'
+cd ..
assert_correct_sources_file
-
-
# get ready for the "apt-ftparchive generate" command
cat > apt-ftparchive.conf <<"EOF"
Dir {
@@ -159,20 +153,21 @@ Tree "dists/test" {
};
EOF
-# generate (empty cachedb)
-aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt
-testequal " Misses in Cache: 2" grep Misses stats-out.txt
+msgtest 'generate (empty cachedb)'
+testsuccess aptftparchive generate apt-ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1
+cp rootdir/tmp/testsuccess.output stats-out.txt
+testsuccess grep Misses stats-out.txt
+testfileequal rootdir/tmp/testsuccess.output ' Misses in Cache: 2'
assert_correct_sources_file
-
-# generate again out of the cache
+msgtest 'generate again out of the cache'
rm -f ./aptarchive/dists/test/main/source/Sources
-aptftparchive generate apt-ftparchive.conf -o APT::FTPArchive::ShowCacheMisses=1 2> stats-out.txt
-testequal " Misses in Cache: 0" grep Misses stats-out.txt
+testsuccess aptftparchive generate apt-ftparchive.conf -q=0 -o APT::FTPArchive::ShowCacheMisses=1
+cp rootdir/tmp/testsuccess.output stats-out.txt
+testsuccess grep Misses stats-out.txt
+testfileequal rootdir/tmp/testsuccess.output ' Misses in Cache: 0'
assert_correct_sources_file
-
-
# generate invalid files
mkdir aptarchive/pool/invalid
printf "meep" > aptarchive/pool/invalid/invalid_1.0.dsc
@@ -185,14 +180,11 @@ testequal "
E: Could not find a Source entry in the DSC 'aptarchive/pool/invalid/invalid_1.0.dsc'" aptftparchive sources aptarchive/pool/invalid
rm -f aptarchive/pool/invalid/invalid_1.0.dsc
-dd if=/dev/zero of="aptarchive/pool/invalid/toobig_1.0.dsc" bs=1k count=129 2>/dev/null
-testequal "
-E: DSC file 'aptarchive/pool/invalid/toobig_1.0.dsc' is too large!" aptftparchive sources aptarchive/pool/invalid
-
# ensure clean works
rm -f aptarchive/pool/main/*
-aptftparchive clean apt-ftparchive.conf -o Debug::APT::FTPArchive::Clean=1 > clean-out.txt 2>&1
-testequal "0 Number of unique keys in the tree" grep unique clean-out.txt
-testequal "sources-main.db" grep sources-main.db clean-out.txt
-
-
+testsuccess aptftparchive clean apt-ftparchive.conf -q=0 -o Debug::APT::FTPArchive::Clean=1
+cp rootdir/tmp/testsuccess.output clean-out.txt
+testsuccess grep unique clean-out.txt
+testfileequal 'rootdir/tmp/testsuccess.output' "0 Number of unique keys in the tree"
+testsuccess grep sources-main.db clean-out.txt
+testfileequal 'rootdir/tmp/testsuccess.output' "sources-main.db"
diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove
index acde4b096..a0e4d3c24 100755
--- a/test/integration/test-apt-get-autoremove
+++ b/test/integration/test-apt-get-autoremove
@@ -20,7 +20,7 @@ testdpkgnotinstalled 'debhelper'
testdpkginstalled 'po-debconf' 'unrelated'
echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
@@ -55,7 +55,7 @@ testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
testsuccess aptmark auto debhelper
testmarkedauto 'debhelper' 'po-debconf'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
@@ -65,7 +65,7 @@ Remv debhelper [8.0.0]
Remv po-debconf [1.0.16]' aptget autoremove -s
testsuccess aptmark hold debhelper
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget autoremove -s
diff --git a/test/integration/test-apt-get-build-dep b/test/integration/test-apt-get-build-dep
index 87ec6e54d..f7af5b782 100755
--- a/test/integration/test-apt-get-build-dep
+++ b/test/integration/test-apt-get-build-dep
@@ -32,7 +32,7 @@ Files:
1e806d32233af87437258d86b1561f57 2036 2vcard_0.5-3.diff.gz
EOF
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Note, using file '2vcard_0.5-3.dsc' to get the build dependencies
The following NEW packages will be installed:
@@ -75,7 +75,7 @@ z2UAn1oXgTai6opwhVfkxrlmJ+iRxzuc
-----END PGP SIGNATURE-----
EOF
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Note, using file '2vcard_0.5-3.dsc' to get the build dependencies
The following NEW packages will be installed:
@@ -117,7 +117,7 @@ Description: install packages using the apt protocol - common data
EOF
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Note, using directory './foo-1.0' to get the build dependencies
The following NEW packages will be installed:
diff --git a/test/integration/test-apt-get-changelog b/test/integration/test-apt-get-changelog
index 648dccf40..5fa8543b9 100755
--- a/test/integration/test-apt-get-changelog
+++ b/test/integration/test-apt-get-changelog
@@ -5,44 +5,98 @@ TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
-configarchitecture "i386"
+configarchitecture 'native'
-buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
+buildsimplenativepackage 'foo' 'all' '1.0' 'stable'
+buildsimplenativepackage 'libbar' 'all' '1.0' 'stable'
+
+getlabelfromsuite() { echo 'Testcases'; }
+getoriginfromsuite() { echo 'Debian'; }
setupaptarchive --no-update
changetowebserver
testsuccess aptget update
-# simulate normal user with non-existent root-owned directories
-rm -rf rootdir/var/cache/apt/archives/
-mkdir rootdir/var/cache/apt/archives/
-addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/cache/apt/archives || true;"
-chmod -R -w rootdir/var/cache/apt/archives
+testsuccessequal "'http://metadata.ftp-master.debian.org/changelogs/main/f/foo/foo_1.0_changelog' foo.changelog
+'http://metadata.ftp-master.debian.org/changelogs/main/libb/libbar/libbar_1.0_changelog' libbar.changelog" aptget changelog foo libbar --print-uris
+
+releasechanger() {
+ # modifying the Release files in lists… bad stuff. Good that this is only a test…
+ sed -i "s#^${1}: .*#${1}: ${2}#" $(find rootdir/var/lib/apt/lists -name '*Release')
+ rm -f rootdir/var/cache/apt/*.bin
+}
+releasechanger 'Origin' 'Ubuntu'
+testsuccessequal "'http://changelogs.ubuntu.com/changelogs/pool/main/f/foo/foo_1.0/changelog' foo.changelog
+'http://changelogs.ubuntu.com/changelogs/pool/main/libb/libbar/libbar_1.0/changelog' libbar.changelog" aptget changelog foo libbar --print-uris
+
+releasechanger 'Label' 'Debian'
+testsuccessequal "'http://changelogs.ubuntu.com/changelogs/pool/main/f/foo/foo_1.0/changelog' foo.changelog
+'http://changelogs.ubuntu.com/changelogs/pool/main/libb/libbar/libbar_1.0/changelog' libbar.changelog" aptget changelog foo libbar --print-uris
+
+testsuccessequal "'http://localhost:8080/main/f/foo/foo_1.0.changelog' foo.changelog
+'http://localhost:8080/main/libb/libbar/libbar_1.0.changelog' libbar.changelog" aptget changelog foo libbar --print-uris -o Acquire::Changelogs::URI::Label::Debian='http://localhost:8080/CHANGEPATH.changelog'
+
+sed -i '/^Origin: / a\
+Changelogs: http://example.org/CHANGEPATH-changelog' $(find rootdir/var/lib/apt/lists -name '*Release')
+rm -f rootdir/var/cache/apt/*.bin
-echo 'Apt::Changelogs::Server "http://localhost:8080/";' > rootdir/etc/apt/apt.conf.d/changelog.conf
+testsuccessequal "'http://example.org/main/f/foo/foo_1.0-changelog' foo.changelog
+'http://example.org/main/libb/libbar/libbar_1.0-changelog' libbar.changelog" aptget changelog foo libbar --print-uris -o Acquire::Changelogs::URI::Label::Debian='http://localhost:8080/CHANGEPATH.changelog'
-testequal "'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt --print-uris
+testsuccessequal "'http://localhost:8080/main/f/foo/foo_1.0.changelog' foo.changelog
+'http://localhost:8080/main/libb/libbar/libbar_1.0.changelog' libbar.changelog" aptget changelog foo libbar --print-uris -o Acquire::Changelogs::URI::Override::Label::Debian='http://localhost:8080/CHANGEPATH.changelog'
-testequal "'http://localhost:8080/pool/apt_1.0/changelog'
-'http://localhost:8080/pool/apt_1.0/changelog'" aptget changelog apt apt --print-uris
+releasechanger 'Changelogs' 'no'
+testequal 'E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0
+' aptget changelog foo -qq -d
+
+sed -i '/^Changelogs: / d' $(find rootdir/var/lib/apt/lists -name '*Release')
+releasechanger 'Label' 'Testcases'
+
+echo 'Acquire::Changelogs::URI::Label::Testcases "http://localhost:8080/CHANGEPATH/change.txt";' > rootdir/etc/apt/apt.conf.d/changelog.conf
+testsuccessequal "'http://localhost:8080/main/f/foo/foo_1.0/change.txt' foo.changelog
+'http://localhost:8080/main/libb/libbar/libbar_1.0/change.txt' libbar.changelog" aptget changelog foo libbar --print-uris
+
+echo 'Acquire::Changelogs::URI::Label::Testcases "http://localhost:8080/pool/CHANGEPATH/changelog";' > rootdir/etc/apt/apt.conf.d/changelog.conf
+testsuccessequal "'http://localhost:8080/pool/main/f/foo/foo_1.0/changelog' foo.changelog" aptget changelog foo --print-uris
cd downloaded
-testsuccess aptget changelog apt -qq
-testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/apt_1.0/changelog)"
+testsuccess aptget changelog foo -qq
+testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)"
+
+testsuccess aptget changelog foo libbar -qq
+testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)
+$(cat ../aptarchive/pool/main/libb/libbar/libbar_1.0/changelog)"
+
+testsuccess aptget changelog foo -d
+testfilestats 'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
+testfileequal 'foo.changelog' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)"
+rm -f foo.changelog
-testsuccess aptget changelog apt -d
-testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0/changelog)"
-testfilestats 'apt.changelog' '%U:%G:%a' '=' "${USER}:${USER}:644"
-rm -f apt.changelog ../aptarchive/pool/apt_1.0/changelog
+testsuccess aptget changelog libbar foo -d
+testfilestats 'libbar.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
+testfilestats 'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
+testfileequal 'libbar.changelog' "$(cat ../aptarchive/pool/main/libb/libbar/libbar_1.0/changelog)"
+testfileequal 'foo.changelog' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)"
+rm -f libbar.changelog foo.changelog
-testequal "$(cat ../aptarchive/pool/apt_1.0.changelog)" aptget changelog apt \
- -qq -o APT::Changelogs::Server='http://not-on-the-main-server:8080/'
+# as such bogus, but can happen with multiple binaries from the same source
+testsuccessequal "'http://localhost:8080/pool/main/f/foo/foo_1.0/changelog' foo.changelog
+'http://localhost:8080/pool/main/f/foo/foo_1.0/changelog' foo.changelog" aptget changelog foo foo --print-uris
+testsuccess aptget changelog foo foo -qq
+testfileequal '../rootdir/tmp/testsuccess.output' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)
+$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)"
+testsuccess aptget changelog foo foo -d
+testfilestats 'foo.changelog' '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
+testfileequal 'foo.changelog' "$(cat ../aptarchive/pool/main/f/foo/foo_1.0/changelog)"
+rm -f foo.changelog
-testsuccess aptget changelog apt -d
-testfileequal 'apt.changelog' "$(cat ../aptarchive/pool/apt_1.0.changelog)"
-testfilestats 'apt.changelog' '%U:%G:%a' '=' "${USER}:${USER}:644"
-rm -f apt.changelog ../aptarchive/pool/apt_1.0.changelog
+# no CHANGEPATH in the URI
+testequal 'E: Failed to fetch changelog:/foo.changelog Changelog unavailable for foo=1.0
+' aptget changelog foo -qq -d -o Acquire::Changelogs::URI::Label::Testcases='http://localhost:8080/change.txt'
+testfailure test -e foo.changelog
-testequal 'E: changelog download failed' aptget changelog apt -qq -d -o APT::Changelogs::Server='http://not-on-the-main-server:8080/'
-testfailure test -e apt.changelog
+testequal 'E: Failed to fetch http://localhost:8080/does/not/exist/main/f/foo/foo_1.0/change.txt Changelog unavailable for foo=1.0 (404 Not Found)
+' aptget changelog foo -qq -d -o Acquire::Changelogs::URI::Label::Testcases='http://localhost:8080/does/not/exist/CHANGEPATH/change.txt'
+testfailure test -e foo.changelog
diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download
index 6503bbd1c..fa0b65672 100755
--- a/test/integration/test-apt-get-download
+++ b/test/integration/test-apt-get-download
@@ -38,7 +38,7 @@ testdownload() {
APT="${APT}/${3}"
fi
msgtest "Test download of package file $1 with" "$APT"
- testsuccess --nomsg aptget download ${APT}
+ testsuccess --nomsg aptget download ${APT} -o Debug::pkgAcquire::Worker=1 -o Debug::pkgAcquire::Auth=1
testsuccess test -f "$1"
rm -f "$1"
}
diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb
index 700009da5..0f34692fe 100755
--- a/test/integration/test-apt-get-install-deb
+++ b/test/integration/test-apt-get-install-deb
@@ -8,23 +8,20 @@ setupenvironment
configarchitecture "i386"
# regression test for #754904
-testequal 'E: Unable to locate package /dev/null' aptget install -qq /dev/null
+testfailureequal 'E: Unable to locate package /dev/null' aptget install -qq /dev/null
# and ensure we fail for invalid debs
cat > foo.deb <<EOF
I'm not a deb, I'm a teapot.
EOF
-testequal 'E: Sub-process Popen returned an error code (100)
-E: Encountered a section with no Package: header
+testfailure aptget install ./foo.deb
+testsuccess grep '^E: Sub-process Popen returned an error code' rootdir/tmp/testfailure.output
+testequal 'E: Encountered a section with no Package: header
E: Problem with MergeLister for ./foo.deb
-E: The package lists or status file could not be parsed or opened.' aptget install -qq ./foo.deb
+E: The package lists or status file could not be parsed or opened.' tail -n 3 rootdir/tmp/testfailure.output
# fakeroot is currently not found, framwork needs updating
-#
-#buildsimplenativepackage 'foo' 'all' '1.0'
-#
-#testequal 'Selecting previously unselected package foo.
-#(Reading database ... 0 files and directories currently installed.)
-# Preparing to unpack .../incoming/foo_1.0_all.deb ...
-#Unpacking foo (1.0) ...
-#Setting up foo (1.0) ...' aptget install -qq ./incoming/foo_1.0_all.deb
+buildsimplenativepackage 'foo' 'all' '1.0'
+testdpkgnotinstalled 'foo'
+testsuccess aptget install ./incoming/foo_1.0_all.deb
+testdpkginstalled 'foo'
diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source
index b27cbbe96..22f01b997 100755
--- a/test/integration/test-apt-get-source
+++ b/test/integration/test-apt-get-source
@@ -34,55 +34,53 @@ APTARCHIVE=$(readlink -f ./aptarchive)
# normal operation gets highest version number
HEADER="Reading package lists...
Building dependency tree..."
-testequal "$HEADER
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo
+DOWNLOAD1="Need to get 0 B/25 B of source archives.
+'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 11 MD5Sum:b998e085e36cf162e6a33c2801318fef
+'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 14 MD5Sum:d46b9a02af8487cbeb49165540c88184"
+DOWNLOAD2="Need to get 0 B/25 B of source archives.
+'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 11 MD5Sum:c0de572c6f8aa576c8ff78c81132ed55
+'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 14 MD5Sum:e10bb487c375b2b938d27bd31c2d1f5f"
+testsuccessequal "$HEADER
+$DOWNLOAD2" aptget source -q --print-uris foo
# select by release: suite
-testequal "$HEADER
+testsuccessequal "$HEADER
Selected version '1.0' (stable) for foo
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/stable
-testequal "$HEADER
+$DOWNLOAD1" aptget source -q --print-uris foo/stable
+testsuccessequal "$HEADER
Selected version '2.0' (unstable) for foo
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/unstable
+$DOWNLOAD2" aptget source -q --print-uris foo/unstable
# select by release: codename
-testequal "$HEADER
+testsuccessequal "$HEADER
Selected version '2.0' (sid) for foo
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/sid
+$DOWNLOAD2" aptget source -q --print-uris foo/sid
# select by version
-testequal "$HEADER
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo=1.0
+testsuccessequal "$HEADER
+$DOWNLOAD1" aptget source -q --print-uris foo=1.0
# select by release with no binary package (Bug#731102) but ensure to get
# highest version
-testequal "$HEADER
+DOWNLOAD01="Need to get 0 B/25 B of source archives.
+'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 11 MD5Sum:0811a4d85238056c613ea897f49f01af
+'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 14 MD5Sum:fa1ecb7a1a53e8e6f6551ca7db888a61"
+testsuccessequal "$HEADER
Selected version '0.1' (wheezy) for foo
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo/wheezy
+$DOWNLOAD01" aptget source -q --print-uris foo/wheezy
# unavailable one
-testequal "$HEADER
+testfailureequal "$HEADER
E: Can not find version '9.9-not-there' of package 'foo'
E: Unable to find a source package for foo" aptget source -q --print-uris foo=9.9-not-there
# version and release
-testequal "$HEADER
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_0.0.1.dsc' foo_0.0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_0.0.1.tar.gz' foo_0.0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris -t unstable foo=0.0.1
-
-testequal "$HEADER
-Need to get 0 B of source archives.
+DOWNLOAD001="Need to get 0 B/29 B of source archives.
+'file://${APTARCHIVE}/foo_0.0.1.dsc' foo_0.0.1.dsc 13 MD5Sum:6c819ebf0a21b1a480e1dbf6b8edfebd
+'file://${APTARCHIVE}/foo_0.0.1.tar.gz' foo_0.0.1.tar.gz 16 MD5Sum:a3c7e1ac2159fc0faf522e110d6906fd"
+testsuccessequal "$HEADER
+$DOWNLOAD001" aptget source -q --print-uris -t unstable foo=0.0.1
+
+testsuccessequal "$HEADER
+Need to get 0 B/25 B of source archives.
Fetch source foo" aptget source -q -s foo
diff --git a/test/integration/test-apt-get-source-arch b/test/integration/test-apt-get-source-arch
index d7ed56dc9..f54bb6012 100755
--- a/test/integration/test-apt-get-source-arch
+++ b/test/integration/test-apt-get-source-arch
@@ -28,43 +28,42 @@ APTARCHIVE=$(readlink -f ./aptarchive)
HEADER="Reading package lists...
Building dependency tree..."
+DOWNLOAD10="Need to get 0 B/25 B of source archives.
+'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 11 MD5Sum:b998e085e36cf162e6a33c2801318fef
+'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 14 MD5Sum:d46b9a02af8487cbeb49165540c88184"
# pick :amd64
-testequal "$HEADER
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo:amd64
+testsuccessequal "$HEADER
+$DOWNLOAD10" aptget source -q --print-uris foo:amd64
# pick :i386
-testequal "$HEADER
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo:i386
+testsuccessequal "$HEADER
+Need to get 0 B/25 B of source archives.
+'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 11 MD5Sum:c0de572c6f8aa576c8ff78c81132ed55
+'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 14 MD5Sum:e10bb487c375b2b938d27bd31c2d1f5f" aptget source -q --print-uris foo:i386
# pick :i386 by release
-testequal "$HEADER
+testsuccessequal "$HEADER
Selected version '0.1' (oldstable) for foo
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo:i386/oldstable
+Need to get 0 B/25 B of source archives.
+'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 11 MD5Sum:0811a4d85238056c613ea897f49f01af
+'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 14 MD5Sum:fa1ecb7a1a53e8e6f6551ca7db888a61" aptget source -q --print-uris foo:i386/oldstable
# pick :i386 by version
-testequal "$HEADER
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -q --print-uris foo:i386=1.0
+testsuccessequal "$HEADER
+$DOWNLOAD10" aptget source -q --print-uris foo:i386=1.0
# error on unknown arch
-testequal "$HEADER
+testfailureequal "$HEADER
E: Can not find a package for architecture 'not-a-available-arch'
E: Unable to find a source package for foo:not-a-available-arch" aptget source -q --print-uris foo:not-a-available-arch
# error on unavailable version for arch
-testequal "$HEADER
+testfailureequal "$HEADER
E: Can not find a package 'foo:amd64' with version '2.0'
E: Unable to find a source package for foo:amd64=2.0" aptget source -q --print-uris foo:amd64=2.0
-# error on unavailable release for arch
-testequal "$HEADER
+# error on unavailable release for arch
+testfailureequal "$HEADER
E: Can not find a package 'foo:amd64' with release 'oldstable'
E: Unable to find a source package for foo:amd64/oldstable" aptget source -q --print-uris foo:amd64/oldstable
diff --git a/test/integration/test-apt-get-source-authenticated b/test/integration/test-apt-get-source-authenticated
index f68c32386..da63f7cb3 100755
--- a/test/integration/test-apt-get-source-authenticated
+++ b/test/integration/test-apt-get-source-authenticated
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Regression test for debian bug #749795. Ensure that we fail with
-# a error if apt-get source foo will download a source that comes
+# an error if apt-get source foo will download a source that comes
# from a unauthenticated repository
#
set -e
@@ -31,4 +31,3 @@ testfailure test -e foo_2.0.dsc
# allow overriding the warning
testsuccess aptget source --allow-unauthenticated foo -o Debug::pkgAcquire::Worker=1
testsuccess test -s foo_2.0.dsc -a -L foo_2.0.dsc
-testaccessrights 'foo_2.0.dsc' '777'
diff --git a/test/integration/test-apt-get-source-multisources b/test/integration/test-apt-get-source-multisources
index cc759e8c1..887a30685 100755
--- a/test/integration/test-apt-get-source-multisources
+++ b/test/integration/test-apt-get-source-multisources
@@ -19,12 +19,12 @@ APTARCHIVE=$(readlink -f ./aptarchive)
HEADER="Reading package lists...
Building dependency tree..."
-testequal "$HEADER
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qdy --print-uris --dsc-only adduser=3.113 python-fll=0.9.11
-
-testequal "$HEADER
-Need to get 0 B of source archives.
-'file://${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qdy --print-uris --dsc-only python-fll=0.9.11 adduser=3.113
+testsuccessequal "$HEADER
+Need to get 0 B/43 B of source archives.
+'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 22 MD5Sum:255405ab5af211238ef53b7a1dd8ca4b
+'file://${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 21 MD5Sum:740a9dbf02a295932f15b1415d0dc0df" aptget source -qdy --print-uris --dsc-only adduser=3.113 python-fll=0.9.11
+
+testsuccessequal "$HEADER
+Need to get 0 B/43 B of source archives.
+'file://${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 21 MD5Sum:740a9dbf02a295932f15b1415d0dc0df
+'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 22 MD5Sum:255405ab5af211238ef53b7a1dd8ca4b" aptget source -qdy --print-uris --dsc-only python-fll=0.9.11 adduser=3.113
diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning
index 0389415c1..fcabf244a 100755
--- a/test/integration/test-apt-get-update-unauth-warning
+++ b/test/integration/test-apt-get-update-unauth-warning
@@ -9,6 +9,7 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture "i386"
+configcompression '.' 'gz'
# a "normal" package with source and binary
buildsimplenativepackage 'foo' 'all' '2.0'
@@ -19,25 +20,65 @@ APTARCHIVE=$(readlink -f ./aptarchive)
rm -f $APTARCHIVE/dists/unstable/*Release*
# update without authenticated files leads to warning
-testequal "Ign file: unstable InRelease
+testfailureequal "Get:1 file:$APTARCHIVE unstable InRelease
+Ign:1 file:$APTARCHIVE unstable InRelease
File not found
-Err file: unstable Release
+Get:2 file:$APTARCHIVE unstable Release
+Err:2 file:$APTARCHIVE unstable Release
File not found
-W: The repository 'file: unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository.
+W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository.
E: Use --allow-insecure-repositories to force the update" aptget update --no-allow-insecure-repositories
# no package foo
-testequal "Listing..." apt list foo
-testequal "partial" ls rootdir/var/lib/apt/lists
+testsuccessequal 'Listing...' apt list foo
+testequal 'lock
+partial' ls rootdir/var/lib/apt/lists
+filesize() {
+ stat -c%s "$(aptget files --no-release-info --format '$(URI)' "Created-By: $1" | cut -d'/' -f 3- ).gz"
+}
# allow override
-testequal "Ign file: unstable InRelease
+#aptget update --allow-insecure-repositories -o Debug::pkgAcquire::worker=1
+#exit
+testwarningequal "Get:1 file:$APTARCHIVE unstable InRelease
+Ign:1 file:$APTARCHIVE unstable InRelease
File not found
-Ign file: unstable Release
+Get:2 file:$APTARCHIVE unstable Release
+Ign:2 file:$APTARCHIVE unstable Release
File not found
+Get:3 file:$APTARCHIVE unstable/main Sources
+Ign:3 file:$APTARCHIVE unstable/main Sources
+ File not found
+Get:4 file:$APTARCHIVE unstable/main i386 Packages
+Ign:4 file:$APTARCHIVE unstable/main i386 Packages
+ File not found
+Get:5 file:$APTARCHIVE unstable/main Translation-en
+Ign:5 file:$APTARCHIVE unstable/main Translation-en
+ File not found
+Get:3 file:$APTARCHIVE unstable/main Sources
+Ign:3 file:$APTARCHIVE unstable/main Sources
+ File not found
+Get:4 file:$APTARCHIVE unstable/main i386 Packages
+Ign:4 file:$APTARCHIVE unstable/main i386 Packages
+ File not found
+Get:5 file:$APTARCHIVE unstable/main Translation-en
+Ign:5 file:$APTARCHIVE unstable/main Translation-en
+ File not found
+Get:3 file:$APTARCHIVE unstable/main Sources
+Ign:3 file:$APTARCHIVE unstable/main Sources
+ File not found
+Get:4 file:$APTARCHIVE unstable/main i386 Packages
+Ign:4 file:$APTARCHIVE unstable/main i386 Packages
+ File not found
+Get:5 file:$APTARCHIVE unstable/main Translation-en
+Ign:5 file:$APTARCHIVE unstable/main Translation-en
+ File not found
+Get:3 file:$APTARCHIVE unstable/main Sources [$(filesize 'Sources') B]
+Get:4 file:$APTARCHIVE unstable/main i386 Packages [$(filesize 'Packages') B]
+Get:5 file:$APTARCHIVE unstable/main Translation-en [$(filesize 'Translations') B]
Reading package lists...
-W: The repository 'file: unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository." aptget update --allow-insecure-repositories
+W: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository." aptget update --allow-insecure-repositories
# ensure we can not install the package
-testequal "WARNING: The following packages cannot be authenticated!
+testfailureequal "WARNING: The following packages cannot be authenticated!
foo
E: There are problems and -y was used without --force-yes" aptget install -qq -y foo
diff --git a/test/integration/test-apt-get-upgrade b/test/integration/test-apt-get-upgrade
index d042e4fb7..09cbcdb7e 100755
--- a/test/integration/test-apt-get-upgrade
+++ b/test/integration/test-apt-get-upgrade
@@ -21,56 +21,124 @@ insertpackage 'stable,installed' 'upgrade-with-conflict' 'all' '1.0'
insertpackage 'unstable' 'upgrade-with-conflict' 'all' '2.0' 'Conflicts: conflicting-dep' 'standard'
insertpackage 'stable,installed' 'conflicting-dep' 'all' '1.0'
+# upgrade with conflict and a new pkg with higher priority than conflict
+insertpackage 'stable,installed' 'init' 'all' '1'
+insertpackage 'unstable' 'init' 'all' '2' 'Pre-Depends: systemd | sysvinit'
+insertpackage 'unstable' 'systemd' 'all' '2' 'Conflicts: conflicting-dep'
+insertpackage 'unstable' 'sysvinit' 'all' '2'
+
setupaptarchive
# Test if normal upgrade works as expected
-testequal 'Reading package lists...
+UPGRADE='Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages have been kept back:
- upgrade-with-conflict upgrade-with-new-dep
+ init upgrade-with-conflict upgrade-with-new-dep
The following packages will be upgraded:
upgrade-simple
-1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
+1 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
Inst upgrade-simple [1.0] (2.0 unstable [all])
-Conf upgrade-simple (2.0 unstable [all])' aptget -s upgrade
+Conf upgrade-simple (2.0 unstable [all])'
+testsuccessequal "$UPGRADE" aptget upgrade -s
+testsuccessequal "$UPGRADE" apt upgrade -s --without-new-pkgs
# Test if apt-get upgrade --with-new-pkgs works
-testequal 'Reading package lists...
+UPGRADENEW='Reading package lists...
Building dependency tree...
Calculating upgrade...
The following NEW packages will be installed:
new-dep
The following packages have been kept back:
- upgrade-with-conflict
+ init upgrade-with-conflict
The following packages will be upgraded:
upgrade-simple upgrade-with-new-dep
-2 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
+2 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Inst new-dep (1.0 stable [all])
Inst upgrade-simple [1.0] (2.0 unstable [all])
Inst upgrade-with-new-dep [1.0] (2.0 unstable [all])
Conf new-dep (1.0 stable [all])
Conf upgrade-simple (2.0 unstable [all])
-Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s upgrade --with-new-pkgs
+Conf upgrade-with-new-dep (2.0 unstable [all])'
+testsuccessequal "$UPGRADENEW" aptget upgrade -s --with-new-pkgs
+testsuccessequal "$UPGRADENEW" apt upgrade -s
# Test if apt-get dist-upgrade works
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be REMOVED:
conflicting-dep
The following NEW packages will be installed:
- new-dep
+ new-dep systemd
The following packages will be upgraded:
- upgrade-simple upgrade-with-conflict upgrade-with-new-dep
-3 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+ init upgrade-simple upgrade-with-conflict upgrade-with-new-dep
+4 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
Remv conflicting-dep [1.0]
+Inst systemd (2 unstable [all])
+Conf systemd (2 unstable [all])
+Inst init [1] (2 unstable [all])
Inst upgrade-with-conflict [1.0] (2.0 unstable [all])
Inst new-dep (1.0 stable [all])
Inst upgrade-simple [1.0] (2.0 unstable [all])
Inst upgrade-with-new-dep [1.0] (2.0 unstable [all])
+Conf init (2 unstable [all])
Conf upgrade-with-conflict (2.0 unstable [all])
Conf new-dep (1.0 stable [all])
Conf upgrade-simple (2.0 unstable [all])
Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s dist-upgrade
+msgmsg 'make systemd a non-choice in the or-group and try again'
+echo 'Package: systemd
+Pin: release unstable
+Pin-Priority: -1' > rootdir/etc/apt/preferences.d/nosystemd.pref
+
+testsuccessequal "$UPGRADE" aptget upgrade -s
+testsuccessequal "$UPGRADE" apt upgrade -s --without-new-pkgs
+
+UPGRADENEW='Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following NEW packages will be installed:
+ new-dep sysvinit
+The following packages have been kept back:
+ upgrade-with-conflict
+The following packages will be upgraded:
+ init upgrade-simple upgrade-with-new-dep
+3 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
+Inst sysvinit (2 unstable [all])
+Conf sysvinit (2 unstable [all])
+Inst init [1] (2 unstable [all])
+Inst new-dep (1.0 stable [all])
+Inst upgrade-simple [1.0] (2.0 unstable [all])
+Inst upgrade-with-new-dep [1.0] (2.0 unstable [all])
+Conf init (2 unstable [all])
+Conf new-dep (1.0 stable [all])
+Conf upgrade-simple (2.0 unstable [all])
+Conf upgrade-with-new-dep (2.0 unstable [all])'
+testsuccessequal "$UPGRADENEW" aptget upgrade -s --with-new-pkgs
+testsuccessequal "$UPGRADENEW" apt upgrade -s
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be REMOVED:
+ conflicting-dep
+The following NEW packages will be installed:
+ new-dep sysvinit
+The following packages will be upgraded:
+ init upgrade-simple upgrade-with-conflict upgrade-with-new-dep
+4 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
+Remv conflicting-dep [1.0]
+Inst sysvinit (2 unstable [all])
+Conf sysvinit (2 unstable [all])
+Inst init [1] (2 unstable [all])
+Inst upgrade-with-conflict [1.0] (2.0 unstable [all])
+Inst new-dep (1.0 stable [all])
+Inst upgrade-simple [1.0] (2.0 unstable [all])
+Inst upgrade-with-new-dep [1.0] (2.0 unstable [all])
+Conf init (2 unstable [all])
+Conf upgrade-with-conflict (2.0 unstable [all])
+Conf new-dep (1.0 stable [all])
+Conf upgrade-simple (2.0 unstable [all])
+Conf upgrade-with-new-dep (2.0 unstable [all])' aptget -s dist-upgrade
diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper
index 06e497ff7..00d859ad5 100755
--- a/test/integration/test-apt-helper
+++ b/test/integration/test-apt-helper
@@ -11,39 +11,40 @@ changetohttpswebserver
test_apt_helper_download() {
echo 'foo' > aptarchive/foo
+ echo 'bar' > aptarchive/foo2
- msgtest 'apt-file download-file' 'md5sum'
- apthelper -qq download-file http://localhost:8080/foo downloaded/foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 && msgpass || msgfail
- testfileequal downloaded/foo2 'foo'
+ msgtest 'apt-file download-file md5sum'
+ testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo2 MD5Sum:d3b07384d113edec49eaa6238ad5ff00
+ testfileequal ./downloaded/foo2 'foo'
- msgtest 'apt-file download-file' 'sha1'
- apthelper -qq download-file http://localhost:8080/foo downloaded/foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 && msgpass || msgfail
- testfileequal downloaded/foo1 'foo'
+ msgtest 'apt-file download-file sha1'
+ testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo1 SHA1:f1d2d2f924e986ac86fdf7b36c94bcdf32beec15
+ testfileequal ./downloaded/foo1 'foo'
- msgtest 'apt-file download-file' 'sha256'
- apthelper -qq download-file http://localhost:8080/foo downloaded/foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c && msgpass || msgfail
- testfileequal downloaded/foo3 'foo'
+ msgtest 'apt-file download-file sha256'
+ testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo3 SHA256:b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c
+ testfileequal ./downloaded/foo3 'foo'
- msgtest 'apt-file download-file' 'no-hash'
- apthelper -qq download-file http://localhost:8080/foo downloaded/foo4 && msgpass || msgfail
- testfileequal downloaded/foo4 'foo'
+ msgtest 'apt-file download-file no-hash'
+ testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo4
+ testfileequal ./downloaded/foo4 'foo'
- msgtest 'apt-file download-file' 'wrong hash'
- if ! apthelper -qq download-file http://localhost:8080/foo downloaded/foo5 MD5Sum:aabbcc 2>&1 2> download.stderr; then
- msgpass
- else
- msgfail
- fi
- testfileequal download.stderr 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch
+ msgtest 'apt-file download-file wrong hash'
+ testfailure --nomsg apthelper -qq download-file http://localhost:8080/foo ./downloaded/foo5 MD5Sum:aabbcc
+ testfileequal rootdir/tmp/testfailure.output 'E: Failed to fetch http://localhost:8080/foo Hash Sum mismatch
E: Download Failed'
- testfileequal downloaded/foo5.FAILED 'foo'
- testfailure test -e downloaded/foo5
+ testfileequal ./downloaded/foo5.FAILED 'foo'
+
+ msgtest 'apt-file download-file md5sum sha1'
+ testsuccess --nomsg apthelper download-file http://localhost:8080/foo ./downloaded/foo6 MD5Sum:d3b07384d113edec49eaa6238ad5ff00 http://localhost:8080/foo2 ./downloaded/foo7 SHA1:e242ed3bffccdf271b7fbaf34ed72d089537b42f
+ testfileequal ./downloaded/foo6 'foo'
+ testfileequal ./downloaded/foo7 'bar'
}
test_apt_helper_detect_proxy() {
# no proxy
- testequal "Using proxy '' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
+ testsuccessequal "Using proxy '' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
# http auto detect proxy script
@@ -53,8 +54,8 @@ echo "http://some-proxy"
EOF
chmod 755 apt-proxy-detect
echo "Acquire::http::Proxy-Auto-Detect \"$(pwd)/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
-
- testequal "Using proxy 'http://some-proxy' for URL 'http://www.example.com/'" apthelper auto-detect-proxy http://www.example.com
+
+ testsuccessequal "Using proxy 'http://some-proxy' for URL 'http://www.example.com/'" apthelper auto-detect-proxy http://www.example.com
# https auto detect proxy script
@@ -64,13 +65,15 @@ echo "https://https-proxy"
EOF
chmod 755 apt-proxy-detect
echo "Acquire::https::Proxy-Auto-Detect \"$(pwd)/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
-
- testequal "Using proxy 'https://https-proxy' for URL 'https://ssl.example.com/'" apthelper auto-detect-proxy https://ssl.example.com
-
-
+ testsuccessequal "Using proxy 'https://https-proxy' for URL 'https://ssl.example.com/'" apthelper auto-detect-proxy https://ssl.example.com
}
test_apt_helper_download
test_apt_helper_detect_proxy
+# test failure modes
+testfailureequal 'E: Invalid operation download' apthelper download
+testfailureequal 'E: Must specify at least one pair url/filename' apthelper download-file
+testfailureequal 'E: Must specify at least one pair url/filename' apthelper download-file http://example.org/
+testfailureequal 'E: Need one URL as argument' apthelper auto-detect-proxy
diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect
index bc744d6f2..c91c78916 100755
--- a/test/integration/test-apt-https-no-redirect
+++ b/test/integration/test-apt-https-no-redirect
@@ -14,22 +14,15 @@ echo 'alright' > aptarchive/working
changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=http://localhost:8080/'
msgtest 'download of a file works via' 'http'
-downloadfile 'http://localhost:8080/working' httpfile >/dev/null 2>&1 && msgpass || msgfail
+testsuccess --nomsg downloadfile 'http://localhost:8080/working' httpfile
testfileequal httpfile 'alright'
msgtest 'download of a file works via' 'https'
-downloadfile 'https://localhost:4433/working' httpsfile >/dev/null 2>&1 && msgpass || msgfail
+testsuccess --nomsg downloadfile 'https://localhost:4433/working' httpsfile
testfileequal httpsfile 'alright'
msgtest 'download of a file does not work if' 'https redirected to http'
-downloadfile 'https://localhost:4433/redirectme/working' redirectfile >curloutput 2>&1 && msgfail || msgpass
+testfailure --nomsg downloadfile 'https://localhost:4433/redirectme/working' redirectfile
msgtest 'libcurl has forbidden access in last request to' 'http resource'
-if grep -q -E -- 'Protocol "?http"? not supported or disabled in libcurl' curloutput; then
- msgpass
-else
- cat curloutput
- msgfail
-fi
-
-
+testsuccess --nomsg grep -q -E -- 'Protocol "?http"? not supported or disabled in libcurl' rootdir/tmp/testfailure.output
diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key
index b6b7b7909..486acccc8 100755
--- a/test/integration/test-apt-key
+++ b/test/integration/test-apt-key
@@ -17,7 +17,7 @@ testaptkeys() {
if ! aptkey list | grep '^pub' > aptkey.list; then
echo -n > aptkey.list
fi
- testequal "$1" cat ./aptkey.list
+ testfileequal './aptkey.list' "$1"
}
echo 'APT::Key::ArchiveKeyring "./keys/joesixpack.pub";
@@ -35,7 +35,7 @@ testrun() {
testaptkeys 'pub 2048R/DBAC8DAE 2010-08-18'
- testequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
+ testsuccessequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
gpg: Total number processed: 1
gpg: unchanged: 1' aptkey --fakeroot update
@@ -73,6 +73,12 @@ pub 2048R/DBAC8DAE 2010-08-18'
testsuccess aptkey --fakeroot del DBAC8DAE
testempty aptkey list
+ msgtest 'Test key removal with' 'lowercase key ID' #keylength somewher between 8byte and short
+ cleanplate
+ cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+ testsuccess --nomsg aptkey --fakeroot del d141dbac8dae
+ testempty aptkey list
+
msgtest 'Test key removal with' 'single key in real file'
cleanplate
cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
@@ -181,3 +187,4 @@ setupgpgcommand 'gpg'
testrun
setupgpgcommand 'gpg2'
testrun
+
diff --git a/test/integration/test-apt-key-net-update b/test/integration/test-apt-key-net-update
index b3c118555..2a0823bec 100755
--- a/test/integration/test-apt-key-net-update
+++ b/test/integration/test-apt-key-net-update
@@ -23,7 +23,7 @@ echo 'APT::Key::ArchiveKeyringURI "http://localhost:8080/ubuntu/project/test-arc
echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf
# test against the "real" webserver
-testequal 'Checking for new archive signing keys now
+testsuccessequal 'Checking for new archive signing keys now
gpg: key F68C85A3: public key "Test Automatic Archive Signing Key <ftpmaster@example.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)' aptkey --fakeroot net-update
@@ -40,7 +40,7 @@ echo 'APT::Key::ArchiveKeyringURI "http://localhost:8080/ubuntu/project/marvinpa
echo 'APT::Key::Net-Update-Enabled "1";' >> ./aptconfig.conf
# test against the "real" webserver
-testequal "Checking for new archive signing keys now
+testsuccessequal "Checking for new archive signing keys now
Key 'DE66AECA9151AFA1877EC31DE8525D47528144E2' not added. It is not signed with a master key" aptkey --fakeroot net-update
aptkey list | grep '^pub' > aptkey.list
diff --git a/test/integration/test-apt-mark b/test/integration/test-apt-mark
new file mode 100755
index 000000000..9b68945f9
--- /dev/null
+++ b/test/integration/test-apt-mark
@@ -0,0 +1,101 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertpackage 'unstable' 'bar' 'amd64,i386' '1'
+insertpackage 'unstable' 'uninstalled' 'all' '1'
+insertpackage 'unstable' 'uninstalled-native' 'amd64' '1'
+
+insertinstalledpackage 'foo' 'all' '1'
+insertinstalledpackage 'bar' 'amd64' '1'
+
+setupaptarchive
+
+# dpkg is "installed" by our test framework
+testdpkginstalled dpkg
+
+testnoautopkg() {
+ testempty aptmark showauto
+ testempty aptcache showauto
+ testsuccessequal 'bar
+dpkg
+foo' aptmark showmanual
+ testsuccessequal 'bar
+foo' aptmark showmanual bar foo uninstalled
+}
+testfooisauto() {
+ testsuccessequal 'foo' aptmark showauto
+ testsuccessequal 'foo' aptcache showauto
+ testsuccessequal 'foo' aptmark showauto foo
+ testsuccessequal 'foo' aptcache showauto foo
+ testsuccessequal 'bar
+dpkg' aptmark showmanual
+ testsuccessequal 'bar' aptmark showmanual bar
+}
+testmarkonpkgasauto() {
+ testsuccess $1 $2 foo
+ testfooisauto
+ testsuccess $1 $2 foo
+ testfooisauto
+
+ testsuccess $1 $3 foo
+ testnoautopkg
+ testsuccess $1 $3 foo
+ testnoautopkg
+}
+
+testfailureequal 'E: No packages found' aptmark auto
+testfailureequal 'E: No packages found' aptmark manual
+
+testnoautopkg
+testmarkonpkgasauto 'aptmark' 'auto' 'manual'
+testmarkonpkgasauto 'aptmark' 'markauto' 'unmarkauto'
+testmarkonpkgasauto 'aptget' 'markauto' 'unmarkauto'
+
+testnoholdpkg() {
+ testempty aptmark showhold
+ testempty aptmark showholds # typical "typo"
+ testempty aptmark showhold dpkg
+ testempty aptmark showholds dpkg
+}
+testpkgonhold() {
+ testsuccessequal "$1" aptmark showhold
+ testsuccessequal "$1" aptmark showholds
+ testsuccessequal "$1" aptmark showhold $1
+ testsuccessequal "$1" aptmark showholds $1
+}
+testmarkonepkgashold() {
+ testsuccess aptmark hold $1
+ testpkgonhold $1
+ testsuccess aptmark hold $1
+ testpkgonhold $1
+ testsuccess aptmark unhold $1
+ testnoholdpkg
+ testsuccess aptmark unhold $1
+ testnoholdpkg
+}
+
+testfailureequal 'E: No packages found' aptmark hold
+testfailureequal 'E: No packages found' aptmark unhold
+
+testnoholdpkg
+testmarkonepkgashold 'foo'
+testmarkonepkgashold 'bar'
+
+msgtest 'dpkg supports --merge-avail via' 'stdin'
+if dpkg --merge-avail - < /dev/null >/dev/null 2>&1; then
+ msgpass
+else
+ msgskip 'dpkg version too old'
+ exit 0
+fi
+
+testmarkonepkgashold 'uninstalled'
+testmarkonepkgashold 'uninstalled-native'
+
+testsuccessequal 'uninstalled set on hold.' aptmark hold uninstalled
+testsuccessequal 'uninstalled-native set on hold.' aptmark hold uninstalled-native
diff --git a/test/integration/test-apt-progress-fd b/test/integration/test-apt-progress-fd
index af022f582..e30d503cb 100755
--- a/test/integration/test-apt-progress-fd
+++ b/test/integration/test-apt-progress-fd
@@ -15,72 +15,75 @@ setupaptarchive
# install native
exec 3> apt-progress.log
testsuccess aptget install testing=0.1 -y -o APT::Status-Fd=3
-testequal "dlstatus:1:0:Retrieving file 1 of 1
+testfileequal './apt-progress.log' 'dlstatus:1:0:Retrieving file 1 of 1
dlstatus:1:20:Retrieving file 1 of 1
pmstatus:dpkg-exec:0:Running dpkg
pmstatus:testing:0:Installing testing (amd64)
-pmstatus:testing:20:Preparing testing (amd64)
-pmstatus:testing:40:Unpacking testing (amd64)
-pmstatus:testing:60:Preparing to configure testing (amd64)
-pmstatus:dpkg-exec:60:Running dpkg
-pmstatus:testing:60:Configuring testing (amd64)
-pmstatus:testing:80:Configuring testing (amd64)
-pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log
+pmstatus:testing:16.6667:Preparing testing (amd64)
+pmstatus:testing:33.3333:Unpacking testing (amd64)
+pmstatus:testing:50:Preparing to configure testing (amd64)
+pmstatus:dpkg-exec:50:Running dpkg
+pmstatus:testing:50:Configuring testing (amd64)
+pmstatus:testing:66.6667:Configuring testing (amd64)
+pmstatus:testing:83.3333:Installed testing (amd64)
+pmstatus:dpkg-exec:83.3333:Running dpkg'
# upgrade
exec 3> apt-progress.log
testsuccess aptget install testing=0.8.15 -y -o APT::Status-Fd=3
-testequal "dlstatus:1:0:Retrieving file 1 of 1
+testfileequal './apt-progress.log' 'dlstatus:1:0:Retrieving file 1 of 1
dlstatus:1:20:Retrieving file 1 of 1
pmstatus:dpkg-exec:0:Running dpkg
pmstatus:testing:0:Installing testing (amd64)
-pmstatus:testing:20:Preparing testing (amd64)
-pmstatus:testing:40:Unpacking testing (amd64)
-pmstatus:testing:60:Preparing to configure testing (amd64)
-pmstatus:dpkg-exec:60:Running dpkg
-pmstatus:testing:60:Configuring testing (amd64)
-pmstatus:testing:80:Configuring testing (amd64)
-pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log
+pmstatus:testing:16.6667:Preparing testing (amd64)
+pmstatus:testing:33.3333:Unpacking testing (amd64)
+pmstatus:testing:50:Preparing to configure testing (amd64)
+pmstatus:dpkg-exec:50:Running dpkg
+pmstatus:testing:50:Configuring testing (amd64)
+pmstatus:testing:66.6667:Configuring testing (amd64)
+pmstatus:testing:83.3333:Installed testing (amd64)
+pmstatus:dpkg-exec:83.3333:Running dpkg'
# reinstall
exec 3> apt-progress.log
testsuccess aptget install testing=0.8.15 --reinstall -y -o APT::Status-Fd=3
-testequal "dlstatus:1:0:Retrieving file 1 of 1
+testfileequal './apt-progress.log' 'dlstatus:1:0:Retrieving file 1 of 1
dlstatus:1:20:Retrieving file 1 of 1
pmstatus:dpkg-exec:0:Running dpkg
pmstatus:testing:0:Installing testing (amd64)
-pmstatus:testing:20:Preparing testing (amd64)
-pmstatus:testing:40:Unpacking testing (amd64)
-pmstatus:testing:60:Preparing to configure testing (amd64)
-pmstatus:dpkg-exec:60:Running dpkg
-pmstatus:testing:60:Configuring testing (amd64)
-pmstatus:testing:80:Configuring testing (amd64)
-pmstatus:testing:100:Installed testing (amd64)" cat apt-progress.log
+pmstatus:testing:16.6667:Preparing testing (amd64)
+pmstatus:testing:33.3333:Unpacking testing (amd64)
+pmstatus:testing:50:Preparing to configure testing (amd64)
+pmstatus:dpkg-exec:50:Running dpkg
+pmstatus:testing:50:Configuring testing (amd64)
+pmstatus:testing:66.6667:Configuring testing (amd64)
+pmstatus:testing:83.3333:Installed testing (amd64)
+pmstatus:dpkg-exec:83.3333:Running dpkg'
# and remove
exec 3> apt-progress.log
testsuccess aptget remove testing -y -o APT::Status-Fd=3
-testequal "pmstatus:dpkg-exec:0:Running dpkg
+testfileequal './apt-progress.log' 'pmstatus:dpkg-exec:0:Running dpkg
pmstatus:testing:0:Removing testing (amd64)
-pmstatus:testing:33.3333:Preparing for removal of testing (amd64)
-pmstatus:testing:66.6667:Removing testing (amd64)
-pmstatus:testing:100:Removed testing (amd64)" cat apt-progress.log
+pmstatus:testing:25:Preparing for removal of testing (amd64)
+pmstatus:testing:50:Removing testing (amd64)
+pmstatus:testing:75:Removed testing (amd64)
+pmstatus:dpkg-exec:75:Running dpkg'
# install non-native and ensure we get proper progress info
exec 3> apt-progress.log
testsuccess aptget install testing2:i386 -y -o APT::Status-Fd=3
-
-# and compare
-testequal "dlstatus:1:0:Retrieving file 1 of 1
+testfileequal './apt-progress.log' 'dlstatus:1:0:Retrieving file 1 of 1
dlstatus:1:20:Retrieving file 1 of 1
pmstatus:dpkg-exec:0:Running dpkg
pmstatus:testing2:0:Installing testing2 (i386)
-pmstatus:testing2:20:Preparing testing2 (i386)
-pmstatus:testing2:40:Unpacking testing2 (i386)
-pmstatus:testing2:60:Preparing to configure testing2 (i386)
-pmstatus:dpkg-exec:60:Running dpkg
-pmstatus:testing2:60:Configuring testing2 (i386)
-pmstatus:testing2:80:Configuring testing2 (i386)
-pmstatus:testing2:100:Installed testing2 (i386)" cat apt-progress.log
+pmstatus:testing2:16.6667:Preparing testing2 (i386)
+pmstatus:testing2:33.3333:Unpacking testing2 (i386)
+pmstatus:testing2:50:Preparing to configure testing2 (i386)
+pmstatus:dpkg-exec:50:Running dpkg
+pmstatus:testing2:50:Configuring testing2 (i386)
+pmstatus:testing2:66.6667:Configuring testing2 (i386)
+pmstatus:testing2:83.3333:Installed testing2 (i386)
+pmstatus:dpkg-exec:83.3333:Running dpkg'
rm -f apt-progress*.log
diff --git a/test/integration/test-apt-progress-fd-deb822 b/test/integration/test-apt-progress-fd-deb822
index 9d227942d..ca7f14cb9 100755
--- a/test/integration/test-apt-progress-fd-deb822
+++ b/test/integration/test-apt-progress-fd-deb822
@@ -16,7 +16,7 @@ setupaptarchive
exec 3> apt-progress.log
testsuccess aptget install testing=0.1 -y -o APT::Status-deb822-Fd=3
-testequal "Status: progress
+testfileequal './apt-progress.log' 'Status: progress
Percent: 0
Message: Running dpkg
@@ -27,38 +27,41 @@ Message: Installing testing (amd64)
Status: progress
Package: testing:amd64
-Percent: 20
+Percent: 16.6667
Message: Preparing testing (amd64)
Status: progress
Package: testing:amd64
-Percent: 40
+Percent: 33.3333
Message: Unpacking testing (amd64)
Status: progress
Package: testing:amd64
-Percent: 60
+Percent: 50
Message: Preparing to configure testing (amd64)
Status: progress
-Percent: 60
+Percent: 50
Message: Running dpkg
Status: progress
Package: testing:amd64
-Percent: 60
+Percent: 50
Message: Configuring testing (amd64)
Status: progress
Package: testing:amd64
-Percent: 80
+Percent: 66.6667
Message: Configuring testing (amd64)
Status: progress
Package: testing:amd64
-Percent: 100
+Percent: 83.3333
Message: Installed testing (amd64)
-" cat apt-progress.log
+Status: progress
+Percent: 83.3333
+Message: Running dpkg
+'
rm -f apt-progress*.log
diff --git a/test/integration/test-apt-progress-fd-error b/test/integration/test-apt-progress-fd-error
index a47095b9b..632300765 100755
--- a/test/integration/test-apt-progress-fd-error
+++ b/test/integration/test-apt-progress-fd-error
@@ -18,7 +18,7 @@ setupaptarchive
exec 3> apt-progress.log
testfailure aptget install foo1 foo2 -y -o APT::Status-Fd=3
msgtest "Ensure correct error message"
-if grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb:40:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log; then
+if grep -q "aptarchive/pool/foo2_0.8.15_amd64.deb:36.3636:trying to overwrite '/usr/bin/file-conflict', which is also in package foo1 0.8.15" apt-progress.log; then
msgpass
else
cat apt-progress.log
diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822
index d8b2334ad..51fe7bcfe 100755
--- a/test/integration/test-apt-sources-deb822
+++ b/test/integration/test-apt-sources-deb822
@@ -23,46 +23,45 @@ Description: summay
msgtest 'Test sources.list' 'old style'
echo "deb http://ftp.debian.org/debian stable main" > $SOURCES
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
-'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
msgtest 'Test sources.list' 'simple deb822'
echo "$BASE" > $SOURCES
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
-'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
-
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
msgtest 'Test deb822 with' 'two entries'
# Two entries
echo "$BASE" > $SOURCES
echo "" >> $SOURCES
echo "$BASE" | sed s/stable/unstable/ >> $SOURCES
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0
'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0
-'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0
-'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris
+'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
# two suite entries
msgtest 'Test deb822 with' 'two Suite entries'
echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0
'http://ftp.debian.org/debian/dists/unstable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_unstable_main_binary-i386_Packages 0
-'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0
-'http://ftp.debian.org/debian/dists/unstable/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris
+'http://ftp.debian.org/debian/dists/unstable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
msgtest 'Test deb822' 'architecture option'
echo "$BASE" > $SOURCES
echo "Architectures: amd64 armel" >> $SOURCES
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/stable/main/binary-amd64/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-amd64_Packages 0
'http://ftp.debian.org/debian/dists/stable/main/binary-armel/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-armel_Packages 0
-'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
msgtest 'Test old-style sources.list file which has' 'malformed dist'
@@ -85,20 +84,20 @@ testempty aptget update --print-uris
# multiple URIs
msgtest 'Test deb822 sources.list file which has' 'Multiple URIs work'
echo "$BASE" | sed -e 's#http://ftp.debian.org/debian#http://ftp.debian.org/debian http://ftp.de.debian.org/debian#' > $SOURCES
-testequal --nomsg "'http://ftp.de.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0
+testequal --nomsg "'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.de.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.de.debian.org_debian_dists_stable_main_binary-i386_Packages 0
'http://ftp.de.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.de.debian.org_debian_dists_stable_main_i18n_Translation-en 0
-'http://ftp.de.debian.org/debian/dists/stable/InRelease' ftp.de.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
-'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
# multiple Type in one field
msgtest 'Test deb822 sources.list file which has' 'Multiple Types work'
echo "$BASE" | sed -e 's#Types: deb#Types: deb deb-src#' > $SOURCES
-testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/main/source/Sources.bz2' ftp.debian.org_debian_dists_stable_main_source_Sources 0
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0
+'http://ftp.debian.org/debian/dists/stable/main/source/Sources.bz2' ftp.debian.org_debian_dists_stable_main_source_Sources 0
'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0
-'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0
-'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 " aptget update --print-uris
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
# a Suite
msgtest 'Test deb822 sources.list file which has' 'a exact path and no sections'
@@ -107,6 +106,6 @@ Types: deb
URIs: http://emacs.naquadah.org
Suites: stable/
EOF
-testequal --nomsg "'http://emacs.naquadah.org/stable/Packages.bz2' emacs.naquadah.org_stable_Packages 0
-'http://emacs.naquadah.org/stable/en.bz2' emacs.naquadah.org_stable_en 0
-'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0 " aptget update --print-uris
+testequal --nomsg "'http://emacs.naquadah.org/stable/InRelease' emacs.naquadah.org_stable_InRelease 0
+'http://emacs.naquadah.org/stable/Packages.bz2' emacs.naquadah.org_stable_Packages 0
+'http://emacs.naquadah.org/stable/en.bz2' emacs.naquadah.org_stable_en 0 " aptget update --print-uris
diff --git a/test/integration/test-apt-tagfile-fields-order b/test/integration/test-apt-tagfile-fields-order
new file mode 100755
index 000000000..27d5c14ff
--- /dev/null
+++ b/test/integration/test-apt-tagfile-fields-order
@@ -0,0 +1,82 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+
+dpkg_field_ordered_list() {
+ local FIELDS="$(perl -e "
+use Dpkg::Control;
+use Dpkg::Control::Fields;
+foreach \$f (field_ordered_list(${1})) {
+ print \"\$f\\n\";
+}" | sort -u)"
+ if [ -z "$FIELDS" ]; then
+ msgfail 'Could not get fields via libdpkg-perl'
+ fi
+ echo "$FIELDS"
+}
+
+comparelsts() {
+ local DIFFOUTPUT="$(diff -u apt.lst dpkg.lst || true)"
+ if echo "$DIFFOUTPUT" | grep -q '^+[^+]'; then
+ echo
+ echo "$DIFFOUTPUT" | grep '^[+-][^+-]'
+ msgfail
+ else
+ msgpass
+ fi
+}
+
+msgtest 'Check that apt knows all fields dpkg orders in' 'Packages'
+dpkg_field_ordered_list 'CTRL_INDEX_PKG' > dpkg.lst
+sed -ne 's#^ "\(.*\)",.*$#\1#p' ${SOURCEDIRECTORY}/apt-pkg/tagfile-order.c | sed -n '/^Package$/,/^Package$/ p' | head -n -1 | sort -u > apt.lst
+comparelsts
+
+msgtest 'Check that apt knows all fields dpkg orders in' 'status'
+dpkg_field_ordered_list 'CTRL_FILE_STATUS' > dpkg.lst
+comparelsts
+
+msgtest 'Check that apt knows all fields dpkg orders in' 'DEBIAN/control'
+dpkg_field_ordered_list 'CTRL_PKG_DEB' > dpkg.lst
+comparelsts
+
+msgtest 'Check that apt knows all fields dpkg orders in' 'Sources'
+dpkg_field_ordered_list 'CTRL_INDEX_SRC' > dpkg.lst
+echo 'Package' > apt.tmp
+sed -ne 's#^ "\(.*\)",.*$#\1#p' ${SOURCEDIRECTORY}/apt-pkg/tagfile-order.c | sed '/^Package$/,/^Package$/ d' >> apt.tmp
+sort -u apt.tmp > apt.lst
+comparelsts
+
+msgtest 'Check that apt knows all fields dpkg orders in' 'dsc'
+dpkg_field_ordered_list 'CTRL_PKG_SRC' > dpkg.lst
+comparelsts
+
+# HACK, but there is no good way to acquire sources in tests and/or to remember to run this regular manually
+if [ "$USER" = 'david' ]; then
+ msgtest 'Check if we have somewhere the sources of' 'dpkg'
+ DPKGSOURCE="$(locate dpkg/lib/dpkg/parse.c | head -n 1 || true)"
+ if [ -z "$DPKGSOURCE" ]; then
+ msgskip 'Not found'
+ else
+ msgpass
+ msgtest 'Check that apt knows about all fields' 'dpkg parses'
+ sed -n 's#^.*FIELD("\(.*\)").*$#\1#p' "${DPKGSOURCE}" | sort -u > dpkg.lst
+ sed -ne 's#^ "\(.*\)",.*$#\1#p' ${SOURCEDIRECTORY}/apt-pkg/tagfile-order.c | sed -n '/^Package$/,/^Package$/ p' | head -n -1 | sort -u > apt.lst
+ comparelsts
+ fi
+
+ msgtest 'Check if we have somewhere the sources of' 'dak'
+ DAKSOURCE="$(locate dak/setup/core-init.d/080_metadatakeys | head -n 1 || true)"
+ if [ -z "$DAKSOURCE" ]; then
+ msgskip 'Not found'
+ else
+ msgpass
+ msgtest 'Check that apt knows about all fields' 'dak knows'
+ # dak mixes both, so we can only check with the mixed one as well
+ sed -ne "s#^.* VALUES ('\(.*\)', \(.*\)).*\$#\1 \2#p" "${DAKSOURCE}" | cut -d ' ' -f 1 | sort -u > dpkg.lst
+ sed -ne 's#^ "\(.*\)",.*$#\1#p' ${SOURCEDIRECTORY}/apt-pkg/tagfile-order.c | sort -u > apt.lst
+ comparelsts
+ fi
+fi
diff --git a/test/integration/test-apt-translation-has-no-packages b/test/integration/test-apt-translation-has-no-packages
index bb2353a33..cf5b56243 100755
--- a/test/integration/test-apt-translation-has-no-packages
+++ b/test/integration/test-apt-translation-has-no-packages
@@ -17,7 +17,7 @@ configarchitecture "amd64"
if [ ! -x ${BUILDDIRECTORY}/apt ]; then
msgmsg "No ${BUILDDIRECTORY}/apt"
- msgskip
+ msgskip
exit 0
fi
@@ -33,9 +33,9 @@ cp $APTARCHIVE/dists/unstable/main/binary-amd64/Packages \
# ensure that there is no Version for the package foo generated out of
# the corrupted Translation-en file
-testequal "foo:
+testsuccessequal "foo:
Installed: (none)
Candidate: 1.0
Version table:
1.0 0
- 500 file:$APTARCHIVE/ unstable/main amd64 Packages" aptcache policy foo
+ 500 file:$APTARCHIVE unstable/main amd64 Packages" aptcache policy foo
diff --git a/test/integration/test-apt-update-expected-size b/test/integration/test-apt-update-expected-size
index 045217a77..24ca85133 100755
--- a/test/integration/test-apt-update-expected-size
+++ b/test/integration/test-apt-update-expected-size
@@ -10,35 +10,68 @@ configarchitecture "i386"
insertpackage 'unstable' 'apt' 'all' '1.0'
setupaptarchive --no-update
+cp -a aptarchive/dists aptarchive/dists.good
+
+test_inreleasetoobig() {
+ # make InRelease really big to trigger fallback
+ dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 2>/dev/null
+ touch -d '+1hour' aptarchive/dists/unstable/InRelease
+ testsuccess aptget update -o Apt::Get::List-Cleanup=0 -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0
+ msgtest 'Check that the max write warning is triggered'
+ cp rootdir/tmp/testsuccess.output update.output
+ testsuccess --nomsg grep -q 'Writing more data than expected' update.output
+ rm -f update.output
+ # ensure the failed InRelease file got renamed
+ testsuccess ls rootdir/var/lib/apt/lists/partial/*InRelease.FAILED
+}
+
+test_packagestoobig() {
+ insertpackage 'unstable' 'foo' 'all' '1.0'
+ buildaptarchivefromfiles '+1 hour'
+ signreleasefiles
+ # append junk at the end of the Packages.gz/Packages
+ SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
+ find aptarchive/dists -name 'Packages*' | while read pkg; do
+ echo "1234567890" >> "$pkg"
+ touch -d '+1hour' "$pkg"
+ done
+ NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
+ testfailuremsg "W: Failed to fetch ${1}/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE)
+E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::Transaction=0
+}
+
+methodtest() {
+ # less complicated test setup this way
+ webserverconfig 'aptwebserver::support::modified-since' 'false' "$1"
+ webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also
+
+ msgmsg 'Test with' "$1" 'and clean start'
+ rm -rf rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good
+ # normal update works fine
+ testsuccess aptget update
+ mv rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good
+
+ # starting fresh works
+ test_inreleasetoobig "$1"
+ rm -rf aptarchive/dists rootdir/var/lib/apt/lists
+ cp -a aptarchive/dists.good aptarchive/dists
+ test_packagestoobig "$1"
+ rm -rf aptarchive/dists rootdir/var/lib/apt/lists
+ cp -a aptarchive/dists.good aptarchive/dists
+
+ msgmsg 'Test with' "$1" 'and existing old data'
+ cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists
+ test_inreleasetoobig "$1"
+ rm -rf aptarchive/dists rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists
+ cp -a aptarchive/dists.good aptarchive/dists
+ test_packagestoobig "$1"
+ rm -rf aptarchive/dists
+ cp -a aptarchive/dists.good aptarchive/dists
+}
+
changetowebserver
+methodtest 'http://localhost:8080'
-# normal update works fine
-testsuccess aptget update
-
-# make InRelease really big to trigger fallback
-mv aptarchive/dists/unstable/InRelease aptarchive/dists/unstable/InRelease.good
-dd if=/dev/zero of=aptarchive/dists/unstable/InRelease bs=1M count=2 2>/dev/null
-touch -d '+1hour' aptarchive/dists/unstable/InRelease
-testsuccess aptget update -o Apt::Get::List-Cleanup=0 -o acquire::MaxReleaseFileSize=$((1*1000*1000)) -o Debug::pkgAcquire::worker=0
-msgtest 'Check that the max write warning is triggered'
-if grep -q "Writing more data than expected" rootdir/tmp/testsuccess.output; then
- msgpass
-else
- cat rootdir/tmp/testsuccess.output
- msgfail
-fi
-# ensure the failed InRelease file got renamed
-testsuccess ls rootdir/var/lib/apt/lists/partial/*InRelease.FAILED
-mv aptarchive/dists/unstable/InRelease.good aptarchive/dists/unstable/InRelease
-
-
-# append junk at the end of the Packages.gz/Packages
-SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
-find aptarchive -name 'Packages*' | while read pkg; do
- echo "1234567890" >> "$pkg"
-done
-NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
-rm -f rootdir/var/lib/apt/lists/localhost*
-testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE)
-
-E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq
+changetohttpswebserver
+methodtest 'https://localhost:4433'
diff --git a/test/integration/test-apt-update-file b/test/integration/test-apt-update-file
index 1ecf9a38a..94b604f0e 100755
--- a/test/integration/test-apt-update-file
+++ b/test/integration/test-apt-update-file
@@ -22,14 +22,33 @@ addtrap 'prefix' 'chmod 750 aptarchive/dists/unstable/main/binary-amd64;'
chmod 550 aptarchive/dists/unstable/main/binary-amd64
testsuccess aptget update
+
+# the release files aren't an IMS-hit, but the indexes are
+redatereleasefiles '+1 hour'
+
+# we don't download the index if it isn't updated
testsuccess aptget update -o Debug::pkgAcquire::Auth=1
+# file:/ isn't shown in the log, so see if it was downloaded anyhow
cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output
+canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')"
+testfailure grep -- "$canary" rootdir/tmp/update.output
+
+testfoo() {
+ # foo is still available
+ testsuccess aptget install -s foo
+ testsuccess aptcache showsrc foo
+ testsuccess aptget source foo --print-uris
+}
+testfoo
-# ensure that the hash of the uncompressed file was verified even on a local ims hit
+# the release file is new again, the index still isn't, but it is somehow gone now from disk
+redatereleasefiles '+2 hour'
+find rootdir/var/lib/apt/lists -name '*_Packages*' -delete
+
+testsuccess aptget update -o Debug::pkgAcquire::Auth=1
+# file:/ isn't shown in the log, so see if it was downloaded anyhow
+cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output
canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')"
testsuccess grep -- "$canary" rootdir/tmp/update.output
-# foo is still available
-testsuccess aptget install -s foo
-testsuccess aptcache showsrc foo
-testsuccess aptget source foo --print-uris
+testfoo
diff --git a/test/integration/test-apt-update-ims b/test/integration/test-apt-update-ims
index 5394a9f30..33b4ed1b9 100755
--- a/test/integration/test-apt-update-ims
+++ b/test/integration/test-apt-update-ims
@@ -6,85 +6,161 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture 'amd64'
-buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
+insertpackage 'unstable' 'unrelated' 'all' '0.5~squeeze1'
+insertsource 'unstable' 'unrelated' 'all' '0.5~squeeze1'
setupaptarchive --no-update
changetowebserver
runtest() {
- configallowinsecurerepositories "${1:-false}"
+ if [ -n "$1" ]; then
+ configallowinsecurerepositories 'true'
+ else
+ configallowinsecurerepositories 'false'
+ fi
- rm -f rootdir/var/lib/apt/lists/localhost*
+ rm -rf rootdir/var/lib/apt/lists/
- if [ "$1" = 'true' ]; then
- testwarning aptget update
- else
- testsuccess aptget update
+ local TEST="test${1:-success}"
+ $TEST aptget update
+ if [ "$1" = 'failure' ]; then
+ # accept the outdated Release file so we can check Hit behaviour
+ "test${2:-success}" aptget update -o Acquire::Min-ValidTime=99999999999
fi
+ listcurrentlistsdirectory > listsdir.lst
+ testsuccess grep '_Packages\(\.gz\)\?$' listsdir.lst
+ testsuccess grep '_Sources\(\.gz\)\?$' listsdir.lst
+ testsuccess grep '_Translation-en\(\.gz\)\?$' listsdir.lst
# ensure no leftovers in partial
- testfailure ls "rootdir/var/lib/apt/lists/partial/*"
+ testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
# check that I-M-S header is kept in redirections
- testequal "$EXPECT" aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0
-
- # ensure that we still do a hash check on ims hit
- msgtest 'Test I-M-S' 'reverify'
- aptget update -o Debug::pkgAcquire::Auth=1 2>&1 | grep -A2 'RecivedHash:' | grep -q -- '- SHA' && msgpass || msgfail
+ echo "$EXPECT" | sed -e 's#(invalid since [^)]\+)#(invalid since)#' > expected.output
+ $TEST aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0
+ sed -i -e 's#(invalid since [^)]\+)#(invalid since)#' rootdir/tmp/${TEST}.output
+ testequal "$(cat expected.output)" cat rootdir/tmp/${TEST}.output
+ testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+ # ensure that we still do a hash check for other files on ims hit of Release
+ if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output || ! grep -q '^Ign:[0-9]\+ .* Release\(\.gpg\)\?$' expected.output; then
+ $TEST aptget update -o Debug::Acquire::gpgv=1
+ cp rootdir/tmp/${TEST}.output goodsign.output
+ testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+ testsuccess grep '^Got GOODSIG, key ID:GOODSIG' goodsign.output
+ fi
# ensure no leftovers in partial
- testfailure ls "rootdir/var/lib/apt/lists/partial/*"
+ testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
}
-msgmsg "InRelease"
-EXPECT="Hit http://localhost:8080 unstable InRelease
-Hit http://localhost:8080 unstable/main Sources
-Hit http://localhost:8080 unstable/main amd64 Packages
-Hit http://localhost:8080 unstable/main Translation-en
-Reading package lists..."
-# with InRelease
+msgmsg 'InRelease'
+EXPECT='Hit:1 http://localhost:8080 unstable InRelease
+Reading package lists...'
+echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
runtest
-
-# with gzip
-echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
+echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
runtest
-msgmsg "Release/Release.gpg"
-# with Release/Release.gpg
-EXPECT="Ign http://localhost:8080 unstable InRelease
+msgmsg 'Release/Release.gpg'
+EXPECT='Ign:1 http://localhost:8080 unstable InRelease
404 Not Found
-Hit http://localhost:8080 unstable Release
-Hit http://localhost:8080 unstable Release.gpg
-Hit http://localhost:8080 unstable/main Sources
-Hit http://localhost:8080 unstable/main amd64 Packages
-Hit http://localhost:8080 unstable/main Translation-en
-Reading package lists..."
-
+Hit:2 http://localhost:8080 unstable Release
+Reading package lists...'
find aptarchive -name 'InRelease' -delete
-
-echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
+echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
runtest
-
-echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
+echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
runtest
-# no Release.gpg or InRelease
-msgmsg "Release only"
-EXPECT="Ign http://localhost:8080 unstable InRelease
+msgmsg 'Release only'
+EXPECT="Ign:1 http://localhost:8080 unstable InRelease
404 Not Found
-Hit http://localhost:8080 unstable Release
-Ign http://localhost:8080 unstable Release.gpg
+Hit:2 http://localhost:8080 unstable Release
+Ign:3 http://localhost:8080 unstable Release.gpg
404 Not Found
-Hit http://localhost:8080 unstable/main Sources
-Hit http://localhost:8080 unstable/main amd64 Packages
-Hit http://localhost:8080 unstable/main Translation-en
Reading package lists...
-W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated."
+W: The data from 'http://localhost:8080 unstable Release' is not signed. Packages from that repository can not be authenticated."
+find aptarchive -name 'Release.gpg' -delete
+echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
+runtest 'warning'
+echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
+runtest 'warning'
+
+
+# make the release file old
+find aptarchive -name '*Release' -exec sed -i \
+ -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \
+ -e '/^Valid-Until: / d' -e "/^Date: / a\
+Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \;
+signreleasefiles
+
+msgmsg 'expired InRelease'
+EXPECT='Hit:1 http://localhost:8080 unstable InRelease
+E: Release file for http://localhost:8080/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied.'
+echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
+runtest 'failure'
+echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
+runtest 'failure'
+
+msgmsg 'expired Release/Release.gpg'
+EXPECT='Ign:1 http://localhost:8080 unstable InRelease
+ 404 Not Found
+Hit:2 http://localhost:8080 unstable Release
+E: Release file for http://localhost:8080/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied.'
+find aptarchive -name 'InRelease' -delete
+echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
+runtest 'failure'
+echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
+runtest 'failure'
+msgmsg 'expired Release only'
+EXPECT="Ign:1 http://localhost:8080 unstable InRelease
+ 404 Not Found
+Hit:2 http://localhost:8080 unstable Release
+Ign:3 http://localhost:8080 unstable Release.gpg
+ 404 Not Found
+W: The data from 'http://localhost:8080 unstable Release' is not signed. Packages from that repository can not be authenticated.
+E: Release file for http://localhost:8080/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
find aptarchive -name 'Release.gpg' -delete
+echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
+runtest 'failure' 'warning'
+echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
+runtest 'failure' 'warning'
-echo "Acquire::GzipIndexes "0";" > rootdir/etc/apt/apt.conf.d/02compressindex
-runtest "true"
-echo "Acquire::GzipIndexes "1";" > rootdir/etc/apt/apt.conf.d/02compressindex
-runtest "true"
+msgmsg 'no Release at all'
+EXPECT="Ign:1 http://localhost:8080 unstable InRelease
+ 404 Not Found
+Ign:2 http://localhost:8080 unstable Release
+ 404 Not Found
+Ign:3 http://localhost:8080 unstable/main Sources
+ 404 Not Found
+Ign:4 http://localhost:8080 unstable/main amd64 Packages
+ 404 Not Found
+Ign:5 http://localhost:8080 unstable/main Translation-en
+ 404 Not Found
+Ign:3 http://localhost:8080 unstable/main Sources
+ 404 Not Found
+Ign:4 http://localhost:8080 unstable/main amd64 Packages
+ 404 Not Found
+Ign:5 http://localhost:8080 unstable/main Translation-en
+ 404 Not Found
+Ign:3 http://localhost:8080 unstable/main Sources
+ 404 Not Found
+Ign:4 http://localhost:8080 unstable/main amd64 Packages
+ 404 Not Found
+Ign:5 http://localhost:8080 unstable/main Translation-en
+ 404 Not Found
+Hit:3 http://localhost:8080 unstable/main Sources
+Hit:4 http://localhost:8080 unstable/main amd64 Packages
+Hit:5 http://localhost:8080 unstable/main Translation-en
+Reading package lists...
+W: The repository 'http://localhost:8080 unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository."
+find aptarchive -name '*Release*' -delete
+echo 'Acquire::GzipIndexes "0";
+Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
+runtest 'warning'
+echo 'Acquire::GzipIndexes "1";
+Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
+runtest 'warning'
diff --git a/test/integration/test-apt-update-nofallback b/test/integration/test-apt-update-nofallback
index e82a976a6..2ded73122 100755
--- a/test/integration/test-apt-update-nofallback
+++ b/test/integration/test-apt-update-nofallback
@@ -8,6 +8,7 @@ set -e
simulate_mitm_and_inject_evil_package()
{
+ redatereleasefiles '+1 hour'
rm -f $APTARCHIVE/dists/unstable/InRelease
rm -f $APTARCHIVE/dists/unstable/Release.gpg
inject_evil_package
@@ -27,18 +28,19 @@ Description: an autogenerated evil package
EOF
# avoid ims hit
touch -d '+1hour' aptarchive/dists/unstable/main/binary-i386/Packages
+ compressfile aptarchive/dists/unstable/main/binary-i386/Packages
}
assert_update_is_refused_and_last_good_state_used()
{
- testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq
+ testfailuremsg "E: The repository 'file:${APTARCHIVE} unstable Release' is no longer signed." aptget update
assert_repo_is_intact
}
assert_repo_is_intact()
{
- testequal "foo/unstable 2.0 all" apt list -q
+ testsuccessequal "foo/unstable 2.0 all" apt list -q
testsuccess aptget install -y -s foo
testfailure aptget install -y evil
testsuccess aptget source foo --print-uris
@@ -86,18 +88,18 @@ test_from_inrelease_to_unsigned_with_override()
{
# setup archive with InRelease file
setupaptarchive_with_lists_clean
- # FIXME: is not what the server reported 4104 4106
- testsuccess aptget update #-o Debug::pkgAcquire::Worker=1
+ testsuccess aptget update
# simulate moving to a unsigned but otherwise valid repo
simulate_mitm_and_inject_evil_package
- generatereleasefiles
+ generatereleasefiles '+2 hours'
+ find $APTARCHIVE -name '*Packages*' -exec touch -d '+2 hours' {} \;
# and ensure we can update to it (with enough force)
testwarning aptget update --allow-insecure-repositories \
- -o Acquire::AllowDowngradeToInsecureRepositories=1
+ -o Acquire::AllowDowngradeToInsecureRepositories=1 -o Debug::pkgAcquire::Worker=1 -o Debug::pkgAcquire::Auth=1
# but that the individual packages are still considered untrusted
- testequal "WARNING: The following packages cannot be authenticated!
+ testfailureequal "WARNING: The following packages cannot be authenticated!
evil
E: There are problems and -y was used without --force-yes" aptget install -qq -y evil
}
@@ -149,7 +151,7 @@ test_subvert_inrelease()
# replace InRelease with something else
mv $APTARCHIVE/dists/unstable/Release $APTARCHIVE/dists/unstable/InRelease
- testequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease Does not start with a cleartext signature
+ testfailureequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease Does not start with a cleartext signature
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq
@@ -166,10 +168,10 @@ test_inrelease_to_invalid_inrelease()
listcurrentlistsdirectory > lists.before
# now remove InRelease and subvert Release do no longer verify
- sed -i 's/Codename.*/Codename: evil!'/ $APTARCHIVE/dists/unstable/InRelease
+ sed -i 's/^Codename:.*/Codename: evil!/' $APTARCHIVE/dists/unstable/InRelease
inject_evil_package
- testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
+ testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file:${APTARCHIVE} unstable InRelease: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
@@ -193,7 +195,7 @@ test_release_gpg_to_invalid_release_release_gpg()
echo "Some evil data" >> $APTARCHIVE/dists/unstable/Release
inject_evil_package
- testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable Release.gpg: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
+ testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file:${APTARCHIVE} unstable Release: The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
W: Failed to fetch file:${APTARCHIVE}/dists/unstable/Release.gpg The following signatures were invalid: BADSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
diff --git a/test/integration/test-apt-update-not-modified b/test/integration/test-apt-update-not-modified
new file mode 100755
index 000000000..6d176a655
--- /dev/null
+++ b/test/integration/test-apt-update-not-modified
@@ -0,0 +1,161 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertpackage 'unstable' 'apt' 'all' '1.0'
+
+setupaptarchive --no-update
+
+methodtest() {
+ msgmsg 'Test InRelease with' "$1"
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a aptarchive/dists aptarchive/dists.good
+ # get our cache populated
+ testsuccess aptget update
+ listcurrentlistsdirectory > listsdir.lst
+
+ # hit again with a good cache
+ testsuccessequal "Hit:1 $1 unstable InRelease
+Reading package lists..." aptget update
+ testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+ # drop an architecture, which means the file should be gone now
+ configarchitecture 'i386'
+ sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
+ testsuccessequal "Hit:1 $1 unstable InRelease
+Reading package lists..." aptget update
+ testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
+
+ # readd arch so its downloaded again…
+ configarchitecture 'amd64' 'i386'
+ # … but oh noes, hashsum mismatch!
+ find aptarchive/dists/unstable/main/binary-amd64/ -type f -delete
+ cat >> aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
+
+Package: thisisbad
+Architecture: amd64
+Version: 1
+EOF
+ compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
+ testfailureequal "Hit:1 $1 unstable InRelease
+Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Err:2 $1 unstable/main amd64 Packages
+ Hash Sum mismatch
+W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
+
+E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
+ testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
+ rm -rf aptarchive/dists
+ cp -a aptarchive/dists.good aptarchive/dists
+
+ # … now everything is fine again
+ testsuccessequal "Hit:1 $1 unstable InRelease
+Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Reading package lists..." aptget update
+ testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+ webserverconfig 'aptwebserver::support::modified-since' 'false'
+ webserverconfig 'aptwebserver::support::last-modified' 'false'
+ testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
+Reading package lists..." aptget update
+ webserverconfig 'aptwebserver::support::modified-since' 'true'
+ webserverconfig 'aptwebserver::support::last-modified' 'true'
+
+ msgmsg 'Test Release.gpg with' "$1"
+ rm -rf rootdir/var/lib/apt/lists
+ find aptarchive/dists -name 'InRelease' -delete
+ # get our cache populated
+ testsuccess aptget update
+ listcurrentlistsdirectory > listsdir.lst
+
+ # hit again with a good cache
+ testsuccessequal "Ign:1 $1 unstable InRelease
+ 404 Not Found
+Hit:2 $1 unstable Release
+Reading package lists..." aptget update
+ testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+ # drop an architecture, which means the file should be gone now
+ configarchitecture 'i386'
+ sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
+ testsuccessequal "Ign:1 $1 unstable InRelease
+ 404 Not Found
+Hit:2 $1 unstable Release
+Reading package lists..." aptget update
+ testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
+
+ # readd arch so its downloaded again…
+ configarchitecture 'amd64' 'i386'
+ # … but oh noes, hashsum mismatch!
+ find aptarchive/dists/unstable/main/binary-amd64/ -type f -delete
+ cat >> aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
+
+Package: thisisbad
+Architecture: amd64
+Version: 1
+EOF
+ compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
+ testfailureequal "Ign:1 $1 unstable InRelease
+ 404 Not Found
+Hit:2 $1 unstable Release
+Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Err:4 $1 unstable/main amd64 Packages
+ Hash Sum mismatch
+W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
+
+E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
+ testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
+ rm -rf aptarchive/dists
+ cp -a aptarchive/dists.good aptarchive/dists
+ find aptarchive/dists -name 'InRelease' -delete
+
+ # … now everything is fine again
+ testsuccessequal "Ign:1 $1 unstable InRelease
+ 404 Not Found
+Hit:2 $1 unstable Release
+Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Reading package lists..." aptget update
+ testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+ webserverconfig 'aptwebserver::support::modified-since' 'false'
+ webserverconfig 'aptwebserver::support::last-modified' 'false'
+ testsuccessequal "Ign:1 $1 unstable InRelease
+ 404 Not Found
+Get:2 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B]
+Reading package lists..." aptget update
+ webserverconfig 'aptwebserver::support::modified-since' 'true'
+ webserverconfig 'aptwebserver::support::last-modified' 'true'
+
+ rm -rf aptarchive/dists
+ cp -a aptarchive/dists.good aptarchive/dists
+
+ # new release file, but the indexes are the same
+ redatereleasefiles '+2 hours'
+
+ rm -rf rootdir/var/lib/apt/lists.good
+ cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.good
+ testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
+Reading package lists..." aptget update
+
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists.good rootdir/var/lib/apt/lists
+ find rootdir/var/lib/apt/lists -name '*_Packages*' -delete
+ testsuccessequal "Get:1 $1 unstable InRelease [$(stat -c '%s' 'aptarchive/dists/unstable/InRelease') B]
+Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Get:3 $1 unstable/main i386 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-i386/Packages.gz') B]
+Reading package lists..." aptget update
+
+ rm -rf aptarchive/dists
+ cp -a aptarchive/dists.good aptarchive/dists
+}
+
+changetowebserver
+methodtest 'http://localhost:8080'
+
+changetohttpswebserver
+methodtest 'https://localhost:4433'
diff --git a/test/integration/test-apt-update-rollback b/test/integration/test-apt-update-rollback
index 9efc194a0..70619dd08 100755
--- a/test/integration/test-apt-update-rollback
+++ b/test/integration/test-apt-update-rollback
@@ -38,7 +38,7 @@ start_with_good_inrelease() {
create_fresh_archive
testsuccess aptget update
listcurrentlistsdirectory > lists.before
- testequal "old/unstable 1.0 all" apt list -q
+ testsuccessequal "old/unstable 1.0 all" apt list -q
}
test_inrelease_to_new_inrelease() {
@@ -47,7 +47,7 @@ test_inrelease_to_new_inrelease() {
add_new_package '+1hour'
testsuccess aptget update -o Debug::Acquire::Transaction=1
- testequal "new/unstable 1.0 all
+ testsuccessequal "new/unstable 1.0 all
old/unstable 1.0 all" apt list -q
}
@@ -60,12 +60,12 @@ test_inrelease_to_broken_hash_reverts_all() {
break_repository_sources_index '+1hour'
# test the error condition
- testequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources Hash Sum mismatch
+ testfailureequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq
# ensure that the Packages file is also rolled back
testfileequal lists.before "$(listcurrentlistsdirectory)"
- testequal "E: Unable to locate package new" aptget install new -s -qq
+ testfailureequal "E: Unable to locate package new" aptget install new -s -qq
}
test_inrelease_to_valid_release() {
@@ -78,7 +78,7 @@ test_inrelease_to_valid_release() {
rm $APTARCHIVE/dists/unstable/Release.gpg
# update fails
- testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq
+ testfailureequal "E: The repository 'file:${APTARCHIVE} unstable Release' is no longer signed." aptget update -qq
# test that security downgrade was not successful
testfileequal lists.before "$(listcurrentlistsdirectory)"
@@ -101,7 +101,7 @@ test_inrelease_to_release_reverts_all() {
break_repository_sources_index '+1hour'
# ensure error
- testequal "E: The repository 'file: unstable Release.gpg' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1
+ testfailureequal "E: The repository 'file:${APTARCHIVE} unstable Release' is no longer signed." aptget update -qq # -o Debug::acquire::transaction=1
# ensure that the Packages file is also rolled back
testfileequal lists.before "$(listcurrentlistsdirectory)"
@@ -119,7 +119,7 @@ test_unauthenticated_to_invalid_inrelease() {
testwarning aptget update --allow-insecure-repositories
listcurrentlistsdirectory > lists.before
- testequal "WARNING: The following packages cannot be authenticated!
+ testfailureequal "WARNING: The following packages cannot be authenticated!
old
E: There are problems and -y was used without --force-yes" aptget install -qq -y old
@@ -127,13 +127,13 @@ E: There are problems and -y was used without --force-yes" aptget install -qq -y
add_new_package '+1hour'
break_repository_sources_index '+1hour'
- testequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources Hash Sum mismatch
+ testfailureequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq
testfileequal lists.before "$(listcurrentlistsdirectory)"
testfailure ls rootdir/var/lib/apt/lists/*_InRelease
- testequal "WARNING: The following packages cannot be authenticated!
+ testfailureequal "WARNING: The following packages cannot be authenticated!
old
E: There are problems and -y was used without --force-yes" aptget install -qq -y old
}
@@ -144,7 +144,7 @@ test_inrelease_to_unauth_inrelease() {
signreleasefiles 'Marvin Paranoid'
- testequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file: unstable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2
+ testwarningequal "W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: file:${APTARCHIVE} unstable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2
W: Failed to fetch file:$APTARCHIVE/dists/unstable/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY E8525D47528144E2
@@ -158,6 +158,10 @@ test_inrelease_to_broken_gzip() {
msgmsg "Test InRelease to broken gzip"
start_with_good_inrelease
+ break_repository_sources_index '+1hour'
+ generatereleasefiles '+2hours'
+ signreleasefiles
+
# append junk at the end of the compressed file
echo "lala" >> $APTARCHIVE/dists/unstable/main/source/Sources.gz
touch -d '+2min' $APTARCHIVE/dists/unstable/main/source/Sources.gz
@@ -165,6 +169,7 @@ test_inrelease_to_broken_gzip() {
rm $APTARCHIVE/dists/unstable/main/source/Sources
testfailure aptget update
+ testsuccess grep 'Hash Sum mismatch' rootdir/tmp/testfailure.output
testfileequal lists.before "$(listcurrentlistsdirectory)"
}
diff --git a/test/integration/test-apt-update-stale b/test/integration/test-apt-update-stale
index 52f94591f..8a2703fd1 100755
--- a/test/integration/test-apt-update-stale
+++ b/test/integration/test-apt-update-stale
@@ -14,9 +14,11 @@ configarchitecture "i386"
insertpackage 'unstable' 'foo' 'all' '1.0'
-setupaptarchive
+setupaptarchive --no-update
changetowebserver
-aptget update -qq
+
+echo "Acquire::Languages \"none\";" > rootdir/etc/apt/apt.conf.d/00nolanguages
+testsuccess aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1
listcurrentlistsdirectory > lists.before
# insert new version
@@ -24,7 +26,7 @@ mkdir aptarchive/dists/unstable/main/binary-i386/saved
cp -p aptarchive/dists/unstable/main/binary-i386/Packages* \
aptarchive/dists/unstable/main/binary-i386/saved
insertpackage 'unstable' 'foo' 'all' '2.0'
-
+touch -d '+1 hour' aptarchive/dists/unstable/main/binary-i386/Packages
compressfile aptarchive/dists/unstable/main/binary-i386/Packages
# ensure that we do not get a I-M-S hit for the Release file
@@ -37,7 +39,6 @@ cp -p aptarchive/dists/unstable/main/binary-i386/saved/Packages* \
aptarchive/dists/unstable/main/binary-i386/
# ensure this raises an error
-testequal "W: Failed to fetch http://localhost:8080/dists/unstable/main/binary-i386/Packages Hash Sum mismatch
-
-E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq
+testfailuremsg "W: Failed to fetch copy:$(readlink -f ./rootdir)/var/lib/apt/lists/localhost:8080_dists_unstable_main_binary-i386_Packages Hash Sum mismatch
+E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1
testfileequal lists.before "$(listcurrentlistsdirectory)"
diff --git a/test/integration/test-apt-update-transactions b/test/integration/test-apt-update-transactions
index fe352c762..a5dac1737 100755
--- a/test/integration/test-apt-update-transactions
+++ b/test/integration/test-apt-update-transactions
@@ -8,6 +8,7 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture 'i386'
+configcompression '.' 'gz'
insertpackage 'unstable' 'foo' 'all' '1.0'
insertsource 'unstable' 'foo' 'all' '1.0'
@@ -15,7 +16,8 @@ insertsource 'unstable' 'foo' 'all' '1.0'
setupaptarchive --no-update
breakfile() {
- mv "$1" "${1}.bak"
+ mv "${1}" "${1}.bak"
+ mv "${1}.gz" "${1}.gz.bak"
cat > "$1" <<EOF
Package: bar
EOF
@@ -23,9 +25,16 @@ EOF
}
restorefile() {
mv "${1}.bak" "$1"
+ mv "${1}.gz.bak" "${1}.gz"
}
testrun() {
+ rm -rf aptarchive/dists.good
+ cp -a aptarchive/dists aptarchive/dists.good
+ insertpackage 'unstable' 'bar' 'all' '1.0'
+ insertsource 'unstable' 'bar' 'all' '1.0'
+ buildaptarchivefromfiles '+1 hour'
+
# produce an unsigned repository
find aptarchive \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
testfailure aptget update --no-allow-insecure-repositories
@@ -34,34 +43,48 @@ testrun() {
# signed but broken
signreleasefiles
+ onehashbroken() {
+ testfailure aptget update
+ # each file generates two messages with this string
+ testequal '2' grep --count 'Hash Sum mismatch' rootdir/tmp/testfailure.output
+ testfileequal "$1" "$(listcurrentlistsdirectory)"
+ }
+
breakfile aptarchive/dists/unstable/main/binary-i386/Packages
- testfailure aptget update
- testfileequal "$1" "$(listcurrentlistsdirectory)"
+ onehashbroken "$1"
restorefile aptarchive/dists/unstable/main/binary-i386/Packages
breakfile aptarchive/dists/unstable/main/source/Sources
- testfailure aptget update
- testfileequal "$1" "$(listcurrentlistsdirectory)"
+ onehashbroken "$1"
restorefile aptarchive/dists/unstable/main/source/Sources
+
+ rm -rf aptarchive/dists
+ cp -a aptarchive/dists.good aptarchive/dists
}
testsetup() {
msgmsg 'Test with no initial data over' "$1"
rm -rf rootdir/var/lib/apt/lists
- mkdir -m 700 -p rootdir/var/lib/apt/lists/partial
- if [ "$(id -u)" = '0' ]; then
- chown _apt:root rootdir/var/lib/apt/lists/partial
- fi
+ mkdir -p rootdir/var/lib/apt/lists/partial
listcurrentlistsdirectory > listsdir.lst
testrun 'listsdir.lst'
msgmsg 'Test with initial data over' "$1"
- testsuccess aptget update
+ rm -rf rootdir/var/lib/apt/lists
+ testsuccess aptget update -o Debug::pkgAcquire::Worker=1
listcurrentlistsdirectory > listsdir.lst
testrun 'listsdir.lst'
}
testsetup 'file'
+
changetowebserver
+webserverconfig 'aptwebserver::support::modified-since' 'false' "$1"
+webserverconfig 'aptwebserver::support::last-modified' 'false' "$1" # curl is clever and sees hits here also
+webserverconfig 'aptwebserver::support::range' 'false' "$1"
+
testsetup 'http'
+changetohttpswebserver
+
+testsetup 'https'
diff --git a/test/integration/test-architecture-specification-parsing b/test/integration/test-architecture-specification-parsing
index d1f6011de..f5a5b123e 100755
--- a/test/integration/test-architecture-specification-parsing
+++ b/test/integration/test-architecture-specification-parsing
@@ -26,7 +26,7 @@ insertinstalledpackage 'build-essential' 'all' '11.5' 'Multi-Arch: foreign'
setupaptarchive
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
@@ -38,7 +38,7 @@ Inst pkg-arch-foo (1.0 stable [${NATIVE}])
Conf foo (1.0 stable [${NATIVE}])
Conf pkg-arch-foo (1.0 stable [${NATIVE}])" aptget install pkg-arch-foo -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
pkg-arch-no-foo
@@ -46,7 +46,7 @@ The following NEW packages will be installed:
Inst pkg-arch-no-foo (1.0 stable [${NATIVE}])
Conf pkg-arch-no-foo (1.0 stable [${NATIVE}])" aptget install pkg-arch-no-foo -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
@@ -58,7 +58,7 @@ Inst pkg-arch-foo-unrelated-no (1.0 stable [${NATIVE}])
Conf foo (1.0 stable [${NATIVE}])
Conf pkg-arch-foo-unrelated-no (1.0 stable [${NATIVE}])" aptget install pkg-arch-foo-unrelated-no -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
@@ -70,7 +70,7 @@ Inst pkg-arch-foo-unrelated-no2 (1.0 stable [${NATIVE}])
Conf foo (1.0 stable [${NATIVE}])
Conf pkg-arch-foo-unrelated-no2 (1.0 stable [${NATIVE}])" aptget install pkg-arch-foo-unrelated-no2 -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
@@ -78,11 +78,11 @@ The following NEW packages will be installed:
Inst foo (1.0 stable [${NATIVE}])
Conf foo (1.0 stable [${NATIVE}])" aptget build-dep pkg-arch-foo -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget build-dep pkg-arch-no-foo -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
@@ -90,7 +90,7 @@ The following NEW packages will be installed:
Inst foo (1.0 stable [${NATIVE}])
Conf foo (1.0 stable [${NATIVE}])" aptget build-dep pkg-arch-foo-unrelated-no -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
@@ -98,13 +98,13 @@ The following NEW packages will be installed:
Inst foo (1.0 stable [${NATIVE}])
Conf foo (1.0 stable [${NATIVE}])" aptget build-dep pkg-arch-foo-unrelated-no2 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget build-dep no-depends -s
# this is not really testing APT - more that dpkg is in line with us
configarchitecture 'amd64' 'armel'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
no-depends:armel
diff --git a/test/integration/test-authentication-basic b/test/integration/test-authentication-basic
index 21b024970..3a6897b59 100755
--- a/test/integration/test-authentication-basic
+++ b/test/integration/test-authentication-basic
@@ -24,7 +24,7 @@ testauthfailure() {
testauthsuccess() {
testsuccess apthelper download-file "${1}/bash" ./downloaded/bash
testfileequal ./downloaded/bash "$(cat aptarchive/bash)"
- testfilestats ./downloaded/bash '%U:%G:%a' '=' "${USER}:${USER}:644"
+ testfilestats ./downloaded/bash '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
rm -f ./downloaded/bash
# lets see if got/retains acceptable permissions
@@ -32,13 +32,13 @@ testauthsuccess() {
if [ "$(id -u)" = '0' ]; then
testfilestats "$AUTHCONF" '%U:%G:%a' '=' "_apt:root:600"
else
- testfilestats "$AUTHCONF" '%U:%G:%a' '=' "${USER}:${USER}:600"
+ testfilestats "$AUTHCONF" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:600"
fi
fi
rm -rf rootdir/var/lib/apt/lists
testsuccess aptget update
- testequal 'Reading package lists...
+ testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
diff --git a/test/integration/test-bug-470115-new-and-tighten-recommends b/test/integration/test-bug-470115-new-and-tighten-recommends
index 6bc22ea7b..0970e2f23 100755
--- a/test/integration/test-bug-470115-new-and-tighten-recommends
+++ b/test/integration/test-bug-470115-new-and-tighten-recommends
@@ -47,7 +47,7 @@ insertpackage 'unstable' 'now-satisfiable' 'all' '2' 'Recommends: cool (>= 2)'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
cool
@@ -59,7 +59,7 @@ Inst tighten-cool [1] (2 unstable [all])
Conf cool (2 unstable [all])
Conf tighten-cool (2 unstable [all])' aptget install tighten-cool -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
stuff
@@ -71,7 +71,7 @@ Inst tighten-coolorstuff [1] (2 unstable [all])
Conf stuff (2 unstable [all])
Conf tighten-coolorstuff (2 unstable [all])' aptget install tighten-coolorstuff -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
cool
@@ -83,7 +83,7 @@ Inst tighten-coolorstuff2 [1] (2 unstable [all])
Conf cool (2 unstable [all])
Conf tighten-coolorstuff2 (2 unstable [all])' aptget install tighten-coolorstuff2 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
cool
@@ -95,7 +95,7 @@ Inst newrec-cool [1] (2 unstable [all])
Conf cool (2 unstable [all])
Conf newrec-cool (2 unstable [all])' aptget install newrec-cool -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
super
@@ -109,7 +109,7 @@ Inst super (2 unstable [all])
Conf newrec-super (2 unstable [all])
Conf super (2 unstable [all])' aptget install newrec-super -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
cool
@@ -121,7 +121,7 @@ Inst newrec-coolorstuff [1] (2 unstable [all])
Conf cool (2 unstable [all])
Conf newrec-coolorstuff (2 unstable [all])' aptget install newrec-coolorstuff -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
stuff
@@ -133,7 +133,7 @@ Inst stuff [1] (2 unstable [all])
Conf cool-gone (2 unstable [all])
Conf stuff (2 unstable [all])' aptget install cool-gone -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
super
@@ -149,7 +149,7 @@ Conf super-overtake (2 unstable [all])' aptget install super-overtake -s
# if super would be in front, we would get a new here as it is new and
# the first option in an or-group should be the preferred one…
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
cool
@@ -163,7 +163,7 @@ Conf upgrade-over-new (2 unstable [all])' aptget install upgrade-over-new -s
# the recommends wasn't used before so while we could do it now,
# the user doesn't seem to need it so avoid upgrading it
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be upgraded:
now-satisfiable
diff --git a/test/integration/test-bug-507998-dist-upgrade-recommends b/test/integration/test-bug-507998-dist-upgrade-recommends
index f3b4e04fb..70c6fb496 100755
--- a/test/integration/test-bug-507998-dist-upgrade-recommends
+++ b/test/integration/test-bug-507998-dist-upgrade-recommends
@@ -14,7 +14,7 @@ insertpackage 'unstable' 'wireshark' 'amd64' '1.2.1-2' 'Depends: wireshark-commo
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be upgraded:
diff --git a/test/integration/test-bug-543966-downgrade-below-1000-pin b/test/integration/test-bug-543966-downgrade-below-1000-pin
index f602bea95..180393867 100755
--- a/test/integration/test-bug-543966-downgrade-below-1000-pin
+++ b/test/integration/test-bug-543966-downgrade-below-1000-pin
@@ -13,9 +13,9 @@ insertinstalledpackage 'base-files' 'all' '5.0.0-1'
setupaptarchive
STATUS=$(readlink -f rootdir/var/lib/dpkg/status)
-APTARCHIVE="$(readlink -f aptarchive)/"
+APTARCHIVE="$(readlink -f aptarchive)"
-testequal "base-files:
+testsuccessequal "base-files:
Installed: 5.0.0-1
Candidate: 5.0.0-1
Version table:
@@ -24,58 +24,70 @@ testequal "base-files:
5.0.0 0
500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=0
-echo 'Package: base-files
+writepin() {
+ echo "Package: $1
Pin: release a=unstable
-Pin-Priority: 99' > rootdir/etc/apt/preferences
+Pin-Priority: $2" > rootdir/etc/apt/preferences
+}
-testequal "base-files:
+
+
+testpinning() {
+ local PKGPIN=''
+ local PKGPINPRIO='0'
+ local REPPINPRIO=''
+ if [ "$1" != '*' ]; then
+ PKGPINPRIO=''
+ REPPINPRIO=' 500'
+ PKGPIN='Package pin: 5.0.0
+ '
+ fi
+ writepin "$1" '99'
+ testsuccessequal "base-files:
Installed: 5.0.0-1
Candidate: 5.0.0-1
- Package pin: 5.0.0
- Version table:
- *** 5.0.0-1 99
+ ${PKGPIN}Version table:
+ *** 5.0.0-1 ${PKGPINPRIO:-99}
100 $STATUS
- 5.0.0 99
- 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=99
+ 5.0.0 ${PKGPINPRIO:-99}
+ ${REPPINPRIO:- 99} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=99
-echo 'Package: base-files
-Pin: release a=unstable
-Pin-Priority: 100' > rootdir/etc/apt/preferences
-
-testequal "base-files:
+ writepin "$1" '100'
+ testsuccessequal "base-files:
Installed: 5.0.0-1
Candidate: 5.0.0-1
- Package pin: 5.0.0
- Version table:
- *** 5.0.0-1 100
+ ${PKGPIN}Version table:
+ *** 5.0.0-1 ${PKGPINPRIO:-100}
100 $STATUS
- 5.0.0 100
- 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=100
+ 5.0.0 ${PKGPINPRIO:-100}
+ ${REPPINPRIO:- 100} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=100
-echo 'Package: base-files
-Pin: release a=unstable
-Pin-Priority: 999' > rootdir/etc/apt/preferences
-
-testequal "base-files:
+ writepin "$1" '999'
+ testsuccessequal "base-files:
Installed: 5.0.0-1
Candidate: 5.0.0-1
- Package pin: 5.0.0
- Version table:
- *** 5.0.0-1 999
+ ${PKGPIN}Version table:
+ *** 5.0.0-1 ${PKGPINPRIO:-999}
100 $STATUS
- 5.0.0 999
- 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=999
-
-echo 'Package: base-files
-Pin: release a=unstable
-Pin-Priority: 1000' > rootdir/etc/apt/preferences
+ 5.0.0 ${PKGPINPRIO:-999}
+ ${REPPINPRIO:- 999} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=999
-testequal "base-files:
+ writepin "$1" '1000'
+ testsuccessequal "base-files:
Installed: 5.0.0-1
Candidate: 5.0.0
- Package pin: 5.0.0
- Version table:
- *** 5.0.0-1 1000
+ ${PKGPIN}Version table:
+ *** 5.0.0-1 ${PKGPINPRIO:-1000}
100 $STATUS
- 5.0.0 1000
- 500 file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=1000
+ 5.0.0 ${PKGPINPRIO:-1000}
+ ${REPPINPRIO:-1000} file:${APTARCHIVE} unstable/main i386 Packages" aptcache policy base-files -o apt::pin=1000
+}
+
+msgmsg 'Tests with generic-form pin'
+testpinning '*'
+msgmsg 'Tests with specific-form pin'
+testpinning 'base-files'
+msgmsg 'Tests with specific-form pin with glob'
+testpinning 'base-fil*'
+msgmsg 'Tests with specific-form pin with regex'
+testpinning '/^base-f[iI]les$/'
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 8c434b3ce..3ff4807de 100755
--- a/test/integration/test-bug-549968-install-depends-of-not-installed
+++ b/test/integration/test-bug-549968-install-depends-of-not-installed
@@ -14,7 +14,7 @@ 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...
+testsuccessequal "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
diff --git a/test/integration/test-bug-590041-prefer-non-virtual-packages b/test/integration/test-bug-590041-prefer-non-virtual-packages
index 0ce4c1413..3bd7d436e 100755
--- a/test/integration/test-bug-590041-prefer-non-virtual-packages
+++ b/test/integration/test-bug-590041-prefer-non-virtual-packages
@@ -46,8 +46,8 @@ EOF
setupaptarchive
testshowvirtual libc6:i386
-testequal "$pkglibc6" aptcache show libc6:armel
-testequal "$pkglibc6" aptcache show libc6
-testequal "$pkglibdb1" aptcache show libdb1:i386
+testsuccessequal "$pkglibc6" aptcache show libc6:armel
+testsuccessequal "$pkglibc6" aptcache show libc6
+testsuccessequal "$pkglibdb1" aptcache show libdb1:i386
testnopackage libdb1:armel
-testequal "$pkglibdb1" aptcache show libdb1
+testsuccessequal "$pkglibdb1" aptcache show libdb1
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 645e86d7d..37426ec11 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
@@ -29,7 +29,7 @@ predependsgawk() {
echo "$pkgbasefile
Pre-Depends: $1
" >> rootdir/var/lib/dpkg/status
- testequal "Inst gawk (1:3.1.7.dfsg-5 localhost [i386])
+ testsuccessequal "Inst gawk (1:3.1.7.dfsg-5 localhost [i386])
Conf gawk (1:3.1.7.dfsg-5 localhost [i386])
Remv mawk [1.3.3-15]" aptget install gawk mawk- -sqq -o PreDepends=$(echo "$1" | sed 's/ //g')
}
diff --git a/test/integration/test-bug-591882-conkeror b/test/integration/test-bug-591882-conkeror
index 891ddb8b7..b71d4d5fd 100755
--- a/test/integration/test-bug-591882-conkeror
+++ b/test/integration/test-bug-591882-conkeror
@@ -73,5 +73,5 @@ 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
-testequal "$UPGRADEFAIL" aptget dist-upgrade --trivial-only -o pkgProblemResolver::FixByInstall=0
-testequal "$UPGRADESUCCESS" aptget dist-upgrade --trivial-only #-o pkgProblemResolver::FixByInstall=0
+testfailureequal "$UPGRADEFAIL" aptget dist-upgrade --trivial-only -o pkgProblemResolver::FixByInstall=0
+testfailureequal "$UPGRADESUCCESS" aptget dist-upgrade --trivial-only #-o pkgProblemResolver::FixByInstall=0
diff --git a/test/integration/test-bug-593360-modifiers-in-names b/test/integration/test-bug-593360-modifiers-in-names
index 74826cbdb..57a24683e 100755
--- a/test/integration/test-bug-593360-modifiers-in-names
+++ b/test/integration/test-bug-593360-modifiers-in-names
@@ -7,7 +7,7 @@ setupenvironment
configarchitecture "i386"
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
g++
@@ -15,12 +15,12 @@ The following NEW packages will be installed:
Inst g++ (4:4.4.5-1 localhost [i386])
Conf g++ (4:4.4.5-1 localhost [i386])' aptget install g++ -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Package 'g++' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget remove g++ -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
g++
@@ -28,7 +28,7 @@ The following NEW packages will be installed:
Inst g++ (4:4.4.5-1 localhost [i386])
Conf g++ (4:4.4.5-1 localhost [i386])' aptget install g+++ -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
g++
@@ -36,7 +36,7 @@ The following NEW packages will be installed:
Inst g++ (4:4.4.5-1 localhost [i386])
Conf g++ (4:4.4.5-1 localhost [i386])' aptget purge g+++ -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
apt
@@ -44,7 +44,7 @@ The following NEW packages will be installed:
Inst apt (0.8.8 localhost [all])
Conf apt (0.8.8 localhost [all])' aptget install apt -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
apt+
@@ -52,7 +52,7 @@ The following NEW packages will be installed:
Inst apt+ (0.8.8 localhost [all])
Conf apt+ (0.8.8 localhost [all])' aptget install apt+ -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
apt+
@@ -60,7 +60,7 @@ The following NEW packages will be installed:
Inst apt+ (0.8.8 localhost [all])
Conf apt+ (0.8.8 localhost [all])' aptget install apt++ -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
apt+
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 bca07268c..47dd62712 100755
--- a/test/integration/test-bug-595691-empty-and-broken-archive-files
+++ b/test/integration/test-bug-595691-empty-and-broken-archive-files
@@ -12,8 +12,8 @@ setupflataptarchive
testaptgetupdate() {
rm -rf rootdir/var/lib/apt
- aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true
- sed -i -e '/Ign /,+1d' -e '/Release/ d' -e 's#Get:[0-9]\+ #Get: #' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff
+ aptget update >testaptgetupdate.diff 2>&1 || true
+ sed -i -e '/Ign /,+1d' -e '/Release/ d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff
GIVEN="$1"
shift
msgtest "Test for correctness of" "apt-get update with $*"
@@ -27,9 +27,6 @@ testaptgetupdate() {
createemptyarchive() {
find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete
- if [ "en" = "$1" ]; then
- echo -n "" | $COMPRESSOR_CMD > aptarchive/Packages.$COMPRESS
- fi
touch aptarchive/Packages
echo -n "" | $COMPRESSOR_CMD > aptarchive/${1}.$COMPRESS
generatereleasefiles
@@ -39,9 +36,6 @@ createemptyarchive() {
createemptyfile() {
find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete
- if [ "en" = "$1" ]; then
- echo -n "" | $COMPRESSOR_CMD > aptarchive/Packages.$COMPRESS
- fi
touch aptarchive/Packages aptarchive/${1}.$COMPRESS
generatereleasefiles
signreleasefiles
@@ -49,23 +43,18 @@ createemptyfile() {
}
testoverfile() {
+ local APTARCHIVE="$(readlink -f ./aptarchive)"
forcecompressor "$1"
- createemptyfile 'en'
- testaptgetupdate 'Reading package lists...' "empty file en.$COMPRESS over file"
-
- createemptyarchive 'en'
- testaptgetupdate 'Reading package lists...' "empty archive en.$COMPRESS over file"
-
createemptyarchive 'Packages'
- # FIXME: Why omits the file transport the Packages Get line?
- #Get:3 file: Packages []
- testaptgetupdate 'Reading package lists...' "empty archive Packages.$COMPRESS over file"
+ testaptgetupdate "Get:2 file:$APTARCHIVE Packages []
+Reading package lists..." "empty archive Packages.$COMPRESS over file"
createemptyfile 'Packages'
- testaptgetupdate "Err file: Packages
+ testaptgetupdate "Get:2 file:$APTARCHIVE Packages
+Err:2 file:$APTARCHIVE 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
+W: Failed to fetch ${COMPRESSOR}:${APTARCHIVE}/Packages.$COMPRESS Empty files can't be valid archives
E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over file"
}
@@ -74,13 +63,13 @@ testoverhttp() {
forcecompressor "$1"
createemptyarchive 'Packages'
- testaptgetupdate "Get: http://localhost:8080 Packages []
+ testaptgetupdate "Get:2 http://localhost:8080 Packages []
Reading package lists..." "empty archive Packages.$COMPRESS over http"
createemptyfile 'Packages'
#FIXME: we should response with a good error message instead
- testaptgetupdate "Get: http://localhost:8080 Packages
-Err http://localhost:8080 Packages
+ testaptgetupdate "Get:2 http://localhost:8080 Packages
+Err:2 http://localhost:8080 Packages
Empty files can't be valid archives
W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:8080_Packages.${COMPRESS}) 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
index 1e5e75b0e..1ff0f1d8d 100755
--- a/test/integration/test-bug-596498-trusted-unsigned-repo
+++ b/test/integration/test-bug-596498-trusted-unsigned-repo
@@ -15,19 +15,23 @@ aptgetupdate() {
${1:-testwarning} aptget update --allow-insecure-repositories
}
-PKGTEXT="$(aptget install cool --assume-no -d | head -n 7)"
+PKGTEXT="$(aptget install cool --assume-no -d | head -n 8)"
+DOWNLOG="$(echo "$PKGTEXT" | tail -n 1)"
+PKGTEXT="$(echo "$PKGTEXT" | head -n 7)"
DEBFILE='rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.list'
-testequal "$PKGTEXT
+testsuccessequal "$PKGTEXT
+$DOWNLOG
Download complete and in download only mode" aptget install cool --assume-no -d
-testequal "$PKGTEXT
+testsuccessequal "$PKGTEXT
+$DOWNLOG
Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
sed -i -e 's#deb#deb [trusted=no]#' $DEBFILE
aptgetupdate 'testsuccess'
-testequal "$PKGTEXT
+testfailureequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
cool
Install these packages without verification? [y/N] N
@@ -37,20 +41,22 @@ find aptarchive/ \( -name 'Release.gpg' -o -name 'InRelease' \) -delete
sed -i -e 's#deb \[trusted=no\]#deb#' $DEBFILE
aptgetupdate
-testequal "$PKGTEXT
+testfailureequal "$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
-testequal "$PKGTEXT
+testsuccessequal "$PKGTEXT
WARNING: The following packages cannot be authenticated!
cool
Authentication warning overridden.
+$DOWNLOG
Download complete and in download only mode" aptget install cool --assume-no -d --allow-unauthenticated
sed -i -e 's#deb#deb [trusted=yes]#' $DEBFILE
aptgetupdate
-testequal "$PKGTEXT
+testsuccessequal "$PKGTEXT
+$DOWNLOG
Download complete and in download only mode" aptget install cool --assume-no -d
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 c3a77f346..2ec1d3d1c 100755
--- a/test/integration/test-bug-598669-install-postfix-gets-exim-heavy
+++ b/test/integration/test-bug-598669-install-postfix-gets-exim-heavy
@@ -7,7 +7,7 @@ setupenvironment
configarchitecture "i386"
setupaptarchive
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
exim4 exim4-daemon-light
diff --git a/test/integration/test-bug-601961-install-info b/test/integration/test-bug-601961-install-info
index 914910597..806d3f547 100755
--- a/test/integration/test-bug-601961-install-info
+++ b/test/integration/test-bug-601961-install-info
@@ -7,7 +7,7 @@ setupenvironment
configarchitecture "i386"
setupaptarchive
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
findutils
@@ -18,7 +18,7 @@ This should NOT be done unless you know exactly what you are doing!
After this operation, 1745 kB disk space will be freed.
E: Trivial Only specified but this is not a trivial operation.' aptget remove findutils --trivial-only
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
install-info
@@ -26,7 +26,7 @@ The following packages will be REMOVED:
After this operation, 262 kB disk space will be freed.
E: Trivial Only specified but this is not a trivial operation.' aptget remove install-info --trivial-only
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
essentialpkg findutils
diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect
index 6393f0c27..b9d232f90 100755
--- a/test/integration/test-bug-602412-dequote-redirect
+++ b/test/integration/test-bug-602412-dequote-redirect
@@ -8,7 +8,7 @@ configarchitecture 'amd64'
buildsimplenativepackage 'unrelated' 'all' '0.5~squeeze1' 'unstable'
-setupaptarchive
+setupaptarchive --no-update
changetowebserver -o aptwebserver::redirect::replace::/pool/=/newpool/ \
-o aptwebserver::redirect::replace::/dists/=/newdists/
@@ -16,14 +16,12 @@ mv aptarchive/pool aptarchive/newpool
mv aptarchive/dists aptarchive/newdists
testrun() {
+ msgmsg 'Test redirection works in method boundaries' "$1"
msgtest 'Test redirection works in' 'apt-get update'
testsuccess --nomsg aptget update
# check that I-M-S header is kept in redirections
- testequal "Hit $1 unstable InRelease
-Hit $1 unstable/main Sources
-Hit $1 unstable/main amd64 Packages
-Hit $1 unstable/main Translation-en
+ testsuccessequal "Hit:1 $1 unstable InRelease
Reading package lists..." aptget update
msgtest 'Test redirection works in' 'package download'
diff --git a/test/integration/test-bug-604222-new-and-autoremove b/test/integration/test-bug-604222-new-and-autoremove
index b29347f64..52992680b 100755
--- a/test/integration/test-bug-604222-new-and-autoremove
+++ b/test/integration/test-bug-604222-new-and-autoremove
@@ -11,7 +11,7 @@ touch rootdir/var/lib/apt/extended_states
testsuccess aptmark markauto 'libvtk5.4'
testmarkedauto 'libvtk5.4'
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
@@ -23,7 +23,7 @@ The following NEW packages will be installed:
Inst libavcodec52 (4:0.5.2-6 localhost [i386])
Conf libavcodec52 (4:0.5.2-6 localhost [i386])" aptget install libavcodec52 -s
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Reading state information...
The following package was automatically installed and is no longer required:
@@ -61,6 +61,6 @@ Need to get 0 B/6304 kB of archives.
After this operation, 17.3 MB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.'
-testequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=0
-testequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=1
-testequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=small
+testfailureequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=0
+testfailureequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=1
+testfailureequal "$CONFLICTING" aptget install dummy-archive --trivial-only -o Debug::pkgDepCache::Marker=1 -o APT::Get::HideAutoRemove=small
diff --git a/test/integration/test-bug-605394-versioned-or-groups b/test/integration/test-bug-605394-versioned-or-groups
index bb72d59e3..f938ba311 100755
--- a/test/integration/test-bug-605394-versioned-or-groups
+++ b/test/integration/test-bug-605394-versioned-or-groups
@@ -7,7 +7,7 @@ setupenvironment
configarchitecture "i386"
setupaptarchive
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be upgraded:
diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual
index e3d454f97..a7bde393b 100755
--- a/test/integration/test-bug-611729-mark-as-manual
+++ b/test/integration/test-bug-611729-mark-as-manual
@@ -34,14 +34,14 @@ testdpkgnotinstalled a
testdpkginstalled b c
testmarkedauto 'b'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
b is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b --only-upgrade
testmarkedauto 'b'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
b is already the newest version.
@@ -59,7 +59,7 @@ sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date:
testfileequal 'rootdir/var/log/apt/history.log' '
Reinstall: b:i386 (1.0)'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
b is already the newest version.
diff --git a/test/integration/test-bug-612099-multiarch-conflicts b/test/integration/test-bug-612099-multiarch-conflicts
index c32600037..401b521a5 100755
--- a/test/integration/test-bug-612099-multiarch-conflicts
+++ b/test/integration/test-bug-612099-multiarch-conflicts
@@ -17,7 +17,7 @@ setupaptarchive
testsuccess aptget install libc6:i386 -t stable -y
testdpkginstalled libc6:i386
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
@@ -29,7 +29,7 @@ Remv libc6 [1.0]
Inst libc6:amd64 (1.0 stable [amd64])
Conf libc6:amd64 (1.0 stable [amd64])' aptget install libc6:amd64 -s -t stable
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
@@ -38,7 +38,7 @@ The following NEW packages will be installed:
Inst foobar (1.0 stable [i386])
Conf foobar (1.0 stable [i386])' aptget install foobar -st stable
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
@@ -54,7 +54,7 @@ Inst foobar:amd64 (1.0 stable [amd64])
Conf libc6:amd64 (1.0 stable [amd64])
Conf foobar:amd64 (1.0 stable [amd64])' aptget install foobar:amd64 -st stable
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
@@ -67,7 +67,7 @@ Inst foobar (1.0 stable [i386])
Conf libc6 (2.0 testing [all])
Conf foobar (1.0 stable [i386])' aptget install foobar/stable libc6 -st testing
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
@@ -84,7 +84,7 @@ testsuccess aptget purge libc6 -y
testsuccess aptget install libc6:i386 -y
testdpkginstalled libc6:all
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
@@ -93,7 +93,7 @@ The following NEW packages will be installed:
Inst foobar (1.0 stable [i386])
Conf foobar (1.0 stable [i386])' aptget install foobar/stable -st testing
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
@@ -110,7 +110,7 @@ Conf libc6:amd64 (1.0 stable [amd64])
Conf foobar:amd64 (1.0 stable [amd64])' aptget install foobar:amd64/stable -st testing
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Reading state information...
Selected version '1.0' (stable [i386]) for 'libc6'
@@ -133,7 +133,7 @@ setupaptarchive
testsuccess aptget install libc6-same:i386 -t stable -y
testdpkginstalled libc6-same:i386
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
@@ -142,7 +142,7 @@ The following NEW packages will be installed:
Inst foobar-same (1.0 stable [i386])
Conf foobar-same (1.0 stable [i386])' aptget install foobar-same -st stable
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
@@ -155,7 +155,7 @@ Inst foobar-same:amd64 (1.0 stable [amd64])
Conf libc6-same:amd64 (1.0 stable [amd64])
Conf foobar-same:amd64 (1.0 stable [amd64])' aptget install foobar-same:amd64 -st stable
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
@@ -166,7 +166,7 @@ Conf libc6-same:amd64 (1.0 stable [amd64])' aptget install libc6-same:amd64 -s -
# FIXME: We should test installing libc6-same:amd64 here, but dpkg doesn't allow it currently
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
@@ -184,7 +184,7 @@ testsuccess aptget install libc6-same:i386 -y
testdpkginstalled libc6-same:all
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Reading state information...
Selected version '1.0' (stable [i386]) for 'libc6-same'
@@ -194,7 +194,7 @@ The following packages will be DOWNGRADED:
Inst libc6-same [2.0] (1.0 stable [i386])
Conf libc6-same (1.0 stable [i386])" aptget install libc6-same/stable -s -q=0
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
@@ -203,7 +203,7 @@ The following NEW packages will be installed:
Inst foobar-same (1.0 stable [i386])
Conf foobar-same (1.0 stable [i386])' aptget install foobar-same/stable -st testing
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
diff --git a/test/integration/test-bug-612557-garbage-upgrade b/test/integration/test-bug-612557-garbage-upgrade
index 910b3b149..552330d81 100755
--- a/test/integration/test-bug-612557-garbage-upgrade
+++ b/test/integration/test-bug-612557-garbage-upgrade
@@ -17,7 +17,7 @@ testsuccess aptmark markauto python-uno openoffice.org-common
#aptmark unmarkauto openoffice.org-emailmerge
testmarkedauto python-uno openoffice.org-common
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
@@ -35,7 +35,7 @@ E: Trivial Only specified but this is not a trivial operation.' aptget --trivial
testsuccess aptmark markauto openoffice.org-emailmerge
testmarkedauto python-uno openoffice.org-common openoffice.org-emailmerge
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
@@ -50,7 +50,7 @@ The following packages will be upgraded:
After this operation, 53.2 MB disk space will be freed.
E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
diff --git a/test/integration/test-bug-613420-new-garbage-dependency b/test/integration/test-bug-613420-new-garbage-dependency
index 9d9f1096a..5839f8798 100755
--- a/test/integration/test-bug-613420-new-garbage-dependency
+++ b/test/integration/test-bug-613420-new-garbage-dependency
@@ -18,7 +18,7 @@ touch rootdir/var/lib/apt/extended_states
testsuccess aptmark markauto openoffice.org-officebean
testmarkedauto openoffice.org-officebean
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Reading state information...
The following packages were automatically installed and are no longer required:
diff --git a/test/integration/test-bug-618848-always-respect-user-requests b/test/integration/test-bug-618848-always-respect-user-requests
index 1ebadf280..a7ffee6c1 100755
--- a/test/integration/test-bug-618848-always-respect-user-requests
+++ b/test/integration/test-bug-618848-always-respect-user-requests
@@ -13,7 +13,7 @@ insertpackage 'unstable' 'exim4-daemon-heavy' 'all' '1.0' 'Depends: libdb4.8'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
MarkDelete libdb4.8 [ i386 ] < 1.0 > ( other ) FU=1
MarkDelete exim4-daemon-light [ i386 ] < 1.0 > ( other ) FU=0
diff --git a/test/integration/test-bug-624218-Translation-file-handling b/test/integration/test-bug-624218-Translation-file-handling
index d32bd513b..3987abff1 100755
--- a/test/integration/test-bug-624218-Translation-file-handling
+++ b/test/integration/test-bug-624218-Translation-file-handling
@@ -8,80 +8,98 @@ configarchitecture 'i386'
buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'
-setupaptarchive
+setupaptarchive --no-update
changetowebserver
-
rm -rf rootdir/var/lib/apt/lists
translationslisted() {
msgtest 'No download of non-existent locals' "$1"
- LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
+ export LC_ALL=""
+ testsuccess --nomsg aptget update -o Acquire::Languages=en
+ testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output
rm -rf rootdir/var/lib/apt/lists
msgtest 'Download of existent locals' "$1"
- LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
+ testsuccess --nomsg aptget update
+ cp rootdir/tmp/testsuccess.output testsuccess.output
+ testsuccess grep -q -e 'Translation-en ' testsuccess.output
rm -rf rootdir/var/lib/apt/lists
msgtest 'Download of en in LC_ALL=C' "$1"
- LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
+ export LC_ALL=C
+ testsuccess --nomsg aptget update
+ cp rootdir/tmp/testsuccess.output testsuccess.output
+ testsuccess grep -q -e 'Translation-en ' testsuccess.output
rm -rf rootdir/var/lib/apt/lists
+ unset LC_ALL
msgtest 'Download of en as forced language' "$1"
- aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
+ testsuccess --nomsg aptget update -o Acquire::Languages=en
+ cp rootdir/tmp/testsuccess.output testsuccess.output
+ testsuccess grep -q -e 'Translation-en ' testsuccess.output
rm -rf rootdir/var/lib/apt/lists
msgtest 'Download of nothing else in forced language' "$1"
- aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
+ testsuccess --nomsg aptget update -o Acquire::Languages=en
+ testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output
rm -rf rootdir/var/lib/apt/lists
msgtest 'Download no Translation- if forced language is non-existent' "$1"
- aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass
+ testsuccess --nomsg aptget update -o Acquire::Languages=ast_DE
+ testfailure grep -q -e 'Translation-' rootdir/tmp/testsuccess.output
rm -rf rootdir/var/lib/apt/lists
msgtest 'Download of nothing if none is forced' "$1"
- aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
+ testsuccess --nomsg aptget update -o Acquire::Languages=none
+ testfailure grep -q -e 'Translation' rootdir/tmp/testsuccess.output
rm -rf rootdir/var/lib/apt/lists
}
translationslisted 'with full Index'
-
# No Release file at all, so no records about Translation files
# (fallback to guessing)
-find aptarchive -name 'Release' -or -name 'InRelease' | xargs rm -f
+find aptarchive \( -name 'Release' -o -name 'InRelease' \) -delete
configallowinsecurerepositories "true";
msgtest 'Download of en as forced language' 'without Index'
-aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
+testwarning --nomsg aptget update -o Acquire::Languages=en
+testsuccess grep -q -e 'Translation-en ' rootdir/tmp/testwarning.output
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
+testwarning --nomsg aptget update -o Acquire::Languages=en
+testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testwarning.output
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
+testwarning --nomsg aptget update -o Acquire::Languages=ast_DE
+testsuccess grep -q -e 'Translation-ast_DE$' rootdir/tmp/testwarning.output
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
+testwarning --nomsg aptget update -o Acquire::Languages=ast_DE
+testfailure grep -q -e 'Translation-[^a][^s]' rootdir/tmp/testwarning.output
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
+testwarning --nomsg aptget update -o Acquire::Languages=none
+testfailure grep -q -e 'Translation' rootdir/tmp/testwarning.output
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
+testwarning --nomsg aptget update
+testsuccess grep -q -e 'Translation-ast_DE' rootdir/tmp/testwarning.output
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
+testwarning --nomsg aptget update -o Acquire::Languages=none
+testfailure grep -q -e 'Translation' rootdir/tmp/testwarning.output
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 d90a103c9..563821173 100755
--- a/test/integration/test-bug-632221-cross-dependency-satisfaction
+++ b/test/integration/test-bug-632221-cross-dependency-satisfaction
@@ -35,17 +35,17 @@ insertsource 'unstable' 'source-specific-armel' 'armel' '1' 'Build-Depends: spec
setupaptarchive
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
E: Build-Depends dependency for forbidden-none can't be satisfied because amdboot:any is not allowed on 'Multi-Arch: none' packages" aptget build-dep forbidden-none -s -a armel
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
E: Build-Depends dependency for forbidden-same can't be satisfied because libc6:any is not allowed on 'Multi-Arch: same' packages" aptget build-dep forbidden-same -s -a armel
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
E: Build-Depends dependency for forbidden-foreign can't be satisfied because doxygen:any is not allowed on 'Multi-Arch: foreign' packages" aptget build-dep forbidden-foreign -s -a armel
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libc6 specific
@@ -54,7 +54,7 @@ Inst libc6 (1.0 unstable [amd64])
Inst specific (1.0 unstable [amd64])
Conf libc6 (1.0 unstable [amd64])
Conf specific (1.0 unstable [amd64])' aptget build-dep source-specific-amd64 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libc6 specific
@@ -64,7 +64,7 @@ Inst specific (1.0 unstable [amd64])
Conf libc6 (1.0 unstable [amd64])
Conf specific (1.0 unstable [amd64])' aptget build-dep source-specific-amd64 -s -a armel
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libc6:armel specific:armel
@@ -73,7 +73,7 @@ Inst libc6:armel (1.0 unstable [armel])
Inst specific:armel (1.0 unstable [armel])
Conf libc6:armel (1.0 unstable [armel])
Conf specific:armel (1.0 unstable [armel])' aptget build-dep source-specific-armel -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libc6:armel specific:armel
@@ -83,7 +83,7 @@ Inst specific:armel (1.0 unstable [armel])
Conf libc6:armel (1.0 unstable [armel])
Conf specific:armel (1.0 unstable [armel])' aptget build-dep source-specific-armel -s -a armel
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
amdboot cool doxygen foreigner libc6 libc6-dev libfwibble-dev libfwibble1
@@ -108,7 +108,7 @@ Conf libfwibble1 (1.0 unstable [amd64])
Conf libfwibble-dev (1.0 unstable [amd64])
Conf linux-stuff (1.0 unstable [amd64])' aptget build-dep apt -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
amdboot arm-stuff:armel cool doxygen foreigner libc6 libc6:armel libc6-dev
@@ -139,7 +139,7 @@ Conf libfwibble-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a arm
configarchitecture 'armel' 'amd64'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
amdboot:amd64 arm-stuff cool doxygen foreigner libc6 libc6-dev
@@ -164,7 +164,7 @@ 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...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
amdboot:amd64 cool doxygen foreigner libc6:amd64 libc6 libc6-dev:amd64
@@ -198,7 +198,7 @@ configarchitecture 'amd64' 'armel'
insertinstalledpackage 'cool' 'amd64' '0.5'
insertinstalledpackage 'foreigner' 'armel' '0.5'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
amdboot doxygen libc6 libc6-dev libfwibble-dev libfwibble1 linux-stuff
@@ -218,7 +218,7 @@ Conf libfwibble1 (1.0 unstable [amd64])
Conf libfwibble-dev (1.0 unstable [amd64])
Conf linux-stuff (1.0 unstable [amd64])' aptget build-dep apt -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
amdboot arm-stuff:armel doxygen libc6 libc6:armel libc6-dev libc6-dev:armel
@@ -246,7 +246,7 @@ Conf libfwibble-dev:armel (1.0 unstable [armel])' aptget build-dep apt -s -a arm
configarchitecture 'armel' 'amd64'
# cool 0.5 is not M-A: allowed, so amd64 is not acceptable
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
cool:amd64
@@ -272,7 +272,7 @@ 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...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
amdboot:amd64 doxygen libc6:amd64 libc6 libc6-dev:amd64 libc6-dev
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 9e6c223a8..ff8fa4523 100755
--- a/test/integration/test-bug-64141-install-dependencies-for-on-hold
+++ b/test/integration/test-bug-64141-install-dependencies-for-on-hold
@@ -19,7 +19,7 @@ insertpackage 'unstable' 'libdb4.8' 'native' '4.8.30-3'
setupaptarchive
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be REMOVED:
@@ -34,7 +34,7 @@ E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgr
testsuccess aptmark hold apt
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages have been kept back:
diff --git a/test/integration/test-bug-657695-resolver-breaks-on-virtuals b/test/integration/test-bug-657695-resolver-breaks-on-virtuals
index 1b92a04fe..14c90b3b9 100755
--- a/test/integration/test-bug-657695-resolver-breaks-on-virtuals
+++ b/test/integration/test-bug-657695-resolver-breaks-on-virtuals
@@ -16,7 +16,7 @@ insertpackage 'unstable' 'xserver-xorg-core' 'amd64' '2:1.11.3-0ubuntu9' 'Breaks
setupaptarchive
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be REMOVED:
diff --git a/test/integration/test-bug-661537-build-profiles-support b/test/integration/test-bug-661537-build-profiles-support
index 6c850fdf9..7e7a74b03 100755
--- a/test/integration/test-bug-661537-build-profiles-support
+++ b/test/integration/test-bug-661537-build-profiles-support
@@ -24,7 +24,7 @@ insertsource 'unstable' 'spec-7' 'any' '1' 'Build-Depends: foo <stage1> <!notest
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
bar
@@ -32,7 +32,7 @@ The following NEW packages will be installed:
Inst bar (1.0 unstable [all])
Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
bar foo
@@ -42,7 +42,7 @@ Inst foo (1.0 unstable [all])
Conf bar (1.0 unstable [all])
Conf foo (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=i386
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
bar
@@ -50,7 +50,7 @@ The following NEW packages will be installed:
Inst bar (1.0 unstable [all])
Conf bar (1.0 unstable [all])' aptget build-dep buildprofiles -s -o APT::Architecture=armel
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
bar
diff --git a/test/integration/test-bug-675449-essential-are-protected b/test/integration/test-bug-675449-essential-are-protected
index 2a27c62b1..f50507532 100755
--- a/test/integration/test-bug-675449-essential-are-protected
+++ b/test/integration/test-bug-675449-essential-are-protected
@@ -27,7 +27,7 @@ insertpackage 'unstable' 'pkg-depends-new' 'amd64,i386' '2' 'Essential: yes'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
pkg-native*
@@ -37,7 +37,7 @@ This should NOT be done unless you know exactly what you are doing!
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
Purg pkg-native [1]' aptget purge pkg-native -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
pkg-foreign:i386*
@@ -47,7 +47,7 @@ This should NOT be done unless you know exactly what you are doing!
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
Purg pkg-foreign:i386 [1]' aptget purge pkg-foreign:i386 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
pkg-none-native*
@@ -57,7 +57,7 @@ This should NOT be done unless you know exactly what you are doing!
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
Purg pkg-none-native [1]' aptget purge pkg-none-native -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
pkg-none-foreign:i386*
@@ -67,7 +67,7 @@ This should NOT be done unless you know exactly what you are doing!
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
Purg pkg-none-foreign:i386 [1]' aptget purge pkg-none-foreign:i386 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following NEW packages will be installed:
diff --git a/test/integration/test-bug-679371-apt-get-autoclean-multiarch b/test/integration/test-bug-679371-apt-get-autoclean-multiarch
index 3de7d69f9..a9436fa11 100755
--- a/test/integration/test-bug-679371-apt-get-autoclean-multiarch
+++ b/test/integration/test-bug-679371-apt-get-autoclean-multiarch
@@ -22,6 +22,6 @@ testsuccess aptget install pkgall pkgnative pkgforeign -y
testdpkginstalled pkgall pkgnative
testsuccess aptcache show pkgforeign/installed
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...' aptget autoclean -s
diff --git a/test/integration/test-bug-680041-apt-mark-holds-correctly b/test/integration/test-bug-680041-apt-mark-holds-correctly
index 3f40c23dc..a6fe76bc2 100755
--- a/test/integration/test-bug-680041-apt-mark-holds-correctly
+++ b/test/integration/test-bug-680041-apt-mark-holds-correctly
@@ -17,7 +17,7 @@ setupaptarchive
runtests() {
testempty aptmark showhold
- testequal 'Reading package lists...
+ testfailureequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be upgraded:
@@ -26,10 +26,10 @@ The following packages will be upgraded:
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
- testequal 'pkgarch set on hold.' aptmark hold pkgarch
- testequal 'pkgarch' aptmark showhold
+ testsuccessequal 'pkgarch set on hold.' aptmark hold pkgarch
+ testsuccessequal 'pkgarch' aptmark showhold
- testequal 'Reading package lists...
+ testfailureequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages have been kept back:
@@ -40,10 +40,10 @@ The following packages will be upgraded:
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
- testequal 'Canceled hold on pkgarch.' aptmark unhold pkgarch
+ testsuccessequal 'Canceled hold on pkgarch.' aptmark unhold pkgarch
testempty aptmark showhold
- testequal 'Reading package lists...
+ testfailureequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be upgraded:
@@ -52,10 +52,10 @@ The following packages will be upgraded:
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
- testequal 'pkgall set on hold.' aptmark hold pkgall
- testequal 'pkgall' aptmark showhold
+ testsuccessequal 'pkgall set on hold.' aptmark hold pkgall
+ testsuccessequal 'pkgall' aptmark showhold
- testequal 'Reading package lists...
+ testfailureequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages have been kept back:
@@ -66,7 +66,7 @@ The following packages will be upgraded:
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
- testequal 'Canceled hold on pkgall.' aptmark unhold pkgall
+ testsuccessequal 'Canceled hold on pkgall.' aptmark unhold pkgall
testempty aptmark showhold
}
# single-arch
diff --git a/test/integration/test-bug-683786-build-dep-on-virtual-packages b/test/integration/test-bug-683786-build-dep-on-virtual-packages
index 65862c572..13a0ef0c8 100755
--- a/test/integration/test-bug-683786-build-dep-on-virtual-packages
+++ b/test/integration/test-bug-683786-build-dep-on-virtual-packages
@@ -23,7 +23,7 @@ insertsource 'unstable' 'sed2' 'any' '1' 'Build-Depends: libsehurd-dev'
setupaptarchive
-testequal 'Package: po-debconf:armel
+testsuccessequal 'Package: po-debconf:armel
Versions:
Reverse Depends:
@@ -31,9 +31,9 @@ Reverse Depends:
Dependencies:
Provides:
Reverse Provides: ' aptcache showpkg po-debconf:armel
-testequal 'N: Unable to locate package texi2html' aptcache showpkg texi2html:armel -q=0
+testsuccessequal 'N: Unable to locate package texi2html' aptcache showpkg texi2html:armel -q=0
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
po-debconf
@@ -41,15 +41,15 @@ The following NEW packages will be installed:
Inst po-debconf (1 unstable [all])
Conf po-debconf (1 unstable [all])' aptget build-dep dash -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
E: Build-Depends dependency for dash cannot be satisfied because the package po-debconf cannot be found' aptget build-dep -aarmel dash -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
E: Build-Depends dependency for diffutils cannot be satisfied because the package texi2html cannot be found' aptget build-dep -aarmel diffutils -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Note, selecting 'libselinux1-dev' instead of 'libselinux-dev'
The following NEW packages will be installed:
@@ -58,11 +58,11 @@ The following NEW packages will be installed:
Inst libselinux1-dev (1 unstable [amd64])
Conf libselinux1-dev (1 unstable [amd64])" aptget build-dep sed -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
E: Build-Depends dependency for sed cannot be satisfied because the package libselinux-dev cannot be found' aptget build-dep -aarmel sed -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Note, selecting 'libsehurd1-dev' instead of 'libsehurd-dev'
The following NEW packages will be installed:
@@ -71,7 +71,7 @@ The following NEW packages will be installed:
Inst libsehurd1-dev (1 unstable [amd64])
Conf libsehurd1-dev (1 unstable [amd64])" aptget build-dep sed2 -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Note, selecting 'libsehurd1-dev:armel' instead of 'libsehurd-dev:armel'
The following NEW packages will be installed:
diff --git a/test/integration/test-bug-686346-package-missing-architecture b/test/integration/test-bug-686346-package-missing-architecture
index 8024f81da..d51bbabfe 100755
--- a/test/integration/test-bug-686346-package-missing-architecture
+++ b/test/integration/test-bug-686346-package-missing-architecture
@@ -15,7 +15,7 @@ insertpackage 'unstable' 'pkge' 'none' '1'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
pkgb:none
@@ -26,7 +26,7 @@ Remv pkgb:none [1]
Inst pkgc (1 unstable [amd64])
Conf pkgc (1 unstable [amd64])' aptget install pkgc -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
pkgb
@@ -51,7 +51,7 @@ testnopackage pkge:*
# do not automatically change from none-arch to whatever-arch as
# this breaks other none packages and dpkg has this ruleset as
# this difference seems so important that it has to be maintained …
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade -s
@@ -103,7 +103,7 @@ rm rootdir/var/lib/dpkg/status
insertinstalledpackage 'pkgx' 'none' '1'
insertinstalledpackage 'pkgy' 'none' '1' 'Depends: pkgz, pkgx (>= 1)'
insertinstalledpackage 'pkgz' 'none' '1'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
@@ -111,7 +111,7 @@ The following packages will be REMOVED:
0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
Purg pkgy:none [1]
Purg pkgx:none [1]' aptget purge pkgx -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
diff --git a/test/integration/test-bug-689582-100-char-long-path-names b/test/integration/test-bug-689582-100-char-long-path-names
index 1b4b172b6..58ece1d5a 100755
--- a/test/integration/test-bug-689582-100-char-long-path-names
+++ b/test/integration/test-bug-689582-100-char-long-path-names
@@ -28,7 +28,7 @@ ar cr ../testpkg.deb debian-binary control.tar.gz data.tar.gz
cd - > /dev/null
-testequal '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000102 testpkg
+testsuccessequal '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000102 testpkg
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101 testpkg
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100 testpkg
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000099 testpkg
diff --git a/test/integration/test-bug-691453-apt-cache-search-multi-pattern b/test/integration/test-bug-691453-apt-cache-search-multi-pattern
index 0367892fc..15586b726 100755
--- a/test/integration/test-bug-691453-apt-cache-search-multi-pattern
+++ b/test/integration/test-bug-691453-apt-cache-search-multi-pattern
@@ -21,13 +21,13 @@ foo - tool best used with bar
bar - tool best used with foo
baz - alternative tool best used with foo'
-testequal "$FOOBAR" aptcache search foo
-testequal "$FOOBAR" aptcache search bar
-testequal "$FOOBAR" aptcache search foo bar
+testsuccessequal "$FOOBAR" aptcache search foo
+testsuccessequal "$FOOBAR" aptcache search bar
+testsuccessequal "$FOOBAR" aptcache search foo bar
-testequal 'foobar - funky tool
+testsuccessequal 'foobar - funky tool
foo - tool best used with bar' aptcache search -n foo
-testequal 'foobar - funky tool
+testsuccessequal 'foobar - funky tool
bar - tool best used with foo
baz - alternative tool best used with foo' aptcache search -n bar
-testequal 'foobar - funky tool' aptcache search -n foo bar
+testsuccessequal 'foobar - funky tool' aptcache search -n foo bar
diff --git a/test/integration/test-bug-709560-set-candidate-release b/test/integration/test-bug-709560-set-candidate-release
index 48dc5c382..ab41d8f2a 100755
--- a/test/integration/test-bug-709560-set-candidate-release
+++ b/test/integration/test-bug-709560-set-candidate-release
@@ -21,7 +21,7 @@ EOF
setupaptarchive
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Selected version '2.0' (experimental [all]) for 'foo'
Selected version '2.1' (experimental [all]) for 'foo-dep' because of 'foo'
diff --git a/test/integration/test-bug-712435-missing-descriptions b/test/integration/test-bug-712435-missing-descriptions
index 7a3518745..726134326 100755
--- a/test/integration/test-bug-712435-missing-descriptions
+++ b/test/integration/test-bug-712435-missing-descriptions
@@ -81,43 +81,43 @@ Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" > aptarchive/Packages
setupaptarchive
-testequal "Package: apt-normal
+testsuccessequal "Package: apt-normal
$PACKAGESTANZA
$DESCRIPTION
Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
" aptcache show apt-normal
for variant in 'below' 'middle' 'top'; do
- testequal "Package: apt-both-$variant
+ testsuccessequal "Package: apt-both-$variant
$PACKAGESTANZA
$TRANSDESCRIPTION
Description-md5: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
" aptcache show apt-both-$variant
done
-testequal "Package: apt-trans
+testsuccessequal "Package: apt-trans
$PACKAGESTANZA
$TRANSDESCRIPTION
Description-md5: cccccccccccccccccccccccccccccccc
" aptcache show apt-trans
-testequal "Package: apt-md5
+testsuccessequal "Package: apt-md5
$PACKAGESTANZA
Description-md5: dddddddddddddddddddddddddddddddd
" aptcache show apt-md5
-testequal "Package: apt-none
+testsuccessequal "Package: apt-none
$PACKAGESTANZA
" aptcache show apt-none
-testequal "Package: apt-intermixed
+testsuccessequal "Package: apt-intermixed
$PACKAGESTANZA
$DESCRIPTION
Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
X-Some-Flag: yes
" aptcache show apt-intermixed
-testequal "Package: apt-intermixed2
+testsuccessequal "Package: apt-intermixed2
$PACKAGESTANZA
$TRANSDESCRIPTION
Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -126,7 +126,7 @@ X-Foo-Flag: Something with a Description
X-Bar-Flag: no
" aptcache show apt-intermixed2
-testequal "Package: apt-intermixed3
+testsuccessequal "Package: apt-intermixed3
$PACKAGESTANZA
$TRANSDESCRIPTION
Description-md5: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
@@ -152,7 +152,7 @@ Reverse Provides: '
testempty aptcache search nonexistentstring
# packages without a description can't be found
-testequal 'apt-normal - commandline package manager
+testsuccessequal 'apt-normal - commandline package manager
apt-both-below - commandline package manager
apt-both-middle - commandline package manager
apt-both-top - commandline package manager
diff --git a/test/integration/test-bug-717891-abolute-uris-for-proxies b/test/integration/test-bug-717891-abolute-uris-for-proxies
index 54a616686..ef948c2d5 100755
--- a/test/integration/test-bug-717891-abolute-uris-for-proxies
+++ b/test/integration/test-bug-717891-abolute-uris-for-proxies
@@ -19,7 +19,7 @@ echo 'Acquire::http::Proxy "http://localhost:8080";' > rootdir/etc/apt/apt.conf.
msgtest 'Check that requests to proxies are' 'absolute uris'
testsuccess --nomsg aptget update
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
unrelated
diff --git a/test/integration/test-apt-bug-718329-support-data.tar b/test/integration/test-bug-718329-support-data.tar-uncompressed
index 5cfb31917..d2845f768 100755
--- a/test/integration/test-apt-bug-718329-support-data.tar
+++ b/test/integration/test-bug-718329-support-data.tar-uncompressed
@@ -5,16 +5,16 @@ test_process_package_with_compression() {
COMPRESSOR="$1"
DATA_TAR="$2"
- msgtest "Testing apt-ftparchive with compression type: $COMPRESSOR"
+ msgmsg "Testing apt-ftparchive with compression type: $COMPRESSOR"
buildsimplenativepackage 'pkg' 'all' '1.0' '' '' 'some descr' '' '' '' "$COMPRESSOR"
- testequal "debian-binary
+ testsuccessequal "debian-binary
control.tar.gz
$DATA_TAR" ar t incoming/pkg_1.0_all.deb
testequal "Package: pkg" echo "$(aptftparchive packages incoming/|grep ^Package)"
- testequal "usr/bin/pkg-all pkg
+ testsuccessequal "usr/bin/pkg-all pkg
usr/share/doc/pkg/FEATURES pkg
usr/share/doc/pkg/changelog pkg
usr/share/doc/pkg/copyright pkg" aptftparchive contents incoming/
@@ -29,6 +29,3 @@ setupenvironment
test_process_package_with_compression "gzip" "data.tar.gz"
test_process_package_with_compression "none" "data.tar"
test_process_package_with_compression "xz" "data.tar.xz"
-
-
-
diff --git a/test/integration/test-bug-719263-print-uris-removes-authentication b/test/integration/test-bug-719263-print-uris-removes-authentication
index 5e674db0b..207bf4611 100755
--- a/test/integration/test-bug-719263-print-uris-removes-authentication
+++ b/test/integration/test-bug-719263-print-uris-removes-authentication
@@ -15,7 +15,7 @@ setupaptarchive
testnoact() {
cp -a rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup-noact
touch rootdir/var/lib/apt/extended_states
- testequal 'Reading package lists...
+ testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be upgraded:
diff --git a/test/integration/test-bug-720597-build-dep-purge b/test/integration/test-bug-720597-build-dep-purge
index 1e24ed5f1..6fa261fbd 100755
--- a/test/integration/test-bug-720597-build-dep-purge
+++ b/test/integration/test-bug-720597-build-dep-purge
@@ -13,7 +13,7 @@ buildsimplenativepackage 'pkgc' 'amd64' '1' 'stable' 'Build-Depends: pkgb'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
pkga
@@ -24,7 +24,7 @@ Remv pkga [1]
Inst pkgb (1 stable [amd64])
Conf pkgb (1 stable [amd64])' aptget build-dep pkgc -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
pkga*
diff --git a/test/integration/test-bug-722207-print-uris-even-if-very-quiet b/test/integration/test-bug-722207-print-uris-even-if-very-quiet
index 9a5685703..1fa94de7d 100755
--- a/test/integration/test-bug-722207-print-uris-even-if-very-quiet
+++ b/test/integration/test-bug-722207-print-uris-even-if-very-quiet
@@ -12,19 +12,20 @@ insertpackage 'unstable' 'apt' 'all' '2'
insertsource 'unstable' 'apt' 'all' '2'
insertsource 'unstable' 'apt2' 'all' '1'
+getoriginfromsuite() { echo 'Debian'; }
setupaptarchive
APTARCHIVE=$(readlink -f ./aptarchive)
-testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget upgrade -qq --print-uris
-testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget dist-upgrade -qq --print-uris
-testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget install apt -qq --print-uris
-testequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget download apt -qq --print-uris
-testequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source apt -qq --print-uris
-testequal "'http://packages.debian.org/changelogs/pool/main/apt/apt_2/changelog'" aptget changelog apt -qq --print-uris
+testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget upgrade -qq --print-uris
+testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget dist-upgrade -qq --print-uris
+testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget install apt -qq --print-uris
+testsuccessequal "'file://${APTARCHIVE}/pool/main/apt/apt_2_all.deb' apt_2_all.deb 0 " aptget download apt -qq --print-uris
+testsuccessequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 9 MD5Sum:16ff470aaedad0f06fb951ed89ffdd3a
+'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 12 MD5Sum:ab2b546f59ff9e8f5cc7a2d987ff3373" aptget source apt -qq --print-uris
+testsuccessequal "'http://metadata.ftp-master.debian.org/changelogs/main/a/apt/apt_2_changelog' apt.changelog" aptget changelog apt -qq --print-uris
-testequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/apt2_1.dsc' apt2_1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
-'file://${APTARCHIVE}/apt2_1.tar.gz' apt2_1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source apt apt2 -qq --print-uris
+testsuccessequal "'file://${APTARCHIVE}/apt_2.dsc' apt_2.dsc 9 MD5Sum:16ff470aaedad0f06fb951ed89ffdd3a
+'file://${APTARCHIVE}/apt_2.tar.gz' apt_2.tar.gz 12 MD5Sum:ab2b546f59ff9e8f5cc7a2d987ff3373
+'file://${APTARCHIVE}/apt2_1.dsc' apt2_1.dsc 10 MD5Sum:4c572ce45f1e2bedbb30da7f5e1c241c
+'file://${APTARCHIVE}/apt2_1.tar.gz' apt2_1.tar.gz 13 MD5Sum:2a96fec139f8722d93312a1ff8281232" aptget source apt apt2 -qq --print-uris
diff --git a/test/integration/test-bug-723586-any-stripped-in-single-arch b/test/integration/test-bug-723586-any-stripped-in-single-arch
index 392b88e9f..0cf3362cf 100755
--- a/test/integration/test-bug-723586-any-stripped-in-single-arch
+++ b/test/integration/test-bug-723586-any-stripped-in-single-arch
@@ -41,14 +41,14 @@ The following packages have unmet dependencies:
python-mips : Depends: python3:mips but it is not installable
E: Unable to correct problems, you have held broken packages.'
-testequal "$INSTALLLOG" aptget install python3-gnupg -s
+testsuccessequal "$INSTALLLOG" aptget install python3-gnupg -s
aptcache showpkg python3 > showpkg.log
-testequal "$FAILLOG" aptget install python-mips -s
+testfailureequal "$FAILLOG" aptget install python-mips -s
# same test, but this time in a multi-arch environment
configarchitecture 'amd64' 'armhf'
rm rootdir/var/cache/apt/*.bin
-testequal "$INSTALLLOG" aptget install python3-gnupg -s
-testequal "$(sed 's#3.3.2-16 - python3#3.3.2-16 - python3:any:armhf python3#' showpkg.log)" aptcache showpkg python3
-testequal "$FAILLOG" aptget install python-mips -s
+testsuccessequal "$INSTALLLOG" aptget install python3-gnupg -s
+testsuccessequal "$(sed 's#3.3.2-16 - python3#3.3.2-16 - python3:any:armhf python3#' showpkg.log)" aptcache showpkg python3
+testfailureequal "$FAILLOG" aptget install python-mips -s
diff --git a/test/integration/test-bug-728500-tempdir b/test/integration/test-bug-728500-tempdir
index 37e5a013e..3ae94c58f 100755
--- a/test/integration/test-bug-728500-tempdir
+++ b/test/integration/test-bug-728500-tempdir
@@ -26,5 +26,5 @@ else
fi
unset TMPDIR
-testequal 'coolstuff' aptcache pkgnames
+testsuccessequal 'coolstuff' aptcache pkgnames
testsuccess ls rootdir/var/lib/apt/lists/*InRelease
diff --git a/test/integration/test-bug-732746-preferences b/test/integration/test-bug-732746-preferences
index b31f98aa0..ce73f1c17 100755
--- a/test/integration/test-bug-732746-preferences
+++ b/test/integration/test-bug-732746-preferences
@@ -25,7 +25,7 @@ Pin-Priority: 700
#Pin: 800
EOF
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree..." aptget check
msgtest "Ensure policy is applied"
diff --git a/test/integration/test-bug-735967-lib32-to-i386-unavailable b/test/integration/test-bug-735967-lib32-to-i386-unavailable
index 826931fe4..eb6e1a331 100755
--- a/test/integration/test-bug-735967-lib32-to-i386-unavailable
+++ b/test/integration/test-bug-735967-lib32-to-i386-unavailable
@@ -31,7 +31,7 @@ setupaptarchive --no-update
configarchitecture 'amd64'
testsuccess aptget update
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be REMOVED:
@@ -43,7 +43,7 @@ Remv lib32nss-mdns [0.9-1]
Inst libnss-mdns [0.9-1] (0.10-6 unstable [amd64])
Conf libnss-mdns (0.10-6 unstable [amd64])' aptget dist-upgrade -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -59,7 +59,7 @@ E: Unable to correct problems, you have held broken packages.' aptget install fo
configarchitecture 'amd64' 'i386'
testsuccess aptget update
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following NEW packages will be installed:
@@ -76,7 +76,7 @@ Conf libnss-mdns (0.10-6 unstable [amd64])
Conf libnss-mdns-i386:i386 (0.10-6 unstable [i386])
Conf lib32nss-mdns (0.10-6 unstable [amd64])' aptget dist-upgrade -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libfoo libfoo-bin:i386
diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol
index 0f458e099..e86f28824 100755
--- a/test/integration/test-bug-738785-switch-protocol
+++ b/test/integration/test-bug-738785-switch-protocol
@@ -10,6 +10,7 @@ configarchitecture "i386"
buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
# setup http redirecting to https
+getlabelfromsuite() { echo 'Testcases'; }
setupaptarchive --no-update
changetowebserver -o 'aptwebserver::redirect::replace::/redirectme/=https://localhost:4433/' \
-o 'aptwebserver::redirect::replace::/downgrademe/=http://localhost:8080/' \
@@ -20,10 +21,10 @@ sed -i -e 's#:4433/#:8080/redirectme#' -e 's# https:# http:#' rootdir/etc/apt/so
testsuccess aptget update -o Debug::Acquire::http=1 -o Debug::Acquire::https=1 -o Debug::pkgAcquire::Worker=1
msgtest 'Test that the webserver does not answer' 'http requests'
-downloadfile 'http://localhost:8080/pool/apt_1.0/changelog' changelog >/dev/null 2>&1 && msgfail || msgpass
+downloadfile 'http://localhost:8080/pool/main/a/apt/apt_1.0/changelog' changelog >/dev/null 2>&1 && msgfail || msgpass
-echo 'Apt::Changelogs::Server "http://localhost:8080/redirectme";' > rootdir/etc/apt/apt.conf.d/changelog.conf
-testequal "'http://localhost:8080/redirectme/pool/apt_1.0/changelog'" aptget changelog apt --print-uris
+echo 'Acquire::Changelogs::URI::Label::Testcases "http://localhost:8080/redirectme/pool/CHANGEPATH/changelog";' > rootdir/etc/apt/apt.conf.d/changelog.conf
+testsuccessequal "'http://localhost:8080/redirectme/pool/main/a/apt/apt_1.0/changelog' apt.changelog" aptget changelog apt --print-uris
cd downloaded
testsuccess aptget changelog apt -d
@@ -38,28 +39,24 @@ cd - >/dev/null
testsuccess aptget install apt -y
testdpkginstalled 'apt'
-# create a copy of all methods, expect https
-eval `aptconfig shell METHODS Dir::Bin::Methods/d`
-COPYMETHODS='usr/lib/apt/methods'
-mv rootdir/${COPYMETHODS} rootdir/${COPYMETHODS}.bak
-mkdir -p rootdir/$COPYMETHODS
-cd rootdir/$COPYMETHODS
-find $METHODS \! -type d | while read meth; do
- ln -s $meth
+# install a slowed down file: otherwise its to fast to reproduce combining
+NEWMETHODS="$(readlink -f rootdir)/usr/lib/apt/methods"
+OLDMETHODS="$(readlink -f rootdir/usr/lib/apt/methods)"
+rm $NEWMETHODS
+mkdir $NEWMETHODS
+for METH in $(find $OLDMETHODS ! -type d); do
+ ln -s $OLDMETHODS/$(basename $METH) $NEWMETHODS
done
-rm https
-cd - >/dev/null
-echo "Dir::Bin::Methods \"${COPYMETHODS}\";" >> aptconfig.conf
+rm $NEWMETHODS/https
cd downloaded
-testequal "E: The method driver $(readlink -f './../')/rootdir/usr/lib/apt/methods/https could not be found.
+testfailureequal "E: The method driver $(readlink -f './../')/rootdir/usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?" aptget download apt -q=0
testfailure test -e apt_1.0_all.deb
cd - >/dev/null
# revert to all methods
-rm -rf rootdir/$COPYMETHODS
-mv rootdir/${COPYMETHODS}.bak rootdir/${COPYMETHODS}
+ln -s $OLDMETHODS/https $NEWMETHODS
# check that downgrades from https to http are not allowed
webserverconfig 'aptwebserver::support::http' 'true'
diff --git a/test/integration/test-bug-745036-new-foreign-invalidates-cache b/test/integration/test-bug-745036-new-foreign-invalidates-cache
index 2b7ee06ad..bfa0f817c 100755
--- a/test/integration/test-bug-745036-new-foreign-invalidates-cache
+++ b/test/integration/test-bug-745036-new-foreign-invalidates-cache
@@ -14,7 +14,7 @@ setupaptarchive
testsuccess aptget check -s
configarchitecture 'amd64' 'i386'
-testequal 'E: The package cache was built for different architectures: amd64 vs amd64,i386' aptget check -s -o pkgCacheFile::Generate=false
+testfailureequal 'E: The package cache was built for different architectures: amd64 vs amd64,i386' aptget check -s -o pkgCacheFile::Generate=false
testsuccess aptget check -s
diff --git a/test/integration/test-bug-745046-candidate-propagation-fails b/test/integration/test-bug-745046-candidate-propagation-fails
index e4aa67a72..f54e1872e 100755
--- a/test/integration/test-bug-745046-candidate-propagation-fails
+++ b/test/integration/test-bug-745046-candidate-propagation-fails
@@ -14,7 +14,7 @@ insertpackage 'experimental' 'gedit' 'amd64' '2' 'Depends: common (>= 2)'
setupaptarchive
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2' (experimental [amd64]) for 'gedit'
Some packages could not be installed. This may mean that you have
@@ -29,7 +29,7 @@ E: Unable to correct problems, you have held broken packages." aptget install ge
insertinstalledpackage 'common' 'amd64' '2'
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Selected version '2' (experimental [amd64]) for 'gedit'
The following packages will be upgraded:
diff --git a/test/integration/test-bug-753297-upgradable b/test/integration/test-bug-753297-upgradable
index 01395a095..53bf3361b 100755
--- a/test/integration/test-bug-753297-upgradable
+++ b/test/integration/test-bug-753297-upgradable
@@ -25,9 +25,9 @@ insertpackage 'testing' 'bar' 'all' '2'
setupaptarchive
-testequal "Listing...
+testsuccessequal "Listing...
bar/testing 2 all [upgradable from: 1]" apt list --upgradable
-testequal "Listing...
+testsuccessequal "Listing...
bar/testing 2 all [upgradable from: 1]
foo/testing,now 1 all [installed]" apt list
diff --git a/test/integration/test-bug-758153-versioned-provides-support b/test/integration/test-bug-758153-versioned-provides-support
index 21f9123c9..30bc921c3 100755
--- a/test/integration/test-bug-758153-versioned-provides-support
+++ b/test/integration/test-bug-758153-versioned-provides-support
@@ -24,9 +24,15 @@ insertpackage 'experimental' 'foreign-webserver' 'i386' '4' 'Multi-Arch: foreign
Provides: httpd (= 4)'
insertpackage 'experimental' 'cool-webapp' 'all' '4' 'Depends: httpd (>= 4)'
+# arch-qualified provides, see #777071
+insertpackage 'unstable' 'foo' 'all' '1' 'Provides: bar:i386'
+insertpackage 'unstable' 'baz' 'i386,amd64' '1' 'Depends: bar'
+insertpackage 'experimental' 'baz' 'i386,amd64' '2' 'Depends: bar:i386'
+insertpackage 'experimental' 'baz-broken' 'i386' '2' 'Depends: bar:amd64'
+
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be upgraded:
@@ -37,7 +43,7 @@ Inst webapp [1] (2 unstable [all])
Conf webserver (2 unstable [amd64])
Conf webapp (2 unstable [all])' aptget dist-upgrade -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be upgraded:
webapp webserver
@@ -47,7 +53,7 @@ Inst webapp [1] (2 unstable [all])
Conf webserver (2 unstable [amd64])
Conf webapp (2 unstable [all])' aptget install webapp webserver -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be upgraded:
webapp webserver
@@ -57,7 +63,7 @@ Inst webapp [1] (3 experimental [all])
Conf webserver (2 unstable [amd64])
Conf webapp (3 experimental [all])' aptget install webapp=3 webserver -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be upgraded:
webapp webserver
@@ -67,7 +73,7 @@ Inst webapp [1] (2 unstable [all])
Conf webserver (3 experimental [amd64])
Conf webapp (2 unstable [all])' aptget install webapp webserver=3 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foreign-webserver:i386
@@ -79,7 +85,7 @@ Inst webapp [1] (2 unstable [all])
Conf foreign-webserver:i386 (2 unstable [i386])
Conf webapp (2 unstable [all])' aptget install webapp foreign-webserver:i386 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foreign-webserver:i386
@@ -91,7 +97,7 @@ Inst webapp [1] (3 experimental [all])
Conf foreign-webserver:i386 (2 unstable [i386])
Conf webapp (3 experimental [all])' aptget install webapp=3 foreign-webserver:i386 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foreign-webserver:i386
@@ -103,7 +109,7 @@ Inst webapp [1] (2 unstable [all])
Conf foreign-webserver:i386 (4 experimental [i386])
Conf webapp (2 unstable [all])' aptget install webapp foreign-webserver:i386=4 -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -115,7 +121,7 @@ The following packages have unmet dependencies:
cool-webapp : Depends: httpd (>= 4)
E: Unable to correct problems, you have held broken packages.' aptget install cool-webapp -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -127,7 +133,7 @@ The following packages have unmet dependencies:
cool-webapp : Depends: httpd (>= 4)
E: Unable to correct problems, you have held broken packages.' aptget install cool-webapp foreign-webserver:i386 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
cool-webapp foreign-webserver:i386
@@ -136,3 +142,65 @@ Inst foreign-webserver:i386 (4 experimental [i386])
Inst cool-webapp (4 experimental [all])
Conf foreign-webserver:i386 (4 experimental [i386])
Conf cool-webapp (4 experimental [all])' aptget install cool-webapp foreign-webserver:i386=4 -s
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ foo
+The following NEW packages will be installed:
+ baz:i386 foo
+0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
+Inst foo (1 unstable [all])
+Inst baz:i386 (1 unstable [i386])
+Conf foo (1 unstable [all])
+Conf baz:i386 (1 unstable [i386])' aptget install baz:i386 -s
+
+testfailureequal 'Reading package lists...
+Building dependency tree...
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ baz : Depends: bar but it is not installable
+E: Unable to correct problems, you have held broken packages.' aptget install baz:amd64 -s
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+Selected version '2' (experimental [amd64]) for 'baz'
+The following extra packages will be installed:
+ foo
+The following NEW packages will be installed:
+ baz foo
+0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
+Inst foo (1 unstable [all])
+Inst baz (2 experimental [amd64])
+Conf foo (1 unstable [all])
+Conf baz (2 experimental [amd64])" aptget install baz/experimental -s -q=0
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+Selected version '2' (experimental [i386]) for 'baz:i386'
+The following extra packages will be installed:
+ foo
+The following NEW packages will be installed:
+ baz:i386 foo
+0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
+Inst foo (1 unstable [all])
+Inst baz:i386 (2 experimental [i386])
+Conf foo (1 unstable [all])
+Conf baz:i386 (2 experimental [i386])" aptget install baz:i386/experimental -s -q=0
+
+testfailureequal 'Reading package lists...
+Building dependency tree...
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ baz-broken:i386 : Depends: bar but it is not installable
+E: Unable to correct problems, you have held broken packages.' aptget install baz-broken -s
diff --git a/test/integration/test-bug-769609-triggers-still-pending-after-run b/test/integration/test-bug-769609-triggers-still-pending-after-run
new file mode 100755
index 000000000..146fa766b
--- /dev/null
+++ b/test/integration/test-bug-769609-triggers-still-pending-after-run
@@ -0,0 +1,75 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+msgtest 'Check if installed dpkg supports' 'noawait trigger'
+if dpkg-checkbuilddeps -d 'dpkg (>= 1.16.1)' /dev/null; then
+ msgpass
+else
+ msgskip 'dpkg version too old'
+ exit 0
+fi
+configdpkgnoopchroot
+
+buildtriggerpackages() {
+ local TYPE="$1"
+ setupsimplenativepackage "triggerable-$TYPE" 'all' '1.0' 'unstable' "Depends: trigdepends-$TYPE"
+ BUILDDIR="incoming/triggerable-${TYPE}-1.0"
+ cat >${BUILDDIR}/debian/postinst <<EOF
+#!/bin/sh
+if [ "\$1" = 'triggered' ]; then
+ ls -l /proc/self/fd/
+fi
+EOF
+ echo "$TYPE /usr/share/doc" > ${BUILDDIR}/debian/triggers
+ buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
+ rm -rf "$BUILDDIR"
+ buildsimplenativepackage "trigdepends-$TYPE" 'all' '1.0' 'unstable'
+}
+
+#buildtriggerpackages 'interest'
+buildtriggerpackages 'interest-noawait'
+buildsimplenativepackage "trigstuff" 'all' '1.0' 'unstable'
+
+setupaptarchive
+
+runtests() {
+ local TYPE="$1"
+ msgmsg 'Working with trigger type' "$TYPE"
+ testsuccess aptget install triggerable-$TYPE -y
+ cp rootdir/tmp/testsuccess.output terminal.output
+ testsuccess grep '^REWRITE ' terminal.output
+ testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
+
+ testsuccess aptget install trigdepends-$TYPE -y --reinstall
+ cp rootdir/tmp/testsuccess.output terminal.output
+ testsuccess grep '^REWRITE ' terminal.output
+ testsuccess grep ' root root ' terminal.output
+ testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
+
+ testsuccess aptget install trigstuff -y
+ cp rootdir/tmp/testsuccess.output terminal.output
+ testsuccess grep '^REWRITE ' terminal.output
+ testsuccess grep ' root root ' terminal.output
+ testdpkginstalled triggerable-$TYPE trigdepends-$TYPE trigstuff
+
+ testsuccess aptget purge trigstuff -y
+ cp rootdir/tmp/testsuccess.output terminal.output
+ testsuccess grep '^REWRITE ' terminal.output
+ testsuccess grep ' root root ' terminal.output
+ testdpkginstalled triggerable-$TYPE trigdepends-$TYPE
+ testdpkgnotinstalled trigstuff
+
+ testsuccess aptget purge trigdepends-$TYPE -y
+ cp rootdir/tmp/testsuccess.output terminal.output
+ testfailure grep '^REWRITE ' terminal.output
+ testfailure grep ' root root ' terminal.output
+ testdpkgnotinstalled triggerable-$TYPE trigdepends-$TYPE
+}
+#runtests 'interest'
+runtests 'interest-noawait'
diff --git a/test/integration/test-bug-770291-reinstall b/test/integration/test-bug-770291-reinstall
new file mode 100755
index 000000000..a5b2aff07
--- /dev/null
+++ b/test/integration/test-bug-770291-reinstall
@@ -0,0 +1,98 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertpackage 'unstable,installed' 'libc6' 'i386' '1'
+insertpackage 'unstable,installed' 'libselinux1' 'i386' '1'
+
+cp rootdir/var/lib/dpkg/status dpkg.status
+
+insertpackage 'unstable,installed' 'init' 'i386' '1' 'Depends: systemd-sysv
+Essential: yes'
+insertpackage 'unstable,installed' 'systemd-sysv' 'i386' '215-5+b1' 'Depends: systemd (= 215-5+b1)
+Pre-Depends: systemd'
+# fun fact: we need these two pre-depends to get systemd ordered before systemd-sysv as
+# many pre-depends mean: do early (as they are a pain, so get them out of the way early)
+insertpackage 'unstable,installed' 'systemd' 'i386' '215-5+b1' 'Pre-Depends: libc6, libselinux1'
+
+# depends loop
+insertpackage 'unstable,installed' 'dependsA' 'i386' '1' 'Depends: dependsB
+Essential: yes'
+insertpackage 'unstable,installed' 'dependsB' 'i386' '1' 'Depends: dependsA
+Essential: yes'
+
+# pre-depends loop
+insertpackage 'unstable,installed' 'predependsA' 'i386' '1' 'Pre-Depends: predependsB
+Essential: yes'
+insertpackage 'unstable,installed' 'predependsB' 'i386' '1' 'Pre-Depends: predependsA
+Essential: yes'
+
+# pre-depends-to-depends loop
+insertpackage 'unstable,installed' 'predependsdependsA' 'i386' '1' 'Pre-Depends: predependsdependsB
+Essential: yes'
+insertpackage 'unstable,installed' 'predependsdependsB' 'i386' '1' 'Depends: predependsdependsA
+Essential: yes'
+
+setupaptarchive
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded.
+Inst systemd [215-5+b1] (215-5+b1 unstable [i386])
+Conf systemd (215-5+b1 unstable [i386])
+Inst systemd-sysv [215-5+b1] (215-5+b1 unstable [i386])
+Conf systemd-sysv (215-5+b1 unstable [i386])' aptget install --reinstall systemd systemd-sysv -s
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+0 upgraded, 0 newly installed, 2 reinstalled, 0 to remove and 0 not upgraded.
+Inst dependsA [1] (1 unstable [i386])
+Inst dependsB [1] (1 unstable [i386])
+Conf dependsB (1 unstable [i386])
+Conf dependsA (1 unstable [i386])' aptget install --reinstall dependsA dependsB -s
+
+# there is a chance dpkg can actually do these, BUT this depends on the maintainerscripts (not) present
+# which is very very risky to depend on (and apt doesn't know about that anyhow).
+testfailure aptget install --reinstall predependsA predependsB -s -o Debug::pkgPackageManager=1
+testequal "E: Couldn't configure predependsA:i386, probably a dependency cycle." tail -n1 rootdir/tmp/testfailure.output
+
+# FIXME: the error message is a catch all here, not like the one above
+testfailure aptget install --reinstall predependsdependsA predependsdependsB -s -o Debug::pkgPackageManager=1
+testequal "E: Could not configure 'predependsdependsB:i386'. " tail -n1 rootdir/tmp/testfailure.output
+
+
+msgmsg 'While we are at it, lets try these loops without reinstall as well'
+cp dpkg.status rootdir/var/lib/dpkg/status
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ systemd systemd-sysv
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst systemd (215-5+b1 unstable [i386])
+Conf systemd (215-5+b1 unstable [i386])
+Inst systemd-sysv (215-5+b1 unstable [i386])
+Conf systemd-sysv (215-5+b1 unstable [i386])' aptget install systemd systemd-sysv -s
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ dependsA dependsB
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst dependsA (1 unstable [i386]) []
+Inst dependsB (1 unstable [i386])
+Conf dependsB (1 unstable [i386])
+Conf dependsA (1 unstable [i386])' aptget install dependsA dependsB -s
+
+# there is a chance dpkg can actually do these, BUT this depends on the maintainerscripts (not) present
+# which is very very risky to depend on (and apt doesn't know about that anyhow).
+testfailure aptget install predependsA predependsB -s -o Debug::pkgPackageManager=1
+testequal "E: Couldn't configure predependsA:i386, probably a dependency cycle." tail -n1 rootdir/tmp/testfailure.output
+
+# FIXME: the error message is a catch all here, not like the one above
+testfailure aptget install predependsdependsA predependsdependsB -s -o Debug::pkgPackageManager=1
+testequal "E: Could not configure 'predependsdependsB:i386'. " tail -n1 rootdir/tmp/testfailure.output
diff --git a/test/integration/test-bug-778375-server-has-no-reason-phrase b/test/integration/test-bug-778375-server-has-no-reason-phrase
new file mode 100755
index 000000000..23481ef88
--- /dev/null
+++ b/test/integration/test-bug-778375-server-has-no-reason-phrase
@@ -0,0 +1,40 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'native'
+
+echo 'found' > aptarchive/working
+changetohttpswebserver -o 'aptwebserver::redirect::replace::/redirectme/=/' \
+ -o 'aptwebserver::httpcode::200=200' -o 'aptwebserver::httpcode::404=404' \
+ -o 'aptwebserver::httpcode::301=301'
+
+testdownload() {
+ rm -f downfile
+ msgtest "download of a $1 via" "${3%%:*}"
+ $2 --nomsg downloadfile "$3" downfile
+
+ cp rootdir/tmp/testsuccess.output download.log
+ #looking for "HTTP server doesn't give Reason-Phrase for 200"
+ testsuccess grep 'give Reason-Phrase for' download.log
+
+ if [ "$2" = 'testsuccess' ]; then
+ testfileequal downfile 'found'
+ else
+ testfailure test -e downfile
+ fi
+}
+
+runtest() {
+ testdownload 'file works' 'testsuccess' "$1/working"
+ testdownload 'file via redirect works' 'testsuccess' "$1/redirectme/working"
+
+ testdownload 'non-existent file fails' 'testfailure' "$1/failing"
+ testdownload 'non-existent file via redirect fails' 'testfailure' "$1/redirectme/failing"
+}
+
+runtest 'http://localhost:8080'
+runtest 'https://localhost:4433'
diff --git a/test/integration/test-bug-782777-single-arch-weirdness b/test/integration/test-bug-782777-single-arch-weirdness
new file mode 100755
index 000000000..004903385
--- /dev/null
+++ b/test/integration/test-bug-782777-single-arch-weirdness
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Ensure that the order in which packages are in the binary cache
+# does not effect if they can be found or not
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertpackage 'unstable' 'abar' 'i386' '1'
+insertpackage 'unstable' 'foobar' 'i386' '1' 'Depends: abar:amd64, zfoo:amd64'
+insertpackage 'unstable' 'zfoo' 'i386' '1'
+
+setupaptarchive
+
+testrun() {
+ rm -f rootdir/var/lib/apt/extended_states
+
+ testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ abar zfoo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst abar (1 unstable [i386])
+Inst zfoo (1 unstable [i386])
+Conf abar (1 unstable [i386])
+Conf zfoo (1 unstable [i386])' aptget install abar zfoo -s
+
+ testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ abar zfoo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst abar (1 unstable [i386])
+Inst zfoo (1 unstable [i386])
+Conf abar (1 unstable [i386])
+Conf zfoo (1 unstable [i386])' aptget install abar:i386 zfoo:i386 -s
+
+ testequal "Reading package lists...
+Building dependency tree...
+Package abar:amd64 is not available, but is referred to by another package.
+This may mean that the package is missing, has been obsoleted, or
+is only available from another source
+
+Package zfoo:amd64 is not available, but is referred to by another package.
+This may mean that the package is missing, has been obsoleted, or
+is only available from another source
+
+E: Package 'abar:amd64' has no installation candidate
+E: Package 'zfoo:amd64' has no installation candidate" aptget install abar:amd64 zfoo:amd64 -s
+
+ cp -f rootdir/var/lib/dpkg/status status.backup
+ insertinstalledpackage 'abar' 'i386' '1'
+ insertinstalledpackage 'zfoo' 'i386' '1'
+
+ testequal 'abar
+zfoo' aptmark showmanual abar zfoo
+ testequal 'abar set to automatically installed.
+zfoo set to automatically installed.' aptmark auto abar zfoo
+ testempty aptmark showmanual abar zfoo
+ testequal 'abar
+zfoo' aptmark showauto abar zfoo
+
+ mv -f status.backup rootdir/var/lib/dpkg/status
+}
+
+msgmsg 'Single-Arch testrun'
+testrun
+msgmsg 'Multi-Arch testrun'
+configarchitecture 'i386' 'amd64'
+testrun
diff --git a/test/integration/test-bug-lp1445239-download-loop b/test/integration/test-bug-lp1445239-download-loop
new file mode 100755
index 000000000..4e4de67bd
--- /dev/null
+++ b/test/integration/test-bug-lp1445239-download-loop
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# this is a regression test for LP: #1445239 where a partial download can
+# trigger an endless hang of the download method
+#
+
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+changetowebserver
+webserverconfig 'aptwebserver::support::range' 'true'
+
+TESTFILE='aptarchive/testfile'
+dd if=/dev/zero of=$TESTFILE bs=100k count=1 2>/dev/null
+
+DOWNLOADLOG='rootdir/tmp/testdownloadfile.log'
+
+TARGET=./downloaded/testfile-downloaded
+dd if=/dev/zero of=$TARGET bs=99k count=1 2>/dev/null
+if ! downloadfile http://localhost:8080/testfile "$TARGET" > "$DOWNLOADLOG"; then
+ cat >&2 "$DOWNLOADLOG"
+ msgfail
+else
+ msgpass
+fi
diff --git a/test/integration/test-bug-multiarch-upgrade b/test/integration/test-bug-multiarch-upgrade
index c29e1f903..56071f184 100755
--- a/test/integration/test-bug-multiarch-upgrade
+++ b/test/integration/test-bug-multiarch-upgrade
@@ -16,7 +16,7 @@ insertpackage 'unstable' 'libcups2' 'i386' '2' 'Multi-Arch: same'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libcups2
diff --git a/test/integration/test-cachecontainer-architecture-specification b/test/integration/test-cachecontainer-architecture-specification
index 47abfb5b0..e5625e811 100755
--- a/test/integration/test-cachecontainer-architecture-specification
+++ b/test/integration/test-cachecontainer-architecture-specification
@@ -12,31 +12,31 @@ insertpackage 'unstable' 'foo' 'all' '1'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libsame
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst libsame (1 unstable [amd64])
Conf libsame (1 unstable [amd64])' aptget -s install libsame
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libsame:armel
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst libsame:armel (1 unstable [armel])
Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:armel
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
E: Unable to locate package libsame' aptget -s install libsame:armhf
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libsame
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst libsame (1 unstable [amd64])
Conf libsame (1 unstable [amd64])' aptget -s install libsame:amd64
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libsame libsame:armel
@@ -45,7 +45,7 @@ Inst libsame (1 unstable [amd64])
Inst libsame:armel (1 unstable [armel])
Conf libsame (1 unstable [amd64])
Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:armel libsame:amd64
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libsame libsame:armel
@@ -54,14 +54,14 @@ Inst libsame (1 unstable [amd64])
Inst libsame:armel (1 unstable [armel])
Conf libsame (1 unstable [amd64])
Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:*
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libsame
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst libsame (1 unstable [amd64])
Conf libsame (1 unstable [amd64])' aptget -s install libsame:any
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libsame libsame:armel
@@ -70,14 +70,14 @@ Inst libsame (1 unstable [amd64])
Inst libsame:armel (1 unstable [armel])
Conf libsame (1 unstable [amd64])
Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:a*
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libsame
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst libsame (1 unstable [amd64])
Conf libsame (1 unstable [amd64])' aptget -s install libsame:linux-any
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libsame libsame:armel
@@ -86,35 +86,35 @@ Inst libsame (1 unstable [amd64])
Inst libsame:armel (1 unstable [armel])
Conf libsame (1 unstable [amd64])
Conf libsame:armel (1 unstable [armel])' aptget -s install libsame:linux-*
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
E: Unable to locate package libsame' aptget -s install libsame:windows-any
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
E: Unable to locate package foo' aptget -s install foo:armel
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst foo (1 unstable [all])
Conf foo (1 unstable [all])' aptget -s install foo
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst foo (1 unstable [all])
Conf foo (1 unstable [all])' aptget -s install foo:all
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst foo (1 unstable [all])
Conf foo (1 unstable [all])' aptget -s install foo:amd64
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo
diff --git a/test/integration/test-compressed-indexes b/test/integration/test-compressed-indexes
index 92e7c0e84..c6b292baa 100755
--- a/test/integration/test-compressed-indexes
+++ b/test/integration/test-compressed-indexes
@@ -61,9 +61,9 @@ testrun() {
cd downloaded
testsuccess --nomsg aptget download testpkg
msgtest '\tdeb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb
- rm testpkg_1.0_i386.deb
+ rm -f testpkg_1.0_i386.deb
cd - >/dev/null
- testequal 'Reading package lists...
+ testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
testpkg
@@ -71,14 +71,14 @@ The following NEW packages will be installed:
Inst testpkg (1.0 unstable [i386])
Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s
rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
- testequal "$GOODSHOW" aptcache show testpkg
- testequal "$GOODSHOW" aptcache show testpkg
+ testsuccessequal "$GOODSHOW" aptcache show testpkg
+ testsuccessequal "$GOODSHOW" aptcache show testpkg
rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
- testequal "$GOODPOLICY" aptcache policy testpkg
- testequal "$GOODPOLICY" aptcache policy testpkg
+ testsuccessequal "$GOODPOLICY" aptcache policy testpkg
+ testsuccessequal "$GOODPOLICY" aptcache policy testpkg
rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
- testequal "$GOODSHOWSRC" aptcache showsrc testpkg
- testequal "$GOODSHOWSRC" aptcache showsrc testpkg
+ testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg
+ testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg
aptget clean
msgtest 'Check if the source is aptgetable'
cd downloaded
@@ -87,7 +87,7 @@ Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s
testsuccess test -d testpkg-1.0
rm -rf testpkg-1.0*
cd - >/dev/null
- testequal "$(aptcache show testpkg -o Acquire::Languages=none)
+ testsuccessequal "$(aptcache show testpkg -o Acquire::Languages=none)
" aptcache dumpavail
}
@@ -134,14 +134,14 @@ testsuccess aptget update
GOODSHOW="$(aptcache show testpkg)
"
test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken'
-testequal "$GOODSHOW" aptcache show testpkg
+testsuccessequal "$GOODSHOW" aptcache show testpkg
GOODSHOWSRC="$(aptcache showsrc testpkg)
"
test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files:' -e '^Checksums-Sha256:' | wc -l) -eq 4 || msgdie 'showsrc is broken'
-testequal "$GOODSHOWSRC" aptcache showsrc testpkg
+testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg
GOODPOLICY="$(aptcache policy testpkg)"
test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'policy is broken'
-testequal "$GOODPOLICY" aptcache policy testpkg
+testsuccessequal "$GOODPOLICY" aptcache policy testpkg
for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'file' $COMPRESSOR; done
@@ -150,7 +150,7 @@ rm -rf rootdir/var/lib/apt/lists
testsuccess aptget update
GOODPOLICY="$(aptcache policy testpkg)"
test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 || msgdie 'policy is broken'
-testequal "$GOODPOLICY" aptcache policy testpkg
+testsuccessequal "$GOODPOLICY" aptcache policy testpkg
for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'http' $COMPRESSOR; done
@@ -159,6 +159,6 @@ rm -rf rootdir/var/lib/apt/lists
testsuccess aptcdrom add </dev/null
GOODPOLICY="$(aptcache policy testpkg)"
test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 cdrom://' | wc -l) -eq 4 || msgdie 'policy is broken'
-testequal "$GOODPOLICY" aptcache policy testpkg
+testsuccessequal "$GOODPOLICY" aptcache policy testpkg
for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'cdrom' $COMPRESSOR; done
diff --git a/test/integration/test-conflicts-loop b/test/integration/test-conflicts-loop
index 81731dfe4..729a5e0f8 100755
--- a/test/integration/test-conflicts-loop
+++ b/test/integration/test-conflicts-loop
@@ -15,7 +15,7 @@ insertpackage 'unstable' 'openjdk-6-jre-headless' 'i386' '6b20-1.9.8-0ubuntu1~10
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be upgraded:
diff --git a/test/integration/test-conflicts-real-multiarch-same b/test/integration/test-conflicts-real-multiarch-same
index d9111677c..e6c6c0e01 100755
--- a/test/integration/test-conflicts-real-multiarch-same
+++ b/test/integration/test-conflicts-real-multiarch-same
@@ -16,7 +16,7 @@ Conflicts: real-provider
Multi-Arch: same'
setupaptarchive
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Note, selecting 'virtual-provider' instead of 'virtual'
Note, selecting 'virtual-provider:i386' instead of 'virtual:i386'
@@ -28,7 +28,7 @@ Inst virtual-provider:i386 (2 unstable [i386])
Conf virtual-provider (2 unstable [amd64])
Conf virtual-provider:i386 (2 unstable [i386])" aptget install virtual:* -s -q=0
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
real real:i386
@@ -39,7 +39,7 @@ Conf real (2 unstable [amd64])
Conf real:i386 (2 unstable [i386])' aptget install real:* -s -q=0
# ensure that we are not confused by the provides
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
real-provider real-provider:i386
diff --git a/test/integration/test-cve-2013-1051-InRelease-parsing b/test/integration/test-cve-2013-1051-InRelease-parsing
index 8f9803991..933cbbd92 100755
--- a/test/integration/test-cve-2013-1051-InRelease-parsing
+++ b/test/integration/test-cve-2013-1051-InRelease-parsing
@@ -12,12 +12,12 @@ insertpackage 'stable' 'good-pkg' 'all' '1.0'
setupaptarchive
changetowebserver
-ARCHIVE='http://localhost:8080/'
+ARCHIVE='http://localhost:8080'
msgtest 'Initial apt-get update should work with' 'InRelease'
testsuccess --nomsg aptget update
# check that the setup is correct
-testequal "good-pkg:
+testsuccessequal "good-pkg:
Installed: (none)
Candidate: 1.0
Version table:
@@ -39,21 +39,26 @@ sed -i '/^-----BEGIN PGP SIGNATURE-----/,/^-----END PGP SIGNATURE-----/ s/^$/ /
cat aptarchive/dists/stable/Release >> aptarchive/dists/stable/InRelease
touch -d '+1hour' aptarchive/dists/stable/InRelease
-# ensure the update fails
-# useful for debugging to add "-o Debug::pkgAcquire::auth=true"
-msgtest 'apt-get update for should fail with the modified' 'InRelease'
-aptget update 2>&1 | grep -E -q '(Writing more data than expected|Hash Sum mismatch)' > /dev/null && msgpass || msgfail
+# ensure the update doesn't load bad data as good data
+# Note that we will pick up the InRelease itself as we download no other
+# indexes which would trigger a hashsum mismatch, but we ignore the 'bad'
+# part of the InRelease
+listcurrentlistsdirectory | sed '/_InRelease/ d' > listsdir.lst
+msgtest 'apt-get update should ignore unsigned data in the' 'InRelease'
+testsuccessequal "Get:1 http://localhost:8080 stable InRelease [$(stat -c%s aptarchive/dists/stable/InRelease) B]
+Reading package lists..." --nomsg aptget update
+testfileequal './listsdir.lst' "$(listcurrentlistsdirectory | sed '/_InRelease/ d')"
# ensure there is no package
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
E: Unable to locate package bad-mitm' aptget install bad-mitm -s
# and verify that its not picked up
-testequal 'N: Unable to locate package bad-mitm' aptcache policy bad-mitm -q=0
+testsuccessequal 'N: Unable to locate package bad-mitm' aptcache policy bad-mitm -q=0
# and that the right one is used
-testequal "good-pkg:
+testsuccessequal "good-pkg:
Installed: (none)
Candidate: 1.0
Version table:
diff --git a/test/integration/test-essential-force-loopbreak b/test/integration/test-essential-force-loopbreak
index 1493430d8..50c682d43 100755
--- a/test/integration/test-essential-force-loopbreak
+++ b/test/integration/test-essential-force-loopbreak
@@ -25,7 +25,7 @@ cp -a rootdir/var/lib/dpkg/status dpkg.status.backup
testforcebreak() {
cp -a dpkg.status.backup rootdir/var/lib/dpkg/status
rm -f rootdir/var/lib/apt/extended_states
- testequal "Reading package lists...
+ testfailureequal "Reading package lists...
Building dependency tree...
The following extra packages will be installed:
sysvinit
diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol
index 07d2441b6..3b9b38c39 100755
--- a/test/integration/test-external-dependency-solver-protocol
+++ b/test/integration/test-external-dependency-solver-protocol
@@ -12,7 +12,10 @@ insertinstalledpackage 'stuff' 'all' '1'
insertpackage 'unstable' 'cool' 'all' '2' 'Multi-Arch: foreign'
insertpackage 'unstable' 'stuff' 'all' '2' 'Multi-Arch: foreign'
insertpackage 'unstable' 'coolstuff' 'i386,amd64' '2' 'Depends: cool, stuff'
-insertpackage 'unstable' 'awesome' 'all' '2' 'Multi-Arch: foreign'
+insertpackage 'unstable' 'awesome' 'all' '2' 'Multi-Arch: foreign
+Conflicts: badstuff'
+insertpackage 'unstable' 'badstuff' 'all' '2' 'Multi-Arch: foreign
+Conflicts: awesome'
insertpackage 'unstable' 'awesomecoolstuff' 'i386' '2' 'Depends: coolstuff, awesome'
insertpackage 'experimental' 'cool' 'all' '3' 'Multi-Arch: foreign'
@@ -22,7 +25,7 @@ insertpackage 'experimental' 'coolstuff' 'i386,amd64' '3' 'Depends: cool, stuff'
setupaptarchive
rm -f /tmp/dump.edsp
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Execute external solver...
The solver encountered an error of type: ERR_JUST_DUMPING
@@ -35,7 +38,7 @@ testsuccess test -s /tmp/dump.edsp
rm -f /tmp/dump.edsp
#FIXME: this should be unstable, but we don't support pinning yet
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Execute external solver...
The following NEW packages will be installed:
@@ -44,6 +47,14 @@ The following NEW packages will be installed:
Inst coolstuff (3 experimental [amd64])
Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Execute external solver...
+The following packages will be REMOVED:
+ cool*
+0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
+Purg cool [1]' aptget purge --solver apt cool -s
+
testsuccess aptget install awesomecoolstuff:i386 -s
testsuccess aptget install --solver apt awesomecoolstuff:i386 -s
@@ -57,9 +68,13 @@ testsuccess aptget dist-upgrade -s --solver apt
testsuccess aptget upgrade -s
testsuccess aptget upgrade -s --solver apt
+testfailure aptget install awesome badstuff -s
+testfailure aptget install awesome badstuff -s --solver apt
+testsuccess grep 'ERR_UNSOLVABLE' rootdir/tmp/testfailure.output
+
configarchitecture 'armel'
msgtest 'Test direct calling is okay for' 'apt-internal-solver'
-cat /tmp/dump.edsp | aptinternalsolver > solver.result 2>&1 || true
+cat /tmp/dump.edsp | aptinternalsolver -q=0 > solver.result 2>&1 || true
if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then
msgpass
else
@@ -69,3 +84,16 @@ fi
rm -f /tmp/dump.edsp
testfailure aptget install --solver apt awesomecoolstuff:i386 -s
+
+testsuccess aptinternalsolver scenario
+testsuccessequal 'Package: stuff
+Source: stuff
+Architecture: all
+Version: 1
+Installed: yes
+APT-ID: 2
+Priority: optional
+Section: other
+APT-Pin: 100
+APT-Candidate: yes
+' aptinternalsolver scenario stuff
diff --git a/test/integration/test-failing-maintainer-scripts b/test/integration/test-failing-maintainer-scripts
index 3dd7d643e..953506aa5 100755
--- a/test/integration/test-failing-maintainer-scripts
+++ b/test/integration/test-failing-maintainer-scripts
@@ -6,6 +6,7 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture 'native'
+configdpkgnoopchroot
# create a bunch of failures
createfailure() {
@@ -25,51 +26,6 @@ createfailure 'postrm'
setupaptarchive
-# create a library to noop chroot() and rewrite maintainer script executions
-# via execvp() as used by dpkg as we don't want our rootdir to be a fullblown
-# chroot directory dpkg could chroot into to execute the maintainer scripts
-cat << EOF > noopchroot.c
-#define _GNU_SOURCE
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <dlfcn.h>
-
-static char * chrootdir = NULL;
-
-int chroot(const char *path) {
- printf("WARNING: CHROOTing to %s was ignored!\n", path);
- free(chrootdir);
- chrootdir = strdup(path);
- return 0;
-}
-int execvp(const char *file, char *const argv[]) {
- static int (*func_execvp) (const char *, char * const []) = NULL;
- if (func_execvp == NULL)
- func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp");
- if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0)
- return func_execvp(file, argv);
- printf("REWRITE execvp call %s into %s\n", file, chrootdir);
- char newfile[strlen(chrootdir) + strlen(file)];
- strcpy(newfile, chrootdir);
- strcat(newfile, file);
- return func_execvp(newfile, argv);
-}
-EOF
-testsuccess gcc -fPIC -shared -o noopchroot.so noopchroot.c -ldl
-
-mkdir -p "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/"
-DPKG="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg"
-echo "#!/bin/sh
-if [ -n \"\$LD_PRELOAD\" ]; then
- export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so \${LD_PRELOAD}\"
-else
- export LD_PRELOAD=\"${TMPWORKINGDIRECTORY}/noopchroot.so\"
-fi
-dpkg \"\$@\"" > $DPKG
-chmod +x $DPKG
-sed -ie "s|^DPKG::options:: \"dpkg\";\$|DPKG::options:: \"$DPKG\";|" aptconfig.conf
-
# setup some pre- and post- invokes to check the output isn't garbled later
APTHOOK="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apthook"
echo '#!/bin/sh
diff --git a/test/integration/test-handling-broken-orgroups b/test/integration/test-handling-broken-orgroups
index 20b314074..149f05fa9 100755
--- a/test/integration/test-handling-broken-orgroups
+++ b/test/integration/test-handling-broken-orgroups
@@ -23,7 +23,7 @@ Provides: stuff-abi-2'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
cool
@@ -35,7 +35,7 @@ Inst coolstuff (1.0-1 unstable [all])
Conf cool (1.0-1 unstable [all])
Conf coolstuff (1.0-1 unstable [all])' aptget install coolstuff -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
stuff
@@ -47,7 +47,7 @@ Inst coolstuff2 (1.0-1 unstable [all])
Conf stuff (1.0-1 unstable [all])
Conf coolstuff2 (1.0-1 unstable [all])' aptget install coolstuff2 -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -60,7 +60,7 @@ The following packages have unmet dependencies:
stuff2 but it is not installable
E: Unable to correct problems, you have held broken packages.' aptget install coolstuff-broken -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Recommended packages:
cool2 stuff2
@@ -70,7 +70,7 @@ The following NEW packages will be installed:
Inst coolstuff-brokenrec (1.0-1 unstable [all])
Conf coolstuff-brokenrec (1.0-1 unstable [all])' aptget install coolstuff-brokenrec -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
stuff
@@ -82,7 +82,7 @@ Inst coolstuff-conflict (1.0-1 unstable [all])
Conf stuff (1.0-1 unstable [all])
Conf coolstuff-conflict (1.0-1 unstable [all])' aptget install coolstuff-conflict -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
extrastuff
@@ -94,7 +94,7 @@ Inst coolstuff-provided (1.0-1 unstable [all])
Conf extrastuff (1.0-1 unstable [all])
Conf coolstuff-provided (1.0-1 unstable [all])' aptget install coolstuff-provided -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
diff --git a/test/integration/test-ignore-provides-if-versioned-breaks b/test/integration/test-ignore-provides-if-versioned-breaks
index 745f7d206..20424b942 100755
--- a/test/integration/test-ignore-provides-if-versioned-breaks
+++ b/test/integration/test-ignore-provides-if-versioned-breaks
@@ -33,7 +33,7 @@ insertpackage 'unstable' 'foo-same-breaker-none' 'i386' '1.0' 'Breaks: foo-same'
setupaptarchive
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -45,7 +45,7 @@ The following packages have unmet dependencies:
foo-breaker-none : Breaks: foo
E: Unable to correct problems, you have held broken packages.' aptget install foo-provider foo-breaker-none -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo-breaker-2 foo-provider
@@ -55,7 +55,7 @@ Inst foo-provider (1.0 unstable [i386])
Conf foo-breaker-2 (1.0 unstable [i386])
Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-2 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
@@ -71,7 +71,7 @@ Conf foo (4.0 unstable [i386])
Conf foo-breaker-3 (1.0 unstable [i386])
Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-3 -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -83,7 +83,7 @@ The following packages have unmet dependencies:
foo-foreign-breaker-none : Breaks: foo-foreign
E: Unable to correct problems, you have held broken packages.' aptget install foo-foreign-provider foo-foreign-breaker-none -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo-foreign-breaker-2 foo-foreign-provider
@@ -93,7 +93,7 @@ Inst foo-foreign-provider (1.0 unstable [i386])
Conf foo-foreign-breaker-2 (1.0 unstable [i386])
Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-2 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo-foreign:amd64
@@ -109,7 +109,7 @@ Conf foo-foreign:amd64 (4.0 unstable [amd64])
Conf foo-foreign-breaker-3 (1.0 unstable [i386])
Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-3 -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -121,7 +121,7 @@ The following packages have unmet dependencies:
foo-same-breaker-none : Breaks: foo-same
E: Unable to correct problems, you have held broken packages.' aptget install foo-same-provider foo-same-breaker-none -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo-same-breaker-2 foo-same-provider
@@ -131,7 +131,7 @@ Inst foo-same-provider (1.0 unstable [i386])
Conf foo-same-breaker-2 (1.0 unstable [i386])
Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-2 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo-same:amd64 foo-same
diff --git a/test/integration/test-ignore-provides-if-versioned-conflicts b/test/integration/test-ignore-provides-if-versioned-conflicts
index a07252768..a781d8e44 100755
--- a/test/integration/test-ignore-provides-if-versioned-conflicts
+++ b/test/integration/test-ignore-provides-if-versioned-conflicts
@@ -33,7 +33,7 @@ insertpackage 'unstable' 'foo-same-breaker-none' 'i386' '1.0' 'Conflicts: foo-sa
setupaptarchive
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -45,7 +45,7 @@ The following packages have unmet dependencies:
foo-breaker-none : Conflicts: foo
E: Unable to correct problems, you have held broken packages.' aptget install foo-provider foo-breaker-none -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo-breaker-2 foo-provider
@@ -55,7 +55,7 @@ Inst foo-provider (1.0 unstable [i386])
Conf foo-breaker-2 (1.0 unstable [i386])
Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-2 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
@@ -71,7 +71,7 @@ Conf foo (4.0 unstable [i386])
Conf foo-breaker-3 (1.0 unstable [i386])
Conf foo-provider (1.0 unstable [i386])' aptget install foo-provider foo-breaker-3 -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -83,7 +83,7 @@ The following packages have unmet dependencies:
foo-foreign-breaker-none : Conflicts: foo-foreign
E: Unable to correct problems, you have held broken packages.' aptget install foo-foreign-provider foo-foreign-breaker-none -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo-foreign-breaker-2 foo-foreign-provider
@@ -93,7 +93,7 @@ Inst foo-foreign-provider (1.0 unstable [i386])
Conf foo-foreign-breaker-2 (1.0 unstable [i386])
Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-2 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo-foreign:amd64
@@ -109,7 +109,7 @@ Conf foo-foreign:amd64 (4.0 unstable [amd64])
Conf foo-foreign-breaker-3 (1.0 unstable [i386])
Conf foo-foreign-provider (1.0 unstable [i386])' aptget install foo-foreign-provider foo-foreign-breaker-3 -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -121,7 +121,7 @@ The following packages have unmet dependencies:
foo-same-breaker-none : Conflicts: foo-same
E: Unable to correct problems, you have held broken packages.' aptget install foo-same-provider foo-same-breaker-none -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo-same-breaker-2 foo-same-provider
@@ -131,7 +131,7 @@ Inst foo-same-provider (1.0 unstable [i386])
Conf foo-same-breaker-2 (1.0 unstable [i386])
Conf foo-same-provider (1.0 unstable [i386])' aptget install foo-same-provider foo-same-breaker-2 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo-same:amd64 foo-same
diff --git a/test/integration/test-implicit-conflicts-real-not-virtual b/test/integration/test-implicit-conflicts-real-not-virtual
index c9fca4edf..7c1365bdd 100755
--- a/test/integration/test-implicit-conflicts-real-not-virtual
+++ b/test/integration/test-implicit-conflicts-real-not-virtual
@@ -17,7 +17,7 @@ insertinstalledpackage 'wireless-crda' 'amd64' '1.14'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
crda
@@ -25,7 +25,7 @@ The following NEW packages will be installed:
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...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
crda
@@ -33,7 +33,7 @@ The following NEW packages will be installed:
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...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
crda
@@ -47,7 +47,7 @@ Conflicts: wireless-crda (<< 1.15)
Replaces: wireless-crda ( << 1.15)
Multi-arch: foreign'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
wireless-crda
diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove
index 22c36890b..c2fc37ee7 100755
--- a/test/integration/test-kernel-helper-autoremove
+++ b/test/integration/test-kernel-helper-autoremove
@@ -26,13 +26,6 @@ insertinstalledpackage 'linux-headers-1000000-1-generic' 'amd64' '100.0.0-1'
testsuccess aptmark auto "$CURRENTKERNEL" 'linux-image-1.0.0-2-generic' 'linux-image-100.0.0-1-generic' 'linux-headers-1000000-1-generic'
-cat > ./fake-dpkg <<EOF
-#!/bin/sh
-exec $(aptconfig dump --no-empty --format='%v ' 'DPKG::options') "\$@"
-EOF
-chmod +x ./fake-dpkg
-echo 'Dir::Bin::dpkg "./fake-dpkg";' > rootdir/etc/apt/apt.conf.d/99fakedpkg
-
# install fake-dpkg into it
catfail() {
echo >&2
@@ -62,7 +55,7 @@ testprotected() {
grep -q "^\\^linux-image-$(uname -r | sed -e 's#\.#\\\\.#g')\\\$\$" protected.list && msgpass || catfail
}
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
@@ -80,7 +73,7 @@ testprotected
msgtest 'Check kernel autoremoval protection list does not include' 'old kernel'
grep -q '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list && catfail || msgpass
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
@@ -92,7 +85,7 @@ Remv linux-image-1.0.0-2-generic [1.0.0-2]' aptget autoremove -s
testprotected 1.0.0-2-generic
msgtest 'Check kernel autoremoval protection list includes' 'installed kernel'
grep -q '^\^linux-image-1\\\.0\\\.0-2-generic\$$' protected.list && msgpass || catfail
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
diff --git a/test/integration/test-method-rred b/test/integration/test-method-rred
new file mode 100755
index 000000000..a8de3ea28
--- /dev/null
+++ b/test/integration/test-method-rred
@@ -0,0 +1,194 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'i386'
+
+echo 'Package: coolstuff
+Version: 0.8.15
+Description: collection of stuff
+ A lot, too much to iterate all, but at least this:
+ - stuff
+ - more stuff
+ - even more stuff
+ .
+ And a cow.
+
+Package: oldstuff
+Version: 0-1
+Description: collection of outdated stuff
+ A lot, but of no use nowadays, but at least this:
+ - stuff
+ - more stuff
+ - even more stuff
+ .
+ And a dog.' > Packages
+
+testrred() {
+ msgtest "$1" "$2"
+ if [ -z "$3" ]; then
+ echo -n '' > Packages.ed
+ else
+ echo "$3" > Packages.ed
+ fi
+ rred() {
+ cat Packages | runapt "${METHODSDIR}/rred" "$@"
+ }
+ testsuccessequal "$4" --nomsg rred -f Packages.ed
+}
+
+testrred 'Remove' 'first line' '1d' "$(tail -n +2 ./Packages)"
+testrred 'Remove' 'empty line' '10d' "$(head -n 9 ./Packages)
+$(tail -n 9 ./Packages)"
+testrred 'Remove' 'line in a paragraph' '5d' "$(head -n 4 ./Packages)
+$(tail -n 14 ./Packages)"
+testrred 'Remove' 'last line' '19d' "$(head -n -1 ./Packages)"
+testrred 'Remove' 'multiple single lines' '17d
+7d' "$(sed -e '/^ - even more stuff$/ d' ./Packages)"
+testrred 'Remove' 'first paragraph' '1,10d' "$(tail -n 9 ./Packages)"
+testrred 'Remove' 'a few lines in the middle' '5,14d' "$(head -n 4 ./Packages)
+$(tail -n 5 ./Packages)"
+testrred 'Remove' 'second paragraph' '10,19d' "$(head -n 9 ./Packages)"
+testrred 'Mass Remove' 'all stuff lines' '15,17d
+13d
+11d
+5,7d
+3d
+1d' "$(sed '/stuff/ d' ./Packages)"
+
+testrred 'Single line add' 'first line' '0a
+Format: 3.0 (native)
+.' "Format: 3.0 (native)
+$(cat ./Packages)"
+testrred 'Single line add' 'last line' '19a
+Multi-Arch: foreign
+.' "$(cat ./Packages)
+Multi-Arch: foreign"
+testrred 'Single line add' 'middle' '9a
+Multi-Arch: foreign
+.' "$(head -n 9 ./Packages)
+Multi-Arch: foreign
+$(tail -n 10 ./Packages)"
+
+testrred 'Multi line add' 'first line' '0a
+Format: 3.0 (native)
+Source: apt
+.' "Format: 3.0 (native)
+Source: apt
+$(cat ./Packages)"
+testrred 'Multi line add' 'last line' '19a
+Multi-Arch: foreign
+Homepage: https://debian.org
+.' "$(cat ./Packages)
+Multi-Arch: foreign
+Homepage: https://debian.org"
+testrred 'Multi line add' 'middle' '9a
+Multi-Arch: foreign
+Homepage: https://debian.org
+.' "$(head -n 9 ./Packages)
+Multi-Arch: foreign
+Homepage: https://debian.org
+$(tail -n 10 ./Packages)"
+
+testrred 'Single line change' 'first line' '1c
+Package: supercoolstuff
+.' "Package: supercoolstuff
+$(tail -n +2 ./Packages)"
+testrred 'Single line change' 'in the middle' '9c
+ And a super cow.
+.' "$(head -n 8 ./Packages)
+ And a super cow.
+$(tail -n 10 ./Packages)"
+testrred 'Single line change' 'an empty line' '10c
+
+.' "$(head -n 9 ./Packages)
+
+$(tail -n 9 ./Packages)"
+testrred 'Single line change' 'a spacy line' '10c
+
+.' "$(head -n 9 ./Packages)
+
+$(tail -n 9 ./Packages)"
+testrred 'Single line change' 'last line' '19c
+ And a cat.
+.' "$(head -n -1 ./Packages)
+ And a cat."
+
+testrred 'Multi line change' 'exchange' '5,7c
+ - good stuff
+ - more good stuff
+ - even more good stuff
+.' "$(head -n 4 ./Packages)
+ - good stuff
+ - more good stuff
+ - even more good stuff
+$(tail -n 12 ./Packages)"
+testrred 'Multi line change' 'less' '5,7c
+ - good stuff
+ - more good stuff
+.' "$(head -n 4 ./Packages)
+ - good stuff
+ - more good stuff
+$(tail -n 12 ./Packages)"
+testrred 'Multi line change' 'more' '5,7c
+ - good stuff
+ - more good stuff
+ - even more good stuff
+ - bonus good stuff
+.' "$(head -n 4 ./Packages)
+ - good stuff
+ - more good stuff
+ - even more good stuff
+ - bonus good stuff
+$(tail -n 12 ./Packages)"
+
+failrred() {
+ msgtest 'Failure caused by' "$1"
+ echo "$2" > Packages.ed
+ rred() {
+ cat Packages | runapt "${METHODSDIR}/rred" "$@"
+ }
+ testfailure --nomsg rred -f Packages.ed
+}
+
+failrred 'Bogus content' '<html>
+</html>'
+
+# not a problem per-se, but we want our parser to be really strict
+failrred 'Empty patch file' ''
+failrred 'Empty line patch file' '
+'
+failrred 'Empty line before command' '
+1d'
+failrred 'Empty line after command' '1d
+'
+failrred 'Empty line between commands' '17d
+
+7d'
+failrred 'Empty spaces lines before command' '
+1d'
+failrred 'Empty spaces lines after command' '1d
+ '
+failrred 'Empty spaces lines between commands' '17d
+
+7d'
+
+# the line before the first one can't be deleted/changed
+failrred 'zero line delete' '0d'
+failrred 'zero line change' '0c
+Package: supercoolstuff
+.'
+# and this makes no sense at all
+failrred 'negative line delete' '-1d'
+failrred 'negative line change' '-1c
+Package: supercoolstuff
+.'
+failrred 'negative line add' '-1a
+Package: supercoolstuff
+.'
+failrred 'Wrong order of commands' '7d
+17d'
+failrred 'End before start' '7,6d'
diff --git a/test/integration/test-multiarch-foreign b/test/integration/test-multiarch-foreign
index 332466d96..7870126f5 100755
--- a/test/integration/test-multiarch-foreign
+++ b/test/integration/test-multiarch-foreign
@@ -7,15 +7,19 @@ setupenvironment
configarchitecture 'amd64' 'i386' 'armel'
insertpackage 'unstable' 'cool-foo' 'amd64,i386' '1.0' 'Depends: foo'
+insertpackage 'unstable' 'cool-foo-x64' 'amd64' '1.0' 'Depends: foo:amd64'
+insertpackage 'unstable' 'cool-foo-x32' 'amd64' '1.0' 'Depends: foo:i386'
insertpackage 'unstable' 'foo' 'amd64,i386,armel' '1.0' 'Multi-Arch: foreign'
insertpackage 'unstable' 'cool-bar' 'amd64,i386' '1.0' 'Depends: bar-provider'
+insertpackage 'unstable' 'cool-bar-x64' 'amd64' '1.0' 'Depends: bar-provider:amd64'
+insertpackage 'unstable' 'cool-bar-x32' 'amd64' '1.0' 'Depends: bar-provider:i386'
insertpackage 'unstable' 'bar' 'amd64,i386,armel' '1.0' 'Provides: bar-provider
Multi-Arch: foreign'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
@@ -27,29 +31,7 @@ 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...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
cool-foo foo:i386
@@ -59,7 +41,7 @@ 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...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
cool-foo foo:armel
@@ -69,11 +51,7 @@ 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...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
bar
@@ -85,7 +63,61 @@ 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...
+testsuccessequal '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
+
+testsuccessequal '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
+
+testsuccessequal "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
+
+satisfiable_in_singlearch() {
+ testsuccessequal '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
+
+ testsuccessequal '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
+
+ testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
bar
@@ -97,7 +129,7 @@ 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...
+ testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
bar cool-bar
@@ -107,44 +139,71 @@ 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...
+ testsuccessequal "Reading package lists...
Building dependency tree...
+Note, selecting 'bar' instead of 'bar-provider'
The following NEW packages will be installed:
- bar:i386 cool-bar
+ bar cool-bar
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
-Inst bar:i386 (1.0 unstable [i386])
+Inst bar (1.0 unstable [amd64])
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
+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...
+ testsuccessequal 'Reading package lists...
Building dependency tree...
+The following extra packages will be installed:
+ foo
The following NEW packages will be installed:
- bar:armel cool-bar
+ cool-foo-x64 foo
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
+Inst foo (1.0 unstable [amd64])
+Inst cool-foo-x64 (1.0 unstable [amd64])
+Conf foo (1.0 unstable [amd64])
+Conf cool-foo-x64 (1.0 unstable [amd64])' aptget install cool-foo-x64 -s
+}
-testequal "Reading package lists...
+#FIXME: do not work in single-arch as i386 isn't known at cache generation time
+ testsuccessequal 'Reading package lists...
Building dependency tree...
-Note, selecting 'bar' instead of 'bar-provider'
+The following extra packages will be installed:
+ foo
The following NEW packages will be installed:
- bar cool-bar
+ cool-foo-x32 foo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1.0 unstable [amd64])
+Inst cool-foo-x32 (1.0 unstable [amd64])
+Conf foo (1.0 unstable [amd64])
+Conf cool-foo-x32 (1.0 unstable [amd64])' aptget install cool-foo-x32 -s
+
+ testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ bar
+The following NEW packages will be installed:
+ bar cool-bar-x32
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])
+Inst cool-bar-x32 (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
+Conf cool-bar-x32 (1.0 unstable [amd64])' aptget install cool-bar-x32 -s -q=0
-testequal "Reading package lists...
+ testsuccessequal 'Reading package lists...
Building dependency tree...
-Note, selecting 'bar:i386' instead of 'bar-provider:i386'
+The following extra packages will be installed:
+ bar
The following NEW packages will be installed:
- bar:i386 cool-bar
+ bar cool-bar-x64
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
+Inst bar (1.0 unstable [amd64])
+Inst cool-bar-x64 (1.0 unstable [amd64])
+Conf bar (1.0 unstable [amd64])
+Conf cool-bar-x64 (1.0 unstable [amd64])' aptget install cool-bar-x64 -s -q=0
+
+
+satisfiable_in_singlearch
+
+msgmsg 'switch to single architecture'
+configarchitecture 'amd64'
+
+satisfiable_in_singlearch
diff --git a/test/integration/test-no-fds-leaked-to-maintainer-scripts b/test/integration/test-no-fds-leaked-to-maintainer-scripts
new file mode 100755
index 000000000..41c057042
--- /dev/null
+++ b/test/integration/test-no-fds-leaked-to-maintainer-scripts
@@ -0,0 +1,119 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64' 'i386'
+configdpkgnoopchroot
+
+setupsimplenativepackage "fdleaks" 'all' '1.0' 'unstable'
+BUILDDIR="incoming/fdleaks-1.0"
+for script in 'preinst' 'postinst' 'prerm' 'postrm'; do
+ cat > ${BUILDDIR}/debian/$script << EOF
+#!/bin/sh
+if [ -e "$(pwd)/rootdir/tmp/read_stdin" ]; then
+ read line;
+ echo "STDIN: -\$line-"
+fi
+ls -l /proc/self/fd/
+EOF
+done
+buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
+rm -rf "$BUILDDIR"
+
+PKGNAME='fdleaks:all'
+if ! dpkg-checkbuilddeps -d 'dpkg (>= 1.16.2)' /dev/null >/dev/null 2>&1; then
+ PKGNAME='fdleaks'
+fi
+
+setupaptarchive
+
+rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
+testsuccess aptget install -y fdleaks -qq < /dev/null
+
+checkfdleak() {
+ msgtest 'Check if fds were not' 'leaked'
+ if [ "$(grep 'root root' rootdir/tmp/testsuccess.output | wc -l)" = "$1" ]; then
+ msgpass
+ else
+ echo
+ cat rootdir/tmp/testsuccess.output
+ msgfail
+ fi
+}
+checkinstall() {
+ checkfdleak 8
+
+ cp rootdir/tmp/testsuccess.output terminal.output
+ tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log
+ testfileequal 'terminal.log' "$(cat terminal.output)"
+
+ testequal "startup archives unpack
+install $PKGNAME <none> 1.0
+status half-installed $PKGNAME 1.0
+status unpacked $PKGNAME 1.0
+status unpacked $PKGNAME 1.0
+startup packages configure
+configure $PKGNAME 1.0 <none>
+status unpacked $PKGNAME 1.0
+status half-configured $PKGNAME 1.0
+status installed $PKGNAME 1.0
+startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log
+}
+checkinstall
+
+rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
+testsuccess aptget purge -y fdleaks -qq
+checkpurge() {
+ checkfdleak 12
+
+ cp rootdir/tmp/testsuccess.output terminal.output
+ tail -n +3 rootdir/var/log/apt/term.log | head -n -1 > terminal.log
+ testfileequal 'terminal.log' "$(cat terminal.output)"
+
+ testequal "startup packages purge
+status installed $PKGNAME 1.0
+remove $PKGNAME 1.0 <none>
+status half-configured $PKGNAME 1.0
+status half-installed $PKGNAME 1.0
+status config-files $PKGNAME 1.0
+purge $PKGNAME 1.0 <none>
+status config-files $PKGNAME 1.0
+status config-files $PKGNAME 1.0
+status config-files $PKGNAME 1.0
+status config-files $PKGNAME 1.0
+status config-files $PKGNAME 1.0
+status not-installed $PKGNAME <none>
+startup packages configure" cut -f 3- -d' ' rootdir/var/log/dpkg.log
+}
+checkpurge
+
+msgtest 'setsid provided is new enough to support' '-w'
+if dpkg-checkbuilddeps -d 'util-linux (>= 2.24.2-1)' /dev/null >/dev/null 2>&1; then
+ msgpass
+else
+ msgskip "$(command dpkg -l util-linux)"
+ exit
+fi
+
+rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
+testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" install -y fdleaks -qq < /dev/null
+checkinstall
+
+rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
+testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq
+checkpurge
+
+touch rootdir/tmp/read_stdin
+
+rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
+for i in $(seq 1 10); do echo "$i"; done | testsuccess aptget install -y fdleaks -qq
+checkinstall
+testequal '2' grep -c '^STDIN: ' rootdir/var/log/apt/term.log
+
+rm -f rootdir/var/log/dpkg.log rootdir/var/log/apt/term.log
+yes '' | testsuccess runapt command setsid -w "${BUILDDIRECTORY}/apt-get" purge -y fdleaks -qq
+checkpurge
+testequal '3' grep -c '^STDIN: ' rootdir/var/log/apt/term.log
diff --git a/test/integration/test-ordering-ignore-not-matching-breaks b/test/integration/test-ordering-ignore-not-matching-breaks
index c9fca4edf..7c1365bdd 100755
--- a/test/integration/test-ordering-ignore-not-matching-breaks
+++ b/test/integration/test-ordering-ignore-not-matching-breaks
@@ -17,7 +17,7 @@ insertinstalledpackage 'wireless-crda' 'amd64' '1.14'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
crda
@@ -25,7 +25,7 @@ The following NEW packages will be installed:
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...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
crda
@@ -33,7 +33,7 @@ The following NEW packages will be installed:
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...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
crda
@@ -47,7 +47,7 @@ Conflicts: wireless-crda (<< 1.15)
Replaces: wireless-crda ( << 1.15)
Multi-arch: foreign'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
wireless-crda
diff --git a/test/integration/test-package-reinstallation b/test/integration/test-package-reinstallation
index b4f2061ec..f0412f98d 100755
--- a/test/integration/test-package-reinstallation
+++ b/test/integration/test-package-reinstallation
@@ -14,7 +14,7 @@ insertinstalledpackage 'apt' 'i386' '0.8.15' 'Depends: libc6'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal '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])
diff --git a/test/integration/test-partial-file-support b/test/integration/test-partial-file-support
index 98b2f242a..c07af7bd0 100755
--- a/test/integration/test-partial-file-support
+++ b/test/integration/test-partial-file-support
@@ -17,20 +17,32 @@ DOWNLOADLOG='rootdir/tmp/testdownloadfile.log'
testdownloadfile() {
rm -f "$DOWNLOADLOG"
- msgtest "Testing download of file $2 with" "$1"
- if ! downloadfile "$2" "$3" > "$DOWNLOADLOG"; then
+ msgtest "Testing download of file $2 with" "$1 $5"
+ if ! downloadfile "$2" "$3" "$5" > "$DOWNLOADLOG"; then
cat >&2 "$DOWNLOADLOG"
msgfail
else
msgpass
fi
- cat "$DOWNLOADLOG" | while read field hash; do
+ sed -e '/^ <- / s#%20# #g' -e '/^ <- / s#%0a#\n#g' "$DOWNLOADLOG" | grep '^.*-Hash: ' > receivedhashes.log
+ testsuccess test -s receivedhashes.log
+ local HASHES_OK=0
+ local HASHES_BAD=0
+ while read field hash; do
local EXPECTED
case "$field" in
'MD5Sum-Hash:') EXPECTED="$(md5sum "$TESTFILE" | cut -d' ' -f 1)";;
'SHA1-Hash:') EXPECTED="$(sha1sum "$TESTFILE" | cut -d' ' -f 1)";;
'SHA256-Hash:') EXPECTED="$(sha256sum "$TESTFILE" | cut -d' ' -f 1)";;
'SHA512-Hash:') EXPECTED="$(sha512sum "$TESTFILE" | cut -d' ' -f 1)";;
+ 'Checksum-FileSize-Hash:')
+ #filesize is too weak to check for !=
+ if [ "$4" = '=' ]; then
+ EXPECTED="$(stat -c '%s' "$TESTFILE")"
+ else
+ continue
+ fi
+ ;;
*) continue;;
esac
if [ "$4" = '=' ]; then
@@ -40,15 +52,47 @@ testdownloadfile() {
fi
if [ "$EXPECTED" "$4" "$hash" ]; then
msgpass
+ HASHES_OK=$((HASHES_OK+1));
else
- cat >&2 "$DOWNLOADLOG"
msgfail "expected: $EXPECTED ; got: $hash"
+ HASHES_BAD=$((HASHES_BAD+1));
fi
- done
+ done < receivedhashes.log
+ msgtest 'At least one good hash and no bad ones'
+ if [ $HASHES_OK -eq 0 ] || [ $HASHES_BAD -ne 0 ]; then
+ cat >&2 "$DOWNLOADLOG"
+ msgfail
+ else
+ msgpass
+ fi
}
TESTFILE='aptarchive/testfile'
cp -a ${TESTDIR}/framework $TESTFILE
+cp -a ${TESTDIR}/framework "${TESTFILE}2"
+
+followuprequest() {
+ local DOWN='./downloaded/testfile'
+
+ copysource $TESTFILE 1M $DOWN
+ testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '='
+ testwebserverlaststatuscode '416' "$DOWNLOADLOG"
+
+ webserverconfig 'aptwebserver::support::content-range' 'false'
+ copysource $TESTFILE 1M $DOWN
+ testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '=' "SHA1:$(sha1sum "$TESTFILE" | cut -d' ' -f 1)"
+ testwebserverlaststatuscode '416' "$DOWNLOADLOG"
+ webserverconfig 'aptwebserver::support::content-range' 'true'
+
+ copysource $TESTFILE 1M $DOWN
+ copysource "${TESTFILE}2" 20 "${DOWN}2"
+ msgtest 'Testing download of files with' 'completely downloaded file + partial file'
+ testsuccess --nomsg apthelper -o Debug::Acquire::${1%%:*}=1 -o Debug::pkgAcquire::Worker=1 \
+ download-file "$1/testfile" "$DOWN" '' "$1/testfile2" "${DOWN}2"
+ testwebserverlaststatuscode '206' 'rootdir/tmp/testsuccess.output'
+ testsuccess diff -u "$TESTFILE" "${DOWN}"
+ testsuccess diff -u "${DOWN}" "${DOWN}2"
+}
testrun() {
webserverconfig 'aptwebserver::support::range' 'true'
@@ -66,9 +110,11 @@ testrun() {
testdownloadfile 'invalid partial data' "${1}/testfile" "$DOWN" '!='
testwebserverlaststatuscode '206' "$DOWNLOADLOG"
- copysource $TESTFILE 1M $DOWN
- testdownloadfile 'completely downloaded file' "${1}/testfile" "$DOWN" '='
- testwebserverlaststatuscode '416' "$DOWNLOADLOG"
+ webserverconfig 'aptwebserver::closeOnError' 'false'
+ followuprequest "$1"
+ webserverconfig 'aptwebserver::closeOnError' 'true'
+ followuprequest "$1"
+ webserverconfig 'aptwebserver::closeOnError' 'false'
copysource /dev/zero 1M $DOWN
testdownloadfile 'too-big partial file' "${1}/testfile" "$DOWN" '='
@@ -86,8 +132,17 @@ testrun() {
testwebserverlaststatuscode '200' "$DOWNLOADLOG"
}
-testrun 'http://localhost:8080'
+serverconfigs() {
+ msgmsg "${1%%:*}: Test with Content-Length"
+ webserverconfig 'aptwebserver::chunked-transfer-encoding' 'false'
+ testrun "$1"
+ msgmsg "${1%%:*}: Test with Transfer-Encoding: chunked"
+ webserverconfig 'aptwebserver::chunked-transfer-encoding' 'true'
+ testrun "$1"
+}
+
+serverconfigs 'http://localhost:8080'
changetohttpswebserver
-testrun 'https://localhost:4433'
+serverconfigs 'https://localhost:4433'
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index 5bad90214..e5fe21e0f 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -14,16 +14,7 @@ changetowebserver
PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
wasmergeused() {
- msgtest 'Test for successful execution of' "$*"
- local OUTPUT=$(mktemp)
- addtrap "rm $OUTPUT;"
- if aptget update "$@" >${OUTPUT} 2>&1; then
- msgpass
- else
- echo
- cat $OUTPUT
- msgfail
- fi
+ testsuccess aptget update "$@"
msgtest 'No intermediate patch files' 'still exist'
local EDS="$(find rootdir/var/lib/apt/lists -name '*.ed' -o -name '*.ed.*')"
@@ -36,7 +27,7 @@ wasmergeused() {
fi
msgtest 'Check if the right pdiff merger was used'
- if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' $OUTPUT; then
+ if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' rootdir/tmp/testsuccess.output; then
if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
msgpass
else
@@ -51,16 +42,18 @@ wasmergeused() {
testrun() {
msgmsg "Testcase: setup the base with: $*"
+ local DOWNLOADHASH=true
+ if [ "$1" = 'nohash' ]; then DOWNLOADHASH=false; shift; fi
find aptarchive -name 'Packages*' -type f -delete
cp ${PKGFILE} aptarchive/Packages
compressfile 'aptarchive/Packages'
generatereleasefiles
signreleasefiles
- rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists
+ rm -rf aptarchive/Packages.diff rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
testsuccess aptget update "$@"
cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
testnopackage newstuff
- testequal "$(cat ${PKGFILE})
+ testsuccessequal "$(cat ${PKGFILE})
" aptcache show apt oldstuff
msgmsg "Testcase: apply with one patch: $*"
@@ -85,18 +78,29 @@ SHA256-History:
SHA256-Patches:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
$(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
+ if $DOWNLOADHASH; then
+ echo "SHA1-Download:
+ 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz
+ $(sha1sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz)
+SHA256-Download:
+ d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
+ $(sha256sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz)" >> $PATCHINDEX
+ fi
+
generatereleasefiles '+1hour'
signreleasefiles
find aptarchive -name 'Packages*' -type f -delete
wasmergeused "$@"
testnopackage oldstuff
- testequal "$(cat ${PKGFILE}-new)
+ testsuccessequal "$(cat ${PKGFILE}-new)
" aptcache show apt newstuff
msgmsg "Testcase: index is already up-to-date: $*"
find rootdir/var/lib/apt/lists -name '*diff_Index' -type f -delete
testsuccess aptget update "$@"
- testequal "$(cat ${PKGFILE}-new)
+ testequal 'Hit:1 http://localhost:8080 InRelease
+Reading package lists...' aptget update "$@" -o Debug::Acquire::Transaction=0 -o Debug::pkgAcquire::Diffs=0
+ testsuccessequal "$(cat ${PKGFILE}-new)
" aptcache show apt newstuff
msgmsg "Testcase: apply with two patches: $*"
@@ -138,6 +142,17 @@ SHA256-Patches:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
$(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)
$(sha256sum ${PATCHFILE2} | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}) $(basename ${PATCHFILE2})" > $PATCHINDEX
+ if $DOWNLOADHASH; then
+ echo "SHA1-Download:
+ 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz
+ $(sha1sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz)
+ $(sha1sum ${PATCHFILE2}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}.gz) $(basename ${PATCHFILE2}.gz)
+SHA256-Download:
+ d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
+ $(sha256sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz)
+ $(sha256sum ${PATCHFILE2}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}.gz) $(basename ${PATCHFILE2}.gz)" >> $PATCHINDEX
+ fi
+
generatereleasefiles '+2hour'
signreleasefiles
cp -a aptarchive/Packages Packages-future
@@ -146,7 +161,7 @@ SHA256-Patches:
cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
wasmergeused "$@"
testnopackage oldstuff
- testequal "$(cat Packages-future)
+ testsuccessequal "$(cat Packages-future)
" aptcache show apt newstuff futurestuff
msgmsg "Testcase: patch applying fails, but successful fallback: $*"
@@ -157,6 +172,7 @@ SHA256-Patches:
mkdir -p aptarchive/Packages.diff
PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true
+ cat $PATCHFILE | gzip > ${PATCHFILE}.gz
PATCHINDEX='aptarchive/Packages.diff/Index'
echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
SHA1-History:
@@ -172,19 +188,75 @@ SHA256-History:
SHA256-Patches:
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
$(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
- echo 'I am Mallory and I change files' >> $PATCHFILE
+ if $DOWNLOADHASH; then
+ echo "SHA1-Download:
+ 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz
+ $(sha1sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz)
+SHA256-Download:
+ d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
+ $(sha256sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz) $(basename ${PATCHFILE}.gz)" >> $PATCHINDEX
+ fi
+ # needs to look like a valid command, otherwise the parser will fail before hashes are checked
+ echo '1d' > $PATCHFILE
cat $PATCHFILE | gzip > ${PATCHFILE}.gz
generatereleasefiles '+1hour'
signreleasefiles
testsuccess aptget update "$@"
+ cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptgetupdate.output
+ testsuccess grep 'Hash Sum mismatch' rootdir/tmp/aptgetupdate.output
+ testnopackage oldstuff
+ testsuccessequal "$(cat ${PKGFILE}-new)
+" aptcache show apt newstuff
+
+ msgmsg "Testcase: pdiff patch bigger than index itself: $*"
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ cp ${PKGFILE}-new aptarchive/Packages
+ compressfile 'aptarchive/Packages'
+ mkdir -p aptarchive/Packages.diff
+ PATCHFILE="aptarchive/Packages.diff/$(date +%Y-%m-%d-%H%M.%S)"
+ diff -e ${PKGFILE} ${PKGFILE}-new > ${PATCHFILE} || true
+ cat $PATCHFILE | gzip > ${PATCHFILE}.gz
+ PATCHINDEX='aptarchive/Packages.diff/Index'
+ echo "SHA1-Current: $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
+SHA1-History:
+ 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
+ $(sha1sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE)
+SHA1-Patches:
+ 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-2013.28
+ $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE)000 $(basename $PATCHFILE)
+SHA256-Current: $(sha256sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new)
+SHA256-History:
+ 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
+ $(sha256sum $PKGFILE | cut -d' ' -f 1) $(stat -c%s $PKGFILE) $(basename $PATCHFILE)
+SHA256-Patches:
+ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
+ $(sha256sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE)000 $(basename $PATCHFILE)" > $PATCHINDEX
+ if $DOWNLOADHASH; then
+ echo "SHA1-Download:
+ 2365ac0ac57cde3d43c63145e8251a3bd5410213 197 2010-08-18-2013.28.gz
+ $(sha1sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz)000 $(basename ${PATCHFILE}.gz)
+SHA256-Download:
+ d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
+ $(sha256sum ${PATCHFILE}.gz | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE}.gz)000 $(basename ${PATCHFILE}.gz)" >> $PATCHINDEX
+ fi
+ generatereleasefiles '+1hour'
+ signreleasefiles
+ #find aptarchive -name 'Packages*' -type f -delete
+ testsuccess aptget update -o Debug::pkgAcquire::Diffs=1 "$@"
+ cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptgetupdate.output
+ testsuccess grep 'bytes (Limit is' rootdir/tmp/aptgetupdate.output
testnopackage oldstuff
- testequal "$(cat ${PKGFILE}-new)
+ testsuccessequal "$(cat ${PKGFILE}-new)
" aptcache show apt newstuff
}
echo 'Debug::pkgAcquire::Diffs "true";
Debug::Acquire::Transaction "true";
Debug::pkgAcquire::rred "true";' > rootdir/etc/apt/apt.conf.d/rreddebug.conf
+testrun nohash -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=1
+testrun nohash -o Acquire::PDiffs::Merge=1 -o APT::Get::List-Cleanup=1
+
testrun -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=1
testrun -o Acquire::PDiffs::Merge=1 -o APT::Get::List-Cleanup=1
testrun -o Acquire::PDiffs::Merge=0 -o APT::Get::List-Cleanup=0
diff --git a/test/integration/test-pin-non-existent-package b/test/integration/test-pin-non-existent-package
index c567e5285..5c839283f 100755
--- a/test/integration/test-pin-non-existent-package
+++ b/test/integration/test-pin-non-existent-package
@@ -23,8 +23,8 @@ testcandidate() {
}
testcandidate rapt '0.8.15'
-testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
-testequal 'Reading package lists...
+testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
@@ -34,8 +34,8 @@ Pin: release a=unstable
Pin-Priority: -1' > rootdir/etc/apt/preferences
testcandidate rapt '(none)'
-testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
-testequal 'Reading package lists...
+testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
@@ -53,9 +53,9 @@ Pin: release a=unstable
Pin-Priority: 1000' >> rootdir/etc/apt/preferences
testcandidate rapt '(none)'
-testequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
+testsuccessequal 'N: Unable to locate package doesntexist' aptcache policy doesntexist -q=0
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget dist-upgrade --trivial-only
diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning
index c08a2f103..9f7f457ae 100755
--- a/test/integration/test-policy-pinning
+++ b/test/integration/test-policy-pinning
@@ -17,78 +17,66 @@ testequalpolicy() {
local SP="$1"
local AP="$2"
shift 2
- testequal "Package files:
+ testsuccessequal "Package files:
$(echo "$SP" | awk '{ printf("%3s\n",$0) }') ${STATUS}
release a=now
- $(echo "$AP" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ Packages
+ $(echo "$AP" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} Packages
release c=
-Pinned packages:" aptcache policy $*
+Pinned packages:" aptcache policy "$@"
}
-aptgetupdate() {
- # just to be sure that no old files are used
- rm -rf rootdir/var/lib/apt
- if aptget update --allow-insecure-repositories -qq 2>&1 | grep '^E: '; then
- msgwarn 'apt-get update failed with an error'
- fi
-}
+testglobalpolicy() {
+ aptgetupdate
-### not signed archive
+ testequalpolicy 100 500
+ testequalpolicy 990 500 -t now
-aptgetupdate
+ sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
+ aptgetupdate
-testequalpolicy 100 500
-testequalpolicy 990 500 -t now
+ testequalpolicy 100 1 -o Test=NotAutomatic
+ testequalpolicy 990 1 -o Test=NotAutomatic -t now
-sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
-aptgetupdate
+ sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
+ aptgetupdate
-testequalpolicy 100 1 -o Test=NotAutomatic
-testequalpolicy 990 1 -o Test=NotAutomatic -t now
+ testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
+ testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
-sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
-aptgetupdate
+ sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
+ aptgetupdate
-testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
-testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
+ testequalpolicy 100 500 -o Test=Automatic
+ testequalpolicy 990 500 -o Test=Automatic -t now
-sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
-aptgetupdate
-
-testequalpolicy 100 500 -o Test=Automatic
-testequalpolicy 990 500 -o Test=Automatic -t now
-
-sed -i aptarchive/Release -e '/NotAutomatic: / d' -e '/ButAutomaticUpgrades: / d'
-
-### signed but no key in trusted
-
-signreleasefiles 'Marvin Paranoid'
-aptgetupdate
-testequalpolicy 100 500
-testequalpolicy 990 500 -t now
-
-sed -i aptarchive/Release -e 1i"NotAutomatic: yes"
-signreleasefiles 'Marvin Paranoid'
-aptgetupdate
-
-testequalpolicy 100 1 -o Test=NotAutomatic
-testequalpolicy 990 1 -o Test=NotAutomatic -t now
-
-sed -i aptarchive/Release -e 1i"ButAutomaticUpgrades: yes"
-signreleasefiles 'Marvin Paranoid'
-aptgetupdate
+ sed -i aptarchive/Release -e '/NotAutomatic: / d' -e '/ButAutomaticUpgrades: / d'
+}
-testequalpolicy 100 100 -o Test=ButAutomaticUpgrades
-testequalpolicy 990 100 -o Test=ButAutomaticUpgrades -t now
+msgmsg 'Test with not signed archive'
+aptgetupdate() {
+ rm -rf rootdir/var/lib/apt
+ testwarning aptget update --allow-insecure-repositories
+}
+testglobalpolicy
-sed -i aptarchive/Release -e 's#NotAutomatic: yes#NotAutomatic: no#' -e '/ButAutomaticUpgrades: / d'
-signreleasefiles 'Marvin Paranoid'
-aptgetupdate
+msgmsg 'Test with signed but no key in trusted'
+aptgetupdate() {
+ rm -rf rootdir/var/lib/apt
+ signreleasefiles 'Marvin Paranoid'
+ testwarning aptget update --allow-insecure-repositories
+}
+testglobalpolicy
-testequalpolicy 100 500 -o Test=Automatic
-testequalpolicy 990 500 -o Test=Automatic -t now
+# much the same tests will be executed below in more detail again for this one
+msgmsg 'Test with signed and valid key'
+aptgetupdate() {
+ rm -rf rootdir/var/lib/apt
+ signreleasefiles 'Joe Sixpack'
+ testsuccess aptget update
+}
+testglobalpolicy
-### signed and valid key
+msgmsg 'Test with specific packages'
buildsimplenativepackage "coolstuff" "all" "1.0" "stable"
buildsimplenativepackage "coolstuff" "all" "2.0~bpo1" "backports"
@@ -117,23 +105,23 @@ testequalpolicycoolstuff() {
local BPO1ARCHIVE=""
local BPO2ARCHIVE=""
if [ ! "$7" = "2.0~bpo2" ]; then
- BPO1ARCHIVE=" $(echo "$AB" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE}/ backports/main i386 Packages"
+ 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"
+ $(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:
+ testsuccessequal "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" \
+ $(echo "$AS" | awk '{ printf("%3s\n",$0) }') file:${APTARCHIVE} stable/main i386 Packages$SS" \
aptcache policy coolstuff -o Policy=${INSTALLED}-${CANDIDATE}-${AB}-${AS}-${PB} $*
}
diff --git a/test/integration/test-prefer-higher-priority-providers b/test/integration/test-prefer-higher-priority-providers
index 64b901dd0..85a302fb1 100755
--- a/test/integration/test-prefer-higher-priority-providers
+++ b/test/integration/test-prefer-higher-priority-providers
@@ -13,7 +13,7 @@ insertpackage 'unstable' 'awesome' 'all' '1' 'Depends: stuff'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
@@ -25,7 +25,7 @@ Inst awesome (1 unstable [all])
Conf foo (1 unstable [all])
Conf awesome (1 unstable [all])' aptget install awesome -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
awesome foo
@@ -35,7 +35,7 @@ Inst awesome (1 unstable [all])
Conf foo (1 unstable [all])
Conf awesome (1 unstable [all])' aptget install awesome foo -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Package 'bar' is not installed, so not removed
Package 'baz' is not installed, so not removed
@@ -49,7 +49,7 @@ Inst awesome (1 unstable [all])
Conf foo (1 unstable [all])
Conf awesome (1 unstable [all])" aptget install awesome bar- baz- -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Package 'foo' is not installed, so not removed
The following extra packages will be installed:
@@ -62,7 +62,7 @@ Inst awesome (1 unstable [all])
Conf bar (1 unstable [all])
Conf awesome (1 unstable [all])" aptget install awesome foo- -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Package 'foo' is not installed, so not removed
Package 'baz' is not installed, so not removed
@@ -76,7 +76,7 @@ Inst awesome (1 unstable [all])
Conf bar (1 unstable [all])
Conf awesome (1 unstable [all])" aptget install awesome foo- baz- -s
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Package 'foo' is not installed, so not removed
Package 'bar' is not installed, so not removed
@@ -90,7 +90,7 @@ Inst awesome (1 unstable [all])
Conf baz (1 unstable [all])
Conf awesome (1 unstable [all])" aptget install awesome foo- bar- -s
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Package 'foo' is not installed, so not removed
Package 'bar' is not installed, so not removed
diff --git a/test/integration/test-prefer-native-architecture-over-higher-priority b/test/integration/test-prefer-native-architecture-over-higher-priority
index 2e5696376..7e4f8f34b 100755
--- a/test/integration/test-prefer-native-architecture-over-higher-priority
+++ b/test/integration/test-prefer-native-architecture-over-higher-priority
@@ -12,7 +12,7 @@ insertpackage 'unstable' 'autoconf' 'all' '1' 'Depends: m4'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
m4
diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
index db97687ce..5f67c0191 100755
--- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
+++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
@@ -38,7 +38,7 @@ insertpackage 'unstable' 'libsame3' 'i386,amd64' '3' 'Multi-Arch: same'
insertpackage 'unstable' 'depender3' 'all' '3' 'Depends: libsame3 (= 3)'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be REMOVED:
@@ -69,7 +69,7 @@ insertinstalledpackage 'libsame2' 'i386' '1' 'Multi-Arch: same'
insertinstalledpackage 'libsame3' 'i386' '1' 'Multi-Arch: same'
# the error message isn't great, but better than nothing, right?
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -81,7 +81,7 @@ The following packages have unmet dependencies:
depender2 : Depends: libsame2 (= 2) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.' aptget install depender2 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libsame3:i386 libsame3
diff --git a/test/integration/test-provides-gone-with-upgrade b/test/integration/test-provides-gone-with-upgrade
index 3b4bc2d04..61d34fa57 100755
--- a/test/integration/test-provides-gone-with-upgrade
+++ b/test/integration/test-provides-gone-with-upgrade
@@ -13,7 +13,7 @@ Replaces: apt (<< 0.8.15)'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following NEW packages will be installed:
diff --git a/test/integration/test-release-candidate-switching b/test/integration/test-release-candidate-switching
index 0970cb935..a1a6a6142 100755
--- a/test/integration/test-release-candidate-switching
+++ b/test/integration/test-release-candidate-switching
@@ -54,7 +54,7 @@ insertpackage 'experimental' 'uninstallablepkg' 'all' '1.0' 'Depends: libmtp8 (>
setupaptarchive
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
The following extra packages will be installed:
amarok-common (2.3.1-1+sid)
@@ -73,7 +73,7 @@ The following NEW packages will be installed:
After this operation, 258 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok --trivial-only -V -q=0
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
The following extra packages will be installed:
amarok-common (2.3.2-2+exp)
@@ -92,7 +92,7 @@ The following NEW packages will be installed:
After this operation, 258 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok -t experimental --trivial-only -V -q=0
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok'
@@ -114,7 +114,7 @@ The following NEW packages will be installed:
After this operation, 258 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok/experimental --trivial-only -V -q=0
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null'
@@ -137,7 +137,7 @@ After this operation, 258 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok-null/experimental --trivial-only -V -q=0
# do not select the same version multiple times
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok'
@@ -165,7 +165,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
# in theory, the second line is wrong, but printing the right version is too much of a hassle
# (we have to check if later in the Changed list is another change and if so use this version
# instead of the current candidate) - and it wouldn't be (really) useful anyway…
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental2 [i386]) for 'amarok-less'
Selected version '5:4.6.0+exp' (experimental [i386]) for 'phonon-backend-xine' because of 'amarok-less'
@@ -192,7 +192,7 @@ After this operation, 301 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok-less/experimental2 amarok-higher/experimental --trivial-only -V -q=0
# phonon-backend-null can't be used directly, but as it provides it is still fine…
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null2'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-null2'
@@ -215,7 +215,7 @@ After this operation, 258 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok-null2/experimental --trivial-only -V -q=0
# if an or-group satisfier is already found, do not set others
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine'
@@ -239,7 +239,7 @@ After this operation, 258 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok-xine/experimental --trivial-only -V -q=0
# … but proceed testing if the first doesn't work out
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine2'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine2'
@@ -263,7 +263,7 @@ After this operation, 258 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok-xine2/experimental --trivial-only -V -q=0
# sometimes, the second level need to be corrected, too
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine3'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine3'
@@ -290,7 +290,7 @@ After this operation, 301 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok-xine3/experimental --trivial-only -V -q=0
# … but proceed testing if the first doesn't work out even in second deep
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-xine4'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-xine4'
@@ -314,7 +314,7 @@ After this operation, 258 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok-xine4/experimental --trivial-only -V -q=0
# providers can be broken, too
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-broken'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-broken'
@@ -338,7 +338,7 @@ After this operation, 258 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok-broken/experimental --trivial-only -V -q=0
# switch the candidate for recommends too if they should be installed
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends'
@@ -361,7 +361,7 @@ After this operation, 258 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok-recommends/experimental --trivial-only -V -q=0 -o APT::Install-Recommends=1
# … or not if not
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends'
@@ -382,7 +382,7 @@ E: Trivial Only specified but this is not a trivial operation." aptget install a
# but broken recommends are not the end of the world
# FIXME: the version output for recommend packages is a bit strange… but what would be better?
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-recommends2'
Selected version '2.3.2-2+exp' (experimental [all]) for 'amarok-common' because of 'amarok-recommends2'
@@ -404,7 +404,7 @@ After this operation, 215 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation." aptget install amarok-recommends2/experimental --trivial-only -V -q=0 -o APT::Install-Recommends=1
# if one depends doesn't work, we don't need to look deeper…
-testequal "Reading package lists...
+testfailureequal "Reading package lists...
Building dependency tree...
Selected version '1.0' (experimental [all]) for 'uninstallablepkg'
Some packages could not be installed. This may mean that you have
diff --git a/test/integration/test-releasefile-date-older b/test/integration/test-releasefile-date-older
new file mode 100755
index 000000000..5cdc34fac
--- /dev/null
+++ b/test/integration/test-releasefile-date-older
@@ -0,0 +1,62 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertpackage 'wheezy' 'apt' 'all' '0.8.15'
+
+setupaptarchive --no-update
+
+# we don't complain as the server could have just sent a 'Hit' here and this
+# 'downgrade attack' is usually performed by out-of-sync mirrors. Valid-Until
+# catches the 'real' downgrade attacks (expect that it finds stale mirrors).
+# Scaring users with an error here serves hence no point.
+
+msgmsg 'InRelease file is silently rejected if' 'new Date is before old Date'
+rm -rf rootdir/var/lib/apt/lists
+generatereleasefiles 'now' 'now + 7 days'
+signreleasefiles
+testsuccess aptget update
+listcurrentlistsdirectory > listsdir.lst
+redatereleasefiles 'now - 2 days'
+testsuccess aptget update
+testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+msgmsg 'Release.gpg file is silently rejected if' 'new Date is before old Date'
+rm -rf rootdir/var/lib/apt/lists
+generatereleasefiles 'now' 'now + 7 days'
+signreleasefiles
+find aptarchive -name 'InRelease' -delete
+testsuccess aptget update
+listcurrentlistsdirectory > listsdir.lst
+redatereleasefiles 'now - 2 days'
+find aptarchive -name 'InRelease' -delete
+testsuccess aptget update
+testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+msgmsg 'Crisscross InRelease/Release.gpg file is silently rejected if' 'new Date is before old Date'
+rm -rf rootdir/var/lib/apt/lists
+generatereleasefiles 'now' 'now + 7 days'
+signreleasefiles
+find aptarchive -name 'Release.gpg' -delete
+testsuccess aptget update
+listcurrentlistsdirectory > listsdir.lst
+redatereleasefiles 'now - 2 days'
+find aptarchive -name 'InRelease' -delete
+testsuccess aptget update
+testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
+
+msgmsg 'Crisscross Release.gpg/InRelease file is silently rejected if' 'new Date is before old Date'
+rm -rf rootdir/var/lib/apt/lists
+generatereleasefiles 'now' 'now + 7 days'
+signreleasefiles
+find aptarchive -name 'InRelease' -delete
+testsuccess aptget update
+listcurrentlistsdirectory > listsdir.lst
+redatereleasefiles 'now - 2 days'
+find aptarchive -name 'Release.gpg' -delete
+testsuccess aptget update
+testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
diff --git a/test/integration/test-releasefile-valid-until b/test/integration/test-releasefile-valid-until
index 0d9a91254..e000abf5d 100755
--- a/test/integration/test-releasefile-valid-until
+++ b/test/integration/test-releasefile-valid-until
@@ -16,13 +16,12 @@ setupaptarchive --no-update
runtest() {
local MSG="$1"
- msgtest "$1" "$2"
+ msgtest "Release file is $MSG as it has" "$2"
rm -rf rootdir/var/lib/apt/lists
- aptget clean
generatereleasefiles "$3" "$4"
signreleasefiles
shift 4
- if expr match "$MSG" '.*accepted.*' >/dev/null; then
+ if [ "$MSG" = 'accepted' ]; then
testsuccess --nomsg aptget update "$@"
testfailure grep -q 'is expired' rootdir/tmp/testsuccess.output
else
@@ -31,19 +30,19 @@ runtest() {
fi
}
-runtest 'Release file is accepted as it has' 'no Until' '' ''
-runtest 'Release file is accepted as it has' 'no Until and good Max-Valid' '' '' -o Acquire::Max-ValidTime=3600
-runtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid' 'now - 2 days' '' -o Acquire::Max-ValidTime=3600
-runtest 'Release file is accepted as it has' 'good Until' 'now - 3 days' 'now + 1 day'
-runtest 'Release file is rejected as it has' 'bad Until' 'now - 7 days' 'now - 4 days'
-runtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=1209600
-runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=86400
-runtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400
-runtest 'Release file is accepted as it has' 'good labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600
-runtest 'Release file is rejected as it has' 'bad labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400
-runtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)' 'now - 7 days' 'now + 1 days' -o Acquire::Min-ValidTime=1209600
-runtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Min-ValidTime=1209600
-runtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200
-runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200
-runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920
-runtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920
+runtest 'accepted' 'no Until' '' ''
+runtest 'accepted' 'no Until and good Max-Valid' '' '' -o Acquire::Max-ValidTime=3600
+runtest 'rejected' 'no Until, but bad Max-Valid' 'now - 2 days' '' -o Acquire::Max-ValidTime=3600
+runtest 'accepted' 'good Until' 'now - 3 days' 'now + 1 day'
+runtest 'rejected' 'bad Until' 'now - 7 days' 'now - 4 days'
+runtest 'rejected' 'bad Until (ignore good Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=1209600
+runtest 'rejected' 'bad Max-Valid (bad Until)' 'now - 7 days' 'now - 4 days' -o Acquire::Max-ValidTime=86400
+runtest 'rejected' 'bad Max-Valid (good Until)' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400
+runtest 'accepted' 'good labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600
+runtest 'rejected' 'bad labeled Max-Valid' 'now - 7 days' 'now + 4 days' -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400
+runtest 'accepted' 'good Until (good Min-Valid, no Max-Valid)' 'now - 7 days' 'now + 1 days' -o Acquire::Min-ValidTime=1209600
+runtest 'accepted' 'good Min-Valid (bad Until, no Max-Valid)' 'now - 7 days' 'now - 4 days' -o Acquire::Min-ValidTime=1209600
+runtest 'accepted' 'good Min-Valid (bad Until, good Max-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200
+runtest 'rejected' 'bad Max-Valid (bad Until, good Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200
+runtest 'rejected' 'bad Max-Valid (bad Until, bad Min-Valid) <' 'now - 7 days' 'now - 2 days' -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920
+runtest 'rejected' 'bad Max-Valid (bad Until, bad Min-Valid) >' 'now - 7 days' 'now - 2 days' -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920
diff --git a/test/integration/test-releasefile-verification b/test/integration/test-releasefile-verification
index 3765a4b1f..e8419524c 100755
--- a/test/integration/test-releasefile-verification
+++ b/test/integration/test-releasefile-verification
@@ -33,7 +33,7 @@ prepare() {
}
installaptold() {
- testequal 'Reading package lists...
+ testsuccessequal 'Reading package lists...
Building dependency tree...
Suggested packages:
aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
@@ -41,12 +41,12 @@ The following NEW packages will be installed:
apt
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
After this operation, 5370 kB of additional disk space will be used.
-Get:1 http://localhost:8080/ apt 0.7.25.3
+Get:1 http://localhost:8080 apt 0.7.25.3
Download complete and in download only mode' aptget install apt -dy
}
installaptnew() {
- testequal 'Reading package lists...
+ testsuccessequal 'Reading package lists...
Building dependency tree...
Suggested packages:
aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
@@ -54,12 +54,12 @@ The following NEW packages will be installed:
apt
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
After this operation, 5808 kB of additional disk space will be used.
-Get:1 http://localhost:8080/ apt 0.8.0~pre1
+Get:1 http://localhost:8080 apt 0.8.0~pre1
Download complete and in download only mode' aptget install apt -dy
}
failaptold() {
- testequal 'Reading package lists...
+ testfailureequal 'Reading package lists...
Building dependency tree...
Suggested packages:
aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
@@ -73,7 +73,7 @@ E: There are problems and -y was used without --force-yes' aptget install apt -d
}
failaptnew() {
- testequal 'Reading package lists...
+ testfailureequal 'Reading package lists...
Building dependency tree...
Suggested packages:
aptitude synaptic wajig dpkg-dev apt-doc bzip2 lzma python-apt
@@ -91,25 +91,9 @@ touch aptarchive/apt.deb
PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
-updatesuccess() {
- local LOG='update.log'
- if aptget update >$LOG 2>&1 || grep -q -E '^(W|E): ' $LOG; then
- msgpass
- else
- cat $LOG
- msgfail
- fi
-}
-
-updatefailure() {
- local LOG='update.log'
- aptget update >$LOG 2>&1 || true
- if grep -q -E "$1" $LOG; then
- msgpass
- else
- cat $LOG
- msgfail
- fi
+updatewithwarnings() {
+ testwarning aptget update
+ testsuccess grep -E "$1" rootdir/tmp/testwarning.output
}
runtest() {
@@ -117,18 +101,18 @@ runtest() {
rm -rf rootdir/var/lib/apt/lists
signreleasefiles 'Joe Sixpack'
find aptarchive/ -name "$DELETEFILE" -delete
- msgtest 'Cold archive signed by' 'Joe Sixpack'
- updatesuccess
- testequal "$(cat ${PKGFILE})
+ msgmsg 'Cold archive signed by' 'Joe Sixpack'
+ testsuccess aptget update
+ testsuccessequal "$(cat ${PKGFILE})
" aptcache show apt
installaptold
prepare ${PKGFILE}-new
signreleasefiles 'Joe Sixpack'
find aptarchive/ -name "$DELETEFILE" -delete
- msgtest 'Good warm archive signed by' 'Joe Sixpack'
- updatesuccess
- testequal "$(cat ${PKGFILE}-new)
+ msgmsg 'Good warm archive signed by' 'Joe Sixpack'
+ testsuccess aptget update
+ testsuccessequal "$(cat ${PKGFILE}-new)
" aptcache show apt
installaptnew
@@ -137,9 +121,9 @@ runtest() {
cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
signreleasefiles 'Rex Expired'
find aptarchive/ -name "$DELETEFILE" -delete
- msgtest 'Cold archive signed by' 'Rex Expired'
- updatefailure '^W: .* KEYEXPIRED'
- testequal "$(cat ${PKGFILE})
+ msgmsg 'Cold archive signed by' 'Rex Expired'
+ updatewithwarnings '^W: .* KEYEXPIRED'
+ testsuccessequal "$(cat ${PKGFILE})
" aptcache show apt
failaptold
rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
@@ -148,9 +132,9 @@ runtest() {
rm -rf rootdir/var/lib/apt/lists
signreleasefiles 'Marvin Paranoid'
find aptarchive/ -name "$DELETEFILE" -delete
- msgtest 'Cold archive signed by' 'Marvin Paranoid'
- updatefailure '^W: .* NO_PUBKEY'
- testequal "$(cat ${PKGFILE})
+ msgmsg 'Cold archive signed by' 'Marvin Paranoid'
+ updatewithwarnings '^W: .* NO_PUBKEY'
+ testsuccessequal "$(cat ${PKGFILE})
" aptcache show apt
failaptold
@@ -162,9 +146,9 @@ runtest() {
done
signreleasefiles 'Joe Sixpack'
find aptarchive/ -name "$DELETEFILE" -delete
- msgtest 'Bad warm archive signed by' 'Joe Sixpack'
- updatesuccess
- testequal "$(cat ${PKGFILE}-new)
+ msgmsg 'Bad warm archive signed by' 'Joe Sixpack'
+ testsuccess aptget update
+ testsuccessequal "$(cat ${PKGFILE}-new)
" aptcache show apt
installaptnew
@@ -173,18 +157,18 @@ runtest() {
rm -rf rootdir/var/lib/apt/lists
signreleasefiles 'Joe Sixpack'
find aptarchive/ -name "$DELETEFILE" -delete
- msgtest 'Cold archive signed by' 'Joe Sixpack'
- updatesuccess
- testequal "$(cat ${PKGFILE})
+ msgmsg 'Cold archive signed by' 'Joe Sixpack'
+ testsuccess aptget update
+ testsuccessequal "$(cat ${PKGFILE})
" aptcache show apt
installaptold
prepare ${PKGFILE}-new
signreleasefiles 'Marvin Paranoid'
find aptarchive/ -name "$DELETEFILE" -delete
- msgtest 'Good warm archive signed by' 'Marvin Paranoid'
- updatefailure '^W: .* NO_PUBKEY'
- testequal "$(cat ${PKGFILE})
+ msgmsg 'Good warm archive signed by' 'Marvin Paranoid'
+ updatewithwarnings '^W: .* NO_PUBKEY'
+ testsuccessequal "$(cat ${PKGFILE})
" aptcache show apt
installaptold
@@ -192,9 +176,9 @@ runtest() {
cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
signreleasefiles 'Rex Expired'
find aptarchive/ -name "$DELETEFILE" -delete
- msgtest 'Good warm archive signed by' 'Rex Expired'
- updatefailure '^W: .* KEYEXPIRED'
- testequal "$(cat ${PKGFILE})
+ msgmsg 'Good warm archive signed by' 'Rex Expired'
+ updatewithwarnings '^W: .* KEYEXPIRED'
+ testsuccessequal "$(cat ${PKGFILE})
" aptcache show apt
installaptold
rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
@@ -202,9 +186,9 @@ runtest() {
prepare ${PKGFILE}-new
signreleasefiles
find aptarchive/ -name "$DELETEFILE" -delete
- msgtest 'Good warm archive signed by' 'Joe Sixpack'
- updatesuccess
- testequal "$(cat ${PKGFILE}-new)
+ msgmsg 'Good warm archive signed by' 'Joe Sixpack'
+ testsuccess aptget update
+ testsuccessequal "$(cat ${PKGFILE}-new)
" aptcache show apt
installaptnew
}
@@ -213,25 +197,25 @@ runtest2() {
prepare ${PKGFILE}
rm -rf rootdir/var/lib/apt/lists
signreleasefiles 'Joe Sixpack'
- msgtest 'Cold archive signed by' 'Joe Sixpack'
- updatesuccess
+ msgmsg 'Cold archive signed by' 'Joe Sixpack'
+ testsuccess aptget update
# New .deb but now an unsigned archive. For example MITM to circumvent
# package verification.
prepare ${PKGFILE}-new
find aptarchive/ -name InRelease -delete
find aptarchive/ -name Release.gpg -delete
- msgtest 'Warm archive signed by' 'nobody'
- updatesuccess
- testequal "$(cat ${PKGFILE}-new)
+ msgmsg 'Warm archive signed by' 'nobody'
+ updatewithwarnings 'W: .* no longer signed.'
+ testsuccessequal "$(cat ${PKGFILE}-new)
" aptcache show apt
failaptnew
# Unsigned archive from the beginning must also be detected.
rm -rf rootdir/var/lib/apt/lists
- msgtest 'Cold archive signed by' 'nobody'
- updatesuccess
- testequal "$(cat ${PKGFILE}-new)
+ msgmsg 'Cold archive signed by' 'nobody'
+ updatewithwarnings 'W: .* is not signed.'
+ testsuccessequal "$(cat ${PKGFILE}-new)
" aptcache show apt
failaptnew
}
diff --git a/test/integration/test-resolve-by-keep-new-recommends b/test/integration/test-resolve-by-keep-new-recommends
index 6b1772877..a8ab9057c 100755
--- a/test/integration/test-resolve-by-keep-new-recommends
+++ b/test/integration/test-resolve-by-keep-new-recommends
@@ -17,5 +17,5 @@ Calculating upgrade...
The following packages have been kept back:
foo
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded."
-testequal "$UPGRADE_KEEP" aptget upgrade -s
+testsuccessequal "$UPGRADE_KEEP" aptget upgrade -s
diff --git a/test/integration/test-sourceslist-trusted-options b/test/integration/test-sourceslist-trusted-options
index 55d4e0233..5fe4933ce 100755
--- a/test/integration/test-sourceslist-trusted-options
+++ b/test/integration/test-sourceslist-trusted-options
@@ -15,7 +15,7 @@ setupaptarchive --no-update
APTARCHIVE=$(readlink -f ./aptarchive)
everythingsucceeds() {
- testequal 'Listing...
+ testsuccessequal 'Listing...
foo/testing 2 amd64
foo/stable 1 amd64
' apt list foo -a
@@ -32,7 +32,7 @@ foo/stable 1 amd64
}
everythingfails() {
- testequal 'Listing...
+ testsuccessequal 'Listing...
foo/testing 2 amd64
foo/stable 1 amd64
' apt list foo -a
diff --git a/test/integration/test-specific-architecture-dependencies b/test/integration/test-specific-architecture-dependencies
index 078a84654..1c72d7b22 100755
--- a/test/integration/test-specific-architecture-dependencies
+++ b/test/integration/test-specific-architecture-dependencies
@@ -12,16 +12,19 @@ insertinstalledpackage 'provider' 'amd64' '1' 'Provides: foo'
insertpackage 'unstable' 'pre-depender' 'all' '1' 'Pre-Depends: libc6:i386'
insertpackage 'unstable' 'depender' 'all' '1' 'Depends: libc6:i386'
+insertpackage 'unstable' 'depender-x32' 'i386,amd64' '1' 'Depends: libc6:i386'
+insertpackage 'unstable' 'depender-x64' 'i386,amd64' '1' 'Depends: libc6:amd64'
insertpackage 'unstable' 'breaker' 'all' '1' 'Breaks: libold (<< 2)'
-insertpackage 'unstable' 'breaker-x32' 'amd64' '1' 'Breaks: libold:i386 (<< 2)'
-insertpackage 'unstable' 'breaker-x64' 'i386' '1' 'Breaks: libold:amd64 (<< 2)'
+insertpackage 'unstable' 'breaker-x32' 'i386,amd64' '1' 'Breaks: libold:i386 (<< 2)'
+insertpackage 'unstable' 'breaker-x64' 'i386,amd64' '1' 'Breaks: libold:amd64 (<< 2)'
# conflicts with no effect
insertpackage 'unstable' 'oldconflictor' 'all' '1' 'Conflicts: libold (<< 0)'
insertpackage 'unstable' 'oldconflictor-x32' 'amd64' '1' 'Conflicts: libold:i386 (<< 0)'
insertpackage 'unstable' 'oldconflictor-x64' 'i386' '1' 'Conflicts: libold:amd64 (<< 0)'
insertpackage 'unstable' 'foo-depender' 'i386,amd64' '1' 'Depends: foo'
+insertpackage 'unstable' 'foo-native-depender' 'amd64' '1' 'Depends: foo:amd64'
insertpackage 'unstable' 'foo-foreign-depender' 'i386' '1' 'Depends: foo:amd64'
insertpackage 'unstable' 'foo-conflictor' 'i386,amd64' '1' 'Conflicts: foo'
@@ -30,7 +33,7 @@ insertpackage 'unstable' 'foo-no-conflictor' 'i386' '1' 'Conflicts: foo:i386'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libc6:i386
@@ -42,7 +45,7 @@ Conf libc6:i386 (1 unstable [i386])
Inst pre-depender (1 unstable [all])
Conf pre-depender (1 unstable [all])' aptget install pre-depender -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libc6:i386
@@ -54,6 +57,54 @@ Inst depender (1 unstable [all])
Conf libc6:i386 (1 unstable [i386])
Conf depender (1 unstable [all])' aptget install depender -s
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libc6:i386
+The following NEW packages will be installed:
+ depender-x32:i386 libc6:i386
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libc6:i386 (1 unstable [i386])
+Inst depender-x32:i386 (1 unstable [i386])
+Conf libc6:i386 (1 unstable [i386])
+Conf depender-x32:i386 (1 unstable [i386])' aptget install depender-x32:i386 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libc6:i386
+The following NEW packages will be installed:
+ depender-x32 libc6:i386
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libc6:i386 (1 unstable [i386])
+Inst depender-x32 (1 unstable [amd64])
+Conf libc6:i386 (1 unstable [i386])
+Conf depender-x32 (1 unstable [amd64])' aptget install depender-x32:amd64 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libc6
+The following NEW packages will be installed:
+ depender-x64 libc6
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libc6 (1 unstable [amd64])
+Inst depender-x64 (1 unstable [amd64])
+Conf libc6 (1 unstable [amd64])
+Conf depender-x64 (1 unstable [amd64])' aptget install depender-x64:amd64 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libc6
+The following NEW packages will be installed:
+ depender-x64:i386 libc6
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libc6 (1 unstable [amd64])
+Inst depender-x64:i386 (1 unstable [i386])
+Conf libc6 (1 unstable [amd64])
+Conf depender-x64:i386 (1 unstable [i386])' aptget install depender-x64:i386 -s
+
testequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
@@ -66,7 +117,7 @@ Remv libold:i386 [1]
Inst breaker (1 unstable [all])
Conf breaker (1 unstable [all])' aptget install breaker -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
libold:i386
@@ -75,20 +126,42 @@ The following NEW packages will be installed:
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Remv libold:i386 [1]
Inst breaker-x32 (1 unstable [amd64])
-Conf breaker-x32 (1 unstable [amd64])' aptget install breaker-x32 -s
+Conf breaker-x32 (1 unstable [amd64])' aptget install breaker-x32:amd64 -s
testequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
+ libold:i386
+The following NEW packages will be installed:
+ breaker-x32:i386
+0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv libold:i386 [1]
+Inst breaker-x32:i386 (1 unstable [i386])
+Conf breaker-x32:i386 (1 unstable [i386])' aptget install breaker-x32:i386 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ libold
+The following NEW packages will be installed:
+ breaker-x64
+0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv libold [1]
+Inst breaker-x64 (1 unstable [amd64])
+Conf breaker-x64 (1 unstable [amd64])' aptget install breaker-x64:amd64 -s
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
libold
The following NEW packages will be installed:
breaker-x64:i386
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Remv libold [1]
Inst breaker-x64:i386 (1 unstable [i386])
-Conf breaker-x64:i386 (1 unstable [i386])' aptget install breaker-x64 -s
+Conf breaker-x64:i386 (1 unstable [i386])' aptget install breaker-x64:i386 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
oldconflictor
@@ -96,7 +169,7 @@ The following NEW packages will be installed:
Inst oldconflictor (1 unstable [all])
Conf oldconflictor (1 unstable [all])' aptget install oldconflictor -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
oldconflictor-x32
@@ -104,7 +177,7 @@ The following NEW packages will be installed:
Inst oldconflictor-x32 (1 unstable [amd64])
Conf oldconflictor-x32 (1 unstable [amd64])' aptget install oldconflictor-x32 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
oldconflictor-x64:i386
@@ -112,7 +185,7 @@ The following NEW packages will be installed:
Inst oldconflictor-x64:i386 (1 unstable [i386])
Conf oldconflictor-x64:i386 (1 unstable [i386])' aptget install oldconflictor-x64 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo-depender
@@ -120,7 +193,7 @@ The following NEW packages will be installed:
Inst foo-depender (1 unstable [amd64])
Conf foo-depender (1 unstable [amd64])' aptget install foo-depender -s
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
@@ -132,6 +205,14 @@ The following packages have unmet dependencies:
foo-depender:i386 : Depends: foo:i386 but it is not installable
E: Unable to correct problems, you have held broken packages.' aptget install foo-depender:i386 -s
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ foo-native-depender
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo-native-depender (1 unstable [amd64])
+Conf foo-native-depender (1 unstable [amd64])' aptget install foo-native-depender -s
+
testequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
@@ -140,7 +221,7 @@ The following NEW packages will be installed:
Inst foo-foreign-depender:i386 (1 unstable [i386])
Conf foo-foreign-depender:i386 (1 unstable [i386])' aptget install foo-foreign-depender:i386 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
provider
@@ -151,7 +232,7 @@ Remv provider [1]
Inst foo-conflictor (1 unstable [amd64])
Conf foo-conflictor (1 unstable [amd64])' aptget install foo-conflictor -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
provider
@@ -162,7 +243,7 @@ Remv provider [1]
Inst foo-conflictor:i386 (1 unstable [i386])
Conf foo-conflictor:i386 (1 unstable [i386])' aptget install foo-conflictor:i386 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following packages will be REMOVED:
provider
@@ -173,10 +254,69 @@ Remv provider [1]
Inst foo-foreign-conflictor:i386 (1 unstable [i386])
Conf foo-foreign-conflictor:i386 (1 unstable [i386])' aptget install foo-foreign-conflictor:i386 -s
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
foo-no-conflictor:i386
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst foo-no-conflictor:i386 (1 unstable [i386])
Conf foo-no-conflictor:i386 (1 unstable [i386])' aptget install foo-no-conflictor:i386 -s
+
+msgmsg 'switch to single architecture'
+configarchitecture 'amd64'
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+ libc6
+The following NEW packages will be installed:
+ depender-x64 libc6
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst libc6 (1 unstable [amd64])
+Inst depender-x64 (1 unstable [amd64])
+Conf libc6 (1 unstable [amd64])
+Conf depender-x64 (1 unstable [amd64])' aptget install depender-x64 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+E: Unable to locate package depender-x64' aptget install depender-x64:i386 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ foo-native-depender
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo-native-depender (1 unstable [amd64])
+Conf foo-native-depender (1 unstable [amd64])' aptget install foo-native-depender -s
+
+# libold:i386 is installed, but we don't see it as i386 isn't configured
+testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ breaker-x32
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst breaker-x32 (1 unstable [amd64])
+Conf breaker-x32 (1 unstable [amd64])' aptget install breaker-x32:amd64 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following packages will be REMOVED:
+ libold
+The following NEW packages will be installed:
+ breaker-x64
+0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Remv libold [1]
+Inst breaker-x64 (1 unstable [amd64])
+Conf breaker-x64 (1 unstable [amd64])' aptget install breaker-x64:amd64 -s
+
+testequal 'Reading package lists...
+Building dependency tree...
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ depender-x32 : Depends: libc6:i386 but it is not installable
+E: Unable to correct problems, you have held broken packages.' aptget install depender-x32 -s
diff --git a/test/integration/test-suggest-installed-multiarch-silbing b/test/integration/test-suggest-installed-multiarch-silbing
index 89640a30c..f2b1db5eb 100755
--- a/test/integration/test-suggest-installed-multiarch-silbing
+++ b/test/integration/test-suggest-installed-multiarch-silbing
@@ -26,26 +26,26 @@ insertpackage 'unstable' 'mozplugger' 'i386,amd64' '1' 'Depends: iceweasel | fir
setupaptarchive
-testequal "Reading package lists...
+testsuccessequal "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...
+testsuccessequal "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...
+testsuccessequal "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...
+testsuccessequal "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
@@ -58,22 +58,22 @@ 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...
+testsuccessequal "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...
+testsuccessequal "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...
+testsuccessequal "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...
+testsuccessequal "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-1098738-apt-get-source-md5sum b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum
index 574183b0a..48a7f0562 100755
--- a/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum
+++ b/test/integration/test-ubuntu-bug-1098738-apt-get-source-md5sum
@@ -145,11 +145,11 @@ cd downloaded
testok() {
rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz
- testequal "Reading package lists...
+ testsuccessequal "Reading package lists...
Building dependency tree...
Need to get 6 B of source archives.
-Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B]
-Get:2 http://localhost:8080/ $1 1.0 (tar) [3 B]
+Get:1 http://localhost:8080 $1 1.0 (dsc) [3 B]
+Get:2 http://localhost:8080 $1 1.0 (tar) [3 B]
Download complete and in download only mode" aptget source -d "$@"
msgtest 'Files were successfully downloaded for' "$1"
testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz
@@ -159,7 +159,7 @@ Download complete and in download only mode" aptget source -d "$@"
testkeep() {
echo -n 'dsc' > ${1}_1.0.dsc
echo -n 'tar' > ${1}_1.0.tar.gz
- testequal "Reading package lists...
+ testsuccessequal "Reading package lists...
Building dependency tree...
Skipping already downloaded file '${1}_1.0.dsc'
Skipping already downloaded file '${1}_1.0.tar.gz'
@@ -172,11 +172,15 @@ Download complete and in download only mode" aptget source -d "$@"
testmismatch() {
rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz
- testequal "Reading package lists...
+ testfailureequal "Reading package lists...
Building dependency tree...
Need to get 6 B of source archives.
-Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B]
-Get:2 http://localhost:8080/ $1 1.0 (tar) [3 B]
+Get:1 http://localhost:8080 $1 1.0 (dsc) [3 B]
+Err:1 http://localhost:8080 $1 1.0 (dsc)
+ Hash Sum mismatch
+Get:2 http://localhost:8080 $1 1.0 (tar) [3 B]
+Err:2 http://localhost:8080 $1 1.0 (tar)
+ Hash Sum mismatch
E: Failed to fetch http://localhost:8080/${1}_1.0.dsc Hash Sum mismatch
E: Failed to fetch http://localhost:8080/${1}_1.0.tar.gz Hash Sum mismatch
@@ -186,7 +190,7 @@ E: Failed to fetch some archives." aptget source -d "$@"
testfailure --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz
rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz
- testequal "Reading package lists...
+ testsuccessequal "Reading package lists...
Building dependency tree...
Skipping download of file 'pkg-sha256-bad_1.0.dsc' as requested hashsum is not available for authentication
Skipping download of file 'pkg-sha256-bad_1.0.tar.gz' as requested hashsum is not available for authentication
@@ -196,11 +200,11 @@ Download complete and in download only mode" aptget source -d "$@" -o Acquire::F
testfailure --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz
rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz
- testequal "Reading package lists...
+ testsuccessequal "Reading package lists...
Building dependency tree...
Need to get 6 B of source archives.
-Get:1 http://localhost:8080/ $1 1.0 (dsc) [3 B]
-Get:2 http://localhost:8080/ $1 1.0 (tar) [3 B]
+Get:1 http://localhost:8080 $1 1.0 (dsc) [3 B]
+Get:2 http://localhost:8080 $1 1.0 (tar) [3 B]
Download complete and in download only mode" aptget source --allow-unauthenticated -d "$@" -o Acquire::ForceHash=ROT26
msgtest 'Files were downloaded unauthenticated as user allowed it' "$1"
testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz
@@ -221,7 +225,7 @@ testok pkg-sha256-bad -o Acquire::ForceHash=MD5Sum
# not having MD5 sum doesn't mean the file doesn't exist at all …
testok pkg-no-md5
testok pkg-no-md5 -o Acquire::ForceHash=SHA256
-testequal "Reading package lists...
+testsuccessequal "Reading package lists...
Building dependency tree...
Skipping download of file 'pkg-no-md5_1.0.dsc' as requested hashsum is not available for authentication
Skipping download of file 'pkg-no-md5_1.0.tar.gz' as requested hashsum is not available for authentication
@@ -233,21 +237,25 @@ testfailure --nomsg test -e pkg-no-md5_1.0.dsc -a -e pkg-no-md5_1.0.tar.gz
# deal with cases in which we haven't for all files the same checksum type
# mostly pathologic as this shouldn't happen, but just to be sure
testok pkg-mixed-ok
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Need to get 6 B of source archives.
-Get:1 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (tar) [3 B]
-Get:2 http://localhost:8080/ pkg-mixed-sha1-bad 1.0 (dsc) [3 B]
+Get:1 http://localhost:8080 pkg-mixed-sha1-bad 1.0 (tar) [3 B]
+Get:2 http://localhost:8080 pkg-mixed-sha1-bad 1.0 (dsc) [3 B]
+Err:2 http://localhost:8080 pkg-mixed-sha1-bad 1.0 (dsc)
+ Hash Sum mismatch
E: Failed to fetch http://localhost:8080/pkg-mixed-sha1-bad_1.0.dsc Hash Sum mismatch
E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha1-bad
msgtest 'Only tar file is downloaded as the dsc has hashsum mismatch' 'pkg-mixed-sha1-bad'
testsuccess --nomsg test ! -e pkg-mixed-sha1-bad_1.0.dsc -a -e pkg-mixed-sha1-bad_1.0.tar.gz
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Need to get 6 B of source archives.
-Get:1 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (tar) [3 B]
-Get:2 http://localhost:8080/ pkg-mixed-sha2-bad 1.0 (dsc) [3 B]
+Get:1 http://localhost:8080 pkg-mixed-sha2-bad 1.0 (tar) [3 B]
+Err:1 http://localhost:8080 pkg-mixed-sha2-bad 1.0 (tar)
+ Hash Sum mismatch
+Get:2 http://localhost:8080 pkg-mixed-sha2-bad 1.0 (dsc) [3 B]
E: Failed to fetch http://localhost:8080/pkg-mixed-sha2-bad_1.0.tar.gz Hash Sum mismatch
E: Failed to fetch some archives.' aptget source -d pkg-mixed-sha2-bad
@@ -256,9 +264,9 @@ testsuccess --nomsg test -e pkg-mixed-sha2-bad_1.0.dsc -a ! -e pkg-mixed-sha2-ba
# it gets even more pathologic: multiple entries for one file, some even disagreeing!
testok pkg-md5-agree
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
E: Error parsing checksum in Files of source package pkg-md5-disagree' aptget source -d pkg-md5-disagree
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
E: Error parsing checksum in Checksums-SHA256 of source package pkg-sha256-disagree' aptget source -d pkg-sha256-disagree
diff --git a/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings b/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings
index af6b7b504..192ed5efc 100755
--- a/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings
+++ b/test/integration/test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings
@@ -20,7 +20,7 @@ insertpackage 'unstable' 'steam' 'i386' '2' 'Depends: libmesa'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libmesa:i386
@@ -31,7 +31,7 @@ Inst libmesa:i386 (1 stable [i386])
Inst steam:i386 (1 stable [i386])
Conf libmesa:i386 (1 stable [i386])
Conf steam:i386 (1 stable [i386])' aptget install steam -st stable
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libmesa:i386
@@ -45,7 +45,7 @@ Conf steam:i386 (2 unstable [i386])' aptget install steam -st unstable
cp rootdir/var/lib/dpkg/status default-status.dpkg
insertinstalledpackage 'libmesa' 'amd64' '1' 'Multi-Arch: same'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libmesa:i386
@@ -56,7 +56,7 @@ Inst libmesa:i386 (1 stable [i386])
Inst steam:i386 (1 stable [i386])
Conf libmesa:i386 (1 stable [i386])
Conf steam:i386 (1 stable [i386])' aptget install steam -st stable
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libmesa libmesa:i386
@@ -76,7 +76,7 @@ cp default-status.dpkg rootdir/var/lib/dpkg/status
insertinstalledpackage 'libmesa-lts' 'amd64' '1' 'Provides: libmesa
Conflicts: libmesa
Multi-Arch: same'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libmesa-lts:i386
@@ -87,7 +87,7 @@ Inst libmesa-lts:i386 (1 stable [i386])
Inst steam:i386 (1 stable [i386])
Conf libmesa-lts:i386 (1 stable [i386])
Conf steam:i386 (1 stable [i386])' aptget install steam -st stable
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
libmesa-lts libmesa-lts:i386
diff --git a/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard b/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard
index 45f70a898..b4f705d8b 100755
--- a/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard
+++ b/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard
@@ -25,7 +25,7 @@ insertinstalledpackage 'not-downloadable' 'all' '1.0' '' 'standard'
setupaptarchive
# discourage keeping obsolete high-priority packages …
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be REMOVED:
@@ -42,7 +42,7 @@ for i in $(seq 1 10); do
insertinstalledpackage "depender$i" 'all' '1.0' 'Depends: not-downloadable'
done
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages have been kept back:
diff --git a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
index df2c69cf6..ea516fc12 100755
--- a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
+++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
@@ -40,7 +40,8 @@ msgtest 'Got expected failure message' 'apt-get update'
aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail
ensure_n_canary_strings_in_dir $LISTS 'ni ni ni' 0
-testequal 'partial' ls $LISTS
+testequal 'lock
+partial' ls $LISTS
# and again with pre-existing files with "valid data" which should remain
for f in Release Release.gpg main_binary-amd64_Packages main_source_Sources; do
diff --git a/test/integration/test-ubuntu-bug-614993 b/test/integration/test-ubuntu-bug-614993
index 49955f231..7067713e8 100755
--- a/test/integration/test-ubuntu-bug-614993
+++ b/test/integration/test-ubuntu-bug-614993
@@ -55,5 +55,5 @@ The following packages will be upgraded:
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
+testfailureequal "$UPGRADE" aptget install xserver-xorg --trivial-only
diff --git a/test/integration/test-ubuntu-bug-761175-remove-purge b/test/integration/test-ubuntu-bug-761175-remove-purge
index 14648e9b8..d5dfa2acf 100755
--- a/test/integration/test-ubuntu-bug-761175-remove-purge
+++ b/test/integration/test-ubuntu-bug-761175-remove-purge
@@ -4,33 +4,54 @@ set -e
TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
-configarchitecture 'native'
-
-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' 'native'
-rm -rf "$BUILDDIR"
+configarchitecture 'amd64' 'i386'
+
+buildcompizpkg() {
+ setupsimplenativepackage "compiz-core-$1" "$2" "$3" "$4"
+ BUILDDIR="incoming/compiz-core-$1-$3"
+ mkdir -p ${BUILDDIR}/debian/compiz-core/etc
+ echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
+ echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
+ buildpackage "$BUILDDIR" "$4" 'main' "$2"
+ rm -rf "$BUILDDIR"
+}
+buildcompizpkg 'native' 'all' '1.0' 'stable'
+buildcompizpkg 'all' 'native' '1.0' 'stable'
+buildcompizpkg 'native' 'native' '2.0' 'unstable'
+buildcompizpkg 'all' 'all' '2.0' 'unstable'
setupaptarchive
+runtests() {
+ testdpkgnotinstalled compiz-core-$1
+ testsuccess aptget install compiz-core-$1 -t "${2:-unstable}"
+ testdpkginstalled compiz-core-$1
-testdpkgnotinstalled compiz-core
-testsuccess aptget install compiz-core
-testdpkginstalled compiz-core
-
-testsuccess aptget remove compiz-core -y
-testdpkgnotinstalled compiz-core
-
-msgtest 'Check that conffiles are still around for' 'compiz-core'
-dpkg -l compiz-core | grep -q '^rc' && msgpass || msgfail
+ testsuccess aptget remove compiz-core-$1 -y
+ testdpkgnotinstalled compiz-core-$1
+ testdpkgstatus 'rc' '1' "compiz-core-$1"
-testequal 'Reading package lists...
+ testsuccessequal "Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
- compiz-core*
+ compiz-core-$1*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
-Purg compiz-core' aptget purge compiz-core -s
+Purg compiz-core-$1" aptget purge compiz-core-$1 -s
+ testsuccess aptget purge compiz-core-$1 -y
+ echo -n '' > rootdir/var/lib/dpkg/available # dpkg -l < 1.16.2 reads the available file by default, where the package can be found
+ testequalor2 "dpkg-query: no packages found matching compiz-core-$1" "No packages found matching compiz-core-$1." dpkg -l compiz-core-$1
+}
+
+msgmsg 'Test in multi arch environment'
+runtests 'native'
+runtests 'all'
+runtests 'native' 'stable'
+runtests 'all' 'stable'
+
+msgmsg 'Test in single arch environment'
+configarchitecture 'amd64'
+runtests 'native'
+runtests 'all'
+runtests 'native' 'stable'
+runtests 'all' 'stable'
diff --git a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only
index 09315868b..754487a90 100755
--- a/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only
+++ b/test/integration/test-ubuntu-bug-784473-InRelease-one-message-only
@@ -31,7 +31,7 @@ msgtest 'The unsigned garbage before signed block is' 'ignored'
aptget update -qq 2>&1 | grep -q 'W:.*Does not start with a cleartext signature' && msgpass || msgfail
ROOTDIR="$(readlink -f .)"
-testequal "Package files:
+testsuccessequal "Package files:
100 ${ROOTDIR}/rootdir/var/lib/dpkg/status
release a=now
Pinned packages:" aptcache policy
diff --git a/test/integration/test-ubuntu-bug-802901-multiarch-early-remove b/test/integration/test-ubuntu-bug-802901-multiarch-early-remove
index bdb4e5e4f..f56ff020c 100755
--- a/test/integration/test-ubuntu-bug-802901-multiarch-early-remove
+++ b/test/integration/test-ubuntu-bug-802901-multiarch-early-remove
@@ -15,7 +15,7 @@ Conflicts: libgl1'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following NEW packages will be installed:
libgl1-mesa-glx:i386
diff --git a/test/integration/test-ubuntu-bug-806274-install-suggests b/test/integration/test-ubuntu-bug-806274-install-suggests
index fb72f0999..3f02316f4 100755
--- a/test/integration/test-ubuntu-bug-806274-install-suggests
+++ b/test/integration/test-ubuntu-bug-806274-install-suggests
@@ -15,7 +15,7 @@ insertpackage 'unstable' 'baz' 'i386' '1.0'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
bar foo
@@ -32,7 +32,7 @@ Inst bar (1.0 unstable [i386])
Conf bar (1.0 unstable [i386])' aptget install apt -s --install-recommends --no-install-suggests
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
bar baz foo
@@ -48,7 +48,7 @@ Inst baz (1.0 unstable [i386])
Conf bar (1.0 unstable [i386])
Conf baz (1.0 unstable [i386])' aptget install apt -s --install-recommends --install-suggests
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
foo
@@ -64,7 +64,7 @@ Conf foo (1.0 unstable [i386])
Inst apt (0.8.15 unstable [i386])
Conf apt (0.8.15 unstable [i386])' aptget install apt -s --no-install-recommends --no-install-suggests
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
baz foo
diff --git a/test/integration/test-ubuntu-bug-859188-multiarch-reinstall b/test/integration/test-ubuntu-bug-859188-multiarch-reinstall
index be86f2e91..9bb99305e 100755
--- a/test/integration/test-ubuntu-bug-859188-multiarch-reinstall
+++ b/test/integration/test-ubuntu-bug-859188-multiarch-reinstall
@@ -21,7 +21,7 @@ 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
+testsuccessequal "$REINSTALL" aptget install --reinstall libsame -s
+testsuccessequal "$REINSTALL" aptget install --reinstall libsame:amd64 -s
+testsuccessequal "$REINSTALL" aptget install --reinstall libsame:i386 -s
+testsuccessequal "$REINSTALL" aptget install --reinstall libsame:amd64 libsame:i386 -s
diff --git a/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering b/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering
index d2b6b9bad..e9cbf958e 100755
--- a/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering
+++ b/test/integration/test-ubuntu-bug-985852-pre-depends-or-group-ordering
@@ -12,7 +12,7 @@ insertpackage 'unstable' 'custom' 'amd64' '2.0' 'Pre-Depends: grub-pc | grub'
setupaptarchive
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be upgraded:
diff --git a/test/integration/test-unpack-different-version-unpacked b/test/integration/test-unpack-different-version-unpacked
index 952f6e6b2..ae121cf4e 100755
--- a/test/integration/test-unpack-different-version-unpacked
+++ b/test/integration/test-unpack-different-version-unpacked
@@ -19,7 +19,7 @@ cleanstatus() {
#FIXME: the reported version is wrong, it should be 1, not 2
insertinstalledpackage 'libqtcore4' 'i386,amd64' '1' 'Multi-Arch: same' '' 'install ok unpacked'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
2 not fully installed or removed.
@@ -29,7 +29,7 @@ Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f
cleanstatus
insertinstalledpackage 'libqtcore4' 'amd64' '2' 'Multi-Arch: same' '' 'install ok unpacked'
insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' '' 'install ok unpacked'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Correcting dependencies... Done
The following extra packages will be installed:
@@ -45,7 +45,7 @@ Conf libqtcore4 (2 unstable [amd64])' aptget install -s -f
cleanstatus
insertinstalledpackage 'libqtcore4' 'i386' '2' 'Multi-Arch: same' '' 'install ok unpacked'
insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' '' 'install ok unpacked'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Correcting dependencies... Done
The following extra packages will be installed:
@@ -61,7 +61,7 @@ Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f
cleanstatus
insertinstalledpackage 'libqtcore4' 'amd64' '2' 'Multi-Arch: same' '' 'install ok unpacked'
insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Correcting dependencies... Done
The following extra packages will be installed:
@@ -77,7 +77,7 @@ Conf libqtcore4 (2 unstable [amd64])' aptget install -s -f
cleanstatus
insertinstalledpackage 'libqtcore4' 'i386' '2' 'Multi-Arch: same' '' 'install ok unpacked'
insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Correcting dependencies... Done
The following extra packages will be installed:
@@ -93,7 +93,7 @@ Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f
cleanstatus
insertinstalledpackage 'libqtcore4' 'amd64' '2' 'Multi-Arch: same'
insertinstalledpackage 'libqtcore4' 'i386' '1' 'Multi-Arch: same' '' 'install ok unpacked'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Correcting dependencies... Done
The following extra packages will be installed:
@@ -108,7 +108,7 @@ Conf libqtcore4:i386 (2 unstable [i386])' aptget install -s -f
cleanstatus
insertinstalledpackage 'libqtcore4' 'i386' '2' 'Multi-Arch: same'
insertinstalledpackage 'libqtcore4' 'amd64' '1' 'Multi-Arch: same' '' 'install ok unpacked'
-testequal 'Reading package lists...
+testsuccessequal 'Reading package lists...
Building dependency tree...
Correcting dependencies... Done
The following extra packages will be installed:
diff --git a/test/integration/test-xorg-break-providers b/test/integration/test-xorg-break-providers
index 0be57d979..ff1f3b077 100755
--- a/test/integration/test-xorg-break-providers
+++ b/test/integration/test-xorg-break-providers
@@ -13,7 +13,7 @@ setupaptarchive
# The test ensures that only -intel will be upgraded
# (together with -core of course) and -vesa not touched.
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
The following extra packages will be installed:
xserver-xorg-video-intel
@@ -24,7 +24,7 @@ Need to get 0 B/2992 kB of archives.
After this operation, 24.6 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.' aptget install xserver-xorg-core --trivial-only
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be upgraded:
@@ -34,7 +34,7 @@ Need to get 0 B/2992 kB of archives.
After this operation, 24.6 kB of additional disk space will be used.
E: Trivial Only specified but this is not a trivial operation.' aptget upgrade --trivial-only
-testequal 'Reading package lists...
+testfailureequal 'Reading package lists...
Building dependency tree...
Calculating upgrade...
The following packages will be upgraded:
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc
index 00004a524..411da0e8f 100644
--- a/test/interactive-helper/aptwebserver.cc
+++ b/test/interactive-helper/aptwebserver.cc
@@ -19,82 +19,99 @@
#include <sys/stat.h>
#include <time.h>
#include <unistd.h>
+
+#include <algorithm>
#include <iostream>
#include <sstream>
#include <list>
#include <string>
#include <vector>
-static char const * httpcodeToStr(int const httpcode) /*{{{*/
+static std::string httpcodeToStr(int const httpcode) /*{{{*/
{
switch (httpcode)
{
// Informational 1xx
- case 100: return "100 Continue";
- case 101: return "101 Switching Protocols";
+ case 100: return _config->Find("aptwebserver::httpcode::100", "100 Continue");
+ case 101: return _config->Find("aptwebserver::httpcode::101", "101 Switching Protocols");
// Successful 2xx
- case 200: return "200 OK";
- case 201: return "201 Created";
- case 202: return "202 Accepted";
- case 203: return "203 Non-Authoritative Information";
- case 204: return "204 No Content";
- case 205: return "205 Reset Content";
- case 206: return "206 Partial Content";
+ case 200: return _config->Find("aptwebserver::httpcode::200", "200 OK");
+ case 201: return _config->Find("aptwebserver::httpcode::201", "201 Created");
+ case 202: return _config->Find("aptwebserver::httpcode::202", "202 Accepted");
+ case 203: return _config->Find("aptwebserver::httpcode::203", "203 Non-Authoritative Information");
+ case 204: return _config->Find("aptwebserver::httpcode::204", "204 No Content");
+ case 205: return _config->Find("aptwebserver::httpcode::205", "205 Reset Content");
+ case 206: return _config->Find("aptwebserver::httpcode::206", "206 Partial Content");
// Redirections 3xx
- case 300: return "300 Multiple Choices";
- case 301: return "301 Moved Permanently";
- case 302: return "302 Found";
- case 303: return "303 See Other";
- case 304: return "304 Not Modified";
- case 305: return "304 Use Proxy";
- case 307: return "307 Temporary Redirect";
+ case 300: return _config->Find("aptwebserver::httpcode::300", "300 Multiple Choices");
+ case 301: return _config->Find("aptwebserver::httpcode::301", "301 Moved Permanently");
+ case 302: return _config->Find("aptwebserver::httpcode::302", "302 Found");
+ case 303: return _config->Find("aptwebserver::httpcode::303", "303 See Other");
+ case 304: return _config->Find("aptwebserver::httpcode::304", "304 Not Modified");
+ case 305: return _config->Find("aptwebserver::httpcode::305", "305 Use Proxy");
+ case 307: return _config->Find("aptwebserver::httpcode::307", "307 Temporary Redirect");
// Client errors 4xx
- case 400: return "400 Bad Request";
- case 401: return "401 Unauthorized";
- case 402: return "402 Payment Required";
- case 403: return "403 Forbidden";
- case 404: return "404 Not Found";
- case 405: return "405 Method Not Allowed";
- case 406: return "406 Not Acceptable";
- case 407: return "407 Proxy Authentication Required";
- case 408: return "408 Request Time-out";
- case 409: return "409 Conflict";
- case 410: return "410 Gone";
- case 411: return "411 Length Required";
- case 412: return "412 Precondition Failed";
- case 413: return "413 Request Entity Too Large";
- case 414: return "414 Request-URI Too Large";
- case 415: return "415 Unsupported Media Type";
- case 416: return "416 Requested range not satisfiable";
- case 417: return "417 Expectation Failed";
- case 418: return "418 I'm a teapot";
+ case 400: return _config->Find("aptwebserver::httpcode::400", "400 Bad Request");
+ case 401: return _config->Find("aptwebserver::httpcode::401", "401 Unauthorized");
+ case 402: return _config->Find("aptwebserver::httpcode::402", "402 Payment Required");
+ case 403: return _config->Find("aptwebserver::httpcode::403", "403 Forbidden");
+ case 404: return _config->Find("aptwebserver::httpcode::404", "404 Not Found");
+ case 405: return _config->Find("aptwebserver::httpcode::405", "405 Method Not Allowed");
+ case 406: return _config->Find("aptwebserver::httpcode::406", "406 Not Acceptable");
+ case 407: return _config->Find("aptwebserver::httpcode::407", "407 Proxy Authentication Required");
+ case 408: return _config->Find("aptwebserver::httpcode::408", "408 Request Time-out");
+ case 409: return _config->Find("aptwebserver::httpcode::409", "409 Conflict");
+ case 410: return _config->Find("aptwebserver::httpcode::410", "410 Gone");
+ case 411: return _config->Find("aptwebserver::httpcode::411", "411 Length Required");
+ case 412: return _config->Find("aptwebserver::httpcode::412", "412 Precondition Failed");
+ case 413: return _config->Find("aptwebserver::httpcode::413", "413 Request Entity Too Large");
+ case 414: return _config->Find("aptwebserver::httpcode::414", "414 Request-URI Too Large");
+ case 415: return _config->Find("aptwebserver::httpcode::415", "415 Unsupported Media Type");
+ case 416: return _config->Find("aptwebserver::httpcode::416", "416 Requested range not satisfiable");
+ case 417: return _config->Find("aptwebserver::httpcode::417", "417 Expectation Failed");
+ case 418: return _config->Find("aptwebserver::httpcode::418", "418 I'm a teapot");
// Server error 5xx
- case 500: return "500 Internal Server Error";
- case 501: return "501 Not Implemented";
- case 502: return "502 Bad Gateway";
- case 503: return "503 Service Unavailable";
- case 504: return "504 Gateway Time-out";
- case 505: return "505 HTTP Version not supported";
- }
- return NULL;
+ case 500: return _config->Find("aptwebserver::httpcode::500", "500 Internal Server Error");
+ case 501: return _config->Find("aptwebserver::httpcode::501", "501 Not Implemented");
+ case 502: return _config->Find("aptwebserver::httpcode::502", "502 Bad Gateway");
+ case 503: return _config->Find("aptwebserver::httpcode::503", "503 Service Unavailable");
+ case 504: return _config->Find("aptwebserver::httpcode::504", "504 Gateway Time-out");
+ case 505: return _config->Find("aptwebserver::httpcode::505", "505 HTTP Version not supported");
+ }
+ return "";
}
/*}}}*/
+static bool chunkedTransferEncoding(std::list<std::string> const &headers) {
+ if (std::find(headers.begin(), headers.end(), "Transfer-Encoding: chunked") != headers.end())
+ return true;
+ if (_config->FindB("aptwebserver::chunked-transfer-encoding", false) == true)
+ return true;
+ return false;
+}
static void addFileHeaders(std::list<std::string> &headers, FileFd &data)/*{{{*/
{
- std::ostringstream contentlength;
- contentlength << "Content-Length: " << data.FileSize();
- headers.push_back(contentlength.str());
-
- std::string lastmodified("Last-Modified: ");
- lastmodified.append(TimeRFC1123(data.ModificationTime()));
- headers.push_back(lastmodified);
+ if (chunkedTransferEncoding(headers) == false)
+ {
+ std::ostringstream contentlength;
+ contentlength << "Content-Length: " << data.FileSize();
+ headers.push_back(contentlength.str());
+ }
+ if (_config->FindB("aptwebserver::support::last-modified", true) == true)
+ {
+ std::string lastmodified("Last-Modified: ");
+ lastmodified.append(TimeRFC1123(data.ModificationTime()));
+ headers.push_back(lastmodified);
+ }
}
/*}}}*/
static void addDataHeaders(std::list<std::string> &headers, std::string &data)/*{{{*/
{
- std::ostringstream contentlength;
- contentlength << "Content-Length: " << data.size();
- headers.push_back(contentlength.str());
+ if (chunkedTransferEncoding(headers) == false)
+ {
+ std::ostringstream contentlength;
+ contentlength << "Content-Length: " << data.size();
+ headers.push_back(contentlength.str());
+ }
}
/*}}}*/
static bool sendHead(int const client, int const httpcode, std::list<std::string> &headers)/*{{{*/
@@ -114,6 +131,9 @@ static bool sendHead(int const client, int const httpcode, std::list<std::string
date.append(TimeRFC1123(time(NULL)));
headers.push_back(date);
+ if (chunkedTransferEncoding(headers) == true)
+ headers.push_back("Transfer-Encoding: chunked");
+
std::clog << ">>> RESPONSE to " << client << " >>>" << std::endl;
bool Success = true;
for (std::list<std::string>::const_iterator h = headers.begin();
@@ -130,25 +150,55 @@ static bool sendHead(int const client, int const httpcode, std::list<std::string
return Success;
}
/*}}}*/
-static bool sendFile(int const client, FileFd &data) /*{{{*/
+static bool sendFile(int const client, std::list<std::string> const &headers, FileFd &data)/*{{{*/
{
bool Success = true;
+ bool const chunked = chunkedTransferEncoding(headers);
char buffer[500];
unsigned long long actual = 0;
while ((Success &= data.Read(buffer, sizeof(buffer), &actual)) == true)
{
if (actual == 0)
break;
- Success &= FileFd::Write(client, buffer, actual);
+
+ if (chunked == true)
+ {
+ std::string size;
+ strprintf(size, "%llX\r\n", actual);
+ Success &= FileFd::Write(client, size.c_str(), size.size());
+ Success &= FileFd::Write(client, buffer, actual);
+ Success &= FileFd::Write(client, "\r\n", strlen("\r\n"));
+ }
+ else
+ Success &= FileFd::Write(client, buffer, actual);
+ }
+ if (chunked == true)
+ {
+ char const * const finish = "0\r\n\r\n";
+ Success &= FileFd::Write(client, finish, strlen(finish));
}
if (Success == false)
- std::cerr << "SENDFILE: READ/WRITE ERROR to " << client << std::endl;
+ std::cerr << "SENDFILE:" << (chunked ? " CHUNKED" : "") << " READ/WRITE ERROR to " << client << std::endl;
return Success;
}
/*}}}*/
-static bool sendData(int const client, std::string const &data) /*{{{*/
+static bool sendData(int const client, std::list<std::string> const &headers, std::string const &data)/*{{{*/
{
- if (FileFd::Write(client, data.c_str(), data.size()) == false)
+ if (chunkedTransferEncoding(headers) == true)
+ {
+ unsigned long long const ullsize = data.length();
+ std::string size;
+ strprintf(size, "%llX\r\n", ullsize);
+ char const * const finish = "\r\n0\r\n\r\n";
+ if (FileFd::Write(client, size.c_str(), size.length()) == false ||
+ FileFd::Write(client, data.c_str(), ullsize) == false ||
+ FileFd::Write(client, finish, strlen(finish)) == false)
+ {
+ std::cerr << "SENDDATA: CHUNK WRITE ERROR to " << client << std::endl;
+ return false;
+ }
+ }
+ else if (FileFd::Write(client, data.c_str(), data.size()) == false)
{
std::cerr << "SENDDATA: WRITE ERROR to " << client << std::endl;
return false;
@@ -157,33 +207,38 @@ static bool sendData(int const client, std::string const &data) /*{{{*/
}
/*}}}*/
static void sendError(int const client, int const httpcode, std::string const &request,/*{{{*/
- bool content, std::string const &error = "", std::list<std::string> headers = std::list<std::string>())
+ bool const content, std::string const &error, std::list<std::string> &headers)
{
std::string response("<html><head><title>");
response.append(httpcodeToStr(httpcode)).append("</title></head>");
response.append("<body><h1>").append(httpcodeToStr(httpcode)).append("</h1>");
if (httpcode != 200)
- {
- if (error.empty() == false)
- response.append("<p><em>Error</em>: ").append(error).append("</p>");
- response.append("This error is a result of the request: <pre>");
- }
+ response.append("<p><em>Error</em>: ");
+ else
+ response.append("<p><em>Success</em>: ");
+ if (error.empty() == false)
+ response.append(error);
+ else
+ response.append(httpcodeToStr(httpcode));
+ if (httpcode != 200)
+ response.append("</p>This error is a result of the request: <pre>");
else
- {
- if (error.empty() == false)
- response.append("<p><em>Success</em>: ").append(error).append("</p>");
response.append("The successfully executed operation was requested by: <pre>");
- }
response.append(request).append("</pre></body></html>");
+ if (httpcode != 200)
+ {
+ if (_config->FindB("aptwebserver::closeOnError", false) == true)
+ headers.push_back("Connection: close");
+ }
addDataHeaders(headers, response);
sendHead(client, httpcode, headers);
if (content == true)
- sendData(client, response);
+ sendData(client, headers, response);
}
static void sendSuccess(int const client, std::string const &request,
- bool content, std::string const &error = "")
+ bool const content, std::string const &error, std::list<std::string> &headers)
{
- sendError(client, 200, request, content, error);
+ sendError(client, 200, request, content, error, headers);
}
/*}}}*/
static void sendRedirect(int const client, int const httpcode, std::string const &uri,/*{{{*/
@@ -220,7 +275,7 @@ static void sendRedirect(int const client, int const httpcode, std::string const
headers.push_back(location);
sendHead(client, httpcode, headers);
if (content == true)
- sendData(client, response);
+ sendData(client, headers, response);
}
/*}}}*/
static int filter_hidden_files(const struct dirent *a) /*{{{*/
@@ -262,16 +317,15 @@ static int grouped_alpha_case_sort(const struct dirent **a, const struct dirent
}
/*}}}*/
static void sendDirectoryListing(int const client, std::string const &dir,/*{{{*/
- std::string const &request, bool content)
+ std::string const &request, bool content, std::list<std::string> &headers)
{
- std::list<std::string> headers;
std::ostringstream listing;
struct dirent **namelist;
int const counter = scandir(dir.c_str(), &namelist, filter_hidden_files, grouped_alpha_case_sort);
if (counter == -1)
{
- sendError(client, 500, request, content);
+ sendError(client, 500, request, content, "scandir failed", headers);
return;
}
@@ -310,18 +364,18 @@ static void sendDirectoryListing(int const client, std::string const &dir,/*{{{*
addDataHeaders(headers, response);
sendHead(client, 200, headers);
if (content == true)
- sendData(client, response);
+ sendData(client, headers, response);
}
/*}}}*/
static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
std::string &filename, std::string &params, bool &sendContent,
- bool &closeConnection)
+ bool &closeConnection, std::list<std::string> &headers)
{
if (strncmp(request.c_str(), "HEAD ", 5) == 0)
sendContent = false;
if (strncmp(request.c_str(), "GET ", 4) != 0)
{
- sendError(client, 501, request, true);
+ sendError(client, 501, request, true, "", headers);
return false;
}
@@ -332,7 +386,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
if (lineend == std::string::npos || filestart == std::string::npos ||
fileend == std::string::npos || filestart == fileend)
{
- sendError(client, 500, request, sendContent, "Filename can't be extracted");
+ sendError(client, 500, request, sendContent, "Filename can't be extracted", headers);
return false;
}
@@ -344,14 +398,14 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
closeConnection = strcasecmp(LookupTag(request, "Connection", "Keep-Alive").c_str(), "close") == 0;
else
{
- sendError(client, 500, request, sendContent, "Not a HTTP/1.{0,1} request");
+ sendError(client, 500, request, sendContent, "Not a HTTP/1.{0,1} request", headers);
return false;
}
filename = request.substr(filestart, fileend - filestart);
if (filename.find(' ') != std::string::npos)
{
- sendError(client, 500, request, sendContent, "Filename contains an unencoded space");
+ sendError(client, 500, request, sendContent, "Filename contains an unencoded space", headers);
return false;
}
@@ -359,7 +413,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
if (host.empty() == true)
{
// RFC 2616 §14.23 requires Host
- sendError(client, 400, request, sendContent, "Host header is required");
+ sendError(client, 400, request, sendContent, "Host header is required", headers);
return false;
}
host = "http://" + host;
@@ -370,7 +424,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
{
if (absolute.find("uri") == std::string::npos)
{
- sendError(client, 400, request, sendContent, "Request is absoluteURI, but configured to not accept that");
+ sendError(client, 400, request, sendContent, "Request is absoluteURI, but configured to not accept that", headers);
return false;
}
@@ -382,9 +436,9 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
if (authConf.empty() != auth.empty())
{
if (auth.empty())
- sendError(client, 407, request, sendContent, "Proxy requires authentication");
+ sendError(client, 407, request, sendContent, "Proxy requires authentication", headers);
else
- sendError(client, 407, request, sendContent, "Client wants to authenticate to proxy, but proxy doesn't need it");
+ sendError(client, 407, request, sendContent, "Client wants to authenticate to proxy, but proxy doesn't need it", headers);
return false;
}
if (authConf.empty() == false)
@@ -395,7 +449,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
auth.erase(0, strlen(basic));
if (auth != authConf)
{
- sendError(client, 407, request, sendContent, "Proxy-Authentication doesn't match");
+ sendError(client, 407, request, sendContent, "Proxy-Authentication doesn't match", headers);
return false;
}
}
@@ -410,7 +464,7 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
}
else if (absolute.find("path") == std::string::npos && APT::String::Startswith(filename, "/_config/") == false)
{
- sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that");
+ sendError(client, 400, request, sendContent, "Request is absolutePath, but configured to not accept that", headers);
return false;
}
@@ -421,9 +475,9 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
if (authConf.empty() != auth.empty())
{
if (auth.empty())
- sendError(client, 401, request, sendContent, "Server requires authentication");
+ sendError(client, 401, request, sendContent, "Server requires authentication", headers);
else
- sendError(client, 401, request, sendContent, "Client wants to authenticate to server, but server doesn't need it");
+ sendError(client, 401, request, sendContent, "Client wants to authenticate to server, but server doesn't need it", headers);
return false;
}
if (authConf.empty() == false)
@@ -434,13 +488,12 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
auth.erase(0, strlen(basic));
if (auth != authConf)
{
- sendError(client, 401, request, sendContent, "Authentication doesn't match");
+ sendError(client, 401, request, sendContent, "Authentication doesn't match", headers);
return false;
}
}
else
{
- std::list<std::string> headers;
headers.push_back("WWW-Authenticate: Basic");
sendError(client, 401, request, sendContent, "Unsupported Authentication Scheme", headers);
return false;
@@ -463,7 +516,8 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
filename.find_first_of("\r\n\t\f\v") != std::string::npos ||
filename.find("/../") != std::string::npos)
{
- sendError(client, 400, request, sendContent, "Filename contains illegal character (sequence)");
+ std::list<std::string> headers;
+ sendError(client, 400, request, sendContent, "Filename contains illegal character (sequence)", headers);
return false;
}
@@ -499,7 +553,8 @@ static bool parseFirstLine(int const client, std::string const &request,/*{{{*/
return true;
}
/*}}}*/
-static bool handleOnTheFlyReconfiguration(int const client, std::string const &request, std::vector<std::string> parts)/*{{{*/
+static bool handleOnTheFlyReconfiguration(int const client, std::string const &request,/*{{{*/
+ std::vector<std::string> parts, std::list<std::string> &headers)
{
size_t const pcount = parts.size();
for (size_t i = 0; i < pcount; ++i)
@@ -507,40 +562,38 @@ static bool handleOnTheFlyReconfiguration(int const client, std::string const &r
if (pcount == 4 && parts[1] == "set")
{
_config->Set(parts[2], parts[3]);
- sendSuccess(client, request, true, "Option '" + parts[2] + "' was set to '" + parts[3] + "'!");
+ sendSuccess(client, request, true, "Option '" + parts[2] + "' was set to '" + parts[3] + "'!", headers);
return true;
}
else if (pcount == 4 && parts[1] == "find")
{
- std::list<std::string> headers;
std::string response = _config->Find(parts[2], parts[3]);
addDataHeaders(headers, response);
sendHead(client, 200, headers);
- sendData(client, response);
+ sendData(client, headers, response);
return true;
}
else if (pcount == 3 && parts[1] == "find")
{
- std::list<std::string> headers;
if (_config->Exists(parts[2]) == true)
{
std::string response = _config->Find(parts[2]);
addDataHeaders(headers, response);
sendHead(client, 200, headers);
- sendData(client, response);
+ sendData(client, headers, response);
return true;
}
- sendError(client, 404, request, "Requested Configuration option doesn't exist.");
+ sendError(client, 404, request, true, "Requested Configuration option doesn't exist", headers);
return false;
}
else if (pcount == 3 && parts[1] == "clear")
{
_config->Clear(parts[2]);
- sendSuccess(client, request, true, "Option '" + parts[2] + "' was cleared.");
+ sendSuccess(client, request, true, "Option '" + parts[2] + "' was cleared.", headers);
return true;
}
- sendError(client, 400, request, true, "Unknown on-the-fly configuration request");
+ sendError(client, 400, request, true, "Unknown on-the-fly configuration request", headers);
return false;
}
/*}}}*/
@@ -548,19 +601,30 @@ static void * handleClient(void * voidclient) /*{{{*/
{
int client = *((int*)(voidclient));
std::clog << "ACCEPT client " << client << std::endl;
- std::vector<std::string> messages;
- while (ReadMessages(client, messages))
+ bool closeConnection = false;
+ while (closeConnection == false)
{
- bool closeConnection = false;
+ std::vector<std::string> messages;
+ if (ReadMessages(client, messages) == false)
+ break;
+
+ std::list<std::string> headers;
for (std::vector<std::string>::const_iterator m = messages.begin();
m != messages.end() && closeConnection == false; ++m) {
+ // if we announced a closing in previous response, do the close now
+ if (std::find(headers.begin(), headers.end(), std::string("Connection: close")) != headers.end())
+ {
+ closeConnection = true;
+ break;
+ }
+ headers.clear();
+
std::clog << ">>> REQUEST from " << client << " >>>" << std::endl << *m
<< std::endl << "<<<<<<<<<<<<<<<<" << std::endl;
- std::list<std::string> headers;
std::string filename;
std::string params;
bool sendContent = true;
- if (parseFirstLine(client, *m, filename, params, sendContent, closeConnection) == false)
+ if (parseFirstLine(client, *m, filename, params, sendContent, closeConnection, headers) == false)
continue;
// special webserver command request
@@ -569,7 +633,7 @@ static void * handleClient(void * voidclient) /*{{{*/
std::vector<std::string> parts = VectorizeString(filename, '/');
if (parts[0] == "_config")
{
- handleOnTheFlyReconfiguration(client, *m, parts);
+ handleOnTheFlyReconfiguration(client, *m, parts, headers);
continue;
}
}
@@ -601,7 +665,7 @@ static void * handleClient(void * voidclient) /*{{{*/
{
char error[300];
regerror(res, pattern, error, sizeof(error));
- sendError(client, 500, *m, sendContent, error);
+ sendError(client, 500, *m, sendContent, error, headers);
continue;
}
if (regexec(pattern, filename.c_str(), 0, 0, 0) == 0)
@@ -620,7 +684,7 @@ static void * handleClient(void * voidclient) /*{{{*/
if (_config->FindB("aptwebserver::support::http", true) == false &&
LookupTag(*m, "Host").find(":4433") == std::string::npos)
{
- sendError(client, 400, *m, sendContent, "HTTP disabled, all requests must be HTTPS");
+ sendError(client, 400, *m, sendContent, "HTTP disabled, all requests must be HTTPS", headers);
continue;
}
else if (RealFileExists(filename) == true)
@@ -667,26 +731,30 @@ static void * handleClient(void * voidclient) /*{{{*/
if (filesize > filestart)
{
data.Skip(filestart);
- std::ostringstream contentlength;
- contentlength << "Content-Length: " << (filesize - filestart);
- headers.push_back(contentlength.str());
+ // make sure to send content-range before conent-length
+ // as regression test for LP: #1445239
std::ostringstream contentrange;
contentrange << "Content-Range: bytes " << filestart << "-"
<< filesize - 1 << "/" << filesize;
headers.push_back(contentrange.str());
+ std::ostringstream contentlength;
+ contentlength << "Content-Length: " << (filesize - filestart);
+ headers.push_back(contentlength.str());
sendHead(client, 206, headers);
if (sendContent == true)
- sendFile(client, data);
+ sendFile(client, headers, data);
continue;
}
else
{
- headers.push_back("Content-Length: 0");
- std::ostringstream contentrange;
- contentrange << "Content-Range: bytes */" << filesize;
- headers.push_back(contentrange.str());
- sendHead(client, 416, headers);
- continue;
+ if (_config->FindB("aptwebserver::support::content-range", true) == true)
+ {
+ std::ostringstream contentrange;
+ contentrange << "Content-Range: bytes */" << filesize;
+ headers.push_back(contentrange.str());
+ }
+ sendError(client, 416, *m, sendContent, "", headers);
+ break;
}
}
}
@@ -695,23 +763,28 @@ static void * handleClient(void * voidclient) /*{{{*/
addFileHeaders(headers, data);
sendHead(client, 200, headers);
if (sendContent == true)
- sendFile(client, data);
+ sendFile(client, headers, data);
}
else if (DirectoryExists(filename) == true)
{
if (filename[filename.length()-1] == '/')
- sendDirectoryListing(client, filename, *m, sendContent);
+ sendDirectoryListing(client, filename, *m, sendContent, headers);
else
sendRedirect(client, 301, filename.append("/"), *m, sendContent);
}
else
- sendError(client, 404, *m, sendContent);
+ sendError(client, 404, *m, sendContent, "", headers);
}
- _error->DumpErrors(std::cerr);
- messages.clear();
- if (closeConnection == true)
+
+ // if we announced a closing in the last response, do the close now
+ if (std::find(headers.begin(), headers.end(), std::string("Connection: close")) != headers.end())
+ closeConnection = true;
+
+ if (_error->PendingError() == true)
break;
+ _error->DumpErrors(std::cerr);
}
+ _error->DumpErrors(std::cerr);
close(client);
std::clog << "CLOSE client " << client << std::endl;
return NULL;
@@ -810,7 +883,8 @@ int main(int const argc, const char * argv[])
std::clog << "Serving ANY file on port: " << port << std::endl;
- int const slaves = _config->FindB("aptwebserver::slaves", SOMAXCONN);
+ int const slaves = _config->FindI("aptwebserver::slaves", SOMAXCONN);
+ std::cerr << "SLAVES: " << slaves << std::endl;
listen(sock, slaves);
/*}}}*/
diff --git a/test/libapt/acqprogress_test.cc b/test/libapt/acqprogress_test.cc
new file mode 100644
index 000000000..dc31423fc
--- /dev/null
+++ b/test/libapt/acqprogress_test.cc
@@ -0,0 +1,178 @@
+#include <config.h>
+#include <apt-pkg/hashes.h>
+#include <apt-pkg/acquire.h>
+#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/configuration.h>
+#include <apt-private/acqprogress.h>
+#include <string>
+#include <sstream>
+#include <gtest/gtest.h>
+
+class TestItem: public pkgAcquire::Item
+{
+public:
+ TestItem(pkgAcquire * const Acq) : pkgAcquire::Item(Acq) {}
+
+ virtual std::string DescURI() const { return ""; }
+ virtual HashStringList GetExpectedHashes() const { return HashStringList(); }
+
+};
+
+TEST(AcqProgress, IMSHit)
+{
+ std::ostringstream out;
+ unsigned int width = 80;
+ AcqTextStatus Stat(out, width, 0);
+ Stat.Start();
+
+ pkgAcquire Acq(&Stat);
+ pkgAcquire::ItemDesc hit;
+ hit.URI = "http://example.org/file";
+ hit.Description = "Example File from example.org";
+ hit.ShortDesc = "Example File";
+ TestItem hitO(&Acq);
+ hit.Owner = &hitO;
+
+ EXPECT_EQ("", out.str());
+ Stat.IMSHit(hit);
+ EXPECT_EQ("Hit:1 Example File from example.org\n", out.str());
+ Stat.IMSHit(hit);
+ EXPECT_EQ("Hit:1 Example File from example.org\n"
+ "Hit:1 Example File from example.org\n", out.str());
+ Stat.Stop();
+ EXPECT_EQ("Hit:1 Example File from example.org\n"
+ "Hit:1 Example File from example.org\n", out.str());
+}
+TEST(AcqProgress, FetchNoFileSize)
+{
+ std::ostringstream out;
+ unsigned int width = 80;
+ AcqTextStatus Stat(out, width, 0);
+ Stat.Start();
+
+ pkgAcquire Acq(&Stat);
+ pkgAcquire::ItemDesc fetch;
+ fetch.URI = "http://example.org/file";
+ fetch.Description = "Example File from example.org";
+ fetch.ShortDesc = "Example File";
+ TestItem fetchO(&Acq);
+ fetch.Owner = &fetchO;
+
+ EXPECT_EQ("", out.str());
+ Stat.Fetch(fetch);
+ EXPECT_EQ("Get:1 Example File from example.org\n", out.str());
+ Stat.Fetch(fetch);
+ EXPECT_EQ("Get:1 Example File from example.org\n"
+ "Get:1 Example File from example.org\n", out.str());
+ Stat.Stop();
+ EXPECT_EQ("Get:1 Example File from example.org\n"
+ "Get:1 Example File from example.org\n", out.str());
+}
+TEST(AcqProgress, FetchFileSize)
+{
+ std::ostringstream out;
+ unsigned int width = 80;
+ AcqTextStatus Stat(out, width, 0);
+ Stat.Start();
+
+ pkgAcquire Acq(&Stat);
+ pkgAcquire::ItemDesc fetch;
+ fetch.URI = "http://example.org/file";
+ fetch.Description = "Example File from example.org";
+ fetch.ShortDesc = "Example File";
+ TestItem fetchO(&Acq);
+ fetchO.FileSize = 100;
+ fetch.Owner = &fetchO;
+
+ EXPECT_EQ("", out.str());
+ Stat.Fetch(fetch);
+ EXPECT_EQ("Get:1 Example File from example.org [100 B]\n", out.str());
+ fetchO.FileSize = 42;
+ Stat.Fetch(fetch);
+ EXPECT_EQ("Get:1 Example File from example.org [100 B]\n"
+ "Get:1 Example File from example.org [42 B]\n", out.str());
+ Stat.Stop();
+ EXPECT_EQ("Get:1 Example File from example.org [100 B]\n"
+ "Get:1 Example File from example.org [42 B]\n", out.str());
+}
+TEST(AcqProgress, Fail)
+{
+ std::ostringstream out;
+ unsigned int width = 80;
+ AcqTextStatus Stat(out, width, 0);
+ Stat.Start();
+
+ pkgAcquire Acq(&Stat);
+ pkgAcquire::ItemDesc fetch;
+ fetch.URI = "http://example.org/file";
+ fetch.Description = "Example File from example.org";
+ fetch.ShortDesc = "Example File";
+ TestItem fetchO(&Acq);
+ fetchO.FileSize = 100;
+ fetchO.Status = pkgAcquire::Item::StatIdle;
+ fetch.Owner = &fetchO;
+
+ EXPECT_EQ("", out.str());
+ Stat.Fail(fetch);
+ EXPECT_EQ("Ign:1 Example File from example.org\n", out.str());
+ fetchO.Status = pkgAcquire::Item::StatDone;
+ Stat.Fail(fetch);
+ EXPECT_EQ("Ign:1 Example File from example.org\n"
+ "Ign:1 Example File from example.org\n", out.str());
+ fetchO.Status = pkgAcquire::Item::StatError;
+ fetchO.ErrorText = "An error test!";
+ Stat.Fail(fetch);
+ EXPECT_EQ("Ign:1 Example File from example.org\n"
+ "Ign:1 Example File from example.org\n"
+ "Err:1 Example File from example.org\n"
+ " An error test!\n", out.str());
+ _config->Set("Acquire::Progress::Ignore::ShowErrorText", true);
+ fetchO.Status = pkgAcquire::Item::StatDone;
+ Stat.Fail(fetch);
+ EXPECT_EQ("Ign:1 Example File from example.org\n"
+ "Ign:1 Example File from example.org\n"
+ "Err:1 Example File from example.org\n"
+ " An error test!\n"
+ "Ign:1 Example File from example.org\n"
+ " An error test!\n", out.str());
+ _config->Set("Acquire::Progress::Ignore::ShowErrorText", true);
+ Stat.Stop();
+ EXPECT_EQ("Ign:1 Example File from example.org\n"
+ "Ign:1 Example File from example.org\n"
+ "Err:1 Example File from example.org\n"
+ " An error test!\n"
+ "Ign:1 Example File from example.org\n"
+ " An error test!\n", out.str());
+}
+TEST(AcqProgress, Pulse)
+{
+ std::ostringstream out;
+ unsigned int width = 80;
+ AcqTextStatus Stat(out, width, 0);
+ _config->Set("APT::Sandbox::User", ""); // ensure we aren't sandboxing
+
+ pkgAcquire Acq(&Stat);
+ pkgAcquire::ItemDesc fetch;
+ fetch.URI = "http://example.org/file";
+ fetch.Description = "Example File from example.org";
+ fetch.ShortDesc = "Example File";
+ TestItem fetchO(&Acq);
+ fetchO.FileSize = 100;
+ fetchO.Status = pkgAcquire::Item::StatFetching;
+ fetch.Owner = &fetchO;
+
+ // make screen smaller and bigger again while running
+ EXPECT_TRUE(Stat.Pulse(&Acq));
+ EXPECT_EQ("\r0% [Working]", out.str());
+ width = 8;
+ EXPECT_TRUE(Stat.Pulse(&Acq));
+ EXPECT_EQ("\r0% [Working]"
+ "\r "
+ "\r0% [Work", out.str());
+ width = 80;
+ EXPECT_TRUE(Stat.Pulse(&Acq));
+ EXPECT_EQ("\r0% [Working]"
+ "\r "
+ "\r0% [Work"
+ "\r0% [Working]", out.str());
+}
diff --git a/test/libapt/cdrom_test.cc b/test/libapt/cdrom_test.cc
index 5cf3b353c..7257eaf1b 100644
--- a/test/libapt/cdrom_test.cc
+++ b/test/libapt/cdrom_test.cc
@@ -109,6 +109,7 @@ TEST(CDROMTest, FindMountPointForDevice)
EXPECT_EQ("/boot/efi", FindMountPointForDevice("/dev/sda1"));
EXPECT_EQ("/tmp", FindMountPointForDevice("tmpfs"));
- unlink(tempfile);
+ if (tempfile != NULL)
+ unlink(tempfile);
free(tempfile);
}
diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc
index 8d47c5098..a2c303768 100644
--- a/test/libapt/fileutl_test.cc
+++ b/test/libapt/fileutl_test.cc
@@ -53,11 +53,16 @@ static void TestFileFd(mode_t const a_umask, mode_t const ExpectedFilePermission
// ensure the memory is as predictably messed up
#define APT_INIT_READBACK \
char readback[20]; \
- memset(readback, 'D', sizeof(readback)/sizeof(readback[0])); \
+ memset(readback, 'D', sizeof(readback)*sizeof(readback[0])); \
readback[19] = '\0';
#define EXPECT_N_STR(expect, actual) \
EXPECT_EQ(0, strncmp(expect, actual, strlen(expect)));
-
+ {
+ APT_INIT_READBACK
+ char const * const expect = "DDDDDDDDDDDDDDDDDDD";
+ EXPECT_STREQ(expect,readback);
+ EXPECT_N_STR(expect, readback);
+ }
{
APT_INIT_READBACK
char const * const expect = "This";
@@ -247,37 +252,40 @@ TEST(FileUtlTest, Popen)
// output something
const char* Args[10] = {"/bin/echo", "meepmeep", NULL};
- bool res = Popen(Args, Fd, Child, FileFd::ReadOnly);
- Fd.Read(buf, sizeof(buf)-1, &n);
+ EXPECT_TRUE(Popen(Args, Fd, Child, FileFd::ReadOnly));
+ EXPECT_TRUE(Fd.Read(buf, sizeof(buf)-1, &n));
buf[n] = 0;
EXPECT_NE(n, 0);
- EXPECT_EQ(res, true);
EXPECT_STREQ(buf, "meepmeep\n");
// wait for the child to exit and cleanup
- ExecWait(Child, "PopenRead");
- Fd.Close();
+ EXPECT_TRUE(ExecWait(Child, "PopenRead"));
+ EXPECT_TRUE(Fd.Close());
// ensure that after a close all is good again
if(FileExists("/proc/self/fd"))
EXPECT_EQ(Glob("/proc/self/fd/*").size(), OpenFds.size());
-
// ReadWrite is not supported
- res = Popen(Args, Fd, Child, FileFd::ReadWrite);
- EXPECT_EQ(res, false);
- _error->Discard();
+ _error->PushToStack();
+ EXPECT_FALSE(Popen(Args, Fd, Child, FileFd::ReadWrite));
+ EXPECT_FALSE(Fd.IsOpen());
+ EXPECT_FALSE(Fd.Failed());
+ EXPECT_TRUE(_error->PendingError());
+ _error->RevertToStack();
// write something
Args[0] = "/bin/bash";
Args[1] = "-c";
Args[2] = "read";
Args[3] = NULL;
- res = Popen(Args, Fd, Child, FileFd::WriteOnly);
+ EXPECT_TRUE(Popen(Args, Fd, Child, FileFd::WriteOnly));
s = "\n";
- Fd.Write(s.c_str(), s.size());
- Fd.Close();
- ExecWait(Child, "PopenWrite");
+ EXPECT_TRUE(Fd.Write(s.c_str(), s.length()));
+ EXPECT_TRUE(Fd.Close());
+ EXPECT_FALSE(Fd.IsOpen());
+ EXPECT_FALSE(Fd.Failed());
+ EXPECT_TRUE(ExecWait(Child, "PopenWrite"));
}
TEST(FileUtlTest, flAbsPath)
{
diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc
index a19a0befd..63c63ecd3 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -194,6 +194,30 @@ TEST(HashSumsTest, FileBased)
}
fd.Seek(0);
{
+ Hashes hashes(Hashes::MD5SUM | Hashes::SHA512SUM);
+ hashes.AddFD(fd);
+ HashStringList list = hashes.GetHashStringList();
+ EXPECT_FALSE(list.empty());
+ EXPECT_EQ(3, list.size());
+ EXPECT_EQ(md5.Value(), list.find("MD5Sum")->HashValue());
+ EXPECT_EQ(NULL, list.find("SHA1"));
+ EXPECT_EQ(NULL, list.find("SHA256"));
+ EXPECT_EQ(sha512.Value(), list.find("SHA512")->HashValue());
+ EXPECT_EQ(FileSize, list.find("Checksum-FileSize")->HashValue());
+ fd.Seek(0);
+ Hashes hashes2(list);
+ hashes2.AddFD(fd);
+ list = hashes2.GetHashStringList();
+ EXPECT_FALSE(list.empty());
+ EXPECT_EQ(3, list.size());
+ EXPECT_EQ(md5.Value(), list.find("MD5Sum")->HashValue());
+ EXPECT_EQ(NULL, list.find("SHA1"));
+ EXPECT_EQ(NULL, list.find("SHA256"));
+ EXPECT_EQ(sha512.Value(), list.find("SHA512")->HashValue());
+ EXPECT_EQ(FileSize, list.find("Checksum-FileSize")->HashValue());
+ }
+ fd.Seek(0);
+ {
MD5Summation MD5;
MD5.AddFD(fd.Fd());
EXPECT_EQ(md5.Value(), MD5.Result().Value());
@@ -282,6 +306,7 @@ TEST(HashSumsTest, HashStringList)
EXPECT_EQ(NULL, list.find(NULL));
EXPECT_EQ(NULL, list.find(""));
EXPECT_EQ(NULL, list.find("MD5Sum"));
+ EXPECT_EQ(0, list.FileSize());
// empty lists aren't equal
HashStringList list2;
@@ -292,6 +317,8 @@ TEST(HashSumsTest, HashStringList)
list.push_back(HashString("Checksum-FileSize", "29"));
EXPECT_FALSE(list.empty());
EXPECT_FALSE(list.usable());
+ EXPECT_EQ(1, list.size());
+ EXPECT_EQ(29, list.FileSize());
Hashes hashes;
hashes.Add("The quick brown fox jumps over the lazy dog");
diff --git a/test/libapt/indexcopytosourcelist_test.cc b/test/libapt/indexcopytosourcelist_test.cc
index bec87601f..1b0427564 100644
--- a/test/libapt/indexcopytosourcelist_test.cc
+++ b/test/libapt/indexcopytosourcelist_test.cc
@@ -16,7 +16,7 @@ class NoCopy : public IndexCopy {
return Path;
}
bool GetFile(std::string &/*Filename*/, unsigned long long &/*Size*/) { return false; }
- bool RewriteEntry(FILE * /*Target*/, std::string /*File*/) { return false; }
+ bool RewriteEntry(FileFd & /*Target*/, std::string const &/*File*/) { return false; }
const char *GetFileName() { return NULL; }
const char *Type() { return NULL; }
diff --git a/test/libapt/makefile b/test/libapt/makefile
index 7f23ace46..61a8aaf31 100644
--- a/test/libapt/makefile
+++ b/test/libapt/makefile
@@ -8,6 +8,7 @@ APT_DOMAIN=none
include ../../buildlib/defaults.mak
.PHONY: test
+ifeq (file-okay,$(shell $(CC) -I $(BASE)/build/include -M gtest_runner.cc >/dev/null 2>&1 && echo 'file-okay'))
test: $(BIN)/gtest$(BASENAME)
MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=$(LIB) $(BIN)/gtest$(BASENAME)
@@ -71,3 +72,12 @@ $(LIB)/gtest.a: $(OBJ)/gtest-all.o
echo Building static library $@
-rm -f $@
$(AR) $(ARFLAGS) $@ $^
+
+else
+test:
+ @echo "APT uses Googles C++ testing framework for its unit tests"
+ @echo "On Debian systems this is available in the 'libgtest-dev' package."
+ @echo "Please install it before attempting to run the unit tests."
+ $(CC) -I $(BASE)/build/include -M gtest_runner.cc
+ exit 100
+endif
diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc
index eb2d76c43..747ab4957 100644
--- a/test/libapt/sourcelist_test.cc
+++ b/test/libapt/sourcelist_test.cc
@@ -20,7 +20,7 @@ class SourceList : public pkgSourceList {
TEST(SourceListTest,ParseFileDeb822)
{
FileFd fd;
- char * tempfile;
+ char * tempfile = NULL;
createTemporaryFile("parsefiledeb822", fd, &tempfile,
"Types: deb\n"
"URIs: http://ftp.debian.org/debian\n"
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc
index 9bc3c76fd..23dc08727 100644
--- a/test/libapt/strutil_test.cc
+++ b/test/libapt/strutil_test.cc
@@ -97,6 +97,28 @@ TEST(StrUtilTest,StartsWith)
EXPECT_FALSE(Startswith("abcd", "x"));
EXPECT_FALSE(Startswith("abcd", "abcndefg"));
}
+TEST(StrUtilTest,TimeToStr)
+{
+ EXPECT_EQ("0s", TimeToStr(0));
+ EXPECT_EQ("42s", TimeToStr(42));
+ EXPECT_EQ("9min 21s", TimeToStr((9*60) + 21));
+ EXPECT_EQ("20min 42s", TimeToStr((20*60) + 42));
+ EXPECT_EQ("10h 42min 21s", TimeToStr((10*3600) + (42*60) + 21));
+ EXPECT_EQ("10h 42min 21s", TimeToStr((10*3600) + (42*60) + 21));
+ EXPECT_EQ("1988d 3h 29min 7s", TimeToStr((1988*86400) + (3*3600) + (29*60) + 7));
+
+ EXPECT_EQ("59s", TimeToStr(59));
+ EXPECT_EQ("60s", TimeToStr(60));
+ EXPECT_EQ("1min 1s", TimeToStr(61));
+ EXPECT_EQ("59min 59s", TimeToStr(3599));
+ EXPECT_EQ("60min 0s", TimeToStr(3600));
+ EXPECT_EQ("1h 0min 1s", TimeToStr(3601));
+ EXPECT_EQ("1h 1min 0s", TimeToStr(3660));
+ EXPECT_EQ("23h 59min 59s", TimeToStr(86399));
+ EXPECT_EQ("24h 0min 0s", TimeToStr(86400));
+ EXPECT_EQ("1d 0h 0min 1s", TimeToStr(86401));
+ EXPECT_EQ("1d 0h 1min 0s", TimeToStr(86460));
+}
TEST(StrUtilTest,SubstVar)
{
EXPECT_EQ("", SubstVar("", "fails", "passes"));
diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc
index df618ea16..d7030f41a 100644
--- a/test/libapt/tagfile_test.cc
+++ b/test/libapt/tagfile_test.cc
@@ -34,6 +34,12 @@ TEST(TagFileTest,SingleField)
EXPECT_FALSE(section.Exists("FieldB-12345678"));
// There is only one section in this tag file
EXPECT_FALSE(tfile.Step(section));
+
+ // Now we scan an empty section to test reset
+ ASSERT_TRUE(section.Scan("\n\n", 2, true));
+ EXPECT_EQ(0, section.Count());
+ EXPECT_FALSE(section.Exists("FieldA-12345678"));
+ EXPECT_FALSE(section.Exists("FieldB-12345678"));
}
TEST(TagFileTest,MultipleSections)
diff --git a/test/libapt/tagsection_test.cc b/test/libapt/tagsection_test.cc
new file mode 100644
index 000000000..f250177af
--- /dev/null
+++ b/test/libapt/tagsection_test.cc
@@ -0,0 +1,270 @@
+#include <config.h>
+
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/tagfile.h>
+
+#include <string>
+#include <sstream>
+
+#include <gtest/gtest.h>
+
+#include "file-helpers.h"
+
+std::string packageValue = "aaaa";
+std::string typoValue = "aa\n"
+ " .\n"
+ " cc";
+std::string typoRawValue = "\n " + typoValue;
+std::string overrideValue = "1";
+/*
+ std::cerr << "FILECONTENT: »";
+ char buffer[3000];
+ while (fd.ReadLine(buffer, sizeof(buffer)))
+ std::cerr << buffer;
+ std::cerr << "«" << std::endl;;
+*/
+
+void setupTestcaseStart(FileFd &fd, pkgTagSection &section, std::string &content)
+{
+ createTemporaryFile("writesection", fd, NULL, NULL);
+ content = "Package: " + packageValue + "\n"
+ "TypoA:\n " + typoValue + "\n"
+ "Override: " + overrideValue + "\n"
+ "Override-Backup: " + overrideValue + "\n"
+ "\n";
+ EXPECT_TRUE(section.Scan(content.c_str(), content.length(), true));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_TRUE(section.Exists("TypoA"));
+ EXPECT_TRUE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_FALSE(section.Exists("TypoB"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(typoValue, section.FindS("TypoA"));
+ EXPECT_EQ(typoRawValue, section.FindRawS("TypoA"));
+ EXPECT_EQ(1, section.FindI("Override"));
+ EXPECT_EQ(1, section.FindI("Override-Backup"));
+ EXPECT_EQ(4, section.Count());
+}
+TEST(TagSectionTest,WriteUnmodified)
+{
+ FileFd fd;
+ pkgTagSection section;
+ std::string content;
+ setupTestcaseStart(fd, section, content);
+ EXPECT_TRUE(section.Write(fd));
+ EXPECT_TRUE(fd.Seek(0));
+ pkgTagFile tfile(&fd);
+ ASSERT_TRUE(tfile.Step(section));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_TRUE(section.Exists("TypoA"));
+ EXPECT_TRUE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_FALSE(section.Exists("TypoB"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(typoValue, section.FindS("TypoA"));
+ EXPECT_EQ(1, section.FindI("Override"));
+ EXPECT_EQ(1, section.FindI("Override-Backup"));
+ EXPECT_EQ(4, section.Count());
+}
+TEST(TagSectionTest,WriteUnmodifiedOrder)
+{
+ FileFd fd;
+ pkgTagSection section;
+ std::string content;
+ setupTestcaseStart(fd, section, content);
+ char const * const order[] = { "Package", "TypoA", "Override", NULL };
+ EXPECT_TRUE(section.Write(fd, order));
+ EXPECT_TRUE(fd.Seek(0));
+ pkgTagFile tfile(&fd);
+ ASSERT_TRUE(tfile.Step(section));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_TRUE(section.Exists("TypoA"));
+ EXPECT_TRUE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_FALSE(section.Exists("TypoB"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(typoValue, section.FindS("TypoA"));
+ EXPECT_EQ(1, section.FindI("Override"));
+ EXPECT_EQ(1, section.FindI("Override-Backup"));
+ EXPECT_EQ(4, section.Count());
+}
+TEST(TagSectionTest,WriteUnmodifiedOrderReversed)
+{
+ FileFd fd;
+ pkgTagSection section;
+ std::string content;
+ setupTestcaseStart(fd, section, content);
+ char const * const order[] = { "Override", "TypoA", "Package", NULL };
+ EXPECT_TRUE(section.Write(fd, order));
+ EXPECT_TRUE(fd.Seek(0));
+ pkgTagFile tfile(&fd);
+ ASSERT_TRUE(tfile.Step(section));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_TRUE(section.Exists("TypoA"));
+ EXPECT_TRUE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_FALSE(section.Exists("TypoB"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(typoValue, section.FindS("TypoA"));
+ EXPECT_EQ(1, section.FindI("Override"));
+ EXPECT_EQ(1, section.FindI("Override-Backup"));
+ EXPECT_EQ(4, section.Count());
+}
+TEST(TagSectionTest,WriteUnmodifiedOrderNotAll)
+{
+ FileFd fd;
+ pkgTagSection section;
+ std::string content;
+ setupTestcaseStart(fd, section, content);
+ char const * const order[] = { "Override", NULL };
+ EXPECT_TRUE(section.Write(fd, order));
+ EXPECT_TRUE(fd.Seek(0));
+ pkgTagFile tfile(&fd);
+ ASSERT_TRUE(tfile.Step(section));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_TRUE(section.Exists("TypoA"));
+ EXPECT_TRUE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_FALSE(section.Exists("TypoB"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(typoValue, section.FindS("TypoA"));
+ EXPECT_EQ(1, section.FindI("Override"));
+ EXPECT_EQ(1, section.FindI("Override-Backup"));
+ EXPECT_EQ(4, section.Count());
+}
+TEST(TagSectionTest,WriteNoOrderRename)
+{
+ FileFd fd;
+ pkgTagSection section;
+ std::string content;
+ setupTestcaseStart(fd, section, content);
+ std::vector<pkgTagSection::Tag> rewrite;
+ rewrite.push_back(pkgTagSection::Tag::Rename("TypoA", "TypoB"));
+ EXPECT_TRUE(section.Write(fd, NULL, rewrite));
+ EXPECT_TRUE(fd.Seek(0));
+ pkgTagFile tfile(&fd);
+ ASSERT_TRUE(tfile.Step(section));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_FALSE(section.Exists("TypoA"));
+ EXPECT_TRUE(section.Exists("TypoB"));
+ EXPECT_TRUE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(typoValue, section.FindS("TypoB"));
+ EXPECT_EQ(1, section.FindI("Override"));
+ EXPECT_EQ(1, section.FindI("Override-Backup"));
+ EXPECT_EQ(4, section.Count());
+}
+TEST(TagSectionTest,WriteNoOrderRemove)
+{
+ FileFd fd;
+ pkgTagSection section;
+ std::string content;
+ setupTestcaseStart(fd, section, content);
+ std::vector<pkgTagSection::Tag> rewrite;
+ rewrite.push_back(pkgTagSection::Tag::Remove("TypoA"));
+ rewrite.push_back(pkgTagSection::Tag::Rewrite("Override", ""));
+ EXPECT_TRUE(section.Write(fd, NULL, rewrite));
+ EXPECT_TRUE(fd.Seek(0));
+ pkgTagFile tfile(&fd);
+ ASSERT_TRUE(tfile.Step(section));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_FALSE(section.Exists("TypoA"));
+ EXPECT_FALSE(section.Exists("TypoB"));
+ EXPECT_FALSE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(2, section.Count());
+}
+TEST(TagSectionTest,WriteNoOrderRewrite)
+{
+ FileFd fd;
+ pkgTagSection section;
+ std::string content;
+ setupTestcaseStart(fd, section, content);
+ std::vector<pkgTagSection::Tag> rewrite;
+ rewrite.push_back(pkgTagSection::Tag::Rewrite("Override", "42"));
+ EXPECT_TRUE(section.Write(fd, NULL, rewrite));
+ EXPECT_TRUE(fd.Seek(0));
+ pkgTagFile tfile(&fd);
+ ASSERT_TRUE(tfile.Step(section));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_TRUE(section.Exists("TypoA"));
+ EXPECT_FALSE(section.Exists("TypoB"));
+ EXPECT_TRUE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(42, section.FindI("Override"));
+ EXPECT_EQ(1, section.FindI("Override-Backup"));
+ EXPECT_EQ(4, section.Count());
+}
+TEST(TagSectionTest,WriteOrderRename)
+{
+ FileFd fd;
+ pkgTagSection section;
+ std::string content;
+ setupTestcaseStart(fd, section, content);
+ std::vector<pkgTagSection::Tag> rewrite;
+ rewrite.push_back(pkgTagSection::Tag::Rename("TypoA", "TypoB"));
+ char const * const order[] = { "Package", "TypoA", "Override", NULL };
+ EXPECT_TRUE(section.Write(fd, order, rewrite));
+ EXPECT_TRUE(fd.Seek(0));
+ pkgTagFile tfile(&fd);
+ ASSERT_TRUE(tfile.Step(section));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_FALSE(section.Exists("TypoA"));
+ EXPECT_TRUE(section.Exists("TypoB"));
+ EXPECT_TRUE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(typoValue, section.FindS("TypoB"));
+ EXPECT_EQ(1, section.FindI("Override"));
+ EXPECT_EQ(1, section.FindI("Override-Backup"));
+ EXPECT_EQ(4, section.Count());
+}
+TEST(TagSectionTest,WriteOrderRemove)
+{
+ FileFd fd;
+ pkgTagSection section;
+ std::string content;
+ setupTestcaseStart(fd, section, content);
+ std::vector<pkgTagSection::Tag> rewrite;
+ rewrite.push_back(pkgTagSection::Tag::Remove("TypoA"));
+ rewrite.push_back(pkgTagSection::Tag::Rewrite("Override", ""));
+ char const * const order[] = { "Package", "TypoA", "Override", NULL };
+ EXPECT_TRUE(section.Write(fd, order, rewrite));
+ EXPECT_TRUE(fd.Seek(0));
+ pkgTagFile tfile(&fd);
+ ASSERT_TRUE(tfile.Step(section));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_FALSE(section.Exists("TypoA"));
+ EXPECT_FALSE(section.Exists("TypoB"));
+ EXPECT_FALSE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(1, section.FindI("Override-Backup"));
+ EXPECT_EQ(2, section.Count());
+}
+TEST(TagSectionTest,WriteOrderRewrite)
+{
+ FileFd fd;
+ pkgTagSection section;
+ std::string content;
+ setupTestcaseStart(fd, section, content);
+ std::vector<pkgTagSection::Tag> rewrite;
+ rewrite.push_back(pkgTagSection::Tag::Rewrite("Override", "42"));
+ char const * const order[] = { "Package", "TypoA", "Override", NULL };
+ EXPECT_TRUE(section.Write(fd, order, rewrite));
+ EXPECT_TRUE(fd.Seek(0));
+ pkgTagFile tfile(&fd);
+ ASSERT_TRUE(tfile.Step(section));
+ EXPECT_TRUE(section.Exists("Package"));
+ EXPECT_TRUE(section.Exists("TypoA"));
+ EXPECT_FALSE(section.Exists("TypoB"));
+ EXPECT_TRUE(section.Exists("Override"));
+ EXPECT_TRUE(section.Exists("Override-Backup"));
+ EXPECT_EQ(packageValue, section.FindS("Package"));
+ EXPECT_EQ(42, section.FindI("Override"));
+ EXPECT_EQ(1, section.FindI("Override-Backup"));
+ EXPECT_EQ(4, section.Count());
+}
diff --git a/test/libapt/uri_test.cc b/test/libapt/uri_test.cc
index 1662f51f0..fe6015e65 100644
--- a/test/libapt/uri_test.cc
+++ b/test/libapt/uri_test.cc
@@ -12,6 +12,10 @@ TEST(URITest, BasicHTTP)
EXPECT_EQ(90, U.Port);
EXPECT_EQ("www.debian.org", U.Host);
EXPECT_EQ("/temp/test", U.Path);
+ EXPECT_EQ("http://www.debian.org:90/temp/test", (std::string)U);
+ EXPECT_EQ("http://www.debian.org:90", URI::SiteOnly(U));
+ EXPECT_EQ("http://www.debian.org:90/temp/test", URI::ArchiveOnly(U));
+ EXPECT_EQ("http://www.debian.org:90/temp/test", URI::NoUserPassword(U));
// Login data
U = URI("http://jgg:foo@ualberta.ca/blah");
EXPECT_EQ("http", U.Access);
@@ -20,6 +24,10 @@ TEST(URITest, BasicHTTP)
EXPECT_EQ(0, U.Port);
EXPECT_EQ("ualberta.ca", U.Host);
EXPECT_EQ("/blah", U.Path);
+ EXPECT_EQ("http://jgg:foo@ualberta.ca/blah", (std::string)U);
+ EXPECT_EQ("http://ualberta.ca", URI::SiteOnly(U));
+ EXPECT_EQ("http://ualberta.ca/blah", URI::ArchiveOnly(U));
+ EXPECT_EQ("http://ualberta.ca/blah", URI::NoUserPassword(U));
}
TEST(URITest, SingeSlashFile)
{
@@ -30,6 +38,10 @@ TEST(URITest, SingeSlashFile)
EXPECT_EQ(0, U.Port);
EXPECT_EQ("", U.Host);
EXPECT_EQ("/usr/bin/foo", U.Path);
+ EXPECT_EQ("file:/usr/bin/foo", (std::string)U);
+ EXPECT_EQ("file:", URI::SiteOnly(U));
+ EXPECT_EQ("file:/usr/bin/foo", URI::ArchiveOnly(U));
+ EXPECT_EQ("file:/usr/bin/foo", URI::NoUserPassword(U));
}
TEST(URITest, BasicCDROM)
{
@@ -40,6 +52,10 @@ TEST(URITest, BasicCDROM)
EXPECT_EQ(0, U.Port);
EXPECT_EQ("Moo Cow Rom", U.Host);
EXPECT_EQ("/debian", U.Path);
+ EXPECT_EQ("cdrom://Moo Cow Rom/debian", (std::string)U);
+ EXPECT_EQ("cdrom://Moo Cow Rom", URI::SiteOnly(U));
+ EXPECT_EQ("cdrom://Moo Cow Rom/debian", URI::ArchiveOnly(U));
+ EXPECT_EQ("cdrom://Moo Cow Rom/debian", URI::NoUserPassword(U));
}
TEST(URITest, RelativeGzip)
{
@@ -50,6 +66,10 @@ TEST(URITest, RelativeGzip)
EXPECT_EQ(0, U.Port);
EXPECT_EQ(".", U.Host);
EXPECT_EQ("/bar/cow", U.Path);
+ EXPECT_EQ("gzip://./bar/cow", (std::string)U);
+ EXPECT_EQ("gzip://.", URI::SiteOnly(U));
+ EXPECT_EQ("gzip://./bar/cow", URI::ArchiveOnly(U));
+ EXPECT_EQ("gzip://./bar/cow", URI::NoUserPassword(U));
}
TEST(URITest, NoSlashFTP)
{
@@ -60,6 +80,10 @@ TEST(URITest, NoSlashFTP)
EXPECT_EQ(0, U.Port);
EXPECT_EQ("ftp.fr.debian.org", U.Host);
EXPECT_EQ("/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", U.Path);
+ EXPECT_EQ("ftp://ftp.fr.debian.org/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", (std::string)U);
+ EXPECT_EQ("ftp://ftp.fr.debian.org", URI::SiteOnly(U));
+ EXPECT_EQ("ftp://ftp.fr.debian.org/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", URI::ArchiveOnly(U));
+ EXPECT_EQ("ftp://ftp.fr.debian.org/debian/pool/main/x/xtel/xtel_3.2.1-15_i386.deb", URI::NoUserPassword(U));
}
TEST(URITest, RFC2732)
{
@@ -70,6 +94,10 @@ TEST(URITest, RFC2732)
EXPECT_EQ(0, U.Port);
EXPECT_EQ("1080::8:800:200C:417A", U.Host);
EXPECT_EQ("/foo", U.Path);
+ EXPECT_EQ("http://[1080::8:800:200C:417A]/foo", (std::string)U);
+ EXPECT_EQ("http://[1080::8:800:200C:417A]", URI::SiteOnly(U));
+ EXPECT_EQ("http://[1080::8:800:200C:417A]/foo", URI::ArchiveOnly(U));
+ EXPECT_EQ("http://[1080::8:800:200C:417A]/foo", URI::NoUserPassword(U));
// with port
U = URI("http://[::FFFF:129.144.52.38]:80/index.html");
EXPECT_EQ("http", U.Access);
@@ -78,6 +106,10 @@ TEST(URITest, RFC2732)
EXPECT_EQ(80, U.Port);
EXPECT_EQ("::FFFF:129.144.52.38", U.Host);
EXPECT_EQ("/index.html", U.Path);
+ EXPECT_EQ("http://[::FFFF:129.144.52.38]:80/index.html", (std::string)U);
+ EXPECT_EQ("http://[::FFFF:129.144.52.38]:80", URI::SiteOnly(U));
+ EXPECT_EQ("http://[::FFFF:129.144.52.38]:80/index.html", URI::ArchiveOnly(U));
+ EXPECT_EQ("http://[::FFFF:129.144.52.38]:80/index.html", URI::NoUserPassword(U));
// extra colon
U = URI("http://[::FFFF:129.144.52.38:]:80/index.html");
EXPECT_EQ("http", U.Access);
@@ -86,6 +118,10 @@ TEST(URITest, RFC2732)
EXPECT_EQ(80, U.Port);
EXPECT_EQ("::FFFF:129.144.52.38:", U.Host);
EXPECT_EQ("/index.html", U.Path);
+ EXPECT_EQ("http://[::FFFF:129.144.52.38:]:80/index.html", (std::string)U);
+ EXPECT_EQ("http://[::FFFF:129.144.52.38:]:80", URI::SiteOnly(U));
+ EXPECT_EQ("http://[::FFFF:129.144.52.38:]:80/index.html", URI::ArchiveOnly(U));
+ EXPECT_EQ("http://[::FFFF:129.144.52.38:]:80/index.html", URI::NoUserPassword(U));
// extra colon port
U = URI("http://[::FFFF:129.144.52.38:]/index.html");
EXPECT_EQ("http", U.Access);
@@ -94,6 +130,10 @@ TEST(URITest, RFC2732)
EXPECT_EQ(0, U.Port);
EXPECT_EQ("::FFFF:129.144.52.38:", U.Host);
EXPECT_EQ("/index.html", U.Path);
+ EXPECT_EQ("http://[::FFFF:129.144.52.38:]/index.html", (std::string)U);
+ EXPECT_EQ("http://[::FFFF:129.144.52.38:]", URI::SiteOnly(U));
+ EXPECT_EQ("http://[::FFFF:129.144.52.38:]/index.html", URI::ArchiveOnly(U));
+ EXPECT_EQ("http://[::FFFF:129.144.52.38:]/index.html", URI::NoUserPassword(U));
// My Evil Corruption of RFC 2732 to handle CDROM names!
// Fun for the whole family! */
U = URI("cdrom:[The Debian 1.2 disk, 1/2 R1:6]/debian/");
@@ -103,6 +143,10 @@ TEST(URITest, RFC2732)
EXPECT_EQ(0, U.Port);
EXPECT_EQ("The Debian 1.2 disk, 1/2 R1:6", U.Host);
EXPECT_EQ("/debian/", U.Path);
+ EXPECT_EQ("cdrom://[The Debian 1.2 disk, 1/2 R1:6]/debian/", (std::string)U);
+ EXPECT_EQ("cdrom://[The Debian 1.2 disk, 1/2 R1:6]", URI::SiteOnly(U));
+ EXPECT_EQ("cdrom://[The Debian 1.2 disk, 1/2 R1:6]/debian", URI::ArchiveOnly(U));
+ EXPECT_EQ("cdrom://[The Debian 1.2 disk, 1/2 R1:6]/debian/", URI::NoUserPassword(U));
// no brackets
U = URI("cdrom:Foo Bar Cow/debian/");
EXPECT_EQ("cdrom", U.Access);
@@ -111,9 +155,16 @@ TEST(URITest, RFC2732)
EXPECT_EQ(0, U.Port);
EXPECT_EQ("Foo Bar Cow", U.Host);
EXPECT_EQ("/debian/", U.Path);
+ EXPECT_EQ("cdrom://Foo Bar Cow/debian/", (std::string)U);
+ EXPECT_EQ("cdrom://Foo Bar Cow", URI::SiteOnly(U));
+ EXPECT_EQ("cdrom://Foo Bar Cow/debian", URI::ArchiveOnly(U));
+ EXPECT_EQ("cdrom://Foo Bar Cow/debian/", URI::NoUserPassword(U));
// percent encoded
U = URI("ftp://foo:b%40r@example.org");
EXPECT_EQ("foo", U.User);
EXPECT_EQ("b@r", U.Password);
EXPECT_EQ("ftp://foo:b%40r@example.org/", (std::string) U);
+ EXPECT_EQ("ftp://example.org", URI::SiteOnly(U));
+ EXPECT_EQ("ftp://example.org", URI::ArchiveOnly(U));
+ EXPECT_EQ("ftp://example.org/", URI::NoUserPassword(U));
}