summaryrefslogtreecommitdiff
path: root/debian/tests
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2014-10-08 22:33:32 +0100
committerColin Watson <cjwatson@debian.org>2014-10-08 22:33:32 +0100
commit9779ee47871217df935261f6931eeb285198da51 (patch)
tree0754ce028799decd90984bdcd7e5eb7c64e42059 /debian/tests
parentf0b009aea83e9ff3a50be30f51012099a5143c16 (diff)
Run a subset of the upstream regression test suite at package build time, and the rest of it under autopkgtest.
Diffstat (limited to 'debian/tests')
-rw-r--r--debian/tests/Makefile12
-rw-r--r--debian/tests/control3
-rw-r--r--debian/tests/getpid.c39
-rwxr-xr-xdebian/tests/keygen-test12
-rw-r--r--debian/tests/regress38
5 files changed, 41 insertions, 63 deletions
diff --git a/debian/tests/Makefile b/debian/tests/Makefile
deleted file mode 100644
index 666ed8227..000000000
--- a/debian/tests/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
1test: getpid.so
2 chmod +x keygen-test
3 ./keygen-test
4
5getpid.o: getpid.c
6 gcc -fPIC -c $< -o $@
7
8getpid.so: getpid.o
9 gcc -shared -o $@ $<
10
11clean:
12 rm -f getpid.o getpid.so key1 key1.pub key2 key2.pub
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 000000000..77b515bf8
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,3 @@
1Tests: regress
2Restrictions: needs-root allow-stderr isolation-container
3Depends: @builddeps@, openssh-client, openssh-server, openssh-sftp-server, sudo, putty-tools, python-twisted-conch
diff --git a/debian/tests/getpid.c b/debian/tests/getpid.c
deleted file mode 100644
index c9e35b87e..000000000
--- a/debian/tests/getpid.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Compile:
3
4gcc -fPIC -c getpid.c -o getpid.o
5gcc -shared -o getpid.so getpid.o
6
7 * Use:
8
9FORCE_PID=1234 LD_PRELOAD=./getpid.so bash
10
11#
12# Copyright (C) 2001-2008 Kees Cook
13# kees@outflux.net, http://outflux.net/
14#
15# This program is free software; you can redistribute it and/or
16# modify it under the terms of the GNU General Public License
17# as published by the Free Software Foundation; either version 2
18# of the License, or (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program; if not, write to the Free Software
27# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28# http://www.gnu.org/copyleft/gpl.html
29
30*/
31
32#include <sys/types.h>
33#include <unistd.h>
34#include <stdlib.h>
35
36pid_t getpid(void)
37{
38 return atoi(getenv("FORCE_PID"));
39}
diff --git a/debian/tests/keygen-test b/debian/tests/keygen-test
deleted file mode 100755
index 02b7c761a..000000000
--- a/debian/tests/keygen-test
+++ /dev/null
@@ -1,12 +0,0 @@
1#! /bin/sh
2
3rm -f key1 key1.pub key2 key2.pub
4LD_PRELOAD="$(pwd)/getpid.so" FORCE_PID=1234 \
5 ../../build-deb/ssh-keygen -N '' -f key1 >/dev/null
6LD_PRELOAD="$(pwd)/getpid.so" FORCE_PID=1234 \
7 ../../build-deb/ssh-keygen -N '' -f key2 >/dev/null
8if cmp -s key1 key2; then
9 echo "Generated two identical keys!" >&2
10 exit 1
11fi
12exit 0
diff --git a/debian/tests/regress b/debian/tests/regress
new file mode 100644
index 000000000..0e3fbc4ae
--- /dev/null
+++ b/debian/tests/regress
@@ -0,0 +1,38 @@
1#! /bin/sh
2set -e
3
4# Don't use "make tests"; we want to test the installed version.
5
6cp -a . "$ADTTMP/tree"
7cd "$ADTTMP/tree"
8
9# 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.
11autoreconf -f -i
12cp -f /usr/share/misc/config.guess /usr/share/misc/config.sub ./
13./configure
14make
15
16# The defaults for TEST_SSH_* in regress/test-exec.sh use the system
17# versions, but the top-level Makefile sets things up to test the just-built
18# versions, so we must bypass the latter in order to work correctly under
19# autopkgtest.
20make regress-prep
21make regress/modpipe \
22 regress/setuid-allowed \
23 regress/unittests/sshbuf/test_sshbuf \
24 regress/unittests/sshkey/test_sshkey
25
26SRCDIR="$(pwd)"
27BUILDDIR="$SRCDIR"
28make -C regress \
29 .OBJDIR="$BUILDDIR/regress" \
30 .CURDIR="$SRCDIR/regress" \
31 BUILDDIR="$BUILDDIR" \
32 OBJ="$BUILDDIR/regress" \
33 SUDO=sudo \
34 TEST_SHELL=sh \
35 TEST_SSH_SFTPSERVER=/usr/lib/openssh/sftp-server \
36 TEST_SSH_IPV6=yes \
37 TEST_SSH_ECC=yes \
38 tests interop-tests