summaryrefslogtreecommitdiffstats
path: root/debian/run-tests
blob: f71e49679a76cd839e44d053688c6de249cf1bfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/sh
# Run installed OpenSSH regression tests.

tmp="$1"
if [ -z "$tmp" ]; then
	tmp="$(mktemp -d)"
	cleanup () {
		rm -rf "$tmp"
	}
	trap cleanup EXIT
fi
shift
if [ -z "$1" ]; then
	set -- tests interop-tests
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_SSH=ssh \
	TEST_SSH_SFTPSERVER=/usr/lib/openssh/sftp-server \
	TEST_SSH_PLINK=plink \
	TEST_SSH_PUTTYGEN=puttygen \
	TEST_SSH_CONCH=conch3 \
	TEST_SSH_IPV6=yes \
	TEST_SSH_ECC=yes \
	TEST_SSH_UNSAFE_PERMISSIONS=1 \
	"$@" </dev/zero || ret="$?"
if [ "$ret" -ne 0 ]; then
	for log in failed-regress.log failed-ssh.log failed-sshd.log; do
		if [ -e "$tmp/regress/$log" ]; then
			tail -v -n+0 "$tmp/regress/$log"
		fi
	done
fi
exit "$ret"