blob: 779abf4fb9c674be1db31b8f8ef4d430d353e938 [file] [log] [blame]
Damien Millerebafebd2013-01-18 11:51:56 +11001# $OpenBSD: Makefile,v 1.62 2013/01/18 00:45:29 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
Damien Miller9c8a4272008-03-27 17:42:06 +110011 rm -rf $(OBJ).putty
12
Darren Tuckerebc3c132003-09-04 15:37:58 +100013distclean: clean
Damien Miller38cd4352002-05-01 13:17:33 +100014
15LTESTS= connect \
16 proxy-connect \
17 connect-privsep \
18 proto-version \
19 proto-mismatch \
20 exit-status \
Darren Tucker4c37ef02004-06-16 20:08:56 +100021 envpass \
Damien Miller38cd4352002-05-01 13:17:33 +100022 transfer \
Darren Tuckerdc001a52003-10-08 17:47:19 +100023 banner \
Darren Tuckerd57a76e2003-06-18 22:32:51 +100024 rekey \
Damien Miller38cd4352002-05-01 13:17:33 +100025 stderr-data \
26 stderr-after-eof \
27 broken-pipe \
28 try-ciphers \
29 yes-head \
Darren Tucker017fd612004-02-29 20:30:17 +110030 login-timeout \
Damien Miller38cd4352002-05-01 13:17:33 +100031 agent \
Damien Miller8b9cde72003-01-22 17:53:16 +110032 agent-getpeereid \
33 agent-timeout \
34 agent-ptrace \
Damien Miller38cd4352002-05-01 13:17:33 +100035 keyscan \
Damien Miller8b9cde72003-01-22 17:53:16 +110036 keygen-change \
Damien Millerb6bd3c22010-02-24 17:24:56 +110037 keygen-convert \
Damien Miller2e80cf22008-06-30 08:06:25 +100038 key-options \
Darren Tucker50433a92004-06-16 20:15:59 +100039 scp \
Damien Miller38cd4352002-05-01 13:17:33 +100040 sftp \
Damien Miller8b9cde72003-01-22 17:53:16 +110041 sftp-cmds \
Darren Tuckera4040f52003-06-18 22:35:11 +100042 sftp-badcmds \
Damien Miller8b9cde72003-01-22 17:53:16 +110043 sftp-batch \
Darren Tucker1c56ef62005-03-07 17:36:18 +110044 sftp-glob \
Darren Tucker50cea672003-06-18 22:45:34 +100045 reconfigure \
Darren Tuckere2f2be72003-07-03 20:27:55 +100046 dynamic-forward \
Darren Tuckere7d05832004-06-16 20:22:22 +100047 forwarding \
Darren Tucker977a9d22004-06-25 13:45:18 +100048 multiplex \
Darren Tucker124f58e2004-12-06 23:07:37 +110049 reexec \
Damien Miller7b1877c2006-07-24 15:31:41 +100050 brokenkeys \
51 cfgmatch \
Darren Tucker10f92422008-06-10 23:16:46 +100052 addrmatch \
Damien Millera5e58422008-03-12 23:58:05 +110053 localcommand \
Darren Tucker287b9322009-10-07 10:31:56 +110054 forcecommand \
Damien Miller58ac6de2010-02-27 07:57:12 +110055 portnum \
Darren Tuckereab5f0d2010-11-05 18:23:38 +110056 keytype \
57 kextype \
Damien Miller58ac6de2010-02-27 07:57:12 +110058 cert-hostkey \
Damien Miller7d06b002011-01-07 09:54:20 +110059 cert-userkey \
Damien Miller771c43c2012-12-03 10:12:13 +110060 host-expand \
Damien Miller999bd2d2012-12-03 10:13:39 +110061 keys-command \
Damien Miller1fb593a2012-12-12 10:54:37 +110062 forward-control \
Damien Millerebafebd2013-01-18 11:51:56 +110063 integrity \
64 krl
Damien Miller38cd4352002-05-01 13:17:33 +100065
Damien Miller4268a132008-06-30 08:07:56 +100066INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
Damien Milleraf784932008-03-13 00:17:00 +110067#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
68
Darren Tuckereab5f0d2010-11-05 18:23:38 +110069#LTESTS= cipher-speed
70
Damien Miller38cd4352002-05-01 13:17:33 +100071USER!= id -un
Damien Miller369c0e82011-01-17 10:51:40 +110072CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
Damien Miller3a0e9f62010-11-05 10:16:34 +110073 t8.out t8.out.pub t9.out t9.out.pub \
Darren Tucker7b6cb5c2003-09-14 13:16:55 +100074 authorized_keys_${USER} known_hosts pidfile \
Darren Tucker3206e572004-12-06 23:04:57 +110075 ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \
Damien Miller38cd4352002-05-01 13:17:33 +100076 rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
77 rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
Darren Tucker50433a92004-06-16 20:15:59 +100078 ls.copy banner.in banner.out empty.in \
Damien Miller7b1877c2006-07-24 15:31:41 +100079 scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \
Damien Miller9c8a4272008-03-27 17:42:06 +110080 sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv \
Damien Millerebafebd2013-01-18 11:51:56 +110081 known_hosts-cert host_ca_key* cert_host_key* cert_user_key* \
Damien Miller369c0e82011-01-17 10:51:40 +110082 putty.rsa2 sshd_proxy_orig ssh_proxy_bak \
83 key.rsa-* key.dsa-* key.ecdsa-* \
Damien Miller999bd2d2012-12-03 10:13:39 +110084 authorized_principals_${USER} expect actual ready \
Damien Millerebafebd2013-01-18 11:51:56 +110085 sshd_proxy.* authorized_keys_${USER}.* modpipe revoked-* krl-*
Damien Miller999bd2d2012-12-03 10:13:39 +110086
Damien Miller38cd4352002-05-01 13:17:33 +100087
Damien Miller8f9492c2010-02-24 17:28:45 +110088# Enable all malloc(3) randomisations and checks
89TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
90
Damien Miller369c0e82011-01-17 10:51:40 +110091TEST_SSH_SSHKEYGEN?=ssh-keygen
92
Damien Millerb3764e12013-02-19 13:15:01 +110093CPPFLAGS=-I..
94
Damien Miller38cd4352002-05-01 13:17:33 +100095t1:
Damien Miller369c0e82011-01-17 10:51:40 +110096 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
Darren Tuckereab5f0d2010-11-05 18:23:38 +110097 tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv
Damien Miller369c0e82011-01-17 10:51:40 +110098 ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv
Darren Tuckereab5f0d2010-11-05 18:23:38 +110099 awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv
Damien Miller369c0e82011-01-17 10:51:40 +1100100 ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv
Damien Miller38cd4352002-05-01 13:17:33 +1000101
102t2:
Tim Rice8b2157d2003-09-09 06:07:10 -0700103 cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out
104 chmod 600 $(OBJ)/t2.out
Damien Miller369c0e82011-01-17 10:51:40 +1100105 ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t2.out | diff - ${.CURDIR}/rsa_openssh.pub
Damien Miller38cd4352002-05-01 13:17:33 +1000106
107t3:
Damien Miller369c0e82011-01-17 10:51:40 +1100108 ${TEST_SSH_SSHKEYGEN} -ef ${.CURDIR}/rsa_openssh.pub >$(OBJ)/t3.out
109 ${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub
Damien Miller38cd4352002-05-01 13:17:33 +1000110
111t4:
Damien Miller369c0e82011-01-17 10:51:40 +1100112 ${TEST_SSH_SSHKEYGEN} -lf ${.CURDIR}/rsa_openssh.pub |\
Damien Miller38cd4352002-05-01 13:17:33 +1000113 awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
114
115t5:
Damien Miller369c0e82011-01-17 10:51:40 +1100116 ${TEST_SSH_SSHKEYGEN} -Bf ${.CURDIR}/rsa_openssh.pub |\
Damien Miller38cd4352002-05-01 13:17:33 +1000117 awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
118
119t6:
Damien Miller369c0e82011-01-17 10:51:40 +1100120 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.prv > $(OBJ)/t6.out1
121 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.pub > $(OBJ)/t6.out2
Tim Rice8b2157d2003-09-09 06:07:10 -0700122 chmod 600 $(OBJ)/t6.out1
Damien Miller369c0e82011-01-17 10:51:40 +1100123 ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t6.out1 | diff - $(OBJ)/t6.out2
Damien Miller38cd4352002-05-01 13:17:33 +1000124
Tim Rice8b2157d2003-09-09 06:07:10 -0700125$(OBJ)/t7.out:
Damien Miller369c0e82011-01-17 10:51:40 +1100126 ${TEST_SSH_SSHKEYGEN} -q -t rsa -N '' -f $@
Damien Miller38cd4352002-05-01 13:17:33 +1000127
Tim Rice8b2157d2003-09-09 06:07:10 -0700128t7: $(OBJ)/t7.out
Damien Miller369c0e82011-01-17 10:51:40 +1100129 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t7.out > /dev/null
130 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t7.out > /dev/null
Damien Miller38cd4352002-05-01 13:17:33 +1000131
Tim Rice522262f2010-11-07 13:00:27 -0800132$(OBJ)/t8.out:
Damien Miller369c0e82011-01-17 10:51:40 +1100133 ${TEST_SSH_SSHKEYGEN} -q -t dsa -N '' -f $@
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100134
Tim Rice522262f2010-11-07 13:00:27 -0800135t8: $(OBJ)/t8.out
Damien Miller369c0e82011-01-17 10:51:40 +1100136 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t8.out > /dev/null
137 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t8.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100138
Tim Rice522262f2010-11-07 13:00:27 -0800139$(OBJ)/t9.out:
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100140 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100141 ${TEST_SSH_SSHKEYGEN} -q -t ecdsa -N '' -f $@
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100142
Tim Rice522262f2010-11-07 13:00:27 -0800143t9: $(OBJ)/t9.out
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100144 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100145 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t9.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100146 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100147 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100148
Damien Millerfaabeb62012-12-12 12:51:54 +1100149t-exec: ${LTESTS:=.sh}
Darren Tuckerebc3c132003-09-04 15:37:58 +1000150 @if [ "x$?" = "x" ]; then exit 0; fi; \
151 for TEST in ""$?; do \
152 echo "run test $${TEST}" ... 1>&2; \
Damien Miller527ded72010-07-02 13:40:16 +1000153 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
Darren Tuckerebc3c132003-09-04 15:37:58 +1000154 done
Damien Milleraf784932008-03-13 00:17:00 +1100155
156t-exec-interop: ${INTEROP_TESTS:=.sh}
157 @if [ "x$?" = "x" ]; then exit 0; fi; \
158 for TEST in ""$?; do \
159 echo "run test $${TEST}" ... 1>&2; \
Damien Miller527ded72010-07-02 13:40:16 +1000160 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
Damien Milleraf784932008-03-13 00:17:00 +1100161 done
162
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100163# Not run by default
164interop: ${INTEROP_TARGETS}