1 # regress/Makefile[.in] - regression test Makefile
3 # This file is part of adns, which is Copyright Ian Jackson
4 # and contributors (see the file INSTALL for full details).
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software Foundation.
22 PROGS_SYSDEP= @PROGS_HAVE_TSEARCH@
24 CLIENTS= adnstest adnshost adnslogres $(PROGS_SYSDEP)
25 AUTOCHDRS= harness.h hsyscalls.h hredirect.h
26 AUTOCSRCS= hrecord.c hplayback.c hcommon.c hfuzzraw.c
27 include ../settings.make
28 include $(srcdir)/../src/adns.make
30 DIRCFLAGS= -I../src -I$(srcdir) -I$(srcdir)/../src
32 HCPPFLAGS= -DADNS_REGRESS_TEST -I.
33 #HCPPFLAGS+= -DFUZZRAW_SYNC
35 REDIRLIBOBJS= $(addsuffix _d.o, $(basename $(LIBOBJS)))
36 HARNLOBJS= hcommon.o $(REDIRLIBOBJS)
37 TARGETS= $(addsuffix _record, $(CLIENTS)) \
38 $(addsuffix _playback, $(CLIENTS)) \
39 $(addsuffix _fuzz, $(CLIENTS)) \
40 $(addsuffix _fuzzraw, $(CLIENTS))
41 ADH_OBJS= adh-main_c.o adh-opts_c.o adh-query_c.o
42 ALL_OBJS= $(HARNLOBJS) dtest.o hrecord.o hplayback.o hnonfuzz.o hfuzz.o
44 .PRECIOUS: $(AUTOCSRCS) $(AUTOCHDRS)
46 all install uninstall: $(TARGETS)
48 ALL_TESTS:=$(patsubst $(srcdir)/case-%.sys,%,$(wildcard $(srcdir)/case-*.sys))
50 check: $(TARGETS) $(addprefix check-,$(ALL_TESTS))
52 @echo 'all tests passed or maybe skipped.'
54 checkfuzz: $(TARGETS) \
55 $(addprefix checkfuzz-,$(ALL_TESTS)) \
56 $(addprefix checkfuzzraw-,$(ALL_TESTS))
58 @echo 'all fuzzes passed or maybe skipped.'
59 # this target is mostly useful as prep work for running the fuzzer;
60 # it doesn't really test any of adns
63 $(srcdir)/categorisefuzz $(ALL_TESTS)
64 perl -ne 'print $$1,"\n" while m/\"([^"% ]{2,})\"/g' \
65 $(srcdir)/../src/*.[ch] $(srcdir)/../client/*.[ch] \
66 | sort -u >fuzzcat.d/dictionary
68 -e 's/[^0-9a-z-_]/sprintf "\\x%02x", ord $$&/ige;' \
71 fuzzcat.d/dictionary >fuzzcat.d/dictionary.afl
74 @srcdir=$(srcdir) $(srcdir)/r1test $* || test $$? = 5
76 fuzz-%: case-%.sys $(TARGETS) make1fuzz shlib
77 srcdir=$(srcdir) $(srcdir)/make1fuzz $*
83 checkfuzz-%: fuzz-% $(TARGETS)
84 @srcdir=$(srcdir) $(srcdir)/check1fuzz $<
86 checkfuzzraw-%: fuzz-% $(TARGETS)
87 @srcdir=$(srcdir) $(srcdir)/check1fuzz $<
89 LINK_CMD= $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
91 %_record: %_c.o hrecord.o hnonfuzz.o $(HARNLOBJS)
94 %_playback: %_c.o hplayback.o hnonfuzz.o $(HARNLOBJS)
97 %_fuzz: %_c.o hplayback.o hfuzz.o $(HARNLOBJS)
100 %_fuzzraw: %_c.o hfuzzraw.o hfuzz.o $(HARNLOBJS)
103 .SECONDARY: $(addsuffix _c.o, $(filter-out adnshost, $(CLIENTS)))
104 # Without this, make will remove <client>_c.o after building <client>.
105 # This wastes effort. (Debian bug #4073.)
107 # Also, it exposes us to a bug (in make 3.81, at least) which can
108 # cause make to run the rule for building <client> without building
109 # <client>_c.o! (Debian #756123.)
111 # See also Savannah #29620, http://savannah.gnu.org/bugs/index.php?29620
113 adnshost_%: $(ADH_OBJS) h%.o hnonfuzz.o $(HARNLOBJS)
116 adnshost_fuzz: $(ADH_OBJS) hplayback.o hfuzz.o $(HARNLOBJS)
119 adnshost_fuzzraw: $(ADH_OBJS) hfuzzraw.o hfuzz.o $(HARNLOBJS)
122 %_d.o: $(srcdir)/../src/%.c hredirect.h hsyscalls.h
123 $(CC) $(CFLAGS) $(HCPPFLAGS) -c -g -o $@ $<
125 %_c.o: $(srcdir)/../client/%.c hredirect.h hsyscalls.h
126 $(CC) $(CFLAGS) $(HCPPFLAGS) -I $(srcdir)/../src -c -g -o $@ $<
128 $(ALL_OBJS): $(srcdir)/../src/adns.h $(srcdir)/../src/internal.h
129 $(ALL_OBJS): harness.h hsyscalls.h
130 $(ADH_OBJS): $(srcdir)/../client/adnshost.h
132 %:: %.m4 hmacros.i4 hsyscalls.i4
133 $(M4) -P -I$(srcdir) $< >$@-a.new
134 sed -e 's/hm_comma/,/g; s/hm_squote/'\''/g; /^[ ]*$$/d' <$@-a.new >$@-b.new
135 @mv -f $@-b.new $(srcdir)/$@; rm -f $@-a.new