summaryrefslogtreecommitdiff
path: root/debian/tests/regress
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2016-12-27 16:00:40 +0000
committerColin Watson <cjwatson@debian.org>2016-12-27 16:00:40 +0000
commitc46ae24baae62b55577aac54deccd631fa134062 (patch)
treea0b9dd9b0c2e3c5afbbde21c13c3739157dd9218 /debian/tests/regress
parentab9e62811d05708655a430199531465edda1e294 (diff)
When running regression tests under autopkgtest, use a non-root user with passwordless sudo.
Diffstat (limited to 'debian/tests/regress')
-rwxr-xr-xdebian/tests/regress27
1 files changed, 25 insertions, 2 deletions
diff --git a/debian/tests/regress b/debian/tests/regress
index 253541ad5..846482d62 100755
--- a/debian/tests/regress
+++ b/debian/tests/regress
@@ -1,10 +1,33 @@
1#! /bin/sh 1#! /bin/sh
2set -e 2set -e
3 3
4if [ "$(id -un)" != openssh-tests ]; then
5 TMP="$ADTTMP/user"
6
7 cleanup () {
8 rm -rf "$TMP"
9 rm -f /etc/sudoers.d/openssh-tests
10 if id openssh-tests >/dev/null 2>&1; then
11 deluser --remove-home openssh-tests
12 fi
13 }
14 trap cleanup EXIT
15
16 adduser --disabled-password --gecos 'OpenSSH tests' openssh-tests
17 cat >/etc/sudoers.d/openssh-tests <<EOF
18openssh-tests ALL = (ALL:ALL) NOPASSWD: ALL
19EOF
20 chmod 440 /etc/sudoers.d/openssh-tests
21 mkdir -p "$TMP"
22 chown openssh-tests:openssh-tests "$TMP"
23 sudo -u openssh-tests env TMP="$TMP" "$0" "$@"
24 exit "$?"
25fi
26
4# Don't use "make tests"; we want to test the installed version. 27# Don't use "make tests"; we want to test the installed version.
5 28
6cp -a . "$ADTTMP/tree" 29cp -a . "$TMP/tree"
7cd "$ADTTMP/tree" 30cd "$TMP/tree"
8 31
9# We aren't actually going to use most of this build, but we need a basic 32# We aren't actually going to use most of this build, but we need a basic
10# build tree in place in order to be able to build the regression tests. 33# build tree in place in order to be able to build the regression tests.