summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-get-download
diff options
context:
space:
mode:
Diffstat (limited to 'test/integration/test-apt-get-download')
-rwxr-xr-xtest/integration/test-apt-get-download43
1 files changed, 41 insertions, 2 deletions
diff --git a/test/integration/test-apt-get-download b/test/integration/test-apt-get-download
index be3144e1f..0514542b3 100755
--- a/test/integration/test-apt-get-download
+++ b/test/integration/test-apt-get-download
@@ -11,8 +11,23 @@ buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
buildsimplenativepackage 'apt' 'all' '2.0' 'unstable'
insertinstalledpackage 'vrms' 'all' '1.0'
+umask 0027
+
setupaptarchive
+# apt-ftparchive knows how to chmod files
+find aptarchive/dists -name '*Packages*' -type f | while read file; do
+ testaccessrights "$file" '644'
+done
+# created by the framework without special care
+find aptarchive/dists -name '*Release*' -type f | while read file; do
+ testaccessrights "$file" '640'
+done
+# all copied files are properly chmodded
+find rootdir/var/lib/apt/lists -type f | while read file; do
+ testaccessrights "$file" '644'
+done
+
testdownload() {
local APT="$2"
if [ -n "$3" ]; then
@@ -20,10 +35,19 @@ testdownload() {
fi
msgtest "Test download of package file $1 with" "$APT"
testsuccess --nomsg aptget download ${APT}
- testsuccess test -f $1
- rm $1
+ testsuccess test -f "$1"
+ rm -f "$1"
}
+# normal case as "root"
+testdownload apt_2.0_all.deb apt
+
+# 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
+
# normal case(es)
testdownload apt_1.0_all.deb apt stable
testdownload apt_2.0_all.deb apt
@@ -45,3 +69,18 @@ rm -f apt_1.0_all.deb apt_2.0_all.deb
testsuccess aptget download apt apt apt/unstable apt=2.0
testsuccess test -s apt_2.0_all.deb
+# restore "root" rights
+chmod -f -R +w $PWD/rootdir/var/cache/apt/archives
+rm -rf rootdir/var/cache/apt/archives/
+
+# file: debs aren't copied to archives, so change to http which obviously are
+changetowebserver
+testsuccess aptget update
+
+# test with already stored deb
+testsuccess aptget install -d apt
+testsuccess test -s rootdir/var/cache/apt/archives/apt_2.0_all.deb
+testaccessrights 'aptarchive/pool/apt_2.0_all.deb' '644'
+mv aptarchive/pool/apt_2.0_all.deb aptarchive/pool/apt_2.0_all.deb.gone
+testdownload apt_2.0_all.deb apt
+mv aptarchive/pool/apt_2.0_all.deb.gone aptarchive/pool/apt_2.0_all.deb