xref: /freebsd/crypto/openssh/regress/Makefile (revision 8ef24a0d4b28fe230e20637f56869cc4148cd2ca)
1#	$OpenBSD: Makefile,v 1.82 2015/09/24 06:16:53 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		cert-file
79
80
81#		dhgex \
82
83INTEROP_TESTS=	putty-transfer putty-ciphers putty-kex conch-ciphers
84#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
85
86#LTESTS= 	cipher-speed
87
88USER!=		id -un
89CLEANFILES=	t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
90		t8.out t8.out.pub t9.out t9.out.pub t10.out t10.out.pub \
91		t12.out t12.out.pub \
92		authorized_keys_${USER} known_hosts pidfile testdata \
93		ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \
94		rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
95		rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
96		ls.copy banner.in banner.out empty.in \
97		scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \
98		sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv \
99		known_hosts-cert host_ca_key* cert_host_key* cert_user_key* \
100		putty.rsa2 sshd_proxy_orig ssh_proxy_bak \
101		key.rsa-* key.dsa-* key.ecdsa-* \
102		authorized_principals_${USER} expect actual ready \
103		sshd_proxy.* authorized_keys_${USER}.* modpipe revoked-* krl-* \
104		ssh.log failed-ssh.log sshd.log failed-sshd.log \
105		regress.log failed-regress.log ssh-log-wrapper.sh \
106		sftp-server.sh sftp-server.log sftp.log setuid-allowed \
107		data ed25519-agent ed25519-agent.pub key.ed25519-512 \
108		key.ed25519-512.pub netcat host_krl_* host_revoked_* \
109		kh.* user_*key* agent-key.* known_hosts.* hkr.*
110
111SUDO_CLEAN+=	/var/run/testdata_${USER} /var/run/keycommand_${USER}
112
113# Enable all malloc(3) randomisations and checks
114TEST_ENV=      "MALLOC_OPTIONS=AFGJPRX"
115
116TEST_SSH_SSHKEYGEN?=ssh-keygen
117
118CPPFLAGS=-I..
119
120t1:
121	${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
122	tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv
123	${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv
124	awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv
125	${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv
126
127t2:
128	cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out
129	chmod 600 $(OBJ)/t2.out
130	${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t2.out | diff - ${.CURDIR}/rsa_openssh.pub
131
132t3:
133	${TEST_SSH_SSHKEYGEN} -ef ${.CURDIR}/rsa_openssh.pub >$(OBJ)/t3.out
134	${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub
135
136t4:
137	${TEST_SSH_SSHKEYGEN} -E md5 -lf ${.CURDIR}/rsa_openssh.pub |\
138		awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
139
140t5:
141	${TEST_SSH_SSHKEYGEN} -Bf ${.CURDIR}/rsa_openssh.pub |\
142		awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
143
144t6:
145	${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.prv > $(OBJ)/t6.out1
146	${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.pub > $(OBJ)/t6.out2
147	chmod 600 $(OBJ)/t6.out1
148	${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t6.out1 | diff - $(OBJ)/t6.out2
149
150$(OBJ)/t7.out:
151	${TEST_SSH_SSHKEYGEN} -q -t rsa -N '' -f $@
152
153t7: $(OBJ)/t7.out
154	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t7.out > /dev/null
155	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t7.out > /dev/null
156
157$(OBJ)/t8.out:
158	${TEST_SSH_SSHKEYGEN} -q -t dsa -N '' -f $@
159
160t8: $(OBJ)/t8.out
161	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t8.out > /dev/null
162	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t8.out > /dev/null
163
164$(OBJ)/t9.out:
165	test "${TEST_SSH_ECC}" != yes || \
166	${TEST_SSH_SSHKEYGEN} -q -t ecdsa -N '' -f $@
167
168t9: $(OBJ)/t9.out
169	test "${TEST_SSH_ECC}" != yes || \
170	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t9.out > /dev/null
171	test "${TEST_SSH_ECC}" != yes || \
172	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null
173
174
175$(OBJ)/t10.out:
176	${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -f $@
177
178t10: $(OBJ)/t10.out
179	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t10.out > /dev/null
180	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t10.out > /dev/null
181
182t11:
183	${TEST_SSH_SSHKEYGEN} -E sha256 -lf ${.CURDIR}/rsa_openssh.pub |\
184		awk '{print $$2}' | diff - ${.CURDIR}/t11.ok
185
186$(OBJ)/t12.out:
187	${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -C 'test-comment-1234' -f $@
188
189t12: $(OBJ)/t12.out
190	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t12.out.pub | grep test-comment-1234 >/dev/null
191
192t-exec:	${LTESTS:=.sh}
193	@if [ "x$?" = "x" ]; then exit 0; fi; \
194	for TEST in ""$?; do \
195		echo "run test $${TEST}" ... 1>&2; \
196		(env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
197	done
198
199t-exec-interop:	${INTEROP_TESTS:=.sh}
200	@if [ "x$?" = "x" ]; then exit 0; fi; \
201	for TEST in ""$?; do \
202		echo "run test $${TEST}" ... 1>&2; \
203		(env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
204	done
205
206# Not run by default
207interop: ${INTEROP_TARGETS}
208
209# Unit tests, built by top-level Makefile
210unit:
211	set -e ; if test -z "${SKIP_UNIT}" ; then \
212		V="" ; \
213		test "x${USE_VALGRIND}" = "x" || \
214		    V=${.CURDIR}/valgrind-unit.sh ; \
215		$$V ${.OBJDIR}/unittests/sshbuf/test_sshbuf ; \
216		$$V ${.OBJDIR}/unittests/sshkey/test_sshkey \
217			-d ${.CURDIR}/unittests/sshkey/testdata ; \
218		$$V ${.OBJDIR}/unittests/bitmap/test_bitmap ; \
219		$$V ${.OBJDIR}/unittests/kex/test_kex ; \
220		$$V ${.OBJDIR}/unittests/hostkeys/test_hostkeys \
221			-d ${.CURDIR}/unittests/hostkeys/testdata ; \
222	fi
223