summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-by-hash-update
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/test-apt-by-hash-update')
-rwxr-xr-xtest/integration/test-apt-by-hash-update26
1 files changed, 15 insertions, 11 deletions
diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update
index c00ab497b..9b97bdeba 100755
--- a/test/integration/test-apt-by-hash-update
+++ b/test/integration/test-apt-by-hash-update
@@ -14,16 +14,15 @@ insertpackage 'unstable' 'foo' 'all' '1.0'
setupaptarchive --no-update
# make Packages *only* accessible 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 &&
- mv ../../Packages* . &&
- ln -s Packages.gz $(sha512sum Packages.gz|cut -f1 -d' ') )
-
-# add sources
-mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512
-(cd aptarchive/dists/unstable/main/source/by-hash/SHA512 &&
- ln -s ../../Sources.gz $(sha512sum ../../Sources.gz|cut -f1 -d' ')
-)
+makebyhashonly() {
+ local NORMAL="$(readlink -f "./aptarchive/dists/unstable/main/${1}")"
+ local BYHASH="${NORMAL}/by-hash/SHA512"
+ mkdir -p "${BYHASH}"
+ find "${NORMAL}/" -maxdepth 1 -name "${2}*" -exec mv '{}' "$BYHASH" \;
+ ln -s "${BYHASH}/${2}.gz" "${BYHASH}/$(sha512sum "${BYHASH}/${2}.gz" | cut -f1 -d' ')"
+}
+makebyhashonly 'binary-i386' 'Packages'
+makebyhashonly 'source' 'Sources'
ensureitsbroken() {
rm -rf rootdir/var/lib/apt/lists
@@ -39,7 +38,12 @@ ensureitsbroken -o Acquire::By-Hash=1
ensureitworks() {
rm -rf rootdir/var/lib/apt/lists
- testsuccess aptget update -o Acquire::Languages=none "$@"
+ testsuccess aptget update "$@" -o Acquire::Languages=none
+ testfailure grep '^Ign' rootdir/tmp/testsuccess.output
+ rm -rf rootdir/var/lib/apt/lists
+ testsuccess aptget update "$@"
+ cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptupdate.output
+ testsuccess grep '^Ign' rootdir/tmp/aptupdate.output
testsuccessequal "Inst foo (1.0 unstable [all])
Conf foo (1.0 unstable [all])" aptget install -qq -s foo
}