diff options
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/framework | 5 | ||||
-rwxr-xr-x | test/integration/test-apt-helper | 7 | ||||
-rwxr-xr-x | test/integration/test-method-mirror | 33 |
3 files changed, 37 insertions, 8 deletions
diff --git a/test/integration/framework b/test/integration/framework index bc84de184..cf0a02de3 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -701,7 +701,8 @@ echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" echo "Source: $NAME Priority: $PRIORITY Maintainer: Joe Sixpack <joe@example.org> -Standards-Version: 3.9.3" +Standards-Version: 4.3.1 +Rules-Requires-Root: no" if [ "$SECTION" != '<none>' ]; then echo "Section: $SECTION" fi @@ -740,7 +741,7 @@ setupsimplenativepackage() { local NAME="$1" local VERSION="$3" local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" - test -e "${BUILDDIR}/debian/compat" || echo '7' > "${BUILDDIR}/debian/compat" + test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" } diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper index fda28968f..ae1ca7456 100755 --- a/test/integration/test-apt-helper +++ b/test/integration/test-apt-helper @@ -123,3 +123,10 @@ testfailureequal 'E: Must specify at least one SRV record' apthelper srv-lookup testfailureequal 'E: GetSrvRec failed for localhost' apthelper -q=1 srv-lookup 'localhost' testfailureequal "E: GetSrvRec failed for localhost:${APTHTTPPORT}" apthelper -q=1 srv-lookup "localhost:${APTHTTPPORT}" testfailureequal "E: GetSrvRec failed for localhost:${APTHTTPSPORT}" apthelper -q=1 srv-lookup "localhost:${APTHTTPSPORT}" + +msgmsg 'apt-helper' 'drop-privs' +testfailureequal "E: No command given to run without privileges" apthelper drop-privs +testsuccess apthelper -- drop-privs true +testsuccess apthelper drop-privs -- true +DATE="$(date -u +'%Y-%m-%d')" +testsuccessequal "$DATE" apthelper drop-privs -- date -u -d "$DATE" +'%Y-%m-%d' diff --git a/test/integration/test-method-mirror b/test/integration/test-method-mirror index 99d0c9700..38d6be9a9 100755 --- a/test/integration/test-method-mirror +++ b/test/integration/test-method-mirror @@ -1,9 +1,12 @@ #!/bin/sh set -e +umask 0 TESTDIR="$(readlink -f "$(dirname "$0")")" . "$TESTDIR/framework" +umask 022 + setupenvironment configarchitecture "i386" @@ -13,6 +16,8 @@ setupaptarchive --no-update changetowebserver webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://localhost:${APTHTTPPORT}/" addtrap 'prefix' "chmod -f -R +w $PWD/rootdir/var/lib/apt/lists || true;" +mkdir -m 755 -p rootdir/var/lib/apt +touch rootdir/var/lib/apt/extended_states testrundownload_internal_debs() { local WORKDIR="$1" @@ -52,17 +57,27 @@ testrundownload() { if [ "$(id -u)" = '0' ]; then testrundownload_internal "$@" else - chmod -f -R -w rootdir/var/lib/apt/lists + mkdir -p rootdir/var/cache/apt/archives/partial + echo 'Debug::SetupAPTPartialDirectory::AssumeGood "true";' > rootdir/etc/apt/apt.conf.d/assumegooddirs.conf + chmod -f 555 rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists/auxfiles rootdir/var/lib/apt/lists/partial testrundownload_internal "$@" - chmod -f -R +w rootdir/var/lib/apt/lists/auxfiles + testnotempty find rootdir/var/lib/apt/lists/auxfiles + testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555" + + chmod -f 755 rootdir/var/lib/apt/lists/auxfiles rm -f rootdir/var/lib/apt/lists/auxfiles/* - chmod -f -R -w rootdir/var/lib/apt/lists/auxfiles + chmod -f 555 rootdir/var/lib/apt/lists/auxfiles testrundownload_internal "$@" - chmod -f -R +w rootdir/var/lib/apt/lists + testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:555" + testempty find rootdir/var/lib/apt/lists/auxfiles ! -type d + + chmod -f 755 rootdir/var/lib/apt/lists rm -rf rootdir/var/lib/apt/lists/auxfiles - chmod -f -R -w rootdir/var/lib/apt/lists + chmod -f 555 rootdir/var/lib/apt/lists testrundownload_internal "$@" - chmod -f -R +w rootdir/var/lib/apt/lists + chmod -f 755 rootdir/var/lib/apt/lists + testsuccess test ! -d rootdir/var/lib/apt/lists/auxfiles + rm -f rootdir/etc/apt/apt.conf.d/assumegooddirs.conf fi } testrun() { @@ -157,6 +172,7 @@ Ign:2 https://localhost:${APTHTTPSPORT}/failure unstable InRelease Hit:2 http://localhost:${APTHTTPPORT}/redirectme unstable InRelease Reading package lists... Building dependency tree... +Reading state information... All packages are up to date." "Get:1 file:${APTARCHIVE}/mirror.txt Mirrorlist [$(stat -c%s 'aptarchive/mirror.txt') B] Ign:2 https://localhost:${APTHTTPSPORT}/failure unstable InRelease 404 Not Found @@ -165,6 +181,7 @@ Ign:2 http://localhost:${APTHTTPPORT}/failure2 unstable InRelease Hit:2 http://localhost:${APTHTTPPORT}/failure2 unstable InRelease Reading package lists... Building dependency tree... +Reading state information... All packages are up to date." apt update testfailure grep '/unused-failure' aptarchive/webserver.log @@ -186,6 +203,7 @@ testsuccessequal "Get:1 file:${APTARCHIVE}/mirror.txt Mirrorlist [$(stat -c%s 'a Hit:2 http://localhost:${APTHTTPPORT}/redirectme unstable InRelease Reading package lists... Building dependency tree... +Reading state information... All packages are up to date." apt update testrundownload 'foo=2' sed -i -e 's# mirror+# foo+mirror+#' rootdir/etc/apt/sources.list.d/* @@ -196,6 +214,7 @@ testsuccessequal "Get:1 foo+file:${APTARCHIVE}/mirror.txt Mirrorlist [$(stat -c% Hit:2 foo+http://localhost:${APTHTTPPORT}/redirectme unstable InRelease Reading package lists... Building dependency tree... +Reading state information... All packages are up to date." apt update testrundownload 'foo=2' @@ -209,6 +228,7 @@ Ign:2 foo+file:/nonexistent/apt/archive unstable InRelease Hit:2 foo+http://localhost:${APTHTTPPORT}/redirectme unstable InRelease Reading package lists... Building dependency tree... +Reading state information... All packages are up to date." apt update sed -i -e "s#+file:${APTARCHIVE}#+http://localhost:${APTHTTPPORT}#" rootdir/etc/apt/sources.list.d/* testsuccess apt update @@ -218,5 +238,6 @@ testsuccessequal "Get:1 foo+http://localhost:${APTHTTPPORT}/mirror.txt Mirrorlis Hit:2 foo+http://localhost:${APTHTTPPORT}/redirectme unstable InRelease Reading package lists... Building dependency tree... +Reading state information... All packages are up to date." apt update testrundownload 'foo=2' |