blob: 13e3fc8ab6f73c0b4eac00cedf245dcd7081f776 [file] [log] [blame]
djm@openbsd.orgd411d392015-01-26 06:12:18 +00001# $OpenBSD: Makefile,v 1.78 2015/01/26 06:12:18 djm Exp $
Damien Miller38cd4352002-05-01 13:17:33 +10002
markus@openbsd.org27ca1a52015-01-12 20:13:27 +00003REGRESS_TARGETS= unit t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t-exec
Damien Miller9e1cfca2015-02-26 20:32:58 -08004tests: prep $(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
Damien Miller9e1cfca2015-02-26 20:32:58 -08009prep:
10 test "x${USE_VALGRIND}" != "x" && mkdir -p $(OBJ)/valgrind-out
11
Darren Tuckerebc3c132003-09-04 15:37:58 +100012clean:
Darren Tuckerb12d16f2003-09-14 11:40:35 +100013 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
Darren Tuckerf3568fc2013-05-17 09:35:26 +100014 test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN}
Damien Miller9c8a4272008-03-27 17:42:06 +110015 rm -rf $(OBJ).putty
16
Darren Tuckerebc3c132003-09-04 15:37:58 +100017distclean: clean
Damien Miller38cd4352002-05-01 13:17:33 +100018
19LTESTS= connect \
20 proxy-connect \
21 connect-privsep \
22 proto-version \
23 proto-mismatch \
24 exit-status \
Darren Tucker4c37ef02004-06-16 20:08:56 +100025 envpass \
Damien Miller38cd4352002-05-01 13:17:33 +100026 transfer \
Darren Tuckerdc001a52003-10-08 17:47:19 +100027 banner \
Darren Tuckerd57a76e2003-06-18 22:32:51 +100028 rekey \
Damien Miller38cd4352002-05-01 13:17:33 +100029 stderr-data \
30 stderr-after-eof \
31 broken-pipe \
32 try-ciphers \
33 yes-head \
Darren Tucker017fd612004-02-29 20:30:17 +110034 login-timeout \
Damien Miller38cd4352002-05-01 13:17:33 +100035 agent \
Damien Miller8b9cde72003-01-22 17:53:16 +110036 agent-getpeereid \
37 agent-timeout \
38 agent-ptrace \
Damien Miller38cd4352002-05-01 13:17:33 +100039 keyscan \
Damien Miller8b9cde72003-01-22 17:53:16 +110040 keygen-change \
Damien Millerb6bd3c22010-02-24 17:24:56 +110041 keygen-convert \
Damien Miller2e80cf22008-06-30 08:06:25 +100042 key-options \
Darren Tucker50433a92004-06-16 20:15:59 +100043 scp \
Damien Miller38cd4352002-05-01 13:17:33 +100044 sftp \
Darren Tuckerf3568fc2013-05-17 09:35:26 +100045 sftp-chroot \
Damien Miller8b9cde72003-01-22 17:53:16 +110046 sftp-cmds \
Darren Tuckera4040f52003-06-18 22:35:11 +100047 sftp-badcmds \
Damien Miller8b9cde72003-01-22 17:53:16 +110048 sftp-batch \
Darren Tucker1c56ef62005-03-07 17:36:18 +110049 sftp-glob \
Damien Millera176e182013-10-18 09:05:41 +110050 sftp-perm \
Darren Tucker50cea672003-06-18 22:45:34 +100051 reconfigure \
Darren Tuckere2f2be72003-07-03 20:27:55 +100052 dynamic-forward \
Darren Tuckere7d05832004-06-16 20:22:22 +100053 forwarding \
Darren Tucker977a9d22004-06-25 13:45:18 +100054 multiplex \
Darren Tucker124f58e2004-12-06 23:07:37 +110055 reexec \
Damien Miller7b1877c2006-07-24 15:31:41 +100056 brokenkeys \
57 cfgmatch \
Darren Tucker10f92422008-06-10 23:16:46 +100058 addrmatch \
Damien Millera5e58422008-03-12 23:58:05 +110059 localcommand \
Darren Tucker287b9322009-10-07 10:31:56 +110060 forcecommand \
Damien Miller58ac6de2010-02-27 07:57:12 +110061 portnum \
Darren Tuckereab5f0d2010-11-05 18:23:38 +110062 keytype \
63 kextype \
Damien Miller58ac6de2010-02-27 07:57:12 +110064 cert-hostkey \
Damien Miller7d06b002011-01-07 09:54:20 +110065 cert-userkey \
Damien Miller771c43c2012-12-03 10:12:13 +110066 host-expand \
Damien Miller999bd2d2012-12-03 10:13:39 +110067 keys-command \
Damien Miller1fb593a2012-12-12 10:54:37 +110068 forward-control \
Damien Millerebafebd2013-01-18 11:51:56 +110069 integrity \
djm@openbsd.org4bea0ab2014-12-22 08:06:03 +000070 krl \
djm@openbsd.org09205532015-01-13 07:49:49 +000071 multipubkey \
djm@openbsd.orgd59ec472015-01-18 19:47:55 +000072 limit-keytype \
djm@openbsd.org79478102015-01-18 22:00:18 +000073 hostkey-agent \
djm@openbsd.orgd411d392015-01-26 06:12:18 +000074 keygen-knownhosts \
75 hostkey-rotate
djm@openbsd.org09205532015-01-13 07:49:49 +000076
77
Damien Miller2476c312014-03-02 04:01:00 +110078# dhgex \
Damien Miller38cd4352002-05-01 13:17:33 +100079
Damien Miller4268a132008-06-30 08:07:56 +100080INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
Damien Milleraf784932008-03-13 00:17:00 +110081#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
82
Darren Tuckereab5f0d2010-11-05 18:23:38 +110083#LTESTS= cipher-speed
84
Damien Miller38cd4352002-05-01 13:17:33 +100085USER!= id -un
Damien Miller369c0e82011-01-17 10:51:40 +110086CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
Damien Miller9f4c8e72013-12-29 17:57:46 +110087 t8.out t8.out.pub t9.out t9.out.pub t10.out t10.out.pub \
markus@openbsd.org27ca1a52015-01-12 20:13:27 +000088 t12.out t12.out.pub \
Darren Tuckerfe10a282013-03-12 11:19:40 +110089 authorized_keys_${USER} known_hosts pidfile testdata \
Darren Tucker3206e572004-12-06 23:04:57 +110090 ssh_config sshd_config.orig ssh_proxy sshd_config sshd_proxy \
Damien Miller38cd4352002-05-01 13:17:33 +100091 rsa.pub rsa rsa1.pub rsa1 host.rsa host.rsa1 \
92 rsa-agent rsa-agent.pub rsa1-agent rsa1-agent.pub \
Darren Tucker50433a92004-06-16 20:15:59 +100093 ls.copy banner.in banner.out empty.in \
Damien Miller7b1877c2006-07-24 15:31:41 +100094 scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \
Damien Miller9c8a4272008-03-27 17:42:06 +110095 sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv \
Damien Millerebafebd2013-01-18 11:51:56 +110096 known_hosts-cert host_ca_key* cert_host_key* cert_user_key* \
Damien Miller369c0e82011-01-17 10:51:40 +110097 putty.rsa2 sshd_proxy_orig ssh_proxy_bak \
98 key.rsa-* key.dsa-* key.ecdsa-* \
Damien Miller999bd2d2012-12-03 10:13:39 +110099 authorized_principals_${USER} expect actual ready \
Darren Tucker75129022013-05-17 09:19:10 +1000100 sshd_proxy.* authorized_keys_${USER}.* modpipe revoked-* krl-* \
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000101 ssh.log failed-ssh.log sshd.log failed-sshd.log \
Damien Millera176e182013-10-18 09:05:41 +1100102 regress.log failed-regress.log ssh-log-wrapper.sh \
Damien Miller9f4c8e72013-12-29 17:57:46 +1100103 sftp-server.sh sftp-server.log sftp.log setuid-allowed \
104 data ed25519-agent ed25519-agent.pub key.ed25519-512 \
djm@openbsd.org79478102015-01-18 22:00:18 +0000105 key.ed25519-512.pub netcat host_krl_* host_revoked_* \
Damien Miller358964f2015-01-27 23:07:25 +1100106 kh.* user_*key* agent-key.* known_hosts.* hkr.*
Damien Miller38cd4352002-05-01 13:17:33 +1000107
Darren Tuckerf3568fc2013-05-17 09:35:26 +1000108SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER}
109
Damien Miller8f9492c2010-02-24 17:28:45 +1100110# Enable all malloc(3) randomisations and checks
111TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
112
Damien Miller369c0e82011-01-17 10:51:40 +1100113TEST_SSH_SSHKEYGEN?=ssh-keygen
114
Damien Millerb3764e12013-02-19 13:15:01 +1100115CPPFLAGS=-I..
116
Damien Miller38cd4352002-05-01 13:17:33 +1000117t1:
Damien Miller369c0e82011-01-17 10:51:40 +1100118 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100119 tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv
Damien Miller369c0e82011-01-17 10:51:40 +1100120 ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100121 awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv
Damien Miller369c0e82011-01-17 10:51:40 +1100122 ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv
Damien Miller38cd4352002-05-01 13:17:33 +1000123
124t2:
Tim Rice8b2157d2003-09-09 06:07:10 -0700125 cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out
126 chmod 600 $(OBJ)/t2.out
Damien Miller369c0e82011-01-17 10:51:40 +1100127 ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t2.out | diff - ${.CURDIR}/rsa_openssh.pub
Damien Miller38cd4352002-05-01 13:17:33 +1000128
129t3:
Damien Miller369c0e82011-01-17 10:51:40 +1100130 ${TEST_SSH_SSHKEYGEN} -ef ${.CURDIR}/rsa_openssh.pub >$(OBJ)/t3.out
131 ${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub
Damien Miller38cd4352002-05-01 13:17:33 +1000132
133t4:
djm@openbsd.org1e304832014-12-22 02:15:52 +0000134 ${TEST_SSH_SSHKEYGEN} -E md5 -lf ${.CURDIR}/rsa_openssh.pub |\
Damien Miller38cd4352002-05-01 13:17:33 +1000135 awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
136
137t5:
Damien Miller369c0e82011-01-17 10:51:40 +1100138 ${TEST_SSH_SSHKEYGEN} -Bf ${.CURDIR}/rsa_openssh.pub |\
Damien Miller38cd4352002-05-01 13:17:33 +1000139 awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
140
141t6:
Damien Miller369c0e82011-01-17 10:51:40 +1100142 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.prv > $(OBJ)/t6.out1
143 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.pub > $(OBJ)/t6.out2
Tim Rice8b2157d2003-09-09 06:07:10 -0700144 chmod 600 $(OBJ)/t6.out1
Damien Miller369c0e82011-01-17 10:51:40 +1100145 ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t6.out1 | diff - $(OBJ)/t6.out2
Damien Miller38cd4352002-05-01 13:17:33 +1000146
Tim Rice8b2157d2003-09-09 06:07:10 -0700147$(OBJ)/t7.out:
Damien Miller369c0e82011-01-17 10:51:40 +1100148 ${TEST_SSH_SSHKEYGEN} -q -t rsa -N '' -f $@
Damien Miller38cd4352002-05-01 13:17:33 +1000149
Tim Rice8b2157d2003-09-09 06:07:10 -0700150t7: $(OBJ)/t7.out
Damien Miller369c0e82011-01-17 10:51:40 +1100151 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t7.out > /dev/null
152 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t7.out > /dev/null
Damien Miller38cd4352002-05-01 13:17:33 +1000153
Tim Rice522262f2010-11-07 13:00:27 -0800154$(OBJ)/t8.out:
Damien Miller369c0e82011-01-17 10:51:40 +1100155 ${TEST_SSH_SSHKEYGEN} -q -t dsa -N '' -f $@
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100156
Tim Rice522262f2010-11-07 13:00:27 -0800157t8: $(OBJ)/t8.out
Damien Miller369c0e82011-01-17 10:51:40 +1100158 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t8.out > /dev/null
159 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t8.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100160
Tim Rice522262f2010-11-07 13:00:27 -0800161$(OBJ)/t9.out:
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100162 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100163 ${TEST_SSH_SSHKEYGEN} -q -t ecdsa -N '' -f $@
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100164
Tim Rice522262f2010-11-07 13:00:27 -0800165t9: $(OBJ)/t9.out
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100166 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100167 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t9.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100168 test "${TEST_SSH_ECC}" != yes || \
Damien Miller369c0e82011-01-17 10:51:40 +1100169 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100170
Damien Millerf54542a2013-12-07 16:32:44 +1100171
172$(OBJ)/t10.out:
173 ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -f $@
174
175t10: $(OBJ)/t10.out
176 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t10.out > /dev/null
177 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t10.out > /dev/null
178
djm@openbsd.org1e304832014-12-22 02:15:52 +0000179t11:
180 ${TEST_SSH_SSHKEYGEN} -E sha256 -lf ${.CURDIR}/rsa_openssh.pub |\
181 awk '{print $$2}' | diff - ${.CURDIR}/t11.ok
182
markus@openbsd.org27ca1a52015-01-12 20:13:27 +0000183t12.out:
Tim Ricef81f1bb2015-02-21 18:12:10 -0800184 ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -C 'test-comment-1234' -f $(OBJ)/$@
markus@openbsd.org27ca1a52015-01-12 20:13:27 +0000185
186t12: t12.out
Tim Ricef81f1bb2015-02-21 18:12:10 -0800187 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t12.out.pub | grep -q test-comment-1234
markus@openbsd.org27ca1a52015-01-12 20:13:27 +0000188
Damien Millerfaabeb62012-12-12 12:51:54 +1100189t-exec: ${LTESTS:=.sh}
Darren Tuckerebc3c132003-09-04 15:37:58 +1000190 @if [ "x$?" = "x" ]; then exit 0; fi; \
191 for TEST in ""$?; do \
192 echo "run test $${TEST}" ... 1>&2; \
Tim Rice5ab9b632013-06-02 14:05:48 -0700193 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
Darren Tuckerebc3c132003-09-04 15:37:58 +1000194 done
Damien Milleraf784932008-03-13 00:17:00 +1100195
196t-exec-interop: ${INTEROP_TESTS:=.sh}
197 @if [ "x$?" = "x" ]; then exit 0; fi; \
198 for TEST in ""$?; do \
199 echo "run test $${TEST}" ... 1>&2; \
Tim Rice5ab9b632013-06-02 14:05:48 -0700200 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
Damien Milleraf784932008-03-13 00:17:00 +1100201 done
202
Darren Tuckereab5f0d2010-11-05 18:23:38 +1100203# Not run by default
204interop: ${INTEROP_TARGETS}
Damien Millere7429f22014-05-15 18:01:01 +1000205
206# Unit tests, built by top-level Makefile
207unit:
Damien Millerdd8b1dd2014-07-02 17:38:31 +1000208 set -e ; if test -z "${SKIP_UNIT}" ; then \
Damien Millerbd588532015-02-25 16:58:22 -0800209 V="" ; \
210 test "x${USE_VALGRIND}" != "x" && \
211 V=${.CURDIR}/valgrind-unit.sh ; \
212 $$V ${.OBJDIR}/unittests/sshbuf/test_sshbuf ; \
213 $$V ${.OBJDIR}/unittests/sshkey/test_sshkey \
Damien Millere89c7802015-02-17 10:04:55 +1100214 -d ${.CURDIR}/unittests/sshkey/testdata ; \
Damien Millerbd588532015-02-25 16:58:22 -0800215 $$V ${.OBJDIR}/unittests/bitmap/test_bitmap ; \
216 $$V ${.OBJDIR}/unittests/kex/test_kex ; \
217 $$V ${.OBJDIR}/unittests/hostkeys/test_hostkeys \
Damien Millere89c7802015-02-17 10:04:55 +1100218 -d ${.CURDIR}/unittests/hostkeys/testdata ; \
Damien Millerdd8b1dd2014-07-02 17:38:31 +1000219 fi