1# $OpenBSD: Makefile,v 1.13 2020/12/17 00:51:13 bluhm Exp $ 2 3# The following ports must be installed for the regression tests: 4# p5-IO-Socket-INET6 object interface for AF_INET and AF_INET6 domain sockets 5# p5-Socket6 Perl defines relating to AF_INET6 sockets 6# p5-IO-Socket-SSL perl interface to SSL sockets 7# 8# Check wether all required perl packages are installed. If some 9# are missing print a warning and skip the tests, but do not fail. 10 11PERL_REQUIRE != perl -Mstrict -Mwarnings -e ' \ 12 eval { require IO::Socket::INET6 } or print $@; \ 13 eval { require Socket6 } or print $@; \ 14 eval { require IO::Socket::SSL } or print $@; \ 15' 16.if ! empty (PERL_REQUIRE) 17regress: 18 @echo "${PERL_REQUIRE}" 19 @echo install these perl packages for additional tests 20 @echo SKIPPED 21.endif 22 23# Automatically generate regress targets from test cases in directory. 24 25ARGS != cd ${.CURDIR} && ls args-*.pl 26CLEANFILES += *.log httpd.conf ktrace.out stamp-* 27CLEANFILES += *.pem *.req *.crt *.key *.srl md5-* 28 29HTDOCS_FILES = 512 1048576 1073741824 30HTDOCS_MD5 = ${HTDOCS_FILES:S,^,md5-,} 31HTDOCS_SPARSE = yes 32CLEANFILES += htdocs/* 33 34# Set variables so that make runs with and without obj directory. 35# Only do that if necessary to keep visible output short. 36 37.if ${.CURDIR} == ${.OBJDIR} 38PERLINC = -I. 39PERLPATH = 40.else 41PERLINC = -I${.CURDIR} 42PERLPATH = ${.CURDIR}/ 43.endif 44 45# The arg tests take a perl hash with arguments controlling the 46# test parameters. Generally they consist of client, httpd, server. 47 48.for a in ${ARGS} 49REGRESS_TARGETS += run-$a 50run-$a: $a ${HTDOCS_MD5} 51 time SUDO=${SUDO} KTRACE=${KTRACE} HTTPD=${HTTPD} perl ${PERLINC} ${PERLPATH}httpd.pl ${.OBJDIR} ${PERLPATH}$a 52.endfor 53 54# populate htdocs 55 56.for d in ${HTDOCS_FILES} 57htdocs/$d: 58 mkdir -m 0755 -p ${@:H} 59.if (${HTDOCS_SPARSE} != "yes") 60 dd if=/dev/urandom of=$@ count=$$(($d / 512)) bs=512 61.else 62 dd of=$@ seek=$$(($d / 512)) bs=512 count=0 status=none 63.endif 64 65md5-$d: htdocs/$d 66 md5 -q htdocs/$d >$@ 67.endfor 68 69# create certificates for TLS 70 71ca.crt: 72 openssl req -batch -new -subj /L=OpenBSD/O=httpd-regress/OU=ca/CN=root/ -nodes -newkey rsa -keyout ca.key -x509 -out ca.crt 73 74server.req: 75 openssl req -batch -new -subj /L=OpenBSD/O=httpd-regress/OU=server/CN=localhost/ -nodes -newkey rsa -keyout server.key -out server.req 76 77client.req: 78 openssl req -batch -new -subj /L=OpenBSD/O=httpd-regress/OU=client/CN=localhost/ -nodes -newkey rsa -keyout client.key -out $@ 79 80server.crt: ca.crt server.req 81 openssl x509 -CAcreateserial -CAkey ca.key -CA ca.crt -req -in server.req -out server.crt 82 83client.crt: ca.crt client.req 84 openssl x509 -CAcreateserial -CAkey ca.key -CA ca.crt -req -in client.req -out $@ 85 86${REGRESS_TARGETS:M*tls*} ${REGRESS_TARGETS:M*https*}: server.crt client.crt 87 88# make perl syntax check for all args files 89 90.PHONY: syntax 91 92syntax: stamp-syntax 93 94stamp-syntax: ${ARGS} 95.for a in ${ARGS} 96 @perl -c ${PERLPATH}$a 97.endfor 98 @date >$@ 99 100.include <bsd.regress.mk> 101