1# $OpenBSD: Makefile,v 1.15 2021/12/02 17:10:53 kn 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 'run "pkg_add p5-IO-Socket-INET6 p5-Socket6 p5-IO-Socket-SSL"' 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 50REGRESS_ROOT_TARGETS += run-$a 51run-$a: $a ${HTDOCS_MD5} 52 time SUDO="${SUDO}" KTRACE=${KTRACE} HTTPD=${HTTPD} perl ${PERLINC} ${PERLPATH}httpd.pl ${.OBJDIR} ${PERLPATH}$a 53.endfor 54 55# populate htdocs 56 57.for d in ${HTDOCS_FILES} 58htdocs/$d: 59 mkdir -m 0755 -p ${@:H} 60.if (${HTDOCS_SPARSE} != "yes") 61 dd if=/dev/urandom of=$@ count=$$(($d / 512)) bs=512 62.else 63 dd of=$@ seek=$$(($d / 512)) bs=512 count=0 status=none 64.endif 65 66md5-$d: htdocs/$d 67 md5 -q htdocs/$d >$@ 68.endfor 69 70# create certificates for TLS 71 72ca.crt: 73 openssl req -batch -new -subj /L=OpenBSD/O=httpd-regress/OU=ca/CN=root/ -nodes -newkey rsa -keyout ca.key -x509 -out ca.crt 74 75server.req: 76 openssl req -batch -new -subj /L=OpenBSD/O=httpd-regress/OU=server/CN=localhost/ -nodes -newkey rsa -keyout server.key -out server.req 77 78client.req: 79 openssl req -batch -new -subj /L=OpenBSD/O=httpd-regress/OU=client/CN=localhost/ -nodes -newkey rsa -keyout client.key -out $@ 80 81server.crt: ca.crt server.req 82 openssl x509 -CAcreateserial -CAkey ca.key -CA ca.crt -req -in server.req -out server.crt 83 84client.crt: ca.crt client.req 85 openssl x509 -CAcreateserial -CAkey ca.key -CA ca.crt -req -in client.req -out $@ 86 87${REGRESS_TARGETS:M*tls*} ${REGRESS_TARGETS:M*https*}: server.crt client.crt 88 89# make perl syntax check for all args files 90 91.PHONY: syntax 92 93syntax: stamp-syntax 94 95stamp-syntax: ${ARGS} 96.for a in ${ARGS} 97 @perl -c ${PERLPATH}$a 98.endfor 99 @date >$@ 100 101.include <bsd.regress.mk> 102