]> git.ipfire.org Git - thirdparty/openssh-portable.git/blame - regress/Makefile
quote regexes used to test for algorithm support
[thirdparty/openssh-portable.git] / regress / Makefile
CommitLineData
50080fa4 1# $OpenBSD: Makefile,v 1.133 2024/01/11 04:50:28 djm Exp $
38cd4358 2
159e987a
DT
3tests: prep file-tests t-exec unit
4
5REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12
6
7# File based tests
8file-tests: $(REGRESS_TARGETS)
38cd4358 9
af78493b 10# Interop tests are not run by default
66429961 11interop interop-tests: t-exec-interop
af78493b 12
6eee8c97
DM
13extra extra-tests: t-extra
14
9e1cfca7 15prep:
02973ad5 16 test "x${USE_VALGRIND}" = "x" || mkdir -p $(OBJ)/valgrind-out
9e1cfca7 17
ebc3c13d 18clean:
b12d16fd 19 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
9c8a4274 20 rm -rf $(OBJ).putty
fbaa707d 21 rm -rf $(OBJ).dropbear
9c8a4274 22
ebc3c13d 23distclean: clean
38cd4358
DM
24
25LTESTS= connect \
26 proxy-connect \
33abbe2f 27 sshfp-connect \
38cd4358 28 connect-privsep \
116b1b43 29 connect-uri \
38cd4358
DM
30 proto-version \
31 proto-mismatch \
32 exit-status \
7cc3fe28 33 exit-status-signal \
4c37ef08 34 envpass \
38cd4358 35 transfer \
dc001a5e 36 banner \
d57a76ee 37 rekey \
7c817d12 38 dhgex \
38cd4358
DM
39 stderr-data \
40 stderr-after-eof \
41 broken-pipe \
42 try-ciphers \
43 yes-head \
017fd61a 44 login-timeout \
38cd4358 45 agent \
8b9cde78
DM
46 agent-getpeereid \
47 agent-timeout \
48 agent-ptrace \
5dba1fca 49 agent-subprocess \
38cd4358 50 keyscan \
8b9cde78 51 keygen-change \
0075511e 52 keygen-comment \
b6bd3c2c 53 keygen-convert \
0075511e 54 keygen-knownhosts \
44d82fc8 55 keygen-moduli \
03482882 56 keygen-sshfp \
2e80cf2b 57 key-options \
50433a92 58 scp \
d247a73c 59 scp3 \
116b1b43 60 scp-uri \
38cd4358 61 sftp \
f3568fc6 62 sftp-chroot \
8b9cde78 63 sftp-cmds \
a4040f59 64 sftp-badcmds \
8b9cde78 65 sftp-batch \
1c56ef6a 66 sftp-glob \
a176e182 67 sftp-perm \
116b1b43 68 sftp-uri \
50cea672 69 reconfigure \
e2f2be7a 70 dynamic-forward \
e7d0583f 71 forwarding \
977a9d21 72 multiplex \
124f58ec 73 reexec \
7b1877c8 74 brokenkeys \
e6508898 75 sshcfgparse \
0ef1de74 76 cfgparse \
7b1877c8 77 cfgmatch \
4319f7a8 78 cfgmatchlisten \
eba523f0 79 percent \
10f9242b 80 addrmatch \
a5e58427 81 localcommand \
287b9329 82 forcecommand \
58ac6de9 83 portnum \
eab5f0df
DT
84 keytype \
85 kextype \
58ac6de9 86 cert-hostkey \
7d06b000 87 cert-userkey \
771c43ce 88 host-expand \
999bd2d2 89 keys-command \
1fb593a3 90 forward-control \
ebafebda 91 integrity \
4bea0ab3 92 krl \
0920553d 93 multipubkey \
d59ec478 94 limit-keytype \
7947810e 95 hostkey-agent \
13640798 96 hostkey-rotate \
e14ac43b 97 principals-command \
35f22dad 98 cert-file \
0d2f8842 99 cfginclude \
677d0ece 100 servcfginclude \
c9cdef35 101 allow-deny-users \
6d6427d0 102 authinfo \
d00d07b6 103 sshsig \
12937d86 104 knownhosts \
f539136c 105 knownhosts-command \
e12d912d 106 agent-restrict \
e1ef1726 107 hostbased \
cef2593c 108 channel-timeout \
0e1f4401 109 connection-timeout \
2f512f86 110 match-subsystem \
e48cdee8 111 agent-pkcs11-restrict \
112 agent-pkcs11-cert
38cd4358 113
4268a136 114INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
fbaa707d 115INTEROP_TESTS+= dropbear-ciphers dropbear-kex
af78493b
DM
116#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
117
b2ce8b31 118EXTRA_TESTS= agent-pkcs11
119#EXTRA_TESTS+= cipher-speed
eab5f0df 120
6bdf70f0 121USERNAME= ${LOGNAME}
09f99789 122CLEANFILES= *.core actual agent-key.* authorized_keys_${USERNAME} \
123 authorized_keys_${USERNAME}.* \
124 authorized_principals_${USERNAME} \
b1d05aa6 125 banner.in banner.out cert_host_key* cert_user_key* \
126 copy.1 copy.2 data ed25519-agent ed25519-agent* \
6bdf70f0
DM
127 ed25519-agent.pub ed25519 ed25519.pub empty.in \
128 expect failed-regress.log failed-ssh.log failed-sshd.log \
9dc81a5a 129 hkr.* host.ecdsa-sha2-nistp256 host.ecdsa-sha2-nistp384 \
130 host.ecdsa-sha2-nistp521 host.ssh-dss host.ssh-ed25519 \
131 host.ssh-rsa host_ca_key* host_krl_* host_revoked_* key.* \
6bdf70f0 132 key.dsa-* key.ecdsa-* key.ed25519-512 \
8b7af02d 133 key.ed25519-512.pub key.rsa-* keys-command-args kh.* askpass \
6bdf70f0
DM
134 known_hosts known_hosts-cert known_hosts.* krl-* ls.copy \
135 modpipe netcat no_identity_config \
1254fcbb 136 pidfile putty.rsa2 ready regress.log remote_pid \
137 revoked-* rsa rsa-agent rsa-agent.pub rsa.pub rsa_ssh2_cr.prv \
b1d05aa6 138 rsa_ssh2_crnl.prv scp-ssh-wrapper.exe \
139 scp-ssh-wrapper.scp setuid-allowed sftp-server.log \
140 sftp-server.sh sftp.log ssh-log-wrapper.sh ssh.log \
e1ef1726 141 ssh-agent.log ssh-add.log slow-sftp-server.sh \
2873f195 142 ssh-rsa_oldfmt knownhosts_command \
b1d05aa6 143 ssh_config ssh_config.* ssh_proxy ssh_proxy_bak \
2873f195 144 ssh_proxy_* sshd.log sshd_config sshd_config.* \
677d0ece 145 sshd_config.* sshd_proxy sshd_proxy.* sshd_proxy_bak \
6bdf70f0
DM
146 sshd_proxy_orig t10.out t10.out.pub t12.out t12.out.pub \
147 t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub \
a6f4ac8a 148 t8.out t8.out.pub t9.out t9.out.pub \
149 timestamp testdata user_*key* user_ca* user_key*
38cd4358 150
8f9492c9 151# Enable all malloc(3) randomisations and checks
7da751d8 152TEST_ENV= "MALLOC_OPTIONS=CFGJRSUX"
8f9492c9 153
369c0e8e
DM
154TEST_SSH_SSHKEYGEN?=ssh-keygen
155
b3764e12
DM
156CPPFLAGS=-I..
157
38cd4358 158t1:
26b09b45 159 set -xe ; if ${TEST_SSH_SSH} -Q key | grep -q "^ssh-rsa" ; then \
d52b6509
DM
160 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv ; \
161 tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv ; \
162 ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv ; \
163 awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv ; \
164 ${TEST_SSH_SSHKEYGEN} -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv ; \
165 fi
38cd4358
DM
166
167t2:
26b09b45 168 set -xe ; if ${TEST_SSH_SSH} -Q key | grep -q "^ssh-rsa" ; then \
d52b6509
DM
169 cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out ; \
170 chmod 600 $(OBJ)/t2.out ; \
171 ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t2.out | diff - ${.CURDIR}/rsa_openssh.pub ; \
172 fi
38cd4358
DM
173
174t3:
26b09b45 175 set -xe ; if ${TEST_SSH_SSH} -Q key | grep -q "^ssh-rsa" ; then \
d52b6509
DM
176 ${TEST_SSH_SSHKEYGEN} -ef ${.CURDIR}/rsa_openssh.pub >$(OBJ)/t3.out ; \
177 ${TEST_SSH_SSHKEYGEN} -if $(OBJ)/t3.out | diff - ${.CURDIR}/rsa_openssh.pub ; \
178 fi
38cd4358
DM
179
180t4:
26b09b45 181 set -xe ; if ${TEST_SSH_SSH} -Q key | grep -q "^ssh-rsa" ; then \
d52b6509
DM
182 ${TEST_SSH_SSHKEYGEN} -E md5 -lf ${.CURDIR}/rsa_openssh.pub |\
183 awk '{print $$2}' | diff - ${.CURDIR}/t4.ok ; \
184 fi
38cd4358
DM
185
186t5:
26b09b45 187 set -xe ; if ${TEST_SSH_SSH} -Q key | grep -q "^ssh-rsa" ; then \
d52b6509
DM
188 ${TEST_SSH_SSHKEYGEN} -Bf ${.CURDIR}/rsa_openssh.pub |\
189 awk '{print $$2}' | diff - ${.CURDIR}/t5.ok ; \
190 fi
38cd4358 191t6:
26b09b45 192 set -xe ; if ${TEST_SSH_SSH} -Q key | grep -q "^ssh-dss" ; then \
415c94ce 193 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.prv > $(OBJ)/t6.out1 ; \
194 ${TEST_SSH_SSHKEYGEN} -if ${.CURDIR}/dsa_ssh2.pub > $(OBJ)/t6.out2 ; \
195 chmod 600 $(OBJ)/t6.out1 ; \
196 ${TEST_SSH_SSHKEYGEN} -yf $(OBJ)/t6.out1 | diff - $(OBJ)/t6.out2 ; \
197 fi
38cd4358 198
8b2157d8 199$(OBJ)/t7.out:
26b09b45 200 set -xe ; if ${TEST_SSH_SSH} -Q key | grep -q "^ssh-dss" ; then \
d52b6509
DM
201 ${TEST_SSH_SSHKEYGEN} -q -t rsa -N '' -f $@ ; \
202 fi
38cd4358 203
8b2157d8 204t7: $(OBJ)/t7.out
26b09b45 205 set -xe ; if ${TEST_SSH_SSH} -Q key | grep -q "^ssh-dss" ; then \
d52b6509
DM
206 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t7.out > /dev/null ; \
207 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t7.out > /dev/null ; \
208 fi
38cd4358 209
522262f8 210$(OBJ)/t8.out:
26b09b45 211 set -xe ; if ssh -Q key | grep -q "^ssh-dss" ; then \
415c94ce 212 ${TEST_SSH_SSHKEYGEN} -q -t dsa -N '' -f $@ ; \
213 fi
eab5f0df 214
522262f8 215t8: $(OBJ)/t8.out
26b09b45 216 set -xe ; if ssh -Q key | grep -q "^ssh-dss" ; then \
415c94ce 217 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t8.out > /dev/null ; \
218 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t8.out > /dev/null ; \
219 fi
eab5f0df 220
522262f8 221$(OBJ)/t9.out:
c9172193 222 ! ${TEST_SSH_SSH} -Q key-plain | grep ecdsa >/dev/null || \
369c0e8e 223 ${TEST_SSH_SSHKEYGEN} -q -t ecdsa -N '' -f $@
eab5f0df 224
522262f8 225t9: $(OBJ)/t9.out
c9172193 226 ! ${TEST_SSH_SSH} -Q key-plain | grep ecdsa >/dev/null || \
369c0e8e 227 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t9.out > /dev/null
c9172193 228 ! ${TEST_SSH_SSH} -Q key-plain | grep ecdsa >/dev/null || \
369c0e8e 229 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t9.out > /dev/null
eab5f0df 230
f54542af
DM
231
232$(OBJ)/t10.out:
233 ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -f $@
234
235t10: $(OBJ)/t10.out
236 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t10.out > /dev/null
237 ${TEST_SSH_SSHKEYGEN} -Bf $(OBJ)/t10.out > /dev/null
238
1e30483c 239t11:
26b09b45 240 set -xe ; if ${TEST_SSH_SSH} -Q key | grep -q "^ssh-dss" ; then \
d52b6509
DM
241 ${TEST_SSH_SSHKEYGEN} -E sha256 -lf ${.CURDIR}/rsa_openssh.pub |\
242 awk '{print $$2}' | diff - ${.CURDIR}/t11.ok ; \
243 fi
1e30483c 244
a170f22b
TR
245$(OBJ)/t12.out:
246 ${TEST_SSH_SSHKEYGEN} -q -t ed25519 -N '' -C 'test-comment-1234' -f $@
27ca1a5c 247
a170f22b 248t12: $(OBJ)/t12.out
9f82e5a9 249 ${TEST_SSH_SSHKEYGEN} -lf $(OBJ)/t12.out.pub | grep test-comment-1234 >/dev/null
27ca1a5c 250
faabeb6b 251t-exec: ${LTESTS:=.sh}
ebc3c13d 252 @if [ "x$?" = "x" ]; then exit 0; fi; \
f446a44f 253 _started=""; test -z "${LTESTS_FROM}" && _started=1 ;\
ebc3c13d 254 for TEST in ""$?; do \
f446a44f 255 if [ -z "$$_started" ] ; then \
256 if [ "x$$TEST" = "x${LTESTS_FROM}.sh" ]; then \
257 _started=1; \
258 else \
259 continue; \
260 fi ; \
261 fi ; \
0a403bfd
DT
262 skip=no; \
263 for t in ""$${SKIP_LTESTS}; do \
264 if [ "x$${t}.sh" = "x$${TEST}" ]; then skip=yes; fi; \
265 done; \
266 if [ "x$${skip}" = "xno" ]; then \
267 echo "run test $${TEST}" ... 1>&2; \
268 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
269 else \
270 echo skip test $${TEST} 1>&2; \
271 fi; \
ebc3c13d 272 done
af78493b
DM
273
274t-exec-interop: ${INTEROP_TESTS:=.sh}
b2ce8b31 275 @if [ "x$?" = "x" ]; then exit 0; fi; \
276 for TEST in ""$?; do \
277 echo "run test $${TEST}" ... 1>&2; \
278 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
279 done
280
281t-extra: ${EXTRA_TESTS:=.sh}
af78493b
DM
282 @if [ "x$?" = "x" ]; then exit 0; fi; \
283 for TEST in ""$?; do \
284 echo "run test $${TEST}" ... 1>&2; \
5ab9b634 285 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
af78493b
DM
286 done
287
eab5f0df
DT
288# Not run by default
289interop: ${INTEROP_TARGETS}
e7429f2b
DM
290
291# Unit tests, built by top-level Makefile
292unit:
dd8b1dd7 293 set -e ; if test -z "${SKIP_UNIT}" ; then \
bd588531 294 V="" ; \
f7f3116a 295 test "x${USE_VALGRIND}" = "x" || \
bd588531 296 V=${.CURDIR}/valgrind-unit.sh ; \
f3ca8af8
DM
297 $$V ${.OBJDIR}/unittests/sshbuf/test_sshbuf ; \
298 $$V ${.OBJDIR}/unittests/sshkey/test_sshkey \
e89c7808 299 -d ${.CURDIR}/unittests/sshkey/testdata ; \
80610e97
DT
300 $$V ${.OBJDIR}/unittests/sshsig/test_sshsig \
301 -d ${.CURDIR}/unittests/sshsig/testdata ; \
f3ca8af8
DM
302 $$V ${.OBJDIR}/unittests/authopt/test_authopt \
303 -d ${.CURDIR}/unittests/authopt/testdata ; \
bd588531 304 $$V ${.OBJDIR}/unittests/bitmap/test_bitmap ; \
b1b22dd0 305 $$V ${.OBJDIR}/unittests/conversion/test_conversion ; \
bd588531
DM
306 $$V ${.OBJDIR}/unittests/kex/test_kex ; \
307 $$V ${.OBJDIR}/unittests/hostkeys/test_hostkeys \
e89c7808 308 -d ${.CURDIR}/unittests/hostkeys/testdata ; \
6ee4f1c0 309 $$V ${.OBJDIR}/unittests/match/test_match ; \
f3ca8af8 310 $$V ${.OBJDIR}/unittests/misc/test_misc ; \
47b8c99a
DT
311 if test "x${TEST_SSH_UTF8}" = "xyes" ; then \
312 $$V ${.OBJDIR}/unittests/utf8/test_utf8 ; \
313 fi \
dd8b1dd7 314 fi