chiark / gitweb /
changelog: Document changes in 1.6.0 and finalise version number
[adns.git] / regress / Makefile.in
1 # regress/Makefile[.in] - regression test Makefile
2
3 #  This file is part of adns, which is
4 #    Copyright (C) 1997-2000,2003,2006,2014-2016,2020  Ian Jackson
5 #    Copyright (C) 2014  Mark Wooding
6 #    Copyright (C) 1999-2000,2003,2006  Tony Finch
7 #    Copyright (C) 1991 Massachusetts Institute of Technology
8 #  (See the file INSTALL for full details.)
9 #  
10 #  This program is free software; you can redistribute it and/or modify
11 #  it under the terms of the GNU General Public License as published by
12 #  the Free Software Foundation; either version 3, or (at your option)
13 #  any later version.
14 #  
15 #  This program is distributed in the hope that it will be useful,
16 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
17 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 #  GNU General Public License for more details.
19 #  
20 #  You should have received a copy of the GNU General Public License
21 #  along with this program; if not, write to the Free Software Foundation.
22
23 srcdir=         @srcdir@
24 VPATH=          @srcdir@
25
26 PROGS_SYSDEP=   @PROGS_HAVE_TSEARCH@
27
28 CLIENTS=        adnstest adnshost adnslogres $(PROGS_SYSDEP)
29 AUTOCHDRS=      harness.h hsyscalls.h hredirect.h
30 AUTOCSRCS=      hrecord.c hplayback.c hcommon.c hfuzzraw.c
31 include         ../settings.make
32 include         $(srcdir)/../src/adns.make
33
34 DIRCFLAGS=      -I../src -I$(srcdir) -I$(srcdir)/../src
35
36 HCPPFLAGS=      -DADNS_REGRESS_TEST -I.
37 #HCPPFLAGS+=    -DFUZZRAW_SYNC
38
39 REDIRLIBOBJS=   $(addsuffix _d.o, $(basename $(LIBOBJS)))
40 HARNLOBJS=      hcommon.o $(REDIRLIBOBJS)
41 TARGETS=        $(addsuffix _record, $(CLIENTS)) \
42                 $(addsuffix _playback, $(CLIENTS)) \
43                 $(addsuffix _fuzz, $(CLIENTS)) \
44                 $(addsuffix _fuzzraw, $(CLIENTS))
45 ADH_OBJS=       adh-main_c.o adh-opts_c.o adh-query_c.o
46 ALL_OBJS=       $(HARNLOBJS) dtest.o hrecord.o hplayback.o hnonfuzz.o hfuzz.o
47
48 .PRECIOUS:      $(AUTOCSRCS) $(AUTOCHDRS)
49
50 all install uninstall: $(TARGETS)
51
52 ALL_TESTS:=$(patsubst $(srcdir)/case-%.sys,%,$(wildcard $(srcdir)/case-*.sys))
53
54 check:          $(TARGETS) $(addprefix check-,$(ALL_TESTS))
55                 @echo
56                 @echo 'all tests passed or maybe skipped.'
57
58 checkfuzz:              $(TARGETS) \
59                         $(addprefix checkfuzz-,$(ALL_TESTS)) \
60                         $(addprefix checkfuzzraw-,$(ALL_TESTS))
61                 @echo
62                 @echo 'all fuzzes passed or maybe skipped.'
63 # this target is mostly useful as prep work for running the fuzzer;
64 # it doesn't really test any of adns
65
66 fuzzcat.d:      checkfuzz
67                 $(srcdir)/categorisefuzz $(ALL_TESTS)
68                 perl -ne 'print $$1,"\n" while m/\"([^"% ]{2,})\"/g' \
69                         $(srcdir)/../src/*.[ch] $(srcdir)/../client/*.[ch] \
70                 | sort -u >fuzzcat.d/dictionary
71                 perl -p -e 'chomp;' \
72                         -e 's/[^0-9a-z-_]/sprintf "\\x%02x", ord $$&/ige;' \
73                         -e 's/^/l$$.="/; ' \
74                         -e 's/$$/"\n/;' \
75                         fuzzcat.d/dictionary >fuzzcat.d/dictionary.afl
76
77 check-%:        case-%.sys
78                 @srcdir=$(srcdir) $(srcdir)/r1test $* || test $$? = 5
79
80 fuzz-%:         case-%.sys $(TARGETS) make1fuzz shlib
81                 srcdir=$(srcdir) $(srcdir)/make1fuzz $*
82
83 fuzzraw-%:      fuzz-%
84
85 .PRECIOUS: fuzz-%
86
87 checkfuzz-%:    fuzz-% $(TARGETS)
88                 @srcdir=$(srcdir) $(srcdir)/check1fuzz $<
89
90 checkfuzzraw-%: fuzz-% $(TARGETS)
91                 @srcdir=$(srcdir) $(srcdir)/check1fuzz $<
92
93 LINK_CMD=       $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
94
95 %_record:       %_c.o hrecord.o hnonfuzz.o $(HARNLOBJS)
96                 $(LINK_CMD)
97
98 %_playback:     %_c.o hplayback.o hnonfuzz.o $(HARNLOBJS)
99                 $(LINK_CMD)
100
101 %_fuzz:         %_c.o hplayback.o hfuzz.o $(HARNLOBJS)
102                 $(LINK_CMD)
103
104 %_fuzzraw:      %_c.o hfuzzraw.o hfuzz.o $(HARNLOBJS)
105                 $(LINK_CMD)
106
107 .SECONDARY: $(addsuffix _c.o, $(filter-out adnshost, $(CLIENTS)))
108 # Without this, make will remove <client>_c.o after building <client>.
109 # This wastes effort.  (Debian bug #4073.)
110 #
111 # Also, it exposes us to a bug (in make 3.81, at least) which can
112 # cause make to run the rule for building <client> without building
113 # <client>_c.o!  (Debian #756123.)
114 #
115 # See also Savannah #29620, http://savannah.gnu.org/bugs/index.php?29620
116
117 adnshost_%:     $(ADH_OBJS) h%.o hnonfuzz.o $(HARNLOBJS)
118                 $(LINK_CMD)
119
120 adnshost_fuzz:  $(ADH_OBJS) hplayback.o hfuzz.o $(HARNLOBJS)
121                 $(LINK_CMD)
122
123 adnshost_fuzzraw: $(ADH_OBJS) hfuzzraw.o hfuzz.o $(HARNLOBJS)
124                 $(LINK_CMD)
125
126 %_d.o:          $(srcdir)/../src/%.c hredirect.h
127                 $(CC) $(CFLAGS) $(HCPPFLAGS) -c -g -o $@ $<
128
129 %_c.o:          $(srcdir)/../client/%.c hredirect.h
130                 $(CC) $(CFLAGS) $(HCPPFLAGS) -I $(srcdir)/../src -c -g -o $@ $<
131
132 $(ALL_OBJS):    $(srcdir)/../src/adns.h $(srcdir)/../src/internal.h
133 $(ALL_OBJS):    harness.h hsyscalls.h
134 $(ADH_OBJS):    $(srcdir)/../client/adnshost.h
135
136 %::     %.m4 hmacros.i4 hsyscalls.i4
137         $(M4) -P -I$(srcdir) $< >$@-a.new
138         sed -e 's/hm_comma/,/g; s/hm_squote/'\''/g; /^[  ]*$$/d' <$@-a.new >$@-b.new
139         @mv -f $@-b.new $(srcdir)/$@; rm -f $@-a.new