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