diff options
Diffstat (limited to 'debian/tests/regress')
-rwxr-xr-x | debian/tests/regress | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/debian/tests/regress b/debian/tests/regress new file mode 100755 index 000000000..662526b54 --- /dev/null +++ b/debian/tests/regress | |||
@@ -0,0 +1,70 @@ | |||
1 | #! /bin/sh | ||
2 | set -e | ||
3 | |||
4 | if [ "$(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 | ||
18 | openssh-tests ALL = (ALL:ALL) NOPASSWD: ALL | ||
19 | EOF | ||
20 | chmod 440 /etc/sudoers.d/openssh-tests | ||
21 | mkdir -p "$TMP" | ||
22 | cp -a . "$TMP/tree" | ||
23 | chown -R openssh-tests:openssh-tests "$TMP" | ||
24 | sudo -u openssh-tests env TMP="$TMP" "$0" "$@" | ||
25 | exit "$?" | ||
26 | fi | ||
27 | |||
28 | # Don't use "make tests"; we want to test the installed version. | ||
29 | |||
30 | cd "$TMP/tree" | ||
31 | |||
32 | # We aren't actually going to use most of this build, but we need a basic | ||
33 | # build tree in place in order to be able to build the regression tests. | ||
34 | autoreconf -f -i | ||
35 | cp -f /usr/share/misc/config.guess /usr/share/misc/config.sub ./ | ||
36 | ./configure | ||
37 | make | ||
38 | |||
39 | # The defaults for TEST_SSH_* in regress/test-exec.sh use the system | ||
40 | # versions, but the top-level Makefile sets things up to test the just-built | ||
41 | # versions, so we must bypass the latter in order to work correctly under | ||
42 | # autopkgtest. | ||
43 | make regress-prep | ||
44 | make regress-binaries | ||
45 | |||
46 | SRCDIR="$(pwd)" | ||
47 | BUILDDIR="$SRCDIR" | ||
48 | ret=0 | ||
49 | annotate-output +%H:%M:%S.%N make -C regress \ | ||
50 | .OBJDIR="$BUILDDIR/regress" \ | ||
51 | .CURDIR="$SRCDIR/regress" \ | ||
52 | BUILDDIR="$BUILDDIR" \ | ||
53 | OBJ="$BUILDDIR/regress" \ | ||
54 | SUDO=sudo \ | ||
55 | TEST_SHELL='sh -x' \ | ||
56 | TEST_SSH_SFTPSERVER=/usr/lib/openssh/sftp-server \ | ||
57 | TEST_SSH_PLINK=plink \ | ||
58 | TEST_SSH_PUTTYGEN=puttygen \ | ||
59 | TEST_SSH_CONCH=conch \ | ||
60 | TEST_SSH_IPV6=yes \ | ||
61 | TEST_SSH_ECC=yes \ | ||
62 | tests interop-tests </dev/zero || ret="$?" | ||
63 | if [ "$ret" -ne 0 ]; then | ||
64 | for log in failed-regress.log failed-ssh.log failed-sshd.log; do | ||
65 | if [ -e "$BUILDDIR/regress/$log" ]; then | ||
66 | tail -v -n+0 "$BUILDDIR/regress/$log" | ||
67 | fi | ||
68 | done | ||
69 | fi | ||
70 | exit "$ret" | ||