xref: /freebsd/crypto/openssh/regress/Makefile (revision 1f4bcc459a76b7aa664f3fd557684cd0ba6da352)
1#	$OpenBSD: Makefile,v 1.81 2015/05/21 06:44:25 djm Exp $
2
3REGRESS_TARGETS=	unit t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t-exec
4tests:		prep $(REGRESS_TARGETS)
5
6# Interop tests are not run by default
7interop interop-tests: t-exec-interop
8
9prep:
10	test "x${USE_VALGRIND}" = "x" || mkdir -p $(OBJ)/valgrind-out
11
12clean:
13	for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
14	test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN}
15	rm -rf $(OBJ).putty
16
17distclean:	clean
18
19LTESTS= 	connect \
20		proxy-connect \
21		connect-privsep \
22		proto-version \
23		proto-mismatch \
24		exit-status \
25		envpass \
26		transfer \
27		banner \
28		rekey \
29		stderr-data \
30		stderr-after-eof \
31		broken-pipe \
32		try-ciphers \
33		yes-head \
34		login-timeout \
35		agent \
36		agent-getpeereid \
37		agent-timeout \
38		agent-ptrace \
39		keyscan \
40		keygen-change \
41		keygen-convert \
42		key-options \
43		scp \
44		sftp \
45		sftp-chroot \
46		sftp-cmds \
47		sftp-badcmds \
48		sftp-batch \
49		sftp-glob \
50		sftp-perm \
51		reconfigure \
52		dynamic-forward \
53		forwarding \
54		multiplex \
55		reexec \
56		brokenkeys \
57		cfgparse \
58		cfgmatch \
59		addrmatch \
60		localcommand \
61		forcecommand \
62		portnum \
63		keytype \
64		kextype \
65		cert-hostkey \
66		cert-userkey \
67		host-expand \
68		keys-command \
69		forward-control \
70		integrity \
71		krl \
72		multipubkey \
73		limit-keytype \
74		hostkey-agent \
75		keygen-knownhosts \
76		hostkey-rotate \
77		principals-command
78
79
80#		dhgex \
81
82INTEROP_TESTS=	putty-transfer putty-ciphers putty-kex conch-ciphers
83#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
84
85#LTESTS= 	cipher-speed
86
87USER!=		id -un
88CLEANFILES=	t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
89		t8.out t8.out.pub t9.out t9.out.pub t10.out t10.out.pub \
90		t12.out t12.out.pub \
91		authorized_keys_${USER} known_hosts pidfile testdata \
92		ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \
93		rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
94		rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
95		ls.copy banner.in banner.out empty.in \
96		scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \
97		sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv \
98		known_hosts-cert host_ca_key* cert_host_key* cert_user_key* \
99		putty.rsa2 sshd_proxy_orig ssh_proxy_bak \
100		key.rsa-* key.dsa-* key.ecdsa-* \
101		authorized_principals_${USER} expect actual ready \
102		sshd_proxy.* authorized_keys_${USER}.* modpipe revoked-* krl-* \
103		ssh.log failed-ssh.log sshd.log failed-sshd.log \
104		regress.log failed-regress.log ssh-log-wrapper.sh \
105		sftp-server.sh sftp-server.log sftp.log setuid-allowed \
106		data ed25519-agent ed25519-agent.pub key.ed25519-512 \
107		key.ed25519-512.pub netcat host_krl_* host_revoked_* \
108		kh.* user_*key* agent-key.* known_hosts.* hkr.*
109
110SUDO_CLEAN+=	/var/run/testdata_${USER} /var/run/keycommand_${USER}
111
112# Enable all malloc(3) randomisations and checks
113TEST_ENV=      "MALLOC_OPTIONS=AFGJPRX"
114
115TEST_SSH_SSHKEYGEN?=ssh-keygen
116
117CPPFLAGS=-I..
118
119t1:
120	${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
121	tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv
122	${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv
123	awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv
124	${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv
125
126t2:
127	cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out
128	chmod 600 $(OBJ)/t2.out
129	${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t2.out | diff - ${.CURDIR}/rsa_openssh.pub
130
131t3:
132	${TEST_SSH_SSHKEYGEN} -ef ${.CURDIR}/rsa_openssh.pub >$(OBJ)/t3.out
133	${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub
134
135t4:
136	${TEST_SSH_SSHKEYGEN} -E md5 -lf ${.CURDIR}/rsa_openssh.pub |\
137		awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
138
139t5:
140	${TEST_SSH_SSHKEYGEN} -Bf ${.CURDIR}/rsa_openssh.pub |\
141		awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
142
143t6:
144	${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.prv > $(OBJ)/t6.out1
145	${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.pub > $(OBJ)/t6.out2
146	chmod 600 $(OBJ)/t6.out1
147	${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t6.out1 | diff - $(OBJ)/t6.out2
148
149$(OBJ)/t7.out:
150	${TEST_SSH_SSHKEYGEN} -q -t rsa -N '' -f $@
151
152t7: $(OBJ)/t7.out
153	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t7.out > /dev/null
154	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t7.out > /dev/null
155
156$(OBJ)/t8.out:
157	${TEST_SSH_SSHKEYGEN} -q -t dsa -N '' -f $@
158
159t8: $(OBJ)/t8.out
160	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t8.out > /dev/null
161	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t8.out > /dev/null
162
163$(OBJ)/t9.out:
164	test "${TEST_SSH_ECC}" != yes || \
165	${TEST_SSH_SSHKEYGEN} -q -t ecdsa -N '' -f $@
166
167t9: $(OBJ)/t9.out
168	test "${TEST_SSH_ECC}" != yes || \
169	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t9.out > /dev/null
170	test "${TEST_SSH_ECC}" != yes || \
171	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null
172
173
174$(OBJ)/t10.out:
175	${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -f $@
176
177t10: $(OBJ)/t10.out
178	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t10.out > /dev/null
179	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t10.out > /dev/null
180
181t11:
182	${TEST_SSH_SSHKEYGEN} -E sha256 -lf ${.CURDIR}/rsa_openssh.pub |\
183		awk '{print $$2}' | diff - ${.CURDIR}/t11.ok
184
185$(OBJ)/t12.out:
186	${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -C 'test-comment-1234' -f $@
187
188t12: $(OBJ)/t12.out
189	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t12.out.pub | grep test-comment-1234 >/dev/null
190
191t-exec:	${LTESTS:=.sh}
192	@if [ "x$?" = "x" ]; then exit 0; fi; \
193	for TEST in ""$?; do \
194		echo "run test $${TEST}" ... 1>&2; \
195		(env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
196	done
197
198t-exec-interop:	${INTEROP_TESTS:=.sh}
199	@if [ "x$?" = "x" ]; then exit 0; fi; \
200	for TEST in ""$?; do \
201		echo "run test $${TEST}" ... 1>&2; \
202		(env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
203	done
204
205# Not run by default
206interop: ${INTEROP_TARGETS}
207
208# Unit tests, built by top-level Makefile
209unit:
210	set -e ; if test -z "${SKIP_UNIT}" ; then \
211		V="" ; \
212		test "x${USE_VALGRIND}" = "x" || \
213		    V=${.CURDIR}/valgrind-unit.sh ; \
214		$$V ${.OBJDIR}/unittests/sshbuf/test_sshbuf ; \
215		$$V ${.OBJDIR}/unittests/sshkey/test_sshkey \
216			-d ${.CURDIR}/unittests/sshkey/testdata ; \
217		$$V ${.OBJDIR}/unittests/bitmap/test_bitmap ; \
218		$$V ${.OBJDIR}/unittests/kex/test_kex ; \
219		$$V ${.OBJDIR}/unittests/hostkeys/test_hostkeys \
220			-d ${.CURDIR}/unittests/hostkeys/testdata ; \
221	fi
222