diff options
| author | bluhm <> | 2018-11-11 00:15:04 +0000 |
|---|---|---|
| committer | bluhm <> | 2018-11-11 00:15:04 +0000 |
| commit | bb7bf59b27f2841b551d2aac13e012204e220296 (patch) | |
| tree | 2e2f3822b8e0eb71ba45a900f399e61fb573f4b2 /src/regress/lib/libssl/interop/netcat | |
| parent | b6050265797720778c82d37cfa77e5524da4f74a (diff) | |
| download | openbsd-bb7bf59b27f2841b551d2aac13e012204e220296.tar.gz openbsd-bb7bf59b27f2841b551d2aac13e012204e220296.tar.bz2 openbsd-bb7bf59b27f2841b551d2aac13e012204e220296.zip | |
Reorganize libssl interop tests. Move netcat tests into separate
directory. Keep all log files for easier debugging. Name regress
target names consistently.
Diffstat (limited to 'src/regress/lib/libssl/interop/netcat')
| -rw-r--r-- | src/regress/lib/libssl/interop/netcat/Makefile | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/regress/lib/libssl/interop/netcat/Makefile b/src/regress/lib/libssl/interop/netcat/Makefile new file mode 100644 index 0000000000..def90c1ffb --- /dev/null +++ b/src/regress/lib/libssl/interop/netcat/Makefile | |||
| @@ -0,0 +1,89 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1 2018/11/11 00:15:04 bluhm Exp $ | ||
| 2 | |||
| 3 | LIBRARIES = libressl | ||
| 4 | .if exists(/usr/local/bin/eopenssl) | ||
| 5 | LIBRARIES += openssl | ||
| 6 | .endif | ||
| 7 | .if exists(/usr/local/bin/eopenssl11) | ||
| 8 | LIBRARIES += openssl11 | ||
| 9 | .endif | ||
| 10 | |||
| 11 | # run netcat server and connect with test client | ||
| 12 | |||
| 13 | .for clib in ${LIBRARIES} | ||
| 14 | |||
| 15 | REGRESS_TARGETS += run-netcat-client-${clib}-server-nc | ||
| 16 | REGRESS_TARGETS += run-protocol-client-${clib} | ||
| 17 | |||
| 18 | run-netcat-client-${clib}-server-nc: ../${clib}/client 127.0.0.1.crt | ||
| 19 | @echo '\n======== $@ ========' | ||
| 20 | echo "greeting" | \ | ||
| 21 | nc >${@:S/^run/server/}.out \ | ||
| 22 | -l -c -C 127.0.0.1.crt -K 127.0.0.1.key \ | ||
| 23 | 127.0.0.1 0 & \ | ||
| 24 | for i in `jot 1000`; do fstat -p $$! >netcat.fstat; \ | ||
| 25 | grep -q ' stream tcp .*:[1-9][0-9]*$$' netcat.fstat && \ | ||
| 26 | exit 0; done; exit 1 | ||
| 27 | LD_LIBRARY_PATH=/usr/local/lib/e${clib} \ | ||
| 28 | ../${clib}/client >${@:S/^run/client/}.out \ | ||
| 29 | `sed -n 's/.* stream tcp .*:/127.0.0.1 /p' netcat.fstat` | ||
| 30 | # check that the client run successfully to the end | ||
| 31 | grep -q '^success$$' ${@:S/^run/client/}.out | ||
| 32 | # client must have read server greeting | ||
| 33 | grep -q '^<<< greeting$$' ${@:S/^run/client/}.out | ||
| 34 | # netstat server must have read client hello | ||
| 35 | grep -q '^hello$$' ${@:S/^run/server/}.out | ||
| 36 | |||
| 37 | .endfor | ||
| 38 | |||
| 39 | # run test server and connect with netcat client | ||
| 40 | |||
| 41 | .for slib in ${LIBRARIES} | ||
| 42 | |||
| 43 | REGRESS_TARGETS += run-netcat-client-nc-server-${slib} | ||
| 44 | |||
| 45 | run-netcat-client-nc-server-${slib}: ../${slib}/server 127.0.0.1.crt | ||
| 46 | @echo '\n======== $@ ========' | ||
| 47 | LD_LIBRARY_PATH=/usr/local/lib/e${slib} \ | ||
| 48 | ../${slib}/server >${@:S/^run/server/}.out \ | ||
| 49 | 127.0.0.1 0 | ||
| 50 | echo "hello" | \ | ||
| 51 | nc >${@:S/^run/client/}.out \ | ||
| 52 | -c -R 127.0.0.1.crt \ | ||
| 53 | `sed -n 's/listen sock: //p' ${@:S/^run/server/}.out` | ||
| 54 | # check that the server child run successfully to the end | ||
| 55 | grep -q '^success$$' ${@:S/^run/server/}.out | ||
| 56 | # server must have read client hello | ||
| 57 | grep -q '^<<< hello$$' ${@:S/^run/server/}.out | ||
| 58 | # client must have read server greeting | ||
| 59 | grep -q '^greeting$$' ${@:S/^run/client/}.out | ||
| 60 | |||
| 61 | .endfor | ||
| 62 | |||
| 63 | # check the TLS protocol version in client and server logs | ||
| 64 | |||
| 65 | .for clib in ${LIBRARIES} | ||
| 66 | |||
| 67 | REGRESS_TARGETS += run-protocol-client-${clib} | ||
| 68 | |||
| 69 | run-protocol-client-${clib}: client-netcat-client-${clib}-server-nc.out | ||
| 70 | @echo '\n======== $@ ========' | ||
| 71 | # check that LibTLS protocol version is TLS 1.2 | ||
| 72 | # XXX adapt when LibreSSL supports TLS 1.3 | ||
| 73 | grep 'Protocol *: TLSv1.2' client-netcat-client-${clib}-server-nc.out | ||
| 74 | |||
| 75 | .endfor | ||
| 76 | |||
| 77 | .for slib in ${LIBRARIES} | ||
| 78 | |||
| 79 | REGRESS_TARGETS += run-protocol-server-${slib} | ||
| 80 | |||
| 81 | run-protocol-server-${slib}: server-netcat-client-nc-server-${slib}.out | ||
| 82 | @echo '\n======== $@ ========' | ||
| 83 | # check that LibTLS protocol version is TLS 1.2 | ||
| 84 | # XXX adapt when LibreSSL supports TLS 1.3 | ||
| 85 | grep 'Protocol *: TLSv1.2' server-netcat-client-nc-server-${slib}.out | ||
| 86 | |||
| 87 | .endfor | ||
| 88 | |||
| 89 | .include <bsd.regress.mk> | ||
