1#	$OpenBSD: Makefile,v 1.2 2015/06/23 19:33:06 reyk Exp $
2
3HTTPDSRC =	${.CURDIR}/../../../../usr.sbin/httpd
4
5.PATH:	${HTTPDSRC}
6
7REGRESS_TARGETS=	test-patterns
8
9CLEANFILES +=		patterns-tester
10
11#LUA?=			lua53
12.ifdef LUA
13REGRESS_TARGETS+=	test-patterns-lua
14.endif
15
16patterns-tester: patterns-tester.c patterns.c patterns.h
17	${CC} -o $@ ${CFLAGS} ${.CURDIR}/patterns-tester.c ${HTTPDSRC}/patterns.c -I${HTTPDSRC}
18
19test-patterns: patterns-tester test-patterns.out test-patterns.in
20	cat ${.CURDIR}/test-patterns.in | grep -v '^#' |			\
21	while IFS='	' read string pattern comments ; do 			\
22		./patterns-tester "$${string}" "$${pattern}" 2>&1 || true;	\
23	done | diff -I 'OpenBSD' -u ${.CURDIR}/test-patterns.out -
24
25test-patterns-lua: patterns-tester.lua test-patterns-lua.out test-patterns.in
26	cat ${.CURDIR}/test-patterns.in | grep -v '^#' |			\
27	while IFS='	' read string pattern comments ; do 			\
28		${LUA} ${.CURDIR}/patterns-tester.lua "$${string}" "$${pattern}" 2>&1 || true;	\
29	done | sed "s/.*\/patterns\-tester\.lua/X_PATTERNS_TESTER_X/g" | \
30	diff -I 'OpenBSD' -u ${.CURDIR}/test-patterns-lua.out -
31
32.include <bsd.regress.mk>
33