summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog6
-rw-r--r--client/adh-main.c28
-rw-r--r--client/adh-opts.c4
-rw-r--r--client/adh-query.c16
-rw-r--r--client/adnshost.h10
-rw-r--r--client/adnstest.c4
-rw-r--r--regress/.cvsignore8
-rw-r--r--regress/Makefile.in43
-rw-r--r--regress/adnshost-xinitflags.text1
-rw-r--r--regress/case-1stservbroken.sys2
-rw-r--r--regress/case-1stservtotcp.sys2
-rw-r--r--regress/case-2ndservok.sys2
-rw-r--r--regress/case-2ndservtcp.sys2
-rw-r--r--regress/case-abbrev.sys2
-rw-r--r--regress/case-abbrevto.sys2
-rw-r--r--regress/case-adh-cancel.err0
-rw-r--r--regress/case-adh-cancel.out2
-rw-r--r--regress/case-adh-cancel.sys73
-rw-r--r--regress/case-adh-cancel2.err0
-rw-r--r--regress/case-adh-cancel2.out1
-rw-r--r--regress/case-adh-cancel2.sys59
-rw-r--r--regress/case-adh-norm.err0
-rw-r--r--regress/case-adh-norm.out2
-rw-r--r--regress/case-adh-norm.sys34
-rw-r--r--regress/case-adh-pipe.err0
-rw-r--r--regress/case-adh-pipe.out2
-rw-r--r--regress/case-adh-pipe.sys48
-rw-r--r--regress/case-brokenmail.sys2
-rw-r--r--regress/case-child.sys2
-rw-r--r--regress/case-cnametocname.sys2
-rw-r--r--regress/case-comprinf.sys2
-rw-r--r--regress/case-datapluscname.sys2
-rw-r--r--regress/case-datapluscnamewait.sys2
-rw-r--r--regress/case-flags10.sys2
-rw-r--r--regress/case-flags9.sys2
-rw-r--r--regress/case-formerr.sys2
-rw-r--r--regress/case-lockup.sys2
-rw-r--r--regress/case-longdom0.sys2
-rw-r--r--regress/case-longdom1.sys2
-rw-r--r--regress/case-longdomsrch0.sys2
-rw-r--r--regress/case-longdomsrch1.sys2
-rw-r--r--regress/case-longdomsrch1b.sys2
-rw-r--r--regress/case-longdomsrch2.sys2
-rw-r--r--regress/case-longlab0.sys2
-rw-r--r--regress/case-longlab1.sys2
-rw-r--r--regress/case-mailboxes.sys2
-rw-r--r--regress/case-manya.sys2
-rw-r--r--regress/case-manyptrwrong.sys2
-rw-r--r--regress/case-manyptrwrongrem.sys2
-rw-r--r--regress/case-manyptrwrongrst.sys2
-rw-r--r--regress/case-manyptrwrongrty.sys2
-rw-r--r--regress/case-ndots-as.sys2
-rw-r--r--regress/case-ndots.sys2
-rw-r--r--regress/case-ndotsbad.sys2
-rw-r--r--regress/case-noinfto.sys2
-rw-r--r--regress/case-norecurse.sys2
-rw-r--r--regress/case-norecurse2.sys2
-rw-r--r--regress/case-norecurse3.sys2
-rw-r--r--regress/case-norm.sys2
-rw-r--r--regress/case-owner.sys2
-rw-r--r--regress/case-poll.sys2
-rw-r--r--regress/case-polltimeout.sys2
-rw-r--r--regress/case-ptrbaddom.sys2
-rw-r--r--regress/case-quote.sys2
-rw-r--r--regress/case-rootquery.sys2
-rw-r--r--regress/case-rootqueryall-as.sys2
-rw-r--r--regress/case-rootqueryall.sys2
-rw-r--r--regress/case-search-as.sys2
-rw-r--r--regress/case-search.sys2
-rw-r--r--regress/case-searchabs.sys2
-rw-r--r--regress/case-sillyrp.sys2
-rw-r--r--regress/case-tcpallfail.sys2
-rw-r--r--regress/case-tcpblock.sys2
-rw-r--r--regress/case-tcpblockbrk.sys2
-rw-r--r--regress/case-tcpblockwr.sys2
-rw-r--r--regress/case-tcpbreakin.sys2
-rw-r--r--regress/case-tcpmultipart.sys2
-rw-r--r--regress/case-tcpptr.sys2
-rw-r--r--regress/case-timeout.sys2
-rw-r--r--regress/case-trunc.sys2
-rw-r--r--regress/case-unknownq.sys2
-rw-r--r--regress/harness.h.m427
-rw-r--r--regress/hcommon.c.m43
-rw-r--r--regress/hmacros.i44
-rw-r--r--regress/hplayback.c.m42
-rw-r--r--regress/hrecord.c.m42
-rw-r--r--regress/hredirect.h.m440
-rw-r--r--regress/hsyscalls.h.m445
-rw-r--r--regress/hsyscalls.i48
-rwxr-xr-xregress/m1test52
-rwxr-xr-xregress/r1test11
-rw-r--r--settings.make.in4
-rw-r--r--src/internal.h4
93 files changed, 526 insertions, 137 deletions
diff --git a/changelog b/changelog
index 78e1c0f..60b0c43 100644
--- a/changelog
+++ b/changelog
@@ -3,6 +3,11 @@ adns (0.10) unstable; urgency=low
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.
@@ -12,6 +17,7 @@ adns (0.10) unstable; urgency=low
* 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.
diff --git a/client/adh-main.c b/client/adh-main.c
index 094295e..88d876a 100644
--- a/client/adh-main.c
+++ b/client/adh-main.c
@@ -28,9 +28,22 @@
#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, ...) {
@@ -40,7 +53,7 @@ void usageerr(const char *fmt, ...) {
vfprintf(stderr,fmt,al);
va_end(al);
putc('\n',stderr);
- exit(11);
+ quitnow(11);
}
void outerr(void) {
@@ -62,6 +75,10 @@ char *xstrsave(const char *str) {
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;
@@ -100,8 +117,6 @@ void of_type(const struct optioninfo *oi, const char *arg, const char *arg2) {
ov_type= tnp->type;
}
-int rcode;
-
static void process_optarg(const char *arg,
const char *const **argv_p,
const char *value) {
@@ -164,9 +179,6 @@ static void process_optarg(const char *arg,
}
static void read_stdin(void) {
- static int used, avail;
- static char *buf;
-
int anydone, r;
char *newline, *space;
@@ -248,5 +260,5 @@ int main(int argc, const char *const *argv) {
}
x_quit:
if (fclose(stdout)) outerr();
- exit(rcode);
+ quitnow(rcode);
}
diff --git a/client/adh-opts.c b/client/adh-opts.c
index 772e474..4cc201a 100644
--- a/client/adh-opts.c
+++ b/client/adh-opts.c
@@ -62,6 +62,8 @@ static const struct optioninfo global_options[]= {
"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 },
@@ -270,7 +272,7 @@ static void printusage(void) {
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);
diff --git a/client/adh-query.c b/client/adh-query.c
index 856b6b2..edacb17 100644
--- a/client/adh-query.c
+++ b/client/adh-query.c
@@ -34,16 +34,21 @@ struct outstanding_list outstanding;
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)
@@ -143,6 +148,7 @@ void query_do(const char *domain) {
static void dequeue_query(struct query_node *qun) {
LIST_UNLINK(outstanding,qun);
free(qun->id);
+ free(qun->owner);
free(qun);
}
diff --git a/client/adnshost.h b/client/adnshost.h
index 7323fbf..1fff4ef 100644
--- a/client/adnshost.h
+++ b/client/adnshost.h
@@ -46,6 +46,10 @@
#include "adns.h"
#include "dlist.h"
+#ifdef ADNS_REGRESS_TEST
+# include "hredirect.h"
+#endif
+
/* declarations related to option processing */
struct optioninfo;
@@ -79,7 +83,8 @@ extern int ov_tcp, ov_cname, ov_format;
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);
@@ -110,6 +115,9 @@ void outerr(void) NONRETURNING;
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
diff --git a/client/adnstest.c b/client/adnstest.c
index 3aa96c9..3a5b4f1 100644
--- a/client/adnstest.c
+++ b/client/adnstest.c
@@ -36,8 +36,8 @@
#include "config.h"
#include "adns.h"
-#ifndef OUTPUTSTREAM
-# define OUTPUTSTREAM stdout
+#ifdef ADNS_REGRESS_TEST
+# include "hredirect.h"
#endif
struct myctx {
diff --git a/regress/.cvsignore b/regress/.cvsignore
index 154e5a9..d2b132d 100644
--- a/regress/.cvsignore
+++ b/regress/.cvsignore
@@ -1,8 +1,12 @@
Makefile
harness.h
+hsyscalls.h
+hredirect.h
hcommon.c
-hrecord
+*_record
+*_playback
hrecord.c
-hplayback
hplayback.c
output-*.*
+pipe.out
+pipe.err
diff --git a/regress/Makefile.in b/regress/Makefile.in
index 45218ed..42fdb5c 100644
--- a/regress/Makefile.in
+++ b/regress/Makefile.in
@@ -24,40 +24,49 @@
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
diff --git a/regress/adnshost-xinitflags.text b/regress/adnshost-xinitflags.text
new file mode 100644
index 0000000..3576c98
--- /dev/null
+++ b/regress/adnshost-xinitflags.text
@@ -0,0 +1 @@
+--config
diff --git a/regress/case-1stservbroken.sys b/regress/case-1stservbroken.sys
index 2b1e9ed..3cb74e4 100644
--- a/regress/case-1stservbroken.sys
+++ b/regress/case-1stservbroken.sys
@@ -1,4 +1,4 @@
-1stservbroken
+adnstest 1stservbroken
:12 trunc.test.iwj.relativity.greenend.org.uk
start 940102940.701451
socket type=SOCK_DGRAM
diff --git a/regress/case-1stservtotcp.sys b/regress/case-1stservtotcp.sys
index 84a851c..77f5bd3 100644
--- a/regress/case-1stservtotcp.sys
+++ b/regress/case-1stservtotcp.sys
@@ -1,4 +1,4 @@
-1stservto
+adnstest 1stservto
:12 trunc.test.iwj.relativity.greenend.org.uk
start 940100259.965940
socket type=SOCK_DGRAM
diff --git a/regress/case-2ndservok.sys b/regress/case-2ndservok.sys
index 8ca8f83..fdb8e27 100644
--- a/regress/case-2ndservok.sys
+++ b/regress/case-2ndservok.sys
@@ -1,4 +1,4 @@
-2ndserver
+adnstest 2ndserver
:1 davenant.relativity.greenend.org.uk
start 940100095.012145
socket type=SOCK_DGRAM
diff --git a/regress/case-2ndservtcp.sys b/regress/case-2ndservtcp.sys
index 0e6da2e..b79bfd4 100644
--- a/regress/case-2ndservtcp.sys
+++ b/regress/case-2ndservtcp.sys
@@ -1,4 +1,4 @@
-2ndserver
+adnstest 2ndserver
:12 trunc.test.iwj.relativity.greenend.org.uk
start 940100083.268555
socket type=SOCK_DGRAM
diff --git a/regress/case-abbrev.sys b/regress/case-abbrev.sys
index f98d716..0fd7a73 100644
--- a/regress/case-abbrev.sys
+++ b/regress/case-abbrev.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
,a/greenend.org.uk
start 929580078.542974
socket type=SOCK_DGRAM
diff --git a/regress/case-abbrevto.sys b/regress/case-abbrevto.sys
index ae1826c..f61cd0a 100644
--- a/regress/case-abbrevto.sys
+++ b/regress/case-abbrevto.sys
@@ -1,4 +1,4 @@
-noserver
+adnstest noserver
,a/greenend.org.uk
start 929580082.699581
socket type=SOCK_DGRAM
diff --git a/regress/case-adh-cancel.err b/regress/case-adh-cancel.err
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/regress/case-adh-cancel.err
diff --git a/regress/case-adh-cancel.out b/regress/case-adh-cancel.out
new file mode 100644
index 0000000..043c851
--- /dev/null
+++ b/regress/case-adh-cancel.out
@@ -0,0 +1,2 @@
+davenant.relativity.greenend.org.uk A INET 172.18.45.6
+rc=0
diff --git a/regress/case-adh-cancel.sys b/regress/case-adh-cancel.sys
new file mode 100644
index 0000000..0c542a9
--- /dev/null
+++ b/regress/case-adh-cancel.sys
@@ -0,0 +1,73 @@
+./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
diff --git a/regress/case-adh-cancel2.err b/regress/case-adh-cancel2.err
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/regress/case-adh-cancel2.err
diff --git a/regress/case-adh-cancel2.out b/regress/case-adh-cancel2.out
new file mode 100644
index 0000000..ab3f8d1
--- /dev/null
+++ b/regress/case-adh-cancel2.out
@@ -0,0 +1 @@
+rc=0
diff --git a/regress/case-adh-cancel2.sys b/regress/case-adh-cancel2.sys
new file mode 100644
index 0000000..f954087
--- /dev/null
+++ b/regress/case-adh-cancel2.sys
@@ -0,0 +1,59 @@
+./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
diff --git a/regress/case-adh-norm.err b/regress/case-adh-norm.err
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/regress/case-adh-norm.err
diff --git a/regress/case-adh-norm.out b/regress/case-adh-norm.out
new file mode 100644
index 0000000..662ff60
--- /dev/null
+++ b/regress/case-adh-norm.out
@@ -0,0 +1,2 @@
+chiark.greenend.org.uk A INET 195.224.76.132
+rc=0
diff --git a/regress/case-adh-norm.sys b/regress/case-adh-norm.sys
new file mode 100644
index 0000000..672908f
--- /dev/null
+++ b/regress/case-adh-norm.sys
@@ -0,0 +1,34 @@
+./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
diff --git a/regress/case-adh-pipe.err b/regress/case-adh-pipe.err
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/regress/case-adh-pipe.err
diff --git a/regress/case-adh-pipe.out b/regress/case-adh-pipe.out
new file mode 100644
index 0000000..662ff60
--- /dev/null
+++ b/regress/case-adh-pipe.out
@@ -0,0 +1,2 @@
+chiark.greenend.org.uk A INET 195.224.76.132
+rc=0
diff --git a/regress/case-adh-pipe.sys b/regress/case-adh-pipe.sys
new file mode 100644
index 0000000..320720a
--- /dev/null
+++ b/regress/case-adh-pipe.sys
@@ -0,0 +1,48 @@
+./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
diff --git a/regress/case-brokenmail.sys b/regress/case-brokenmail.sys
index 9514d6b..dcf31da 100644
--- a/regress/case-brokenmail.sys
+++ b/regress/case-brokenmail.sys
@@ -1,4 +1,4 @@
-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
diff --git a/regress/case-child.sys b/regress/case-child.sys
index 0cd1079..c0f82ac 100644
--- a/regress/case-child.sys
+++ b/regress/case-child.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:65548 134.76.224.195.in-addr.arpa
start 929574747.401802
socket type=SOCK_DGRAM
diff --git a/regress/case-cnametocname.sys b/regress/case-cnametocname.sys
index 97f2156..4a9c52a 100644
--- a/regress/case-cnametocname.sys
+++ b/regress/case-cnametocname.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 intel.ugcs.caltech.edu.
start 938369896.279735
socket type=SOCK_DGRAM
diff --git a/regress/case-comprinf.sys b/regress/case-comprinf.sys
index 2064818..e79e826 100644
--- a/regress/case-comprinf.sys
+++ b/regress/case-comprinf.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:12 37.45.18.172.in-addr.arpa.
start 951961094.184850
socket type=SOCK_DGRAM
diff --git a/regress/case-datapluscname.sys b/regress/case-datapluscname.sys
index e164b53..63d2b10 100644
--- a/regress/case-datapluscname.sys
+++ b/regress/case-datapluscname.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
292/170.99.219.194.in-addr.arpa
start 933809668.543946
socket type=SOCK_DGRAM
diff --git a/regress/case-datapluscnamewait.sys b/regress/case-datapluscnamewait.sys
index 77c5a13..ff188ee 100644
--- a/regress/case-datapluscnamewait.sys
+++ b/regress/case-datapluscnamewait.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
292/170.99.219.194.in-addr.arpa
start 933809632.795174
socket type=SOCK_DGRAM
diff --git a/regress/case-flags10.sys b/regress/case-flags10.sys
index c535edd..fe0b341 100644
--- a/regress/case-flags10.sys
+++ b/regress/case-flags10.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 ,aaaaaaaaaa/chiark.greenend.org.uk
start 929580072.670441
socket type=SOCK_DGRAM
diff --git a/regress/case-flags9.sys b/regress/case-flags9.sys
index 94ac969..914c556 100644
--- a/regress/case-flags9.sys
+++ b/regress/case-flags9.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 ,aaaaaaaaa/chiark.greenend.org.uk
start 929580075.263215
socket type=SOCK_DGRAM
diff --git a/regress/case-formerr.sys b/regress/case-formerr.sys
index 7cf6034..d455b19 100644
--- a/regress/case-formerr.sys
+++ b/regress/case-formerr.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 1/h.rndrobwlxxxxxxxxxxlllantysiliogogllanfairpwllgwyngyllgogerychw.relativity.greenend.org.uk.
start 951956380.814815
socket type=SOCK_DGRAM
diff --git a/regress/case-lockup.sys b/regress/case-lockup.sys
index 8336d92..a14c5ac 100644
--- a/regress/case-lockup.sys
+++ b/regress/case-lockup.sys
@@ -1,4 +1,4 @@
-noserver
+adnstest noserver
:1 chiark.greenend.org.uk
start 912889153.349504
socket type=SOCK_DGRAM
diff --git a/regress/case-longdom0.sys b/regress/case-longdom0.sys
index e79da8c..33a29ef 100644
--- a/regress/case-longdom0.sys
+++ b/regress/case-longdom0.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 1/0rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk.
start 951955651.857473
socket type=SOCK_DGRAM
diff --git a/regress/case-longdom1.sys b/regress/case-longdom1.sys
index f34cdde..a54e14d 100644
--- a/regress/case-longdom1.sys
+++ b/regress/case-longdom1.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 1/10rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk.
start 951955690.505811
socket type=SOCK_DGRAM
diff --git a/regress/case-longdomsrch0.sys b/regress/case-longdomsrch0.sys
index b023124..298bec8 100644
--- a/regress/case-longdomsrch0.sys
+++ b/regress/case-longdomsrch0.sys
@@ -1,4 +1,4 @@
-ndots100
+adnstest ndots100
:1 1/10rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
start 951956073.321566
socket type=SOCK_DGRAM
diff --git a/regress/case-longdomsrch1.sys b/regress/case-longdomsrch1.sys
index 8b61888..a61d920 100644
--- a/regress/case-longdomsrch1.sys
+++ b/regress/case-longdomsrch1.sys
@@ -1,4 +1,4 @@
-ndots100
+adnstest ndots100
:1 1/0rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
start 951956087.269350
socket type=SOCK_DGRAM
diff --git a/regress/case-longdomsrch1b.sys b/regress/case-longdomsrch1b.sys
index 6277dbd..e9e58dc 100644
--- a/regress/case-longdomsrch1b.sys
+++ b/regress/case-longdomsrch1b.sys
@@ -1,4 +1,4 @@
-ndots100
+adnstest ndots100
:1 1/1xxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
start 951956136.566877
socket type=SOCK_DGRAM
diff --git a/regress/case-longdomsrch2.sys b/regress/case-longdomsrch2.sys
index 4df61ad..3c07b71 100644
--- a/regress/case-longdomsrch2.sys
+++ b/regress/case-longdomsrch2.sys
@@ -1,4 +1,4 @@
-ndots100
+adnstest ndots100
:1 1/xxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
start 951956143.624786
socket type=SOCK_DGRAM
diff --git a/regress/case-longlab0.sys b/regress/case-longlab0.sys
index 19ebb14..6bc3f84 100644
--- a/regress/case-longlab0.sys
+++ b/regress/case-longlab0.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 1/yrndrobwlxxxxxxxxxxlllantysiliogogllanfairpwllgwyngyllgogerychw.relativity.greenend.org.uk.
start 951955250.786132
socket type=SOCK_DGRAM
diff --git a/regress/case-longlab1.sys b/regress/case-longlab1.sys
index 5698df7..5b0e46a 100644
--- a/regress/case-longlab1.sys
+++ b/regress/case-longlab1.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 1/hyrndrobwlxxxxxxxxxxlllantysiliogogllanfairpwllgwyngyllgogerychw.relativity.greenend.org.uk.
start 951955261.286712
socket type=SOCK_DGRAM
diff --git a/regress/case-mailboxes.sys b/regress/case-mailboxes.sys
index 2144c05..9a0284f 100644
--- a/regress/case-mailboxes.sys
+++ b/regress/case-mailboxes.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:131089 silly-rp.test.iwj.relativity.greenend.org.uk
start 923859567.899146
socket type=SOCK_DGRAM
diff --git a/regress/case-manya.sys b/regress/case-manya.sys
index 8b560fa..4d1357b 100644
--- a/regress/case-manya.sys
+++ b/regress/case-manya.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 manyaddrs.test.iwj.relativity.greenend.org.uk
start 912888920.123769
socket type=SOCK_DGRAM
diff --git a/regress/case-manyptrwrong.sys b/regress/case-manyptrwrong.sys
index d5ef49b..1346753 100644
--- a/regress/case-manyptrwrong.sys
+++ b/regress/case-manyptrwrong.sys
@@ -1,4 +1,4 @@
-ncipher
+adnstest ncipher
254.0.99.203.in-addr.arpa
start 933269010.293417
socket type=SOCK_DGRAM
diff --git a/regress/case-manyptrwrongrem.sys b/regress/case-manyptrwrongrem.sys
index 3b90e59..24fe00f 100644
--- a/regress/case-manyptrwrongrem.sys
+++ b/regress/case-manyptrwrongrem.sys
@@ -1,4 +1,4 @@
-manyptrwrong
+adnstest manyptrwrong
292/254.0.99.203.in-addr.arpa
start 933286859.476326
socket type=SOCK_DGRAM
diff --git a/regress/case-manyptrwrongrst.sys b/regress/case-manyptrwrongrst.sys
index cb0bdf0..a577018 100644
--- a/regress/case-manyptrwrongrst.sys
+++ b/regress/case-manyptrwrongrst.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
292/254.0.99.203.in-addr.arpa
start 933289772.727140
socket type=SOCK_DGRAM
diff --git a/regress/case-manyptrwrongrty.sys b/regress/case-manyptrwrongrty.sys
index 826f408..1afba85 100644
--- a/regress/case-manyptrwrongrty.sys
+++ b/regress/case-manyptrwrongrty.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
292/254.0.99.203.in-addr.arpa
start 933286845.072950
socket type=SOCK_DGRAM
diff --git a/regress/case-ndots-as.sys b/regress/case-ndots-as.sys
index b5f6e5a..f4e7153 100644
--- a/regress/case-ndots-as.sys
+++ b/regress/case-ndots-as.sys
@@ -1,4 +1,4 @@
-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
diff --git a/regress/case-ndots.sys b/regress/case-ndots.sys
index 8367d98..2471723 100644
--- a/regress/case-ndots.sys
+++ b/regress/case-ndots.sys
@@ -1,4 +1,4 @@
-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
diff --git a/regress/case-ndotsbad.sys b/regress/case-ndotsbad.sys
index 56d5877..eaf457d 100644
--- a/regress/case-ndotsbad.sys
+++ b/regress/case-ndotsbad.sys
@@ -1,2 +1,2 @@
-ndotsbad
+adnstest ndotsbad
:1 5/news.davenant.greenend.org.uk
diff --git a/regress/case-noinfto.sys b/regress/case-noinfto.sys
index 422b38a..ceeb290 100644
--- a/regress/case-noinfto.sys
+++ b/regress/case-noinfto.sys
@@ -1,4 +1,4 @@
-noserver -,p
+adnstest noserver -,p
:1 a.b.c.d
start 940011574.766962
socket type=SOCK_DGRAM
diff --git a/regress/case-norecurse.sys b/regress/case-norecurse.sys
index bbeff65..239b282 100644
--- a/regress/case-norecurse.sys
+++ b/regress/case-norecurse.sys
@@ -1,4 +1,4 @@
-default -0x16
+adnstest default -0x16
4.204.50.158.in-addr.arpa
start 939764098.821612
socket type=SOCK_DGRAM
diff --git a/regress/case-norecurse2.sys b/regress/case-norecurse2.sys
index 1397bbf..4029009 100644
--- a/regress/case-norecurse2.sys
+++ b/regress/case-norecurse2.sys
@@ -1,4 +1,4 @@
-default -0x16
+adnstest default -0x16
4.204.50.158.in-addr.arpa
start 939764277.018636
socket type=SOCK_DGRAM
diff --git a/regress/case-norecurse3.sys b/regress/case-norecurse3.sys
index 2daa4d5..56651c2 100644
--- a/regress/case-norecurse3.sys
+++ b/regress/case-norecurse3.sys
@@ -1,4 +1,4 @@
-default -0x16
+adnstest default -0x16
2.203.156.195.in-addr.arpa1
start 939764258.086555
socket type=SOCK_DGRAM
diff --git a/regress/case-norm.sys b/regress/case-norm.sys
index 675a9bd..ab58174 100644
--- a/regress/case-norm.sys
+++ b/regress/case-norm.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 chiark.greenend.org.uk
start 912888966.802483
socket type=SOCK_DGRAM
diff --git a/regress/case-owner.sys b/regress/case-owner.sys
index 5e2c335..aecce80 100644
--- a/regress/case-owner.sys
+++ b/regress/case-owner.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
4/chiark.greenend.org.uk
start 933206012.504679
socket type=SOCK_DGRAM
diff --git a/regress/case-poll.sys b/regress/case-poll.sys
index ba05521..a01e333 100644
--- a/regress/case-poll.sys
+++ b/regress/case-poll.sys
@@ -1,4 +1,4 @@
-default -,p
+adnstest default -,p
:1 chiark.greenend.org.uk
start 931719947.391142
socket type=SOCK_DGRAM
diff --git a/regress/case-polltimeout.sys b/regress/case-polltimeout.sys
index 4e207f0..3da57c0 100644
--- a/regress/case-polltimeout.sys
+++ b/regress/case-polltimeout.sys
@@ -1,4 +1,4 @@
-noserver -,p
+adnstest noserver -,p
:1 chiark.greenend.org.uk
start 931719968.733439
socket type=SOCK_DGRAM
diff --git a/regress/case-ptrbaddom.sys b/regress/case-ptrbaddom.sys
index 6b12372..11f376b 100644
--- a/regress/case-ptrbaddom.sys
+++ b/regress/case-ptrbaddom.sys
@@ -1,4 +1,4 @@
-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
diff --git a/regress/case-quote.sys b/regress/case-quote.sys
index 75e44d4..0fec635 100644
--- a/regress/case-quote.sys
+++ b/regress/case-quote.sys
@@ -1,4 +1,4 @@
-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
diff --git a/regress/case-rootquery.sys b/regress/case-rootquery.sys
index 4cd21b8..1a91711 100644
--- a/regress/case-rootquery.sys
+++ b/regress/case-rootquery.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:131078 . 1/.
start 924364442.672925
socket type=SOCK_DGRAM
diff --git a/regress/case-rootqueryall-as.sys b/regress/case-rootqueryall-as.sys
index 532d875..745100d 100644
--- a/regress/case-rootqueryall-as.sys
+++ b/regress/case-rootqueryall-as.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
. 1/.
start 931992019.753022
socket type=SOCK_DGRAM
diff --git a/regress/case-rootqueryall.sys b/regress/case-rootqueryall.sys
index f38522d..d342750 100644
--- a/regress/case-rootqueryall.sys
+++ b/regress/case-rootqueryall.sys
@@ -1,4 +1,4 @@
-default -,s
+adnstest default -,s
. 1/.
start 924364450.165424
socket type=SOCK_DGRAM
diff --git a/regress/case-search-as.sys b/regress/case-search-as.sys
index c741d41..5a7f11d 100644
--- a/regress/case-search-as.sys
+++ b/regress/case-search-as.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 0x5/news 0x5/chiark 1/news 1/chiark
start 931992052.232208
socket type=SOCK_DGRAM
diff --git a/regress/case-search.sys b/regress/case-search.sys
index 1cbc301..29b7194 100644
--- a/regress/case-search.sys
+++ b/regress/case-search.sys
@@ -1,4 +1,4 @@
-default -,s
+adnstest default -,s
:1 0x5/news 0x5/chiark 1/news 1/chiark
start 924360470.478357
socket type=SOCK_DGRAM
diff --git a/regress/case-searchabs.sys b/regress/case-searchabs.sys
index 9899ffd..1167a7a 100644
--- a/regress/case-searchabs.sys
+++ b/regress/case-searchabs.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 1/news.davenant
start 924363451.882765
socket type=SOCK_DGRAM
diff --git a/regress/case-sillyrp.sys b/regress/case-sillyrp.sys
index 2b28a49..3fbdb54 100644
--- a/regress/case-sillyrp.sys
+++ b/regress/case-sillyrp.sys
@@ -1,4 +1,4 @@
-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
diff --git a/regress/case-tcpallfail.sys b/regress/case-tcpallfail.sys
index 08718fc..f17346b 100644
--- a/regress/case-tcpallfail.sys
+++ b/regress/case-tcpallfail.sys
@@ -1,4 +1,4 @@
-anarres
+adnstest anarres
2/test.iwj.relativity.greenend.org.uk.
start 962142174.403028
socket type=SOCK_DGRAM
diff --git a/regress/case-tcpblock.sys b/regress/case-tcpblock.sys
index 5adf026..1257e1e 100644
--- a/regress/case-tcpblock.sys
+++ b/regress/case-tcpblock.sys
@@ -1,4 +1,4 @@
-anarres
+adnstest anarres
2/test.iwj.relativity.greenend.org.uk.
start 962142246.340485
socket type=SOCK_DGRAM
diff --git a/regress/case-tcpblockbrk.sys b/regress/case-tcpblockbrk.sys
index 68ce1d7..b4f5171 100644
--- a/regress/case-tcpblockbrk.sys
+++ b/regress/case-tcpblockbrk.sys
@@ -1,4 +1,4 @@
-anarres -0x300
+adnstest anarres -0x300
2/test.iwj.relativity.greenend.org.uk.
start 962143388.709150
socket type=SOCK_DGRAM
diff --git a/regress/case-tcpblockwr.sys b/regress/case-tcpblockwr.sys
index 61c7bf5..81864aa 100644
--- a/regress/case-tcpblockwr.sys
+++ b/regress/case-tcpblockwr.sys
@@ -1,4 +1,4 @@
-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
diff --git a/regress/case-tcpbreakin.sys b/regress/case-tcpbreakin.sys
index 4979230..9e8e75b 100644
--- a/regress/case-tcpbreakin.sys
+++ b/regress/case-tcpbreakin.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:65548 2/6.45.18.172.in-addr.arpa
start 957718868.938329
socket type=SOCK_DGRAM
diff --git a/regress/case-tcpmultipart.sys b/regress/case-tcpmultipart.sys
index bdc3f78..d26ded2 100644
--- a/regress/case-tcpmultipart.sys
+++ b/regress/case-tcpmultipart.sys
@@ -1,4 +1,4 @@
-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
diff --git a/regress/case-tcpptr.sys b/regress/case-tcpptr.sys
index bdddeea..387dc87 100644
--- a/regress/case-tcpptr.sys
+++ b/regress/case-tcpptr.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:65548 2/6.45.18.172.in-addr.arpa
start 957718868.938329
socket type=SOCK_DGRAM
diff --git a/regress/case-timeout.sys b/regress/case-timeout.sys
index 003d1ca..f810c3b 100644
--- a/regress/case-timeout.sys
+++ b/regress/case-timeout.sys
@@ -1,4 +1,4 @@
-noserver
+adnstest noserver
:1 chiark.greenend.org.uk
start 912889153.349504
socket type=SOCK_DGRAM
diff --git a/regress/case-trunc.sys b/regress/case-trunc.sys
index 4288e5d..3698827 100644
--- a/regress/case-trunc.sys
+++ b/regress/case-trunc.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:1 trunc.test.iwj.relativity.greenend.org.uk
start 912888921.274801
socket type=SOCK_DGRAM
diff --git a/regress/case-unknownq.sys b/regress/case-unknownq.sys
index ba279bb..736210d 100644
--- a/regress/case-unknownq.sys
+++ b/regress/case-unknownq.sys
@@ -1,4 +1,4 @@
-default
+adnstest default
:32767 davenant.relativity.greenend.org.uk.
start 933811310.565828
socket type=SOCK_DGRAM
diff --git a/regress/harness.h.m4 b/regress/harness.h.m4
index 1f96131..3988557 100644
--- a/regress/harness.h.m4
+++ b/regress/harness.h.m4
@@ -3,7 +3,7 @@ m4_dnl (part of complex test harness, not of the library)
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>
@@ -28,30 +28,8 @@ m4_include(hmacros.i4)
#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
@@ -60,6 +38,7 @@ void Hexit(int rv);
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);
diff --git a/regress/hcommon.c.m4 b/regress/hcommon.c.m4
index 2238cda..5807ddd 100644
--- a/regress/hcommon.c.m4
+++ b/regress/hcommon.c.m4
@@ -122,8 +122,9 @@ void Q$1(hm_args_massage($3,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;
diff --git a/regress/hmacros.i4 b/regress/hmacros.i4
index 6f52787..429c825 100644
--- a/regress/hmacros.i4
+++ b/regress/hmacros.i4
@@ -32,10 +32,10 @@ m4_define(`hm_args_massage',
`'),
`',
`$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', `
diff --git a/regress/hplayback.c.m4 b/regress/hplayback.c.m4
index 22e975a..a3c2d8b 100644
--- a/regress/hplayback.c.m4
+++ b/regress/hplayback.c.m4
@@ -371,4 +371,6 @@ int H$1(hm_args_massage($3,void)) {
}
')
+m4_define(`hm_specsyscall', `')
+
m4_include(`hsyscalls.i4')
diff --git a/regress/hrecord.c.m4 b/regress/hrecord.c.m4
index 58d3636..d59395f 100644
--- a/regress/hrecord.c.m4
+++ b/regress/hrecord.c.m4
@@ -154,4 +154,6 @@ int H$1(hm_args_massage($3,void)) {
}
')
+m4_define(`hm_specsyscall', `')
+
m4_include(`hsyscalls.i4')
diff --git a/regress/hredirect.h.m4 b/regress/hredirect.h.m4
new file mode 100644
index 0000000..8f7eeb9
--- /dev/null
+++ b/regress/hredirect.h.m4
@@ -0,0 +1,40 @@
+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
diff --git a/regress/hsyscalls.h.m4 b/regress/hsyscalls.h.m4
new file mode 100644
index 0000000..b74627e
--- /dev/null
+++ b/regress/hsyscalls.h.m4
@@ -0,0 +1,45 @@
+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
diff --git a/regress/hsyscalls.i4 b/regress/hsyscalls.i4
index a31c708..b3ccd73 100644
--- a/regress/hsyscalls.i4
+++ b/regress/hsyscalls.i4
@@ -120,3 +120,11 @@ hm_syscall(
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)
diff --git a/regress/m1test b/regress/m1test
index 81b4634..c556f8c 100755
--- a/regress/m1test
+++ b/regress/m1test
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# usage: m1test <name> <initfile> [<initflags>] <queryargs>'
# test recording script
#
@@ -28,15 +28,15 @@ set -e
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
@@ -46,24 +46,56 @@ case "$1" in
=*) 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"
diff --git a/regress/r1test b/regress/r1test
index 57df4bb..96d7195 100755
--- a/regress/r1test
+++ b/regress/r1test
@@ -32,10 +32,17 @@ case="case-$casename"
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.*
@@ -44,7 +51,7 @@ export EF_DISABLE_BANNER
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
diff --git a/settings.make.in b/settings.make.in
index 63f2da7..f276a6a 100644
--- a/settings.make.in
+++ b/settings.make.in
@@ -64,7 +64,7 @@ clean mostlyclean:
distclean: clean
rm -f $(TARGETS) *~ ./#*# core *.orig *.rej Makefile
-distprep: $(AUTOCSRCS)
+distprep: $(AUTOCSRCS) $(AUTOCHDRS)
maintainer-clean: distclean
- -rm -f $(AUTOCSRCS)
+ -rm -f $(AUTOCSRCS) $(AUTOCHDRS)
diff --git a/src/internal.h b/src/internal.h
index b82857c..ac8de47 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -45,6 +45,10 @@ typedef unsigned char byte;
#include "adns.h"
#include "dlist.h"
+#ifdef ADNS_REGRESS_TEST
+# include "hredirect.h"
+#endif
+
/* Configuration and constants */
#define MAXSERVERS 5