summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-01-21 07:20:07 +0100
committerMichael Vogt <mvo@debian.org>2014-01-21 07:20:07 +0100
commitf744c64c591cec9e5aa489a9af55e1ed6d1871d1 (patch)
treede1d27910d66062508b22c5a7b46c288d1b3fab9 /test
parent7f316a3feab95370f1dd28c08c58bc3c140bf0a0 (diff)
parent1700c3cfb902f3f61fa4d9269523467fcceaaf58 (diff)
Merge remote-tracking branch 'upstream/debian/experimental-no-abi-break' into feature/source-deb822
Conflicts: test/integration/test-apt-sources-deb822
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework32
-rwxr-xr-xtest/integration/test-apt-binary47
-rwxr-xr-xtest/integration/test-apt-progress-fd-conffile17
-rwxr-xr-xtest/integration/test-apt-sources-deb82258
-rwxr-xr-xtest/integration/test-bug-728500-tempdir19
-rwxr-xr-xtest/integration/test-pdiff-usage156
-rw-r--r--test/libapt/sourcelist_test.cc1
7 files changed, 258 insertions, 72 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 6ada1e9cc..ca2f90050 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -99,6 +99,7 @@ aptconfig() { runapt apt-config $*; }
aptcache() { runapt apt-cache $*; }
aptcdrom() { runapt apt-cdrom $*; }
aptget() { runapt apt-get $*; }
+apt() { runapt apt $*; }
aptftparchive() { runapt apt-ftparchive $*; }
aptkey() { runapt apt-key $*; }
aptmark() { runapt apt-mark $*; }
@@ -202,6 +203,7 @@ setupenvironment() {
echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
echo 'quiet::NoUpdate "true";' >> aptconfig.conf
echo "Acquire::https::CaInfo \"${TESTDIR}/apt.pem\";" > rootdir/etc/apt/apt.conf.d/99https
+ echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary
export LC_ALL=C
export PATH="${PATH}:/usr/local/sbin:/usr/sbin:/sbin"
configcompression '.' 'gz' #'bz2' 'lzma' 'xz'
@@ -288,7 +290,7 @@ setupsimplenativepackage() {
local VERSION="$3"
local RELEASE="${4:-unstable}"
local DEPENDENCIES="$5"
- local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
If you find such a package installed on your system,
something went horribly wrong! They are autogenerated
und used only by testcases and surf no other propose…"}"
@@ -338,7 +340,7 @@ buildsimplenativepackage() {
local VERSION="$3"
local RELEASE="${4:-unstable}"
local DEPENDENCIES="$5"
- local DESCRIPTION="${6:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ local DESCRIPTION="${6:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
If you find such a package installed on your system,
something went horribly wrong! They are autogenerated
und used only by testcases and surf no other propose…"}"
@@ -535,7 +537,7 @@ insertpackage() {
local VERSION="$4"
local DEPENDENCIES="$5"
local PRIORITY="${6:-optional}"
- local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
+ local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/${RELEASE}
If you find such a package installed on your system,
something went horribly wrong! They are autogenerated
und used only by testcases and surf no other propose…"}"
@@ -595,7 +597,7 @@ insertinstalledpackage() {
local DEPENDENCIES="$4"
local PRIORITY="${5:-optional}"
local STATUS="${6:-install ok installed}"
- local DESCRIPTION="${7:-"Description: an autogenerated dummy ${NAME}=${VERSION}/installed
+ local DESCRIPTION="${7:-"an autogenerated dummy ${NAME}=${VERSION}/installed
If you find such a package installed on your system,
something went horribly wrong! They are autogenerated
und used only by testcases and surf no other propose…"}"
@@ -948,22 +950,22 @@ testempty() {
test -z "$($* 2>&1)" && msgpass || msgfail
}
-testequalwithmsg() {
- local MSG="$1"
- shift
+testequal() {
+ local MSG='Test of equality of'
+ if [ "$1" = '--nomsg' ]; then
+ MSG=''
+ shift
+ fi
+
local COMPAREFILE=$(mktemp)
addtrap "rm $COMPAREFILE;"
echo "$1" > $COMPAREFILE
shift
- msgtest "$MSG"
- $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
-}
-testequal() {
- local EXPECTED="$1"
- shift
- local MSG="Test for equality of $*"
- testequalwithmsg "$MSG" "$EXPECTED" $*
+ if [ -n "$MSG" ]; then
+ msgtest "$MSG" "$*"
+ fi
+ $* 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
}
testequalor2() {
diff --git a/test/integration/test-apt-binary b/test/integration/test-apt-binary
new file mode 100755
index 000000000..8d5df9051
--- /dev/null
+++ b/test/integration/test-apt-binary
@@ -0,0 +1,47 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+insertpackage 'unstable' 'foo' 'all' '1.0'
+insertinstalledpackage 'bar' 'i386' '1.0'
+
+insertinstalledpackage 'foobar' 'i386' '1.0'
+insertpackage 'unstable' 'foobar' 'i386' '2.0'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+testequal "Listing...
+bar/now 1.0 [installed,local] i386
+foo/unstable 1.0 all
+foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list
+
+testequal "Listing...
+foo/unstable 1.0 all
+foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list "foo*"
+
+testequal "Listing...
+foobar/unstable 2.0 [upgradable from: 1.0] i386" apt list --upgradable
+
+# FIXME: hm, hm - does it make sense to have this different? shouldn't
+# we use "installed,upgradable" consitently?
+testequal "Listing...
+bar/now 1.0 [installed,local] i386
+foobar/now 1.0 [installed,upgradable to: 2.0] i386" apt list --installed
+
+testequal "Listing...
+foobar/unstable 2.0 [upgradable from: 1.0] i386
+foobar/now 1.0 [installed,upgradable to: 2.0] i386
+" apt list foobar --all-versions
+
+testequal "Listing...
+bar/now 1.0 [installed,local] i386
+ an autogenerated dummy bar=1.0/installed
+" apt list bar --verbose
+
diff --git a/test/integration/test-apt-progress-fd-conffile b/test/integration/test-apt-progress-fd-conffile
index 0b42b1b2f..085d5e871 100755
--- a/test/integration/test-apt-progress-fd-conffile
+++ b/test/integration/test-apt-progress-fd-conffile
@@ -32,12 +32,19 @@ testsuccess aptget install compiz-core=1.0
# fake conffile change
echo "meep" >> rootdir/etc/compiz.conf/compiz.conf
-# install
+# FIXME: Is there really no way to see if dpkg actually prompts?
+msgtest 'Test for successful execution of' 'apt-get install compiz-core=2.0'
+OUTPUT=$(mktemp)
+addtrap "rm $OUTPUT;"
exec 3> apt-progress.log
-echo n | aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false
+if aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false -o dpkg::options::='--force-confold' >${OUTPUT} 2>&1; then
+ msgpass
+else
+ echo
+ cat $OUTPUT
+ msgfail
+fi
# and ensure there is a conffile message in the file
-msgtest "Conffile prompt in apt-progress.log"
+msgtest 'Test status fd for an included' 'pmconffile msg'
grep -q "pmconffile:/etc/compiz.conf/compiz.conf" apt-progress.log && msgpass || (cat apt-progress.log && msgfail)
-
-cat apt-progress.log \ No newline at end of file
diff --git a/test/integration/test-apt-sources-deb822 b/test/integration/test-apt-sources-deb822
index e74fc4cb9..743543cd5 100755
--- a/test/integration/test-apt-sources-deb822
+++ b/test/integration/test-apt-sources-deb822
@@ -5,17 +5,10 @@ TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386'
-SOURCES="rootdir/etc/apt/sources.list"
-
-echo "deb http://ftp.debian.org/debian stable main" > $SOURCES
-testequalwithmsg "Old style sources.list works" "'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
-
-
-BASE="# some comment
+SOURCES='rootdir/etc/apt/sources.list'
+BASE='# some comment
# that contains a : as well
#Types: meep
@@ -24,55 +17,62 @@ URIs: http://ftp.debian.org/debian
Suites: stable
Sections: main
Description: summay
- and the long part"
+ and the long part'
+
+msgtest 'Test old-style sources.list'
+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
-# simple case
+msgtest 'Test simple deb822 sources.list'
echo "$BASE" > $SOURCES
-testequalwithmsg "Simple deb822 sources.list works" "'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/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/InRelease' ftp.debian.org_debian_dists_stable_InRelease 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
-
-testequalwithmsg "Multiple entries in deb822 sources.list work" "'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/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/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/InRelease' ftp.debian.org_debian_dists_unstable_InRelease 0 " aptget update --print-uris
# two suite entries
+msgtest 'Test deb822 with' 'two Suite entries'
echo "$BASE" | sed -e "s/stable/stable unstable/" > $SOURCES
-testequalwithmsg "Two Suite entries deb822 sources.list work" "'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/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/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
-# ARCH option
+msgtest 'Test deb822' 'architecture option'
echo "$BASE" > $SOURCES
echo "Architectures: amd64,armel" >> $SOURCES
-
-testequalwithmsg "Arch: option in deb822 sources.list works" "'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/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
-# invalid sources.list file
-echo "deb http://ftp.debian.org" > $SOURCES
-testequalwithmsg "Invalid sources.list file gives proper error" "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist)
+msgtest 'Test old-style sources.list file which has' 'malformed dist'
+echo "deb http://ftp.debian.org" > $SOURCES
+testequal --nomsg "E: Malformed line 1 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (dist)
E: The list of sources could not be read." aptget update --print-uris
+msgtest 'Test deb822 sources.list file which has' 'malformed URI'
echo "Types: deb
Suites: stable
" > $SOURCES
-
-testequalwithmsg "Invalid deb822 sources.list file gives proper error" "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse)
+testequal --nomsg "E: Malformed stanza 0 in source list $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list (URI parse)
E: The list of sources could not be read." aptget update --print-uris
# with Enabled: false
@@ -81,8 +81,9 @@ echo "Enabled: no" >> $SOURCES
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
-testequalwithmsg "Multiple URIs work" "'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/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/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 :
@@ -90,8 +91,9 @@ testequalwithmsg "Multiple URIs work" "'http://ftp.de.debian.org/debian/dists/st
'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 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
-testequalwithmsg "Multiple Types work" "'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/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
diff --git a/test/integration/test-bug-728500-tempdir b/test/integration/test-bug-728500-tempdir
index 0606538a1..0451fc1ed 100755
--- a/test/integration/test-bug-728500-tempdir
+++ b/test/integration/test-bug-728500-tempdir
@@ -7,12 +7,23 @@ TESTDIR=$(readlink -f $(dirname $0))
setupenvironment
configarchitecture 'i386'
-buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'
+insertpackage 'unstable' 'coolstuff' 'all' '1.0'
setupaptarchive
changetowebserver
-msgtest 'Test with incorect TMPDIR'
+msgtest 'Test apt-get update with incorrect' 'TMPDIR'
+
+OUTPUT=$(mktemp)
+addtrap "rm $OUTPUT;"
export TMPDIR=/does-not-exists
-aptget update && msgpass || msgfail
-unset TMPDIR \ No newline at end of file
+if aptget update >${OUTPUT} 2>&1; then
+ msgpass
+else
+ echo
+ cat $OUTPUT
+ msgfail
+fi
+unset TMPDIR
+
+testequal 'coolstuff' aptcache pkgnames
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index ac0563b7f..ad31511b9 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -5,39 +5,155 @@ TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
-configarchitecture "i386"
+configarchitecture 'i386'
buildaptarchive
setupflataptarchive
changetowebserver
-signreleasefiles
-testsuccess aptget update
-testnopackage newstuff
PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
-testequal "$(cat ${PKGFILE})
+
+echo '#!/bin/sh
+touch merge-was-used
+/usr/bin/diffindex-rred "$@"' > extrred
+chmod +x extrred
+echo 'Dir::Bin::rred "./extrred";' > rootdir/etc/apt/apt.conf.d/99rred
+
+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
+
+ msgtest 'Check if the right pdiff merger was used'
+ if grep -q '^pkgAcqIndexMergeDiffs::Done(): rred' $OUTPUT; then
+ if echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
+ msgpass
+ else
+ msgfail "Merge shouldn't have been used, but was"
+ fi
+ elif echo "$*" | grep -q -- '-o Acquire::PDiffs::Merge=1'; then
+ msgfail "Merge should have been used, but wasn't"
+ else
+ msgpass
+ fi
+}
+
+testrun() {
+ # setup the base
+ 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
+ testsuccess aptget update "$@"
+ cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists-bak
+ testnopackage newstuff
+ testequal "$(cat ${PKGFILE})
" aptcache show apt oldstuff
-cp ${PKGFILE}-new aptarchive/Packages
-compressfile 'aptarchive/Packages'
-rm -rf aptarchive/Packages.diff
-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)
+ msgmsg 'Testcase: apply with one patch'
+ 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-0814.28
$(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
-generatereleasefiles '+1hour'
-signreleasefiles
-find aptarchive -name 'Packages*' -type f -delete
-testsuccess aptget update
+ generatereleasefiles '+1hour'
+ signreleasefiles
+ find aptarchive -name 'Packages*' -type f -delete
+ wasmergeused "$@"
+ testnopackage oldstuff
+ testequal "$(cat ${PKGFILE}-new)
+" aptcache show apt newstuff
+
+ msgmsg 'Testcase: index is already up-to-date'
+ find rootdir/var/lib/apt/lists -name '*.IndexDiff' -type f -delete
+ testsuccess aptget update "$@"
+ testequal "$(cat ${PKGFILE}-new)
+" aptcache show apt newstuff
+
+ msgmsg 'Testcase: apply with two patches'
+ cp ${PKGFILE}-new aptarchive/Packages
+ echo '
+Package: futurestuff
+Version: 1.0
+Architecture: i386
+Maintainer: Joe Sixpack <joe@example.org>
+Installed-Size: 202
+Filename: pool/futurestuff_1.0_i386.deb
+Size: 202200
+MD5sum: 311aeeaaae5ba33aff1ceaf3e1f76671
+SHA1: 3c695e028f7a1ae324deeaae5ba332desa81088c
+SHA256: b46fd154615edaae5ba33c56a5cc0e7deaef23e2da3e4f129727fd660f28f050
+Description: some cool and shiny future stuff
+ This package will appear in the next next mirror update
+Description-md5: d5f89fbbc2ce34c455dfee9b67d82b6b' >> aptarchive/Packages
+
+ compressfile 'aptarchive/Packages'
+ PATCHFILE2="aptarchive/Packages.diff/$(date -d 'now + 1hour' '+%Y-%m-%d-%H%M.%S')"
+ diff -e ${PKGFILE}-new aptarchive/Packages > ${PATCHFILE2} || true
+ cat $PATCHFILE2 | gzip > ${PATCHFILE2}.gz
+ echo "SHA1-Current: $(sha1sum aptarchive/Packages | cut -d' ' -f 1) $(stat -c%s aptarchive/Packages)
+SHA1-History:
+ 9f4148e06d7faa37062994ff10d0c842d7017513 33053002 2010-08-18-2013.28
+ $(sha1sum ${PKGFILE} | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}) $(basename ${PATCHFILE})
+ $(sha1sum ${PKGFILE}-new | cut -d' ' -f 1) $(stat -c%s ${PKGFILE}-new) $(basename ${PATCHFILE2})
+SHA1-Patches:
+ 7651fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28
+ $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)
+ $(sha1sum ${PATCHFILE2} | cut -d' ' -f 1) $(stat -c%s ${PATCHFILE2}) $(basename ${PATCHFILE2})" > $PATCHINDEX
+ generatereleasefiles '+2hour'
+ signreleasefiles
+ cp -a aptarchive/Packages Packages-future
+ find aptarchive -name 'Packages*' -type f -delete
+ rm -rf rootdir/var/lib/apt/lists
+ cp -a rootdir/var/lib/apt/lists-bak rootdir/var/lib/apt/lists
+ wasmergeused "$@"
+ testnopackage oldstuff
+ testequal "$(cat Packages-future)
+" aptcache show apt newstuff futurestuff
-testnopackage oldstuff
-testequal "$(cat ${PKGFILE}-new)
+ msgmsg 'Testcase: patch applying fails, but successful fallback'
+ 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
+ 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-0814.28
+ $(sha1sum $PATCHFILE | cut -d' ' -f 1) $(stat -c%s $PATCHFILE) $(basename $PATCHFILE)" > $PATCHINDEX
+ echo 'I am Mallory and I change files' >> $PATCHFILE
+ cat $PATCHFILE | gzip > ${PATCHFILE}.gz
+ generatereleasefiles '+1hour'
+ signreleasefiles
+ testsuccess aptget update "$@"
+ testnopackage oldstuff
+ testequal "$(cat ${PKGFILE}-new)
" aptcache show apt newstuff
+}
+
+testrun -o Debug::pkgAcquire::Diffs=1 -o Debug::pkgAcquire::rred=1 -o Acquire::PDiffs::Merge=0
+testrun -o Debug::pkgAcquire::Diffs=1 -o Debug::pkgAcquire::rred=1 -o Acquire::PDiffs::Merge=1
diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc
index 6ab30ba67..6fc84fd93 100644
--- a/test/libapt/sourcelist_test.cc
+++ b/test/libapt/sourcelist_test.cc
@@ -36,6 +36,7 @@ int main(int argc, char *argv[])
;
FileFd fd;
+ atexit(remove_tmpfile);
tempfile = strdup("apt-test.XXXXXXXX");
tempfile_fd = mkstemp(tempfile);