chiark / gitweb /
Fix typo in changelog entry for 1.6.1
[adns.git] / regress / Makefile.in
1 # regress/Makefile[.in] - regression test Makefile
2
3 #  This file is part of adns, which is Copyright Ian Jackson
4 #  and contributors (see the file INSTALL for full details).
5 #  
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)
9 #  any later version.
10 #  
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.
15 #  
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.
18
19 srcdir=         @srcdir@
20 VPATH=          @srcdir@
21
22 PROGS_SYSDEP=   @PROGS_HAVE_TSEARCH@
23
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
29
30 DIRCFLAGS=      -I../src -I$(srcdir) -I$(srcdir)/../src
31
32 HCPPFLAGS=      -DADNS_REGRESS_TEST -I.
33 #HCPPFLAGS+=    -DFUZZRAW_SYNC
34
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
43
44 .PRECIOUS:      $(AUTOCSRCS) $(AUTOCHDRS)
45
46 all install uninstall: $(TARGETS)
47
48 ALL_TESTS:=$(patsubst $(srcdir)/case-%.sys,%,$(wildcard $(srcdir)/case-*.sys))
49
50 check:          $(TARGETS) $(addprefix check-,$(ALL_TESTS))
51                 @echo
52                 @echo 'all tests passed or maybe skipped.'
53
54 checkfuzz:              $(TARGETS) \
55                         $(addprefix checkfuzz-,$(ALL_TESTS)) \
56                         $(addprefix checkfuzzraw-,$(ALL_TESTS))
57                 @echo
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
61
62 fuzzcat.d:      checkfuzz
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
67                 perl -p -e 'chomp;' \
68                         -e 's/[^0-9a-z-_]/sprintf "\\x%02x", ord $$&/ige;' \
69                         -e 's/^/l$$.="/; ' \
70                         -e 's/$$/"\n/;' \
71                         fuzzcat.d/dictionary >fuzzcat.d/dictionary.afl
72
73 check-%:        case-%.sys
74                 @srcdir=$(srcdir) $(srcdir)/r1test $* || test $$? = 5
75
76 fuzz-%:         case-%.sys $(TARGETS) make1fuzz shlib
77                 srcdir=$(srcdir) $(srcdir)/make1fuzz $*
78
79 fuzzraw-%:      fuzz-%
80
81 .PRECIOUS: fuzz-%
82
83 checkfuzz-%:    fuzz-% $(TARGETS)
84                 @srcdir=$(srcdir) $(srcdir)/check1fuzz $<
85
86 checkfuzzraw-%: fuzz-% $(TARGETS)
87                 @srcdir=$(srcdir) $(srcdir)/check1fuzz $<
88
89 LINK_CMD=       $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
90
91 %_record:       %_c.o hrecord.o hnonfuzz.o $(HARNLOBJS)
92                 $(LINK_CMD)
93
94 %_playback:     %_c.o hplayback.o hnonfuzz.o $(HARNLOBJS)
95                 $(LINK_CMD)
96
97 %_fuzz:         %_c.o hplayback.o hfuzz.o $(HARNLOBJS)
98                 $(LINK_CMD)
99
100 %_fuzzraw:      %_c.o hfuzzraw.o hfuzz.o $(HARNLOBJS)
101                 $(LINK_CMD)
102
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.)
106 #
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.)
110 #
111 # See also Savannah #29620, http://savannah.gnu.org/bugs/index.php?29620
112
113 adnshost_%:     $(ADH_OBJS) h%.o hnonfuzz.o $(HARNLOBJS)
114                 $(LINK_CMD)
115
116 adnshost_fuzz:  $(ADH_OBJS) hplayback.o hfuzz.o $(HARNLOBJS)
117                 $(LINK_CMD)
118
119 adnshost_fuzzraw: $(ADH_OBJS) hfuzzraw.o hfuzz.o $(HARNLOBJS)
120                 $(LINK_CMD)
121
122 %_d.o:          $(srcdir)/../src/%.c hredirect.h hsyscalls.h
123                 $(CC) $(CFLAGS) $(HCPPFLAGS) -c -g -o $@ $<
124
125 %_c.o:          $(srcdir)/../client/%.c hredirect.h hsyscalls.h
126                 $(CC) $(CFLAGS) $(HCPPFLAGS) -I $(srcdir)/../src -c -g -o $@ $<
127
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
131
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