blob: b19c7ae22437b2978330cdbc01d88184c66961a8 [file] [log] [blame]
Darren Tuckerf3568fc2013-05-17 09:35:26 +10001# $OpenBSD: Makefile,v 1.65 2013/04/18 02:46:12 djm Exp $
Damien Miller38cd4352002-05-01 13:17:33 +10002
Damien Miller3a0e9f62010-11-05 10:16:34 +11003REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t-exec
Tim Ricec31db8c2013-02-19 19:01:51 -08004tests: $(REGRESS_TARGETS)
Damien Miller38cd4352002-05-01 13:17:33 +10005
Damien Milleraf784932008-03-13 00:17:00 +11006# Interop tests are not run by default
Damien Miller66429962008-03-13 12:05:40 +11007interop interop-tests: t-exec-interop
Damien Milleraf784932008-03-13 00:17:00 +11008
Darren Tuckerebc3c132003-09-04 15:37:58 +10009clean:
Darren Tuckerb12d16f2003-09-14 11:40:35 +100010 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
Darren Tuckerf3568fc2013-05-17 09:35:26 +100011 test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN}
Damien Miller9c8a4272008-03-27 17:42:06 +110012 rm -rf $(OBJ).putty
13
Darren Tuckerebc3c132003-09-04 15:37:58 +100014distclean: clean
Damien Miller38cd4352002-05-01 13:17:33 +100015
16LTESTS= connect \
17 proxy-connect \
18 connect-privsep \
19 proto-version \
20 proto-mismatch \
21 exit-status \
Darren Tucker4c37ef02004-06-16 20:08:56 +100022 envpass \
Damien Miller38cd4352002-05-01 13:17:33 +100023 transfer \
Darren Tuckerdc001a52003-10-08 17:47:19 +100024 banner \
Darren Tuckerd57a76e2003-06-18 22:32:51 +100025 rekey \
Damien Miller38cd4352002-05-01 13:17:33 +100026 stderr-data \
27 stderr-after-eof \
28 broken-pipe \
29 try-ciphers \
30 yes-head \
Darren Tucker017fd612004-02-29 20:30:17 +110031 login-timeout \
Damien Miller38cd4352002-05-01 13:17:33 +100032 agent \
Damien Miller8b9cde72003-01-22 17:53:16 +110033 agent-getpeereid \
34 agent-timeout \
35 agent-ptrace \
Damien Miller38cd4352002-05-01 13:17:33 +100036 keyscan \
Damien Miller8b9cde72003-01-22 17:53:16 +110037 keygen-change \
Damien Millerb6bd3c22010-02-24 17:24:56 +110038 keygen-convert \
Damien Miller2e80cf22008-06-30 08:06:25 +100039 key-options \
Darren Tucker50433a92004-06-16 20:15:59 +100040 scp \
Damien Miller38cd4352002-05-01 13:17:33 +100041 sftp \
Darren Tuckerf3568fc2013-05-17 09:35:26 +100042 sftp-chroot \
Damien Miller8b9cde72003-01-22 17:53:16 +110043 sftp-cmds \
Darren Tuckera4040f52003-06-18 22:35:11 +100044 sftp-badcmds \
Damien Miller8b9cde72003-01-22 17:53:16 +110045 sftp-batch \
Darren Tucker1c56ef62005-03-07 17:36:18 +110046 sftp-glob \
Darren Tucker50cea672003-06-18 22:45:34 +100047 reconfigure \
Darren Tuckere2f2be72003-07-03 20:27:55 +100048 dynamic-forward \
Darren Tuckere7d05832004-06-16 20:22:22 +100049 forwarding \
Darren Tucker977a9d22004-06-25 13:45:18 +100050 multiplex \
Darren Tucker124f58e2004-12-06 23:07:37 +110051 reexec \
Damien Miller7b1877c2006-07-24 15:31:41 +100052 brokenkeys \
53 cfgmatch \
Darren Tucker10f92422008-06-10 23:16:46 +100054 addrmatch \
Damien Millera5e58422008-03-12 23:58:05 +110055 localcommand \
Darren Tucker287b9322009-10-07 10:31:56 +110056 forcecommand \
Damien Miller58ac6de2010-02-27 07:57:12 +110057 portnum \
Darren Tuckereab5f0d2010-11-05 18:23:38 +110058 keytype \
59 kextype \
Damien Miller58ac6de2010-02-27 07:57:12 +110060 cert-hostkey \
Damien Miller7d06b002011-01-07 09:54:20 +110061 cert-userkey \
Damien Miller771c43c2012-12-03 10:12:13 +110062 host-expand \
Damien Miller999bd2d2012-12-03 10:13:39 +110063 keys-command \
Damien Miller1fb593a2012-12-12 10:54:37 +110064 forward-control \
Damien Millerebafebd2013-01-18 11:51:56 +110065 integrity \
66 krl
Damien Miller38cd4352002-05-01 13:17:33 +100067
Damien Miller4268a132008-06-30 08:07:56 +100068INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
Damien Milleraf784932008-03-13 00:17:00 +110069#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
70
Darren Tuckereab5f0d2010-11-05 18:23:38 +110071#LTESTS= cipher-speed
72
Damien Miller38cd4352002-05-01 13:17:33 +100073USER!= id -un
Damien Miller369c0e82011-01-17 10:51:40 +110074CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
Damien Miller3a0e9f62010-11-05 10:16:34 +110075 t8.out t8.out.pub t9.out t9.out.pub \
Darren Tuckerfe10a282013-03-12 11:19:40 +110076 authorized_keys_${USER} known_hosts pidfile testdata \
Darren Tucker3206e572004-12-06 23:04:57 +110077 ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \
Damien Miller38cd4352002-05-01 13:17:33 +100078 rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
79 rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
Darren Tucker50433a92004-06-16 20:15:59 +100080 ls.copy banner.in banner.out empty.in \
Damien Miller7b1877c2006-07-24 15:31:41 +100081 scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \
Damien Miller9c8a4272008-03-27 17:42:06 +110082 sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv \
Damien Millerebafebd2013-01-18 11:51:56 +110083 known_hosts-cert host_ca_key* cert_host_key* cert_user_key* \
Damien Miller369c0e82011-01-17 10:51:40 +110084 putty.rsa2 sshd_proxy_orig ssh_proxy_bak \
85 key.rsa-* key.dsa-* key.ecdsa-* \
Damien Miller999bd2d2012-12-03 10:13:39 +110086 authorized_principals_${USER} expect actual ready \
Darren Tucker75129022013-05-17 09:19:10 +100087 sshd_proxy.* authorized_keys_${USER}.* modpipe revoked-* krl-* \
Darren Tuckerdfea3bc2013-05-17 09:31:39 +100088 ssh.log failed-ssh.log sshd.log failed-sshd.log \
89 regress.log failed-regress.log ssh-log-wrapper.sh
Damien Miller38cd4352002-05-01 13:17:33 +100090
Darren Tuckerf3568fc2013-05-17 09:35:26 +100091SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER}
92
Damien Miller8f9492c2010-02-24 17:28:45 +110093# Enable all malloc(3) randomisations and checks
94TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
95
Damien Miller369c0e82011-01-17 10:51:40 +110096TEST_SSH_SSHKEYGEN?=ssh-keygen
97
Damien Millerb3764e12013-02-19 13:15:01 +110098CPPFLAGS=-I..
99
Damien Miller38cd4352002-05-01 13:17:33 +1000100t1:
Damien Miller369c0e82011-01-17 10:51:40 +1100101 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100102 tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv
Damien Miller369c0e82011-01-17 10:51:40 +1100103 ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100104 awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv
Damien Miller369c0e82011-01-17 10:51:40 +1100105 ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv
Damien Miller38cd4352002-05-01 13:17:33 +1000106
107t2:
Tim Rice8b2157d2003-09-09 06:07:10 -0700108 cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out
109 chmod 600 $(OBJ)/t2.out
Damien Miller369c0e82011-01-17 10:51:40 +1100110 ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t2.out | diff - ${.CURDIR}/rsa_openssh.pub
Damien Miller38cd4352002-05-01 13:17:33 +1000111
112t3:
Damien Miller369c0e82011-01-17 10:51:40 +1100113 ${TEST_SSH_SSHKEYGEN} -ef ${.CURDIR}/rsa_openssh.pub >$(OBJ)/t3.out
114 ${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub
Damien Miller38cd4352002-05-01 13:17:33 +1000115
116t4:
Damien Miller369c0e82011-01-17 10:51:40 +1100117 ${TEST_SSH_SSHKEYGEN} -lf ${.CURDIR}/rsa_openssh.pub |\
Damien Miller38cd4352002-05-01 13:17:33 +1000118 awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
119
120t5:
Damien Miller369c0e82011-01-17 10:51:40 +1100121 ${TEST_SSH_SSHKEYGEN} -Bf ${.CURDIR}/rsa_openssh.pub |\
Damien Miller38cd4352002-05-01 13:17:33 +1000122 awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
123
124t6:
Damien Miller369c0e82011-01-17 10:51:40 +1100125 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.prv > $(OBJ)/t6.out1
126 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.pub > $(OBJ)/t6.out2
Tim Rice8b2157d2003-09-09 06:07:10 -0700127 chmod 600 $(OBJ)/t6.out1
Damien Miller369c0e82011-01-17 10:51:40 +1100128 ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t6.out1 | diff - $(OBJ)/t6.out2
Damien Miller38cd4352002-05-01 13:17:33 +1000129
Tim Rice8b2157d2003-09-09 06:07:10 -0700130$(OBJ)/t7.out:
Damien Miller369c0e82011-01-17 10:51:40 +1100131 ${TEST_SSH_SSHKEYGEN} -q -t rsa -N '' -f $@
Damien Miller38cd4352002-05-01 13:17:33 +1000132
Tim Rice8b2157d2003-09-09 06:07:10 -0700133t7: $(OBJ)/t7.out
Damien Miller369c0e82011-01-17 10:51:40 +1100134 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t7.out > /dev/null
135 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t7.out > /dev/null
Damien Miller38cd4352002-05-01 13:17:33 +1000136
Tim Rice522262f2010-11-07 13:00:27 -0800137$(OBJ)/t8.out:
Damien Miller369c0e82011-01-17 10:51:40 +1100138 ${TEST_SSH_SSHKEYGEN} -q -t dsa -N '' -f $@
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100139
Tim Rice522262f2010-11-07 13:00:27 -0800140t8: $(OBJ)/t8.out
Damien Miller369c0e82011-01-17 10:51:40 +1100141 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t8.out > /dev/null
142 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t8.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100143
Tim Rice522262f2010-11-07 13:00:27 -0800144$(OBJ)/t9.out:
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100145 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100146 ${TEST_SSH_SSHKEYGEN} -q -t ecdsa -N '' -f $@
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100147
Tim Rice522262f2010-11-07 13:00:27 -0800148t9: $(OBJ)/t9.out
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100149 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100150 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t9.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100151 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100152 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100153
Damien Millerfaabeb62012-12-12 12:51:54 +1100154t-exec: ${LTESTS:=.sh}
Darren Tuckerebc3c132003-09-04 15:37:58 +1000155 @if [ "x$?" = "x" ]; then exit 0; fi; \
156 for TEST in ""$?; do \
157 echo "run test $${TEST}" ... 1>&2; \
Damien Miller527ded72010-07-02 13:40:16 +1000158 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
Darren Tuckerebc3c132003-09-04 15:37:58 +1000159 done
Damien Milleraf784932008-03-13 00:17:00 +1100160
161t-exec-interop: ${INTEROP_TESTS:=.sh}
162 @if [ "x$?" = "x" ]; then exit 0; fi; \
163 for TEST in ""$?; do \
164 echo "run test $${TEST}" ... 1>&2; \
Damien Miller527ded72010-07-02 13:40:16 +1000165 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
Damien Milleraf784932008-03-13 00:17:00 +1100166 done
167
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100168# Not run by default
169interop: ${INTEROP_TARGETS}