summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2018-11-05 23:20:28 +0000
committerColin Watson <cjwatson@debian.org>2018-11-05 23:20:29 +0000
commitb6760514d86206ce810da5f8895f3c364b047515 (patch)
treea560e672484de8661bc961eacaea2e0b64d92a8f
parentd41b9922e63e5069991d0e28079d710637715149 (diff)
Add an openssh-tests binary package
This contains enough files to run the upstream regression tests. Doing this allows autopkgtest to run more efficiently, as it doesn't have to build part of the source tree again.
-rw-r--r--debian/changelog3
-rw-r--r--debian/control16
-rw-r--r--debian/openssh-tests.install5
-rwxr-xr-xdebian/rules4
-rwxr-xr-xdebian/run-tests39
-rw-r--r--debian/tests/control8
-rwxr-xr-xdebian/tests/regress52
7 files changed, 70 insertions, 57 deletions
diff --git a/debian/changelog b/debian/changelog
index f4a1870d1..4b97e0d1d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ openssh (1:7.9p1-2) UNRELEASED; urgency=medium
4 * Make the autopkgtest create /run/sshd if it doesn't already exist. 4 * Make the autopkgtest create /run/sshd if it doesn't already exist.
5 * Drop "set -x" verbosity from the autopkgtest; I think we can do without 5 * Drop "set -x" verbosity from the autopkgtest; I think we can do without
6 this in most cases nowadays. 6 this in most cases nowadays.
7 * Add an openssh-tests binary package containing enough files to run the
8 upstream regression tests. This allows autopkgtest to run more
9 efficiently, as it doesn't have to build part of the source tree again.
7 10
8 -- Colin Watson <cjwatson@debian.org> Sat, 03 Nov 2018 16:28:16 +0000 11 -- Colin Watson <cjwatson@debian.org> Sat, 03 Nov 2018 16:28:16 +0000
9 12
diff --git a/debian/control b/debian/control
index 425d9ccf7..b91897ea9 100644
--- a/debian/control
+++ b/debian/control
@@ -153,6 +153,22 @@ Description: secure shell (SSH) sftp server module, for SFTP access from remote
153 Newer versions of the draft will not be supported, though some features 153 Newer versions of the draft will not be supported, though some features
154 are individually implemented as extensions. 154 are individually implemented as extensions.
155 155
156Package: openssh-tests
157Priority: optional
158Architecture: any
159Depends: openssh-client (= ${binary:Version}),
160 openssh-server (= ${binary:Version}),
161 openssh-sftp-server (= ${binary:Version}),
162 openssl,
163 putty-tools (>= 0.67-2),
164 python-twisted-conch (>= 1:15.5.0-1),
165 ${misc:Depends},
166 ${shlibs:Depends},
167Description: OpenSSH regression tests
168 This package provides OpenSSH's regression test suite. It is mainly
169 intended for use with the autopkgtest system, though can also be run
170 directly using /usr/lib/openssh/regress/run-tests.
171
156Package: ssh 172Package: ssh
157Priority: optional 173Priority: optional
158Architecture: all 174Architecture: all
diff --git a/debian/openssh-tests.install b/debian/openssh-tests.install
new file mode 100644
index 000000000..7c24e558f
--- /dev/null
+++ b/debian/openssh-tests.install
@@ -0,0 +1,5 @@
1regress /usr/lib/openssh
2debian/build-deb/regress /usr/lib/openssh
3
4debian/build-deb/config.h /usr/lib/openssh/regress
5debian/run-tests /usr/lib/openssh/regress
diff --git a/debian/rules b/debian/rules
index a41241079..24f1683dc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -130,6 +130,8 @@ override_dh_auto_configure-indep:
130 130
131override_dh_auto_build-arch: 131override_dh_auto_build-arch:
132 $(MAKE) -C debian/build-deb $(PARALLEL) ASKPASS_PROGRAM='/usr/bin/ssh-askpass' 132 $(MAKE) -C debian/build-deb $(PARALLEL) ASKPASS_PROGRAM='/usr/bin/ssh-askpass'
133 $(MAKE) -C debian/build-deb regress-prep
134 $(MAKE) -C debian/build-deb $(PARALLEL) regress-binaries
133ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),) 135ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
134 $(MAKE) -C debian/build-udeb $(PARALLEL) ASKPASS_PROGRAM='/usr/bin/ssh-askpass' ssh scp sftp sshd ssh-keygen 136 $(MAKE) -C debian/build-udeb $(PARALLEL) ASKPASS_PROGRAM='/usr/bin/ssh-askpass' ssh scp sftp sshd ssh-keygen
135endif 137endif
@@ -142,8 +144,6 @@ override_dh_auto_build-indep:
142 144
143override_dh_auto_test-arch: 145override_dh_auto_test-arch:
144ifeq ($(RUN_TESTS),yes) 146ifeq ($(RUN_TESTS),yes)
145 $(MAKE) -C debian/build-deb regress-prep
146 $(MAKE) -C debian/build-deb $(PARALLEL) regress-binaries
147 $(MAKE) -C debian/build-deb/regress \ 147 $(MAKE) -C debian/build-deb/regress \
148 .OBJDIR="$(CURDIR)/debian/build-deb/regress" \ 148 .OBJDIR="$(CURDIR)/debian/build-deb/regress" \
149 .CURDIR="$(CURDIR)/regress" \ 149 .CURDIR="$(CURDIR)/regress" \
diff --git a/debian/run-tests b/debian/run-tests
new file mode 100755
index 000000000..7c7a8b2a3
--- /dev/null
+++ b/debian/run-tests
@@ -0,0 +1,39 @@
1#! /bin/sh
2# Run installed OpenSSH regression tests.
3
4tmp="$1"
5if [ -z "$tmp" ]; then
6 tmp="$(mktemp -d)"
7 cleanup () {
8 rm -rf "$tmp"
9 }
10 trap cleanup EXIT
11fi
12
13# Copy the regression tests to a fresh directory; this is easier than trying
14# to pick apart which ones need write access.
15cp -a /usr/lib/openssh/regress "$tmp/regress"
16
17ret=0
18make -C "$tmp/regress" \
19 .OBJDIR="$tmp/regress" \
20 .CURDIR="$tmp/regress" \
21 BUILDDIR="$tmp/regress" \
22 OBJ="$tmp/regress" \
23 SUDO=sudo \
24 TEST_SHELL=sh \
25 TEST_SSH_SFTPSERVER=/usr/lib/openssh/sftp-server \
26 TEST_SSH_PLINK=plink \
27 TEST_SSH_PUTTYGEN=puttygen \
28 TEST_SSH_CONCH=conch \
29 TEST_SSH_IPV6=yes \
30 TEST_SSH_ECC=yes \
31 tests interop-tests </dev/zero || ret="$?"
32if [ "$ret" -ne 0 ]; then
33 for log in failed-regress.log failed-ssh.log failed-sshd.log; do
34 if [ -e "$tmp/regress/$log" ]; then
35 tail -v -n+0 "$tmp/regress/$log"
36 fi
37 done
38fi
39exit "$ret"
diff --git a/debian/tests/control b/debian/tests/control
index ba59c97b4..85220df4e 100644
--- a/debian/tests/control
+++ b/debian/tests/control
@@ -2,12 +2,6 @@ Tests: regress
2Restrictions: needs-root allow-stderr 2Restrictions: needs-root allow-stderr
3Depends: devscripts, 3Depends: devscripts,
4 haveged, 4 haveged,
5 openssh-client, 5 openssh-tests,
6 openssh-server,
7 openssh-sftp-server,
8 openssl,
9 putty-tools (>= 0.67-2),
10 python-twisted-conch (>= 1:15.5.0-1),
11 sudo, 6 sudo,
12 sysvinit-utils, 7 sysvinit-utils,
13 @builddeps@,
diff --git a/debian/tests/regress b/debian/tests/regress
index 6c2a8daec..8bb73ee95 100755
--- a/debian/tests/regress
+++ b/debian/tests/regress
@@ -15,11 +15,10 @@ if [ "$(id -un)" != openssh-tests ]; then
15 else 15 else
16 start-stop-daemon --stop --quiet \ 16 start-stop-daemon --stop --quiet \
17 --retry=TERM/30/KILL/5 \ 17 --retry=TERM/30/KILL/5 \
18 --pidfile "$TMP/haveged.pid" \ 18 --pidfile "$ADTTMP/haveged.pid" \
19 --name haveged 19 --name haveged
20 fi 20 fi
21 fi 21 fi
22 rm -rf "$TMP"
23 rm -f /etc/sudoers.d/openssh-tests 22 rm -f /etc/sudoers.d/openssh-tests
24 if id openssh-tests >/dev/null 2>&1; then 23 if id openssh-tests >/dev/null 2>&1; then
25 deluser --remove-home openssh-tests 24 deluser --remove-home openssh-tests
@@ -37,7 +36,6 @@ openssh-tests ALL = (ALL:ALL) NOPASSWD: ALL
37EOF 36EOF
38 chmod 440 /etc/sudoers.d/openssh-tests 37 chmod 440 /etc/sudoers.d/openssh-tests
39 mkdir -p "$TMP" 38 mkdir -p "$TMP"
40 cp -a . "$TMP/tree"
41 chown -R openssh-tests:openssh-tests "$TMP" 39 chown -R openssh-tests:openssh-tests "$TMP"
42 40
43 # Depending on how the environment is configured, our test 41 # Depending on how the environment is configured, our test
@@ -56,8 +54,8 @@ EOF
56 STARTED_HAVEGED=: 54 STARTED_HAVEGED=:
57 elif ! pidof haveged >/dev/null; then 55 elif ! pidof haveged >/dev/null; then
58 start-stop-daemon --start --quiet \ 56 start-stop-daemon --start --quiet \
59 --pidfile "$TMP/haveged.pid" \ 57 --pidfile "$ADTTMP/haveged.pid" \
60 --exec /usr/sbin/haveged -- -p "$TMP/haveged.pid" 58 --exec /usr/sbin/haveged -- -p "$ADTTMP/haveged.pid"
61 STARTED_HAVEGED=: 59 STARTED_HAVEGED=:
62 fi 60 fi
63 61
@@ -65,46 +63,4 @@ EOF
65 exit "$?" 63 exit "$?"
66fi 64fi
67 65
68# Don't use "make tests"; we want to test the installed version. 66annotate-output +%H:%M:%S.%N /usr/lib/openssh/regress/run-tests "$TMP"
69
70cd "$TMP/tree"
71
72# We aren't actually going to use most of this build, but we need a basic
73# build tree in place in order to be able to build the regression tests.
74autoreconf -f -i
75cp -f /usr/share/misc/config.guess /usr/share/misc/config.sub ./
76./configure
77make
78
79# The defaults for TEST_SSH_* in regress/test-exec.sh use the system
80# versions, but the top-level Makefile sets things up to test the just-built
81# versions, so we must bypass the latter in order to work correctly under
82# autopkgtest.
83make regress-prep
84make regress-binaries
85
86SRCDIR="$(pwd)"
87BUILDDIR="$SRCDIR"
88ret=0
89annotate-output +%H:%M:%S.%N make -C regress \
90 .OBJDIR="$BUILDDIR/regress" \
91 .CURDIR="$SRCDIR/regress" \
92 BUILDDIR="$BUILDDIR" \
93 OBJ="$BUILDDIR/regress" \
94 SUDO=sudo \
95 TEST_SHELL=sh \
96 TEST_SSH_SFTPSERVER=/usr/lib/openssh/sftp-server \
97 TEST_SSH_PLINK=plink \
98 TEST_SSH_PUTTYGEN=puttygen \
99 TEST_SSH_CONCH=conch \
100 TEST_SSH_IPV6=yes \
101 TEST_SSH_ECC=yes \
102 tests interop-tests </dev/zero || ret="$?"
103if [ "$ret" -ne 0 ]; then
104 for log in failed-regress.log failed-ssh.log failed-sshd.log; do
105 if [ -e "$BUILDDIR/regress/$log" ]; then
106 tail -v -n+0 "$BUILDDIR/regress/$log"
107 fi
108 done
109fi
110exit "$ret"