Makefile 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. # $OpenBSD: Makefile,v 1.109 2020/06/19 05:07:09 dtucker Exp $
  2. tests: prep file-tests t-exec unit
  3. REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
  4. # File based tests
  5. file-tests: $(REGRESS_TARGETS)
  6. # Interop tests are not run by default
  7. interop interop-tests: t-exec-interop
  8. prep:
  9. test "x${USE_VALGRIND}" = "x" || mkdir -p $(OBJ)/valgrind-out
  10. clean:
  11. for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
  12. rm -rf $(OBJ).putty
  13. distclean: clean
  14. LTESTS= connect \
  15. proxy-connect \
  16. connect-privsep \
  17. connect-uri \
  18. proto-version \
  19. proto-mismatch \
  20. exit-status \
  21. envpass \
  22. transfer \
  23. banner \
  24. rekey \
  25. dhgex \
  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. agent-subprocess \
  37. keyscan \
  38. keygen-change \
  39. keygen-convert \
  40. keygen-moduli \
  41. key-options \
  42. scp \
  43. scp-uri \
  44. sftp \
  45. sftp-chroot \
  46. sftp-cmds \
  47. sftp-badcmds \
  48. sftp-batch \
  49. sftp-glob \
  50. sftp-perm \
  51. sftp-uri \
  52. reconfigure \
  53. dynamic-forward \
  54. forwarding \
  55. multiplex \
  56. reexec \
  57. brokenkeys \
  58. sshcfgparse \
  59. cfgparse \
  60. cfgmatch \
  61. cfgmatchlisten \
  62. percent \
  63. addrmatch \
  64. localcommand \
  65. forcecommand \
  66. portnum \
  67. keytype \
  68. kextype \
  69. cert-hostkey \
  70. cert-userkey \
  71. host-expand \
  72. keys-command \
  73. forward-control \
  74. integrity \
  75. krl \
  76. multipubkey \
  77. limit-keytype \
  78. hostkey-agent \
  79. keygen-knownhosts \
  80. hostkey-rotate \
  81. principals-command \
  82. cert-file \
  83. cfginclude \
  84. servcfginclude \
  85. allow-deny-users \
  86. authinfo \
  87. sshsig \
  88. keygen-comment \
  89. knownhosts-command
  90. INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
  91. #INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
  92. EXTRA_TESTS= agent-pkcs11
  93. #EXTRA_TESTS+= cipher-speed
  94. USERNAME= ${LOGNAME}
  95. CLEANFILES= *.core actual agent-key.* authorized_keys_${USERNAME} \
  96. authorized_keys_${USERNAME}.* \
  97. authorized_principals_${USERNAME} \
  98. banner.in banner.out cert_host_key* cert_user_key* \
  99. copy.1 copy.2 data ed25519-agent ed25519-agent* \
  100. ed25519-agent.pub ed25519 ed25519.pub empty.in \
  101. expect failed-regress.log failed-ssh.log failed-sshd.log \
  102. hkr.* host.ecdsa-sha2-nistp256 host.ecdsa-sha2-nistp384 \
  103. host.ecdsa-sha2-nistp521 host.ssh-dss host.ssh-ed25519 \
  104. host.ssh-rsa host_ca_key* host_krl_* host_revoked_* key.* \
  105. key.dsa-* key.ecdsa-* key.ed25519-512 \
  106. key.ed25519-512.pub key.rsa-* keys-command-args kh.* \
  107. known_hosts known_hosts-cert known_hosts.* krl-* ls.copy \
  108. modpipe netcat no_identity_config \
  109. pidfile putty.rsa2 ready regress.log remote_pid \
  110. revoked-* rsa rsa-agent rsa-agent.pub rsa-agent-cert.pub \
  111. rsa.pub rsa_ssh2_cr.prv pkcs11*.crt pkcs11*.key pkcs11.info \
  112. rsa_ssh2_crnl.prv scp-ssh-wrapper.exe \
  113. scp-ssh-wrapper.scp setuid-allowed sftp-server.log \
  114. sftp-server.sh sftp.log ssh-log-wrapper.sh ssh.log \
  115. ssh-rsa_oldfmt ssh-rsa_oldfmt.pub knownhosts_command \
  116. ssh_config ssh_config.* ssh_proxy ssh_proxy_bak \
  117. ssh_proxy_* sshd.log sshd_config sshd_config_* \
  118. sshd_config.* sshd_proxy sshd_proxy.* sshd_proxy_bak \
  119. sshd_proxy_orig t10.out t10.out.pub t12.out t12.out.pub \
  120. t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub \
  121. t8.out t8.out.pub t9.out t9.out.pub testdata \
  122. user_*key* user_ca* user_key*
  123. # Enable all malloc(3) randomisations and checks
  124. TEST_ENV= "MALLOC_OPTIONS=CFGJRSUX"
  125. TEST_SSH_SSHKEYGEN?=ssh-keygen
  126. CPPFLAGS=-I..
  127. t1:
  128. ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
  129. tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv
  130. ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv
  131. awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv
  132. ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv
  133. t2:
  134. cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out
  135. chmod 600 $(OBJ)/t2.out
  136. ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t2.out | diff - ${.CURDIR}/rsa_openssh.pub
  137. t3:
  138. ${TEST_SSH_SSHKEYGEN} -ef ${.CURDIR}/rsa_openssh.pub >$(OBJ)/t3.out
  139. ${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub
  140. t4:
  141. ${TEST_SSH_SSHKEYGEN} -E md5 -lf ${.CURDIR}/rsa_openssh.pub |\
  142. awk '{print $$2}' | diff - ${.CURDIR}/t4.ok
  143. t5:
  144. ${TEST_SSH_SSHKEYGEN} -Bf ${.CURDIR}/rsa_openssh.pub |\
  145. awk '{print $$2}' | diff - ${.CURDIR}/t5.ok
  146. t6:
  147. ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.prv > $(OBJ)/t6.out1
  148. ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.pub > $(OBJ)/t6.out2
  149. chmod 600 $(OBJ)/t6.out1
  150. ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t6.out1 | diff - $(OBJ)/t6.out2
  151. $(OBJ)/t7.out:
  152. ${TEST_SSH_SSHKEYGEN} -q -t rsa -N '' -f $@
  153. t7: $(OBJ)/t7.out
  154. ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t7.out > /dev/null
  155. ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t7.out > /dev/null
  156. $(OBJ)/t8.out:
  157. ${TEST_SSH_SSHKEYGEN} -q -t dsa -N '' -f $@
  158. t8: $(OBJ)/t8.out
  159. ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t8.out > /dev/null
  160. ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t8.out > /dev/null
  161. $(OBJ)/t9.out:
  162. test "${TEST_SSH_ECC}" != yes || \
  163. ${TEST_SSH_SSHKEYGEN} -q -t ecdsa -N '' -f $@
  164. t9: $(OBJ)/t9.out
  165. test "${TEST_SSH_ECC}" != yes || \
  166. ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t9.out > /dev/null
  167. test "${TEST_SSH_ECC}" != yes || \
  168. ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null
  169. $(OBJ)/t10.out:
  170. ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -f $@
  171. t10: $(OBJ)/t10.out
  172. ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t10.out > /dev/null
  173. ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t10.out > /dev/null
  174. t11:
  175. ${TEST_SSH_SSHKEYGEN} -E sha256 -lf ${.CURDIR}/rsa_openssh.pub |\
  176. awk '{print $$2}' | diff - ${.CURDIR}/t11.ok
  177. $(OBJ)/t12.out:
  178. ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -C 'test-comment-1234' -f $@
  179. t12: $(OBJ)/t12.out
  180. ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t12.out.pub | grep test-comment-1234 >/dev/null
  181. t-exec: ${LTESTS:=.sh}
  182. @if [ "x$?" = "x" ]; then exit 0; fi; \
  183. for TEST in ""$?; do \
  184. skip=no; \
  185. for t in ""$${SKIP_LTESTS}; do \
  186. if [ "x$${t}.sh" = "x$${TEST}" ]; then skip=yes; fi; \
  187. done; \
  188. if [ "x$${skip}" = "xno" ]; then \
  189. echo "run test $${TEST}" ... 1>&2; \
  190. (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
  191. else \
  192. echo skip test $${TEST} 1>&2; \
  193. fi; \
  194. done
  195. t-exec-interop: ${INTEROP_TESTS:=.sh}
  196. @if [ "x$?" = "x" ]; then exit 0; fi; \
  197. for TEST in ""$?; do \
  198. echo "run test $${TEST}" ... 1>&2; \
  199. (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
  200. done
  201. t-extra: ${EXTRA_TESTS:=.sh}
  202. @if [ "x$?" = "x" ]; then exit 0; fi; \
  203. for TEST in ""$?; do \
  204. echo "run test $${TEST}" ... 1>&2; \
  205. (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
  206. done
  207. # Not run by default
  208. interop: ${INTEROP_TARGETS}
  209. # Unit tests, built by top-level Makefile
  210. unit:
  211. set -e ; if test -z "${SKIP_UNIT}" ; then \
  212. V="" ; \
  213. test "x${USE_VALGRIND}" = "x" || \
  214. V=${.CURDIR}/valgrind-unit.sh ; \
  215. $$V ${.OBJDIR}/unittests/pkcs11/test_pkcs11 ; \
  216. $$V ${.OBJDIR}/unittests/sshbuf/test_sshbuf ; \
  217. $$V ${.OBJDIR}/unittests/sshkey/test_sshkey \
  218. -d ${.CURDIR}/unittests/sshkey/testdata ; \
  219. $$V ${.OBJDIR}/unittests/sshsig/test_sshsig \
  220. -d ${.CURDIR}/unittests/sshsig/testdata ; \
  221. $$V ${.OBJDIR}/unittests/bitmap/test_bitmap ; \
  222. $$V ${.OBJDIR}/unittests/conversion/test_conversion ; \
  223. $$V ${.OBJDIR}/unittests/kex/test_kex ; \
  224. $$V ${.OBJDIR}/unittests/hostkeys/test_hostkeys \
  225. -d ${.CURDIR}/unittests/hostkeys/testdata ; \
  226. $$V ${.OBJDIR}/unittests/match/test_match ; \
  227. if test "x${TEST_SSH_UTF8}" = "xyes" ; then \
  228. $$V ${.OBJDIR}/unittests/utf8/test_utf8 ; \
  229. fi \
  230. fi