Bugfixes:
* Actually compile shared libraries by default !
+ General Improvements:
+ * adnshost has --config option for overriding configuration.
+ * Regression tests now include `adnshost' invocations.
+ * Test cancellation both before and after query completion.
+
Portability fixes:
* Fix <sys/fcntl.h> in client/adnsresfilter.c to <fcntl.h>.
* #include <sys/types.h> and <unistd.h> for fcntl in */*.c.
* adnstest: setvbuf(stdout,...) before we do first output.
* Cast a sizeof(...) in src/event.c to unsigned long before printing.
* #include <sys/select.h> if it exists.
+ * Regression tests work better if some syscalls are already macros.
Portability cleanups:
* Add list of tested platforms in INSTALL file.
#include "adnshost.h"
+int rcode;
+const char *config_text;
+
+static int used, avail;
+static char *buf;
+
+void quitnow(int rc) {
+ if (ads) adns_finish(ads);
+ free(buf);
+ free(ov_id);
+ exit(rc);
+}
+
void sysfail(const char *what, int errnoval) {
fprintf(stderr,"adnshost failed: %s: %s\n",what,strerror(errnoval));
- exit(10);
+ quitnow(10);
}
void usageerr(const char *fmt, ...) {
vfprintf(stderr,fmt,al);
va_end(al);
putc('\n',stderr);
- exit(11);
+ quitnow(11);
}
void outerr(void) {
return p;
}
+void of_config(const struct optioninfo *oi, const char *arg, const char *arg2) {
+ config_text= arg;
+}
+
void of_type(const struct optioninfo *oi, const char *arg, const char *arg2) {
static const struct typename {
adns_rrtype type;
ov_type= tnp->type;
}
-int rcode;
-
static void process_optarg(const char *arg,
const char *const **argv_p,
const char *value) {
}
static void read_stdin(void) {
- static int used, avail;
- static char *buf;
-
int anydone, r;
char *newline, *space;
}
x_quit:
if (fclose(stdout)) outerr();
- exit(rcode);
+ quitnow(rcode);
}
"Vd", "debug", &ov_verbose, adns_if_debug },
{ ot_desconly, "other global options:" },
+ { ot_funcarg, "Configuration to use instead of /etc/resolv.conf",
+ 0, "config", 0,0, of_config, "<config-text>" },
{ ot_func, "Print usage information",
0, "help", 0,0, of_help },
void of_help(const struct optioninfo *oi, const char *arg, const char *arg2) {
printusage();
if (fclose(stdout)) sysfail("finish writing output",errno);
- exit(0);
+ quitnow(0);
}
typedef int comparer_type(const char **optp, const struct optioninfo *entry);
static unsigned long idcounter;
void ensure_adns_init(void) {
+ adns_initflags initflags;
int r;
if (ads) return;
if (signal(SIGPIPE,SIG_IGN) == SIG_ERR) sysfail("ignore SIGPIPE",errno);
- r= adns_init(&ads,
- adns_if_noautosys|adns_if_nosigpipe |
- (ov_env ? 0 : adns_if_noenv) |
- ov_verbose,
- 0);
+
+ initflags= adns_if_noautosys|adns_if_nosigpipe|ov_verbose;
+ if (!ov_env) initflags |= adns_if_noenv;
+
+ if (config_text) {
+ r= adns_init_strcfg(&ads, initflags, stderr, config_text);
+ } else {
+ r= adns_init(&ads, initflags, 0);
+ }
if (r) sysfail("adns_init",r);
if (ov_format == fmt_default)
static void dequeue_query(struct query_node *qun) {
LIST_UNLINK(outstanding,qun);
free(qun->id);
+ free(qun->owner);
free(qun);
}
#include "adns.h"
#include "dlist.h"
+#ifdef ADNS_REGRESS_TEST
+# include "hredirect.h"
+#endif
+
/* declarations related to option processing */
struct optioninfo;
extern char *ov_id;
extern struct perqueryflags_remember ov_pqfr;
-extern optfunc of_help, of_type, of_ptr, of_reverse, of_asynch_id, of_cancel_id;
+extern optfunc of_config, of_help, of_type, of_ptr, of_reverse;
+extern optfunc of_asynch_id, of_cancel_id;
const struct optioninfo *opt_findl(const char *opt);
const struct optioninfo *opt_finds(const char **optp);
void *xmalloc(size_t sz);
char *xstrsave(const char *str);
+void quitnow(int rc) NONRETURNING;
+
extern int rcode;
+extern const char *config_text; /* 0 => use defaults */
#endif
#include "config.h"
#include "adns.h"
-#ifndef OUTPUTSTREAM
-# define OUTPUTSTREAM stdout
+#ifdef ADNS_REGRESS_TEST
+# include "hredirect.h"
#endif
struct myctx {
Makefile
harness.h
+hsyscalls.h
+hredirect.h
hcommon.c
-hrecord
+*_record
+*_playback
hrecord.c
-hplayback
hplayback.c
output-*.*
+pipe.out
+pipe.err
srcdir= @srcdir@
VPATH= @srcdir@
-TARGETS= hplayback hrecord
-AUTOCSRCS= harness.h hrecord.c hplayback.c hcommon.c
+CLIENTS= adnstest adnshost
+AUTOCHDRS= harness.h hsyscalls.h hredirect.h
+AUTOCSRCS= hrecord.c hplayback.c hcommon.c
include $(srcdir)/../settings.make
include $(srcdir)/../src/adns.make
DIRCFLAGS= -I$(srcdir)/../src
-HCPPFLAGS:= $(foreach F, \
- gettimeofday select poll \
- socket fcntl connect close \
- sendto recvfrom read write writev \
- malloc realloc free exit \
-, -D$F=H$F)
+HCPPFLAGS= -DADNS_REGRESS_TEST -I.
-HARNLOBJS= $(addsuffix _d.o, $(basename $(LIBOBJS)))
-ALLOBJS= $(HARNLOBJS) dtest.o hrecord.o hplayback.o hcommon.o
+REDIRLIBOBJS= $(addsuffix _d.o, $(basename $(LIBOBJS)))
+HARNLOBJS= hcommon.o $(REDIRLIBOBJS)
+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
-.PRECIOUS: $(AUTOCSRCS)
+.PRECIOUS: $(AUTOCSRCS) $(AUTOCHDRS)
+
+all install uninstall: $(TARGETS)
check: $(TARGETS)
./checkall
-all install uninstall:
+LINK_CMD= $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
+
+%_record: %_c.o hrecord.o $(HARNLOBJS)
+ $(LINK_CMD)
+
+%_playback: %_c.o hplayback.o $(HARNLOBJS)
+ $(LINK_CMD)
-hrecord: adnstest_c.o hrecord.o hcommon.o $(HARNLOBJS)
-hplayback: adnstest_c.o hplayback.o hcommon.o $(HARNLOBJS)
+adnshost_%: $(ADH_OBJS) h%.o $(HARNLOBJS)
+ $(LINK_CMD)
-%_d.o: $(srcdir)/../src/%.c
+%_d.o: $(srcdir)/../src/%.c hredirect.h
$(CC) $(HCPPFLAGS) -c -g -o $@ $<
-%_c.o: $(srcdir)/../client/%.c
+%_c.o: $(srcdir)/../client/%.c hredirect.h
$(CC) $(HCPPFLAGS) -I $(srcdir)/../src -c -g -o $@ $<
-$(ALLOBJS): $(srcdir)/../src/adns.h $(srcdir)/../src/internal.h harness.h
+$(ALL_OBJS): $(srcdir)/../src/adns.h $(srcdir)/../src/internal.h
+$(ALL_OBJS): harness.h hsyscalls.h
+$(ADH_OBJS): $(srcdir)/../client/adnshost.h
%:: %.m4 hmacros.i4 hsyscalls.i4
$(M4) -P $< >$@-a.new
-1stservbroken
+adnstest 1stservbroken
:12 trunc.test.iwj.relativity.greenend.org.uk
start 940102940.701451
socket type=SOCK_DGRAM
-1stservto
+adnstest 1stservto
:12 trunc.test.iwj.relativity.greenend.org.uk
start 940100259.965940
socket type=SOCK_DGRAM
-2ndserver
+adnstest 2ndserver
:1 davenant.relativity.greenend.org.uk
start 940100095.012145
socket type=SOCK_DGRAM
-2ndserver
+adnstest 2ndserver
:12 trunc.test.iwj.relativity.greenend.org.uk
start 940100083.268555
socket type=SOCK_DGRAM
-default
+adnstest default
,a/greenend.org.uk
start 929580078.542974
socket type=SOCK_DGRAM
-noserver
+adnstest noserver
,a/greenend.org.uk
start 929580082.699581
socket type=SOCK_DGRAM
--- /dev/null
+davenant.relativity.greenend.org.uk A INET 172.18.45.6
+rc=0
--- /dev/null
+./adnshost default -f
+
+ start 969124425.922896
+ socket type=SOCK_DGRAM
+ socket=6
+ +0.000162
+ fcntl fd=6 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000058
+ fcntl fd=6 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000035
+ select max=7 rfds=[0,6] wfds=[] efds=[] to=null
+ select=1 rfds=[0] wfds=[] efds=[]
+ +0.000135
+ read fd=0 buflen=40
+ read=OK
+ 2d2d6173 796e6368 2d696420 34320a63 68696172 6b2e6772 65656e65 6e642e6f
+ 72672e75 6b0a2d2d.
+ +0.000254
+ sendto fd=6 addr=172.18.45.6:53
+ 311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+ 02756b00 00010001.
+ sendto=40
+ +0.000825
+ read fd=0 buflen=38
+ read=OK
+ 6173796e 63682d69 64203433 0a646176 656e616e 742e7265 6c617469 76697479
+ 2e677265 656e.
+ +0.000184
+ read fd=0 buflen=15
+ read=OK
+ 656e642e 6f72672e 756b0a2d 2d6361.
+ +0.000106
+ sendto fd=6 addr=172.18.45.6:53
+ 31200100 00010000 00000000 08646176 656e616e 740a7265 6c617469 76697479
+ 08677265 656e656e 64036f72 6702756b 00000100 01.
+ sendto=53
+ +0.000624
+ read fd=0 buflen=36
+ read=OK
+ 6e63656c 2d696420 34320a.
+ +0.000145
+ select max=7 rfds=[0,6] wfds=[] efds=[] to=1.999231
+ select=2 rfds=[0,6] wfds=[] efds=[]
+ +0.000157
+ recvfrom fd=6 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+ 311f8580 00010001 00020002 06636869 61726b08 67726565 6e656e64 036f7267
+ 02756b00 00010001 c00c0001 00010001 51800004 c3e04c84 08677265 656e656e
+ 64036f72 6702756b 00000200 01000151 80001103 6e73300a 72656c61 74697669
+ 7479c038 c0380002 00010001 51800006 036e7331 c057c053 00010001 00015180
+ 0004ac12 2d06c070 00010001 00015180 0004ac12 2d01.
+ +0.000551
+ recvfrom fd=6 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+ 31208580 00010001 00020002 08646176 656e616e 740a7265 6c617469 76697479
+ 08677265 656e656e 64036f72 6702756b 00000100 01c00c00 01000100 01518000
+ 04ac122d 060a7265 6c617469 76697479 08677265 656e656e 64036f72 6702756b
+ 00000200 01000151 80000603 6e7330c0 45c04500 02000100 01518000 06036e73
+ 31c045c0 6b000100 01000151 800004ac 122d06c0 7d000100 01000151 800004ac
+ 122d01.
+ +0.000579
+ recvfrom fd=6 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000151
+ read fd=0 buflen=40
+ read=OK
+ .
+ +0.000043
+ close fd=6
+ close=OK
+ +0.000961
--- /dev/null
+./adnshost default -f
+
+ start 969124594.885114
+ socket type=SOCK_DGRAM
+ socket=6
+ +0.000160
+ fcntl fd=6 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000057
+ fcntl fd=6 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000035
+ select max=7 rfds=[0,6] wfds=[] efds=[] to=null
+ select=1 rfds=[0] wfds=[] efds=[]
+ +6.-286734
+ read fd=0 buflen=40
+ read=OK
+ 2d2d6173 796e6368 2d696420 34320a.
+ +0.000727
+ select max=7 rfds=[0,6] wfds=[] efds=[] to=null
+ select=1 rfds=[0] wfds=[] efds=[]
+ +0.000147
+ read fd=0 buflen=40
+ read=OK
+ 63686961 726b2e67 7265656e 656e642e 6f72672e 756b0a.
+ +0.000129
+ sendto fd=6 addr=172.18.45.6:53
+ 311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+ 02756b00 00010001.
+ sendto=40
+ +0.000802
+ select max=7 rfds=[0,6] wfds=[] efds=[] to=1.999198
+ select=1 rfds=[0,6] wfds=[] efds=[]
+ +0.000135
+ recvfrom fd=6 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+ 311f8580 00010001 00020002 06636869 61726b08 67726565 6e656e64 036f7267
+ 02756b00 00010001 c00c0001 00010001 51800004 c3e04c84 08677265 656e656e
+ 64036f72 6702756b 00000200 01000151 80001103 6e73300a 72656c61 74697669
+ 7479c038 c0380002 00010001 51800006 036e7331 c057c053 00010001 00015180
+ 0004ac12 2d06c070 00010001 00015180 0004ac12 2d01.
+ +0.000553
+ recvfrom fd=6 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000195
+ read fd=0 buflen=40
+ read=OK
+ 2d2d6361 6e63656c 2d696420 34320a.
+ +0.000688
+ select max=7 rfds=[0,6] wfds=[] efds=[] to=null
+ select=1 rfds=[0] wfds=[] efds=[]
+ +2.-11588
+ read fd=0 buflen=40
+ read=OK
+ .
+ +0.000089
+ close fd=6
+ close=OK
+ +0.000149
--- /dev/null
+chiark.greenend.org.uk A INET 195.224.76.132
+rc=0
--- /dev/null
+./adnshost default
+chiark.greenend.org.uk
+ start 969122933.609498
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000155
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000057
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000037
+ sendto fd=4 addr=172.18.45.6:53
+ 311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+ 02756b00 00010001.
+ sendto=40
+ +0.000827
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.999173
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.000158
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+ 311f8580 00010001 00020002 06636869 61726b08 67726565 6e656e64 036f7267
+ 02756b00 00010001 c00c0001 00010001 51800004 c3e04c84 08677265 656e656e
+ 64036f72 6702756b 00000200 01000151 80001103 6e73300a 72656c61 74697669
+ 7479c038 c0380002 00010001 51800006 036e7331 c057c053 00010001 00015180
+ 0004ac12 2d06c070 00010001 00015180 0004ac12 2d01.
+ +0.000895
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000149
+ close fd=4
+ close=OK
+ +0.000290
--- /dev/null
+chiark.greenend.org.uk A INET 195.224.76.132
+rc=0
--- /dev/null
+./adnshost default -f
+
+ start 969123801.904882
+ socket type=SOCK_DGRAM
+ socket=6
+ +0.000156
+ fcntl fd=6 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000057
+ fcntl fd=6 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000035
+ select max=7 rfds=[0,6] wfds=[] efds=[] to=null
+ select=1 rfds=[0] wfds=[] efds=[]
+ +4.-792858
+ read fd=0 buflen=40
+ read=OK
+ 63686961 726b2e67 7265656e 656e642e 6f72672e 756b0a.
+ +0.000235
+ sendto fd=6 addr=172.18.45.6:53
+ 311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
+ 02756b00 00010001.
+ sendto=40
+ +0.000847
+ select max=7 rfds=[0,6] wfds=[] efds=[] to=1.999153
+ select=1 rfds=[6] wfds=[] efds=[]
+ +0.000140
+ recvfrom fd=6 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+ 311f8580 00010001 00020002 06636869 61726b08 67726565 6e656e64 036f7267
+ 02756b00 00010001 c00c0001 00010001 51800004 c3e04c84 08677265 656e656e
+ 64036f72 6702756b 00000200 01000151 80001103 6e73300a 72656c61 74697669
+ 7479c038 c0380002 00010001 51800006 036e7331 c057c053 00010001 00015180
+ 0004ac12 2d06c070 00010001 00015180 0004ac12 2d01.
+ +0.000548
+ recvfrom fd=6 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000184
+ select max=7 rfds=[0,6] wfds=[] efds=[] to=null
+ select=1 rfds=[0] wfds=[] efds=[]
+ +0.715699
+ read fd=0 buflen=40
+ read=OK
+ .
+ +0.000090
+ close fd=6
+ close=OK
+ +0.000134
-default
+adnstest default
:15,65551 broken-mail.test.iwj.relativity.greenend.org.uk. 256/broken-mail.test.iwj.relativity.greenend.org.uk. 0x104/broken-mail.test.iwj.relativity.greenend.org.uk.
start 934726868.117908
socket type=SOCK_DGRAM
-default
+adnstest default
:65548 134.76.224.195.in-addr.arpa
start 929574747.401802
socket type=SOCK_DGRAM
-default
+adnstest default
:1 intel.ugcs.caltech.edu.
start 938369896.279735
socket type=SOCK_DGRAM
-default
+adnstest default
:12 37.45.18.172.in-addr.arpa.
start 951961094.184850
socket type=SOCK_DGRAM
-default
+adnstest default
292/170.99.219.194.in-addr.arpa
start 933809668.543946
socket type=SOCK_DGRAM
-default
+adnstest default
292/170.99.219.194.in-addr.arpa
start 933809632.795174
socket type=SOCK_DGRAM
-default
+adnstest default
:1 ,aaaaaaaaaa/chiark.greenend.org.uk
start 929580072.670441
socket type=SOCK_DGRAM
-default
+adnstest default
:1 ,aaaaaaaaa/chiark.greenend.org.uk
start 929580075.263215
socket type=SOCK_DGRAM
-default
+adnstest default
:1 1/h.rndrobwlxxxxxxxxxxlllantysiliogogllanfairpwllgwyngyllgogerychw.relativity.greenend.org.uk.
start 951956380.814815
socket type=SOCK_DGRAM
-noserver
+adnstest noserver
:1 chiark.greenend.org.uk
start 912889153.349504
socket type=SOCK_DGRAM
-default
+adnstest default
:1 1/0rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk.
start 951955651.857473
socket type=SOCK_DGRAM
-default
+adnstest default
:1 1/10rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk.
start 951955690.505811
socket type=SOCK_DGRAM
-ndots100
+adnstest ndots100
:1 1/10rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
start 951956073.321566
socket type=SOCK_DGRAM
-ndots100
+adnstest ndots100
:1 1/0rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
start 951956087.269350
socket type=SOCK_DGRAM
-ndots100
+adnstest ndots100
:1 1/1xxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
start 951956136.566877
socket type=SOCK_DGRAM
-ndots100
+adnstest ndots100
:1 1/xxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
start 951956143.624786
socket type=SOCK_DGRAM
-default
+adnstest default
:1 1/yrndrobwlxxxxxxxxxxlllantysiliogogllanfairpwllgwyngyllgogerychw.relativity.greenend.org.uk.
start 951955250.786132
socket type=SOCK_DGRAM
-default
+adnstest default
:1 1/hyrndrobwlxxxxxxxxxxlllantysiliogogllanfairpwllgwyngyllgogerychw.relativity.greenend.org.uk.
start 951955261.286712
socket type=SOCK_DGRAM
-default
+adnstest default
:131089 silly-rp.test.iwj.relativity.greenend.org.uk
start 923859567.899146
socket type=SOCK_DGRAM
-default
+adnstest default
:1 manyaddrs.test.iwj.relativity.greenend.org.uk
start 912888920.123769
socket type=SOCK_DGRAM
-ncipher
+adnstest ncipher
254.0.99.203.in-addr.arpa
start 933269010.293417
socket type=SOCK_DGRAM
-manyptrwrong
+adnstest manyptrwrong
292/254.0.99.203.in-addr.arpa
start 933286859.476326
socket type=SOCK_DGRAM
-default
+adnstest default
292/254.0.99.203.in-addr.arpa
start 933289772.727140
socket type=SOCK_DGRAM
-default
+adnstest default
292/254.0.99.203.in-addr.arpa
start 933286845.072950
socket type=SOCK_DGRAM
-default
+adnstest default
:1 5/newsx.davenant 5/news.davenant 5/news.davenant.greenend.org.uk 5/trunc.test.iwj.relativity 5/trunx.test.iwj.relativity 5/test.iwj.relativity
start 931992163.221752
socket type=SOCK_DGRAM
-ndots -,s
+adnstest ndots -,s
:1 5/newsx.davenant 5/news.davenant 5/news.davenant.greenend.org.uk 5/trunc.test.iwj.relativity 5/trunx.test.iwj.relativity 5/test.iwj.relativity
start 924365863.351594
socket type=SOCK_DGRAM
-ndotsbad
+adnstest ndotsbad
:1 5/news.davenant.greenend.org.uk
-noserver -,p
+adnstest noserver -,p
:1 a.b.c.d
start 940011574.766962
socket type=SOCK_DGRAM
-default -0x16
+adnstest default -0x16
4.204.50.158.in-addr.arpa
start 939764098.821612
socket type=SOCK_DGRAM
-default -0x16
+adnstest default -0x16
4.204.50.158.in-addr.arpa
start 939764277.018636
socket type=SOCK_DGRAM
-default -0x16
+adnstest default -0x16
2.203.156.195.in-addr.arpa1
start 939764258.086555
socket type=SOCK_DGRAM
-default
+adnstest default
:1 chiark.greenend.org.uk
start 912888966.802483
socket type=SOCK_DGRAM
-default
+adnstest default
4/chiark.greenend.org.uk
start 933206012.504679
socket type=SOCK_DGRAM
-default -,p
+adnstest default -,p
:1 chiark.greenend.org.uk
start 931719947.391142
socket type=SOCK_DGRAM
-noserver -,p
+adnstest noserver -,p
:1 chiark.greenend.org.uk
start 931719968.733439
socket type=SOCK_DGRAM
-default
+adnstest default
:12,65548 37.45.18.172.in-addr.arpa.test.iwj.relativity.greenend.org.uk.
start 951960654.608219
socket type=SOCK_DGRAM
-default
+adnstest default
:1 hyphen.cname.test.iwj.relativity.greenend.org.uk dot.cname.test.iwj.relativity.greenend.org.uk plus.cname.test.iwj.relativity.greenend.org.uk slash.cname.test.iwj.relativity.greenend.org.uk underscore.cname.test.iwj.relativity.greenend.org.uk quote.cname.test.iwj.relativity.greenend.org.uk backslash.cname.test.iwj.relativity.greenend.org.uk null.cname.test.iwj.relativity.greenend.org.uk space.cname.test.iwj.relativity.greenend.org.uk hash.cname.test.iwj.relativity.greenend.org.uk del.cname.test.iwj.relativity.greenend.org.uk meta-null.cname.test.iwj.relativity.greenend.org.uk meta-del.cname.test.iwj.relativity.greenend.org.uk
start 951958420.936685
socket type=SOCK_DGRAM
-default
+adnstest default
:131078 . 1/.
start 924364442.672925
socket type=SOCK_DGRAM
-default
+adnstest default
. 1/.
start 931992019.753022
socket type=SOCK_DGRAM
-default -,s
+adnstest default -,s
. 1/.
start 924364450.165424
socket type=SOCK_DGRAM
-default
+adnstest default
:1 0x5/news 0x5/chiark 1/news 1/chiark
start 931992052.232208
socket type=SOCK_DGRAM
-default -,s
+adnstest default -,s
:1 0x5/news 0x5/chiark 1/news 1/chiark
start 924360470.478357
socket type=SOCK_DGRAM
-default
+adnstest default
:1 1/news.davenant
start 924363451.882765
socket type=SOCK_DGRAM
-default
+adnstest default
:17,131089 0x70/silly-rp-dm.test.iwj.relativity.greenend.org.uk 0x70/silly-rp-lp.test.iwj.relativity.greenend.org.uk silly-rp-lp.test.iwj.relativity.greenend.org.uk silly-rp-dm.test.iwj.relativity.greenend.org.uk
start 929580348.131048
socket type=SOCK_DGRAM
-anarres
+adnstest anarres
2/test.iwj.relativity.greenend.org.uk.
start 962142174.403028
socket type=SOCK_DGRAM
-anarres
+adnstest anarres
2/test.iwj.relativity.greenend.org.uk.
start 962142246.340485
socket type=SOCK_DGRAM
-anarres -0x300
+adnstest anarres -0x300
2/test.iwj.relativity.greenend.org.uk.
start 962143388.709150
socket type=SOCK_DGRAM
-anarres -0x300
+adnstest anarres -0x300
2/test.iwj.relativity.greenend.org.uk. 2/test.iwj.relativity.greenend.org.uk. 2/test.iwj.relativity.greenend.org.uk.
start 962143438.172669
socket type=SOCK_DGRAM
-default
+adnstest default
:65548 2/6.45.18.172.in-addr.arpa
start 957718868.938329
socket type=SOCK_DGRAM
-tunnel
+adnstest tunnel
:12 2/132.76.224.195.in-addr.arpa 2/manymorerrs.test.culture.dotat.at. 2/132.76.224.195.in-addr.arpa
start 938365454.994875
socket type=SOCK_DGRAM
-default
+adnstest default
:65548 2/6.45.18.172.in-addr.arpa
start 957718868.938329
socket type=SOCK_DGRAM
-noserver
+adnstest noserver
:1 chiark.greenend.org.uk
start 912889153.349504
socket type=SOCK_DGRAM
-default
+adnstest default
:1 trunc.test.iwj.relativity.greenend.org.uk
start 912888921.274801
socket type=SOCK_DGRAM
-default
+adnstest default
:32767 davenant.relativity.greenend.org.uk.
start 933811310.565828
socket type=SOCK_DGRAM
m4_dnl - function and other declarations
m4_dnl This file is
-m4_dnl Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk>
+m4_dnl Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
m4_dnl
m4_dnl It is part of adns, which is
m4_dnl Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
#ifndef HARNESS_H_INCLUDED
#define HARNESS_H_INCLUDED
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <unistd.h>
-
#include "internal.h"
-
-#ifdef HAVE_POLL
-#include <sys/poll.h>
-#endif
-
-/* We override several system calls with #define's */
-
-hm_create_proto_h
-m4_define(`hm_syscall', `int H$1(hm_args_massage($3,void));')
-m4_include(`hsyscalls.i4')
-
-int Hwritev(int fd, const struct iovec *vector, size_t count);
-int Hgettimeofday(struct timeval *tv, struct timezone *tz);
-
-void *Hmalloc(size_t sz);
-void Hfree(void *ptr);
-void *Hrealloc(void *op, size_t nsz);
-void Hexit(int rv);
+#include "hsyscalls.h"
/* There is a Q function (Q for Question) for each such syscall;
* it constructs a string representing the call, and calls Q_str
hm_create_proto_q
m4_define(`hm_syscall', `void Q$1(hm_args_massage($3,void));')
+m4_define(`hm_specsyscall', `')
m4_include(`hsyscalls.i4')
void Q_vb(void);
}
')
-m4_include(`hsyscalls.i4')
+m4_define(`hm_specsyscall', `')
+m4_include(`hsyscalls.i4')
void Tvbaddr(const struct sockaddr *addr, int len) {
const struct sockaddr_in *ai= (const struct sockaddr_in*)addr;
`'),
`',
`$2',
- `
+ `m4_dnl
m4_patsubst(m4_patsubst(m4_patsubst(m4_translit($1, `
',` '), `\(hm_comma *\)*$', `'), `^\( *hm_comma\)*', `'),
- `\( *hm_comma *\)+',` hm_comma ')
+ `\( *hm_comma *\)+',` hm_comma ')m4_dnl
')')
m4_define(`hm_create_nothing', `
}
')
+m4_define(`hm_specsyscall', `')
+
m4_include(`hsyscalls.i4')
}
')
+m4_define(`hm_specsyscall', `')
+
m4_include(`hsyscalls.i4')
--- /dev/null
+m4_dnl hredirect.h.m4
+m4_dnl (part of complex test harness, not of the library)
+m4_dnl - redefinitions of system calls
+
+m4_dnl This file is
+m4_dnl Copyright (C) 2000 Ian Jackson <ian@davenant.greenend.org.uk>
+m4_dnl
+m4_dnl It is part of adns, which is
+m4_dnl Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
+m4_dnl Copyright (C) 1999 Tony Finch <dot@dotat.at>
+m4_dnl
+m4_dnl This program is free software; you can redistribute it and/or modify
+m4_dnl it under the terms of the GNU General Public License as published by
+m4_dnl the Free Software Foundation; either version 2, or (at your option)
+m4_dnl any later version.
+m4_dnl
+m4_dnl This program is distributed in the hope that it will be useful,
+m4_dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+m4_dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+m4_dnl GNU General Public License for more details.
+m4_dnl
+m4_dnl You should have received a copy of the GNU General Public License
+m4_dnl along with this program; if not, write to the Free Software Foundation,
+m4_dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+m4_include(hmacros.i4)
+
+#ifndef HREDIRECT_H_INCLUDED
+#define HREDIRECT_H_INCLUDED
+
+#include "hsyscalls.h"
+
+hm_create_nothing
+m4_define(`hm_syscall', `#undef $1
+#define $1 H$1')
+m4_define(`hm_specsyscall',`#undef $1
+#define $2 H$2')
+m4_include(`hsyscalls.i4')
+
+#endif
--- /dev/null
+m4_dnl hsyscalls.h.m4
+m4_dnl (part of complex test harness, not of the library)
+m4_dnl - prototypes of redefinitions of system calls
+
+m4_dnl This file is
+m4_dnl Copyright (C) 2000 Ian Jackson <ian@davenant.greenend.org.uk>
+m4_dnl
+m4_dnl It is part of adns, which is
+m4_dnl Copyright (C) 1997-2000 Ian Jackson <ian@davenant.greenend.org.uk>
+m4_dnl Copyright (C) 1999 Tony Finch <dot@dotat.at>
+m4_dnl
+m4_dnl This program is free software; you can redistribute it and/or modify
+m4_dnl it under the terms of the GNU General Public License as published by
+m4_dnl the Free Software Foundation; either version 2, or (at your option)
+m4_dnl any later version.
+m4_dnl
+m4_dnl This program is distributed in the hope that it will be useful,
+m4_dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+m4_dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+m4_dnl GNU General Public License for more details.
+m4_dnl
+m4_dnl You should have received a copy of the GNU General Public License
+m4_dnl along with this program; if not, write to the Free Software Foundation,
+m4_dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+m4_include(hmacros.i4)
+
+#ifndef HSYSCALLS_H_INCLUDED
+#define HSYSCALLS_H_INCLUDED
+
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#ifdef HAVE_POLL
+#include <sys/poll.h>
+#endif
+
+hm_create_proto_h
+m4_define(`hm_syscall', `int H$1(hm_args_massage($3,void));')
+m4_define(`hm_specsyscall', `$1 H$2($3)$4;')
+m4_include(`hsyscalls.i4')
+
+#endif
hm_arg_fd(fd) hm_na
hm_arg_bytes_in(void,buf,size_t,len) hm_na
')
+
+hm_specsyscall(int, writev, `int fd, const struct iovec *vector, size_t count')
+hm_specsyscall(int, gettimeofday, `struct timeval *tv, struct timezone *tz')
+
+hm_specsyscall(void*, malloc, `size_t sz')
+hm_specsyscall(void, free, `void *ptr')
+hm_specsyscall(void*, realloc, `void *op, size_t nsz')
+hm_specsyscall(void, exit, `int rv', NONRETURNING)
-#!/bin/sh
+#!/bin/bash
# usage: m1test <name> <initfile> [<initflags>] <queryargs>'
# test recording script
#
if [ $# -lt 3 ]
then
echo >&2 \
-'usage: m1test <name> <initfile> [<initflags>] [=<hrecord-command-args>]
- <queryargs>'
+'usage: m1test <name> <initfile> [-<initflags>]
+ [=<hrecord-command-args>] <queryargs>'
exit 1
fi
case="case-$1"; shift
initfile="$1"; shift
-hrecord="./hrecord"
+hrecord="./adnstest_record"
case "$1" in
-*) initflags="$1"; shift
=*) hrecord="`echo \"$1\" | sed -e 's/^=//'`"; shift
esac
+if test ! -f "$hrecord" -a -f "${hrecord}_record"
+then
+ case "$hrecord" in
+ /*) program="$hrecord" ;;
+ *) program="./$hrecord" ;;
+ esac
+ hrecord="${program}_record"
+else
+ program="$(echo "$hrecord" | sed -e 's/ .*//; s/_record$//')"
+fi
+
queryargs="$*"
initstring="`cat init-$initfile.text`"
+xinitflagsf=$program-xinitflags.text
+if test -f $xinitflagsf
+then
+ useinitflags="$initflags $(cat $xinitflagsf)";
+else
+ useinitflags="$initflags /"
+fi
-echo $initfile $initflags >"$case.sys"
+echo $program $initfile $initflags >"$case.sys"
echo "$queryargs" >>"$case.sys"
EF_DISABLE_BANNER=1
export EF_DISABLE_BANNER
-echo running hrecord $initflags "/... $queryargs"
+rm -f pipe.out pipe.err
+mknod pipe.out p
+mknod pipe.err p
+tee <pipe.out "$case.out" &
+tee_out=$!
+tee <pipe.err "$case.err" &
+tee_err=$!
+exec 4>pipe.out
+exec 5>pipe.err
+
+echo running hrecord $initflags "... $queryargs"
set +e
-ADNS_TEST_OUT_FD=3 3>>"$case.sys" >"$case.out" 2>"$case.err" </dev/null \
- $hrecord $initflags "/$initstring" $queryargs
+ADNS_TEST_OUT_FD=3 3>>"$case.sys" >&4 2>&5 \
+ $hrecord $useinitflags"$initstring" $queryargs
rc=$?
set -e
-echo "rc=$rc" >>$case.out
+echo "rc=$rc" >&4
+exec 4>&-
+exec 5>&-
+
+wait $tee_out
+wait $tee_err
-egrep . -- "$case.err" "$case.out"
echo "exit status: $rc"
ocase="output-$casename"
exec <"$case.sys"
-read initfile initflags
+read program initfile initflags
read queryargs
initstring="`cat init-$initfile.text`"
+xinitflagsf=$program-xinitflags.text
+if test -f $xinitflagsf
+then
+ initflags="$initflags $(cat $xinitflagsf)";
+else
+ initflags="$initflags /"
+fi
rm -f $ocase.*
set +e
ADNS_TEST_REPORT_FD=3 3>>"$ocase.report" >"$ocase.out" 2>"$ocase.err" \
- ./hplayback $initflags "/$initstring" $queryargs
+ ./${program}_playback $initflags"$initstring" $queryargs
rc=$?
set -e
distclean: clean
rm -f $(TARGETS) *~ ./#*# core *.orig *.rej Makefile
-distprep: $(AUTOCSRCS)
+distprep: $(AUTOCSRCS) $(AUTOCHDRS)
maintainer-clean: distclean
- -rm -f $(AUTOCSRCS)
+ -rm -f $(AUTOCSRCS) $(AUTOCHDRS)
#include "adns.h"
#include "dlist.h"
+#ifdef ADNS_REGRESS_TEST
+# include "hredirect.h"
+#endif
+
/* Configuration and constants */
#define MAXSERVERS 5