TARGETS= $(addsuffix _record, $(CLIENTS)) \
$(addsuffix _playback, $(CLIENTS))
ADH_OBJS= adh-main_c.o adh-opts_c.o adh-query_c.o
-ALL_OBJS= $(HARNLOBJS) dtest.o hrecord.o hplayback.o
+ALL_OBJS= $(HARNLOBJS) dtest.o hrecord.o hplayback.o hnonfuzz.o
.PRECIOUS: $(AUTOCSRCS) $(AUTOCHDRS)
LINK_CMD= $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
-%_record: %_c.o hrecord.o $(HARNLOBJS)
+%_record: %_c.o hrecord.o hnonfuzz.o $(HARNLOBJS)
$(LINK_CMD)
-%_playback: %_c.o hplayback.o $(HARNLOBJS)
+%_playback: %_c.o hplayback.o hnonfuzz.o $(HARNLOBJS)
$(LINK_CMD)
.SECONDARY: $(addsuffix _c.o, $(filter-out adnshost, $(CLIENTS)))
#
# See also Savannah #29620, http://savannah.gnu.org/bugs/index.php?29620
-adnshost_%: $(ADH_OBJS) h%.o $(HARNLOBJS)
+adnshost_%: $(ADH_OBJS) h%.o hnonfuzz.o $(HARNLOBJS)
$(LINK_CMD)
%_d.o: $(srcdir)/../src/%.c hredirect.h
--- /dev/null
+/* nhonfuzz.c
+ * (part of complex test harness, not of the library)
+ * - routines used for record and playback but not for fuzzing
+ *
+ * This file is part of adns, which is
+ * Copyright (C) 1997-2000,2003,2006,2014-2016 Ian Jackson
+ * Copyright (C) 2014 Mark Wooding
+ * Copyright (C) 1999-2000,2003,2006 Tony Finch
+ * Copyright (C) 1991 Massachusetts Institute of Technology
+ * (See the file INSTALL for full details.)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation.
+ */
+
+#include <stdio.h>
+
+#include "harness.h"
+
+int Ttestinputfd(void) {
+ const char *fdstr= getenv("ADNS_TEST_IN_FD");
+ if (!fdstr) return -1;
+ return atoi(fdstr);
+}
}
void Tensurerecordfile(void) {
- const char *fdstr;
int fd;
int chars;
unsigned long sec, usec;
if (Tinputfile) return;
Tinputfile= stdin;
- fdstr= getenv("ADNS_TEST_IN_FD");
- if (fdstr) {
- fd= atoi(fdstr);
+ fd = Ttestinputfd();
+ if (fd >= 0) {
Tinputfile= fdopen(fd,"r"); if (!Tinputfile) Tfailed("fdopen ADNS_TEST_IN_FD");
}
setvbuf(Tinputfile,0,_IONBF,0);