debian: Hook the functional test suite into autopkgtest

We add two tests, one for normal user and directory root operation, and
another one for unprivileged and DPKG_ROOT operation.
This commit is contained in:
Guillem Jover
2021-01-03 19:48:04 +01:00
parent c1b7c5122b
commit 0a4f64d9ff
4 changed files with 34 additions and 0 deletions

View File

@ -94,6 +94,8 @@ EXTRA_DIST = \
debian/shlibs.default \
debian/shlibs.override \
debian/tests/control \
debian/tests/test-func \
debian/tests/test-func-root \
debian/tests/test-not-root \
debian/tests/test-root \
po/its/polkit.its \

View File

@ -5,3 +5,11 @@ Restrictions: superficial skippable
Tests: test-root
Depends: build-essential, autoconf, pkg-config, file
Restrictions: superficial needs-root breaks-testbed
Tests: test-func
Depends: @, eatmydata
Restrictions: allow-stderr
Tests: test-func-root
Depends: @, eatmydata
Restrictions: allow-stderr needs-root breaks-testbed

10
debian/tests/test-func vendored Normal file
View File

@ -0,0 +1,10 @@
#!/bin/sh
set -e
export DPKG_TESTSUITE_OPTIONS="debug"
export DPKG_ADMINDIR="$AUTOPKGTEST_TMP/db"
export DPKG_INSTDIR="$AUTOPKGTEST_TMP/root"
tests/db-regen "$DPKG_ADMINDIR" "$DPKG_INSTDIR"
eatmydata make -C tests test DPKG_INSTDIR="$DPKG_INSTDIR" DPKG_ADMINDIR="$DPKG_ADMINDIR"

14
debian/tests/test-func-root vendored Normal file
View File

@ -0,0 +1,14 @@
#!/bin/sh
set -e
if [ "$(id -u)" != '0' ]; then
# Fail, we declared needing root as a restriction.
exit 1
fi
export DPKG_TESTSUITE_OPTIONS="debug as-root"
export DPKG_ADMINDIR="$AUTOPKGTEST_TMP/db"
tests/db-regen "$DPKG_ADMINDIR" "/"
eatmydata make -C tests test DPKG_ADMINDIR="$DPKG_ADMINDIR"