From b6760514d86206ce810da5f8895f3c364b047515 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 5 Nov 2018 23:20:28 +0000 Subject: 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. --- debian/changelog | 3 +++ debian/control | 16 ++++++++++++++ debian/openssh-tests.install | 5 +++++ debian/rules | 4 ++-- debian/run-tests | 39 +++++++++++++++++++++++++++++++++ debian/tests/control | 8 +------ debian/tests/regress | 52 ++++---------------------------------------- 7 files changed, 70 insertions(+), 57 deletions(-) create mode 100644 debian/openssh-tests.install create mode 100755 debian/run-tests 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 * Make the autopkgtest create /run/sshd if it doesn't already exist. * Drop "set -x" verbosity from the autopkgtest; I think we can do without this in most cases nowadays. + * Add an openssh-tests binary package containing enough files to run the + upstream regression tests. This allows autopkgtest to run more + efficiently, as it doesn't have to build part of the source tree again. -- Colin Watson Sat, 03 Nov 2018 16:28:16 +0000 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 Newer versions of the draft will not be supported, though some features are individually implemented as extensions. +Package: openssh-tests +Priority: optional +Architecture: any +Depends: openssh-client (= ${binary:Version}), + openssh-server (= ${binary:Version}), + openssh-sftp-server (= ${binary:Version}), + openssl, + putty-tools (>= 0.67-2), + python-twisted-conch (>= 1:15.5.0-1), + ${misc:Depends}, + ${shlibs:Depends}, +Description: OpenSSH regression tests + This package provides OpenSSH's regression test suite. It is mainly + intended for use with the autopkgtest system, though can also be run + directly using /usr/lib/openssh/regress/run-tests. + Package: ssh Priority: optional Architecture: 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 @@ +regress /usr/lib/openssh +debian/build-deb/regress /usr/lib/openssh + +debian/build-deb/config.h /usr/lib/openssh/regress +debian/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: override_dh_auto_build-arch: $(MAKE) -C debian/build-deb $(PARALLEL) ASKPASS_PROGRAM='/usr/bin/ssh-askpass' + $(MAKE) -C debian/build-deb regress-prep + $(MAKE) -C debian/build-deb $(PARALLEL) regress-binaries ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),) $(MAKE) -C debian/build-udeb $(PARALLEL) ASKPASS_PROGRAM='/usr/bin/ssh-askpass' ssh scp sftp sshd ssh-keygen endif @@ -142,8 +144,6 @@ override_dh_auto_build-indep: override_dh_auto_test-arch: ifeq ($(RUN_TESTS),yes) - $(MAKE) -C debian/build-deb regress-prep - $(MAKE) -C debian/build-deb $(PARALLEL) regress-binaries $(MAKE) -C debian/build-deb/regress \ .OBJDIR="$(CURDIR)/debian/build-deb/regress" \ .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 @@ +#! /bin/sh +# Run installed OpenSSH regression tests. + +tmp="$1" +if [ -z "$tmp" ]; then + tmp="$(mktemp -d)" + cleanup () { + rm -rf "$tmp" + } + trap cleanup EXIT +fi + +# Copy the regression tests to a fresh directory; this is easier than trying +# to pick apart which ones need write access. +cp -a /usr/lib/openssh/regress "$tmp/regress" + +ret=0 +make -C "$tmp/regress" \ + .OBJDIR="$tmp/regress" \ + .CURDIR="$tmp/regress" \ + BUILDDIR="$tmp/regress" \ + OBJ="$tmp/regress" \ + SUDO=sudo \ + TEST_SHELL=sh \ + TEST_SSH_SFTPSERVER=/usr/lib/openssh/sftp-server \ + TEST_SSH_PLINK=plink \ + TEST_SSH_PUTTYGEN=puttygen \ + TEST_SSH_CONCH=conch \ + TEST_SSH_IPV6=yes \ + TEST_SSH_ECC=yes \ + tests interop-tests = 0.67-2), - python-twisted-conch (>= 1:15.5.0-1), + openssh-tests, sudo, sysvinit-utils, - @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 else start-stop-daemon --stop --quiet \ --retry=TERM/30/KILL/5 \ - --pidfile "$TMP/haveged.pid" \ + --pidfile "$ADTTMP/haveged.pid" \ --name haveged fi fi - rm -rf "$TMP" rm -f /etc/sudoers.d/openssh-tests if id openssh-tests >/dev/null 2>&1; then deluser --remove-home openssh-tests @@ -37,7 +36,6 @@ openssh-tests ALL = (ALL:ALL) NOPASSWD: ALL EOF chmod 440 /etc/sudoers.d/openssh-tests mkdir -p "$TMP" - cp -a . "$TMP/tree" chown -R openssh-tests:openssh-tests "$TMP" # Depending on how the environment is configured, our test @@ -56,8 +54,8 @@ EOF STARTED_HAVEGED=: elif ! pidof haveged >/dev/null; then start-stop-daemon --start --quiet \ - --pidfile "$TMP/haveged.pid" \ - --exec /usr/sbin/haveged -- -p "$TMP/haveged.pid" + --pidfile "$ADTTMP/haveged.pid" \ + --exec /usr/sbin/haveged -- -p "$ADTTMP/haveged.pid" STARTED_HAVEGED=: fi @@ -65,46 +63,4 @@ EOF exit "$?" fi -# Don't use "make tests"; we want to test the installed version. - -cd "$TMP/tree" - -# We aren't actually going to use most of this build, but we need a basic -# build tree in place in order to be able to build the regression tests. -autoreconf -f -i -cp -f /usr/share/misc/config.guess /usr/share/misc/config.sub ./ -./configure -make - -# The defaults for TEST_SSH_* in regress/test-exec.sh use the system -# versions, but the top-level Makefile sets things up to test the just-built -# versions, so we must bypass the latter in order to work correctly under -# autopkgtest. -make regress-prep -make regress-binaries - -SRCDIR="$(pwd)" -BUILDDIR="$SRCDIR" -ret=0 -annotate-output +%H:%M:%S.%N make -C regress \ - .OBJDIR="$BUILDDIR/regress" \ - .CURDIR="$SRCDIR/regress" \ - BUILDDIR="$BUILDDIR" \ - OBJ="$BUILDDIR/regress" \ - SUDO=sudo \ - TEST_SHELL=sh \ - TEST_SSH_SFTPSERVER=/usr/lib/openssh/sftp-server \ - TEST_SSH_PLINK=plink \ - TEST_SSH_PUTTYGEN=puttygen \ - TEST_SSH_CONCH=conch \ - TEST_SSH_IPV6=yes \ - TEST_SSH_ECC=yes \ - tests interop-tests