summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2021-03-08 09:21:06 +0000
committerJulian Andres Klode <jak@debian.org>2021-03-08 09:21:06 +0000
commitfbc06b381d14cfa9e2efb4b437b2ce1419e4f1a4 (patch)
tree24a6bc2a81d4b3d7ab716a1f5fd7acb619f0e528 /test
parent3a7aecd232dfdbcec5dbdc3af16e03479d47d917 (diff)
parent2a81f98b124d8fe551b160df55db1d3bf79a77c1 (diff)
Merge branch 'fix/rredemptypatches' into 'master'
Deal with rred shortcomings around empty patch files See merge request apt-team/apt!159
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework12
-rwxr-xr-xtest/integration/test-method-mirror10
-rwxr-xr-xtest/integration/test-method-rred5
-rwxr-xr-xtest/integration/test-pdiff-usage8
4 files changed, 25 insertions, 10 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 696fcd8cd..cfde80329 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -2126,6 +2126,9 @@ aptautotest() {
fi
}
+cdfind() {
+ ( cd /; find "$@" )
+}
aptautotest_aptget_update() {
local TESTCALL="$1"
while [ -n "$2" ]; do
@@ -2135,24 +2138,21 @@ aptautotest_aptget_update() {
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"
- (
- cd /
# all copied files are properly chmodded
local backupIFS="$IFS"
IFS="$(printf "\n\b")"
- find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | while read file; do
+ cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | while read file; do
testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
done
IFS="$backupIFS"
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' \)
+ testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \)
fi
if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then
testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \
- "$(find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)"
+ "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)"
fi
- )
}
aptautotest_apt_update() { aptautotest_aptget_update "$@"; }
aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; }
diff --git a/test/integration/test-method-mirror b/test/integration/test-method-mirror
index 56c9a10a0..81a5585fd 100755
--- a/test/integration/test-method-mirror
+++ b/test/integration/test-method-mirror
@@ -192,6 +192,16 @@ http://localhost:${APTHTTPPORT}/redirectme type:deb
testfailure apt update
testrundownload 'foo=2'
+msgmsg 'Mirrors can be filtered by' 'by-hash type'
+echo "http://localhost:${APTHTTPPORT}/failure type:foobar priority:1
+http://localhost:${APTHTTPPORT}/redirectme type:index type:deb
+" > aptarchive/mirror.txt
+rm -rf rootdir/var/lib/apt/lists
+testsuccess apt update -o Acquire::By-Hash=force #-o Debug::pkgAcquire::Worker=1
+cp rootdir/tmp/testsuccess.output forcedbyhash.output
+testfailure grep "localhost:${APTHTTPPORT}/failure" forcedbyhash.output
+testrundownload 'foo=2'
+
msgmsg 'The prefix for the mirrorlist is' 'passed on'
echo 'Dir::Bin::Methods::foo+mirror+file "mirror";
Dir::Bin::Methods::foo+mirror+http "mirror";
diff --git a/test/integration/test-method-rred b/test/integration/test-method-rred
index 645b0dfdd..5a42b8417 100755
--- a/test/integration/test-method-rred
+++ b/test/integration/test-method-rred
@@ -146,6 +146,7 @@ testrred 'Multi line change' 'more' '5,7c
- even more good stuff
- bonus good stuff
$(tail -n 12 ./Packages)"
+testrred 'Patch file' 'empty' '' "$(cat ./Packages)"
failrred() {
msgtest 'Failure caused by' "$1"
@@ -161,7 +162,6 @@ 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' '
@@ -222,7 +222,8 @@ createpatch 'Remove more stuff and fix later' '23d,
testsuccess apthelper cat-file --compress gzip Packages.ed-1
mv rootdir/tmp/testsuccess.output Packages.ed-1.gz
testsuccess rm Packages.ed-1
-createpatch 'Remove (old) dog paragraph' '10,19d' > Packages.ed-2
+touch Packages.ed-2 # an empty patch
+createpatch 'Remove (old) dog paragraph' '10,19d' > Packages.ed-3
mergepatches '11,19c
Package: extra-kittens
Version: unavailable
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index c5726dd08..b727aa138 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -100,12 +100,15 @@ testrun() {
PATCHINDEX='aptarchive/Packages.diff/Index'
echo "SHA256-Current: $(sha256sum "${PKGFILE}-new" | cut -d' ' -f 1) $(stat -c%s "${PKGFILE}-new")
SHA256-History:
+ $(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") 2000-08-18-2013.28
01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b 33053002 2010-08-18-2013.28
$(sha256sum "$PKGFILE" | cut -d' ' -f 1) $(stat -c%s "$PKGFILE") $(basename "$PATCHFILE")
SHA256-Patches:
+ $(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") 2000-08-18-2013.28
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 19722 2010-08-18-2013.28
$(sha256sum "$PATCHFILE" | cut -d' ' -f 1) $(stat -c%s "$PATCHFILE") $(basename "$PATCHFILE")
SHA256-Download:
+ $(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") 2000-08-18-2013.28.gz
d2a1b33187ed2d248eeae3b1223ea71791ea35f2138a713ed371332a6421f467 197 2010-08-18-2013.28.gz
$(sha256sum "${PATCHFILE}.gz" | cut -d' ' -f 1) $(stat -c%s "${PATCHFILE}.gz") $(basename "${PATCHFILE}.gz")" > "$PATCHINDEX"
@@ -254,7 +257,7 @@ SHA256-Download:
# This should work in at least 4% of the cases...
for i in $(seq 25); do
testfailure apt update "$@"
- if ! grep 'rred:600' rootdir/tmp/testfailure.output; then
+ if ! grep -q 'rred:600' rootdir/tmp/testfailure.output; then
break
fi
done
@@ -281,7 +284,8 @@ SHA256-Download:
rm "${PATCHFILE}.gz"
testsuccess apt update "$@"
cp rootdir/tmp/testsuccess.output patchdownload.output
- testsuccess grep '^Falling back to normal index file acquire' patchdownload.output
+ # it should be anchored on line start, but multiple processes on the same output stream…
+ testsuccess grep 'Falling back to normal index file acquire' patchdownload.output
testnopackage oldstuff
testsuccessequal "$(cat Packages-future)
" aptcache show apt newstuff futurestuff