summaryrefslogtreecommitdiffstats
path: root/debian/tests/regress
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 11:13:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 11:13:19 +0000
commit94597021fbf5b12b369b7bb3c13af715d8be8c4e (patch)
tree5195a1ab18ed95e7ae2e5bf5e74396b00861a6b7 /debian/tests/regress
parentAdding upstream version 1:8.4p1. (diff)
downloadopenssh-94597021fbf5b12b369b7bb3c13af715d8be8c4e.tar.xz
openssh-94597021fbf5b12b369b7bb3c13af715d8be8c4e.zip
Adding debian version 1:8.4p1-5+deb11u3.debian/1%8.4p1-5+deb11u3debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/tests/regress')
-rwxr-xr-xdebian/tests/regress67
1 files changed, 67 insertions, 0 deletions
diff --git a/debian/tests/regress b/debian/tests/regress
new file mode 100755
index 0000000..418bf55
--- /dev/null
+++ b/debian/tests/regress
@@ -0,0 +1,67 @@
+#! /bin/sh
+set -e
+
+if [ "$(id -un)" != openssh-tests ]; then
+ TMP="$AUTOPKGTEST_TMP/user"
+ CREATED_RUN_SSHD=false
+ STARTED_HAVEGED=false
+
+ cleanup () {
+ if $STARTED_HAVEGED; then
+ if [ -d /run/systemd/system ] && \
+ which systemctl >/dev/null 2>&1; then
+ systemctl disable haveged || true
+ systemctl stop haveged || true
+ else
+ start-stop-daemon --stop --quiet \
+ --retry=TERM/30/KILL/5 \
+ --pidfile "$AUTOPKGTEST_TMP/haveged.pid" \
+ --name haveged
+ fi
+ fi
+ rm -f /etc/sudoers.d/openssh-tests
+ if id openssh-tests >/dev/null 2>&1; then
+ deluser --remove-home openssh-tests
+ fi
+
+ if $CREATED_RUN_SSHD; then
+ rm -rf /run/sshd
+ fi
+ }
+ trap cleanup EXIT
+
+ adduser --disabled-password --gecos 'OpenSSH tests' openssh-tests
+ cat >/etc/sudoers.d/openssh-tests <<EOF
+openssh-tests ALL = (ALL:ALL) NOPASSWD: ALL
+EOF
+ chmod 440 /etc/sudoers.d/openssh-tests
+ mkdir -p "$TMP"
+ chown -R openssh-tests:openssh-tests "$TMP"
+
+ # Depending on how the environment is configured, our test
+ # dependency on openssh-server may not actually started sshd and
+ # thus may not have caused /run/sshd to be created.
+ if [ ! -d /run/sshd ]; then
+ mkdir -m755 /run/sshd
+ CREATED_RUN_SSHD=:
+ fi
+
+ # If we're running in a container, haveged may not have started
+ # automatically.
+ if [ -d /run/systemd/system ] && which systemctl >/dev/null 2>&1; then
+ systemctl enable haveged || true
+ systemctl start haveged || true
+ STARTED_HAVEGED=:
+ elif ! pidof haveged >/dev/null; then
+ start-stop-daemon --start --quiet \
+ --pidfile "$AUTOPKGTEST_TMP/haveged.pid" \
+ --exec /usr/sbin/haveged -- \
+ -p "$AUTOPKGTEST_TMP/haveged.pid"
+ STARTED_HAVEGED=:
+ fi
+
+ sudo -u openssh-tests env TMP="$TMP" "$0" "$@"
+ exit "$?"
+fi
+
+annotate-output +%H:%M:%S.%N /usr/lib/openssh/regress/run-tests "$TMP"