1 # $OpenBSD: Makefile,v 1.82 2015/09/24 06:16:53 djm Exp $
3 REGRESS_TARGETS= unit t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t-exec
4 tests: prep $(REGRESS_TARGETS)
6 # Interop tests are not run by default
7 interop interop-tests: t-exec-interop
10 test "x${USE_VALGRIND}" = "x" || mkdir -p $(OBJ)/valgrind-out
13 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
14 test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN}
83 INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
84 #INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
89 CLEANFILES= 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 \
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.*
111 SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER}
113 # Enable all malloc(3) randomisations and checks
114 TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
116 TEST_SSH_SSHKEYGEN?=ssh-keygen
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
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
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
137 ${TEST_SSH_SSHKEYGEN} -E md5 -lf ${.CURDIR}/rsa_openssh.pub |\
138 awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
141 ${TEST_SSH_SSHKEYGEN} -Bf ${.CURDIR}/rsa_openssh.pub |\
142 awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
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
151 ${TEST_SSH_SSHKEYGEN} -q -t rsa -N '' -f $@
154 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t7.out > /dev/null
155 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t7.out > /dev/null
158 ${TEST_SSH_SSHKEYGEN} -q -t dsa -N '' -f $@
161 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t8.out > /dev/null
162 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t8.out > /dev/null
165 test "${TEST_SSH_ECC}" != yes || \
166 ${TEST_SSH_SSHKEYGEN} -q -t ecdsa -N '' -f $@
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
176 ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -f $@
179 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t10.out > /dev/null
180 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t10.out > /dev/null
183 ${TEST_SSH_SSHKEYGEN} -E sha256 -lf ${.CURDIR}/rsa_openssh.pub |\
184 awk '{print $$2}' | diff - ${.CURDIR}/t11.ok
187 ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -C 'test-comment-1234' -f $@
190 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t12.out.pub | grep test-comment-1234 >/dev/null
192 t-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 $$?; \
199 t-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 $$?; \
207 interop: ${INTEROP_TARGETS}
209 # Unit tests, built by top-level Makefile
211 set -e ; if test -z "${SKIP_UNIT}" ; then \
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 ; \