Makefile revision 1305e95ba6ff9fa202d0818caf10405df4b0f648
1#	$OpenBSD: Makefile,v 1.58 2011/01/06 22:46:21 djm Exp $
2
3REGRESS_TARGETS=	t1 t2 t3 t4 t5 t6 t7 t8 t9 t-exec
4tests:		$(REGRESS_TARGETS)
5
6# Interop tests are not run by default
7interop interop-tests: t-exec-interop
8
9clean:
10	for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
11	rm -rf $(OBJ).putty
12
13distclean:	clean
14
15LTESTS= 	connect \
16		proxy-connect \
17		connect-privsep \
18		proto-version \
19		proto-mismatch \
20		exit-status \
21		envpass \
22		transfer \
23		banner \
24		rekey \
25		stderr-data \
26		stderr-after-eof \
27		broken-pipe \
28		try-ciphers \
29		yes-head \
30		login-timeout \
31		agent \
32		agent-getpeereid \
33		agent-timeout \
34		agent-ptrace \
35		keyscan \
36		keygen-change \
37		keygen-convert \
38		key-options \
39		scp \
40		sftp \
41		sftp-cmds \
42		sftp-badcmds \
43		sftp-batch \
44		sftp-glob \
45		reconfigure \
46		dynamic-forward \
47		forwarding \
48		multiplex \
49		reexec \
50		brokenkeys \
51		cfgmatch \
52		addrmatch \
53		localcommand \
54		forcecommand \
55		portnum \
56		keytype \
57		kextype \
58		cert-hostkey \
59		cert-userkey \
60		host-expand
61
62INTEROP_TESTS=	putty-transfer putty-ciphers putty-kex conch-ciphers
63#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
64
65#LTESTS= 	cipher-speed
66
67USER!=		id -un
68CLEANFILES=	t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
69		t8.out t8.out.pub t9.out t9.out.pub \
70		authorized_keys_${USER} known_hosts pidfile \
71		ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \
72		rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
73		rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
74		ls.copy banner.in banner.out empty.in \
75		scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \
76		sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv \
77		known_hosts-cert host_ca_key* cert_host_key* \
78		putty.rsa2 sshd_proxy_orig ssh_proxy_bak \
79		key.rsa-* key.dsa-* key.ecdsa-* \
80		authorized_principals_${USER} expect actual
81
82# Enable all malloc(3) randomisations and checks
83TEST_ENV=      "MALLOC_OPTIONS=AFGJPRX"
84
85TEST_SSH_SSHKEYGEN?=ssh-keygen
86
87t1:
88	${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
89	tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv
90	${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv
91	awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv
92	${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv
93
94t2:
95	cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out
96	chmod 600 $(OBJ)/t2.out
97	${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t2.out | diff - ${.CURDIR}/rsa_openssh.pub
98
99t3:
100	${TEST_SSH_SSHKEYGEN} -ef ${.CURDIR}/rsa_openssh.pub >$(OBJ)/t3.out
101	${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub
102
103t4:
104	${TEST_SSH_SSHKEYGEN} -lf ${.CURDIR}/rsa_openssh.pub |\
105		awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
106
107t5:
108	${TEST_SSH_SSHKEYGEN} -Bf ${.CURDIR}/rsa_openssh.pub |\
109		awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
110
111t6:
112	${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.prv > $(OBJ)/t6.out1
113	${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.pub > $(OBJ)/t6.out2
114	chmod 600 $(OBJ)/t6.out1
115	${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t6.out1 | diff - $(OBJ)/t6.out2
116
117$(OBJ)/t7.out:
118	${TEST_SSH_SSHKEYGEN} -q -t rsa -N '' -f $@
119
120t7: $(OBJ)/t7.out
121	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t7.out > /dev/null
122	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t7.out > /dev/null
123
124$(OBJ)/t8.out:
125	${TEST_SSH_SSHKEYGEN} -q -t dsa -N '' -f $@
126
127t8: $(OBJ)/t8.out
128	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t8.out > /dev/null
129	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t8.out > /dev/null
130
131$(OBJ)/t9.out:
132	test "${TEST_SSH_ECC}" != yes || \
133	${TEST_SSH_SSHKEYGEN} -q -t ecdsa -N '' -f $@
134
135t9: $(OBJ)/t9.out
136	test "${TEST_SSH_ECC}" != yes || \
137	${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t9.out > /dev/null
138	test "${TEST_SSH_ECC}" != yes || \
139	${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null
140
141t-exec:	${LTESTS:=.sh}
142	@if [ "x$?" = "x" ]; then exit 0; fi; \
143	for TEST in ""$?; do \
144		echo "run test $${TEST}" ... 1>&2; \
145		(env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
146	done
147
148t-exec-interop:	${INTEROP_TESTS:=.sh}
149	@if [ "x$?" = "x" ]; then exit 0; fi; \
150	for TEST in ""$?; do \
151		echo "run test $${TEST}" ... 1>&2; \
152		(env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
153	done
154
155# Not run by default
156interop: ${INTEROP_TARGETS}
157