xref: /openbsd/regress/lib/libz/Makefile (revision 5cb2e6ca)
1# $OpenBSD: Makefile,v 1.5 2024/01/20 11:29:40 tb Exp $
2
3# compile and run zlib test files from upstream
4# https://github.com/madler/zlib/tree/master/test
5
6# google chromium has special test for libz bugs
7# https://chromium.googlesource.com/chromium/src/third_party/+/refs/heads/main/zlib/contrib/tests/utils_unittest.cc
8
9PROGS=		example infcover minigzip utils_unittest
10SRCS_utils_unittest =	utils_unittest.cc
11LDADD=		-lz
12DPADD=		${LIBZ}
13CPPFLAGS=	-I${.CURDIR}/../../../lib/libz
14WARNINGS=	Yes
15CLEANFILES=	foo.gz in out out.gz
16
17# infcover uses the internal inflate_table, so link it statically
18LDADD_infcover = -Wl,-Bstatic -lz -Wl,-Bdynamic
19
20REGRESS_TARGETS=	run-regress-example run-regress-infcover
21
22.for stategy in default filtered huffman rle
23.for level in 0 1 2 3 4 5 6 7 8 9
24.for zero rand in 0 0  0 1  1 0  0 10  5 5  10 0
25
26REGRESS_TARGETS+=	run-${stategy}-level${level}-zero${zero}-rand${rand}
27
28run-${stategy}-level${level}-zero${zero}-rand${rand}: minigzip
29	rm -f in out out.gz
30	dd status=none seek=${zero} count=${rand} if=/dev/random of=in bs=1k
31	./minigzip ${stategy:Ndefault:C/^([frh]).*/-\1/} ${level:N0:S/^/-/} \
32	    <in >out.gz
33	gunzip -k out.gz
34	cmp in out
35
36.endfor
37.endfor
38.endfor
39
40.for tst in 0 1 2 3 4 5 6
41
42REGRESS_TARGETS+=	run-utils_unittest-${tst}
43
44run-utils_unittest-${tst}: utils_unittest
45	./utils_unittest ${tst}
46
47.endfor
48
49.include <bsd.regress.mk>
50