@@ -3,6 +3,11 @@
authorian <ian>
Sat, 16 Sep 2000 17:35:01 +0000 (17:35 +0000)
committerian <ian>
Sat, 16 Sep 2000 17:35:01 +0000 (17:35 +0000)
   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 @@
   * 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.

93 files changed:
changelog
client/adh-main.c
client/adh-opts.c
client/adh-query.c
client/adnshost.h
client/adnstest.c
regress/.cvsignore
regress/Makefile.in
regress/adnshost-xinitflags.text [new file with mode: 0644]
regress/case-1stservbroken.sys
regress/case-1stservtotcp.sys
regress/case-2ndservok.sys
regress/case-2ndservtcp.sys
regress/case-abbrev.sys
regress/case-abbrevto.sys
regress/case-adh-cancel.err [new file with mode: 0644]
regress/case-adh-cancel.out [new file with mode: 0644]
regress/case-adh-cancel.sys [new file with mode: 0644]
regress/case-adh-cancel2.err [new file with mode: 0644]
regress/case-adh-cancel2.out [new file with mode: 0644]
regress/case-adh-cancel2.sys [new file with mode: 0644]
regress/case-adh-norm.err [new file with mode: 0644]
regress/case-adh-norm.out [new file with mode: 0644]
regress/case-adh-norm.sys [new file with mode: 0644]
regress/case-adh-pipe.err [new file with mode: 0644]
regress/case-adh-pipe.out [new file with mode: 0644]
regress/case-adh-pipe.sys [new file with mode: 0644]
regress/case-brokenmail.sys
regress/case-child.sys
regress/case-cnametocname.sys
regress/case-comprinf.sys
regress/case-datapluscname.sys
regress/case-datapluscnamewait.sys
regress/case-flags10.sys
regress/case-flags9.sys
regress/case-formerr.sys
regress/case-lockup.sys
regress/case-longdom0.sys
regress/case-longdom1.sys
regress/case-longdomsrch0.sys
regress/case-longdomsrch1.sys
regress/case-longdomsrch1b.sys
regress/case-longdomsrch2.sys
regress/case-longlab0.sys
regress/case-longlab1.sys
regress/case-mailboxes.sys
regress/case-manya.sys
regress/case-manyptrwrong.sys
regress/case-manyptrwrongrem.sys
regress/case-manyptrwrongrst.sys
regress/case-manyptrwrongrty.sys
regress/case-ndots-as.sys
regress/case-ndots.sys
regress/case-ndotsbad.sys
regress/case-noinfto.sys
regress/case-norecurse.sys
regress/case-norecurse2.sys
regress/case-norecurse3.sys
regress/case-norm.sys
regress/case-owner.sys
regress/case-poll.sys
regress/case-polltimeout.sys
regress/case-ptrbaddom.sys
regress/case-quote.sys
regress/case-rootquery.sys
regress/case-rootqueryall-as.sys
regress/case-rootqueryall.sys
regress/case-search-as.sys
regress/case-search.sys
regress/case-searchabs.sys
regress/case-sillyrp.sys
regress/case-tcpallfail.sys
regress/case-tcpblock.sys
regress/case-tcpblockbrk.sys
regress/case-tcpblockwr.sys
regress/case-tcpbreakin.sys
regress/case-tcpmultipart.sys
regress/case-tcpptr.sys
regress/case-timeout.sys
regress/case-trunc.sys
regress/case-unknownq.sys
regress/harness.h.m4
regress/hcommon.c.m4
regress/hmacros.i4
regress/hplayback.c.m4
regress/hrecord.c.m4
regress/hredirect.h.m4 [new file with mode: 0644]
regress/hsyscalls.h.m4 [new file with mode: 0644]
regress/hsyscalls.i4
regress/m1test
regress/r1test
settings.make.in
src/internal.h

index 78e1c0f..60b0c43 100644 (file)
--- 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.
index 094295e..88d876a 100644 (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, ...) {
@@ -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);
 }
index 772e474..4cc201a 100644 (file)
@@ -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);
index 856b6b2..edacb17 100644 (file)
@@ -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);
 }
 
index 7323fbf..1fff4ef 100644 (file)
 #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
index 3aa96c9..3a5b4f1 100644 (file)
@@ -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 {
index 154e5a9..d2b132d 100644 (file)
@@ -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
index 45218ed..42fdb5c 100644 (file)
 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 (file)
index 0000000..3576c98
--- /dev/null
@@ -0,0 +1 @@
+--config 
index 2b1e9ed..3cb74e4 100644 (file)
@@ -1,4 +1,4 @@
-1stservbroken
+adnstest 1stservbroken
 :12 trunc.test.iwj.relativity.greenend.org.uk
  start 940102940.701451
  socket type=SOCK_DGRAM
index 84a851c..77f5bd3 100644 (file)
@@ -1,4 +1,4 @@
-1stservto
+adnstest 1stservto
 :12 trunc.test.iwj.relativity.greenend.org.uk
  start 940100259.965940
  socket type=SOCK_DGRAM
index 8ca8f83..fdb8e27 100644 (file)
@@ -1,4 +1,4 @@
-2ndserver
+adnstest 2ndserver
 :1 davenant.relativity.greenend.org.uk
  start 940100095.012145
  socket type=SOCK_DGRAM
index 0e6da2e..b79bfd4 100644 (file)
@@ -1,4 +1,4 @@
-2ndserver
+adnstest 2ndserver
 :12 trunc.test.iwj.relativity.greenend.org.uk
  start 940100083.268555
  socket type=SOCK_DGRAM
index f98d716..0fd7a73 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 ,a/greenend.org.uk
  start 929580078.542974
  socket type=SOCK_DGRAM
index ae1826c..f61cd0a 100644 (file)
@@ -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 (file)
index 0000000..e69de29
diff --git a/regress/case-adh-cancel.out b/regress/case-adh-cancel.out
new file mode 100644 (file)
index 0000000..043c851
--- /dev/null
@@ -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 (file)
index 0000000..0c542a9
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/regress/case-adh-cancel2.out b/regress/case-adh-cancel2.out
new file mode 100644 (file)
index 0000000..ab3f8d1
--- /dev/null
@@ -0,0 +1 @@
+rc=0
diff --git a/regress/case-adh-cancel2.sys b/regress/case-adh-cancel2.sys
new file mode 100644 (file)
index 0000000..f954087
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/regress/case-adh-norm.out b/regress/case-adh-norm.out
new file mode 100644 (file)
index 0000000..662ff60
--- /dev/null
@@ -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 (file)
index 0000000..672908f
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/regress/case-adh-pipe.out b/regress/case-adh-pipe.out
new file mode 100644 (file)
index 0000000..662ff60
--- /dev/null
@@ -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 (file)
index 0000000..320720a
--- /dev/null
@@ -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
index 9514d6b..dcf31da 100644 (file)
@@ -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
index 0cd1079..c0f82ac 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :65548 134.76.224.195.in-addr.arpa
  start 929574747.401802
  socket type=SOCK_DGRAM
index 97f2156..4a9c52a 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 intel.ugcs.caltech.edu.
  start 938369896.279735
  socket type=SOCK_DGRAM
index 2064818..e79e826 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :12 37.45.18.172.in-addr.arpa.
  start 951961094.184850
  socket type=SOCK_DGRAM
index e164b53..63d2b10 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 292/170.99.219.194.in-addr.arpa
  start 933809668.543946
  socket type=SOCK_DGRAM
index 77c5a13..ff188ee 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 292/170.99.219.194.in-addr.arpa
  start 933809632.795174
  socket type=SOCK_DGRAM
index c535edd..fe0b341 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 ,aaaaaaaaaa/chiark.greenend.org.uk
  start 929580072.670441
  socket type=SOCK_DGRAM
index 94ac969..914c556 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 ,aaaaaaaaa/chiark.greenend.org.uk
  start 929580075.263215
  socket type=SOCK_DGRAM
index 7cf6034..d455b19 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 1/h.rndrobwlxxxxxxxxxxlllantysiliogogllanfairpwllgwyngyllgogerychw.relativity.greenend.org.uk.
  start 951956380.814815
  socket type=SOCK_DGRAM
index 8336d92..a14c5ac 100644 (file)
@@ -1,4 +1,4 @@
-noserver
+adnstest noserver
 :1 chiark.greenend.org.uk
  start 912889153.349504
  socket type=SOCK_DGRAM
index e79da8c..33a29ef 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 1/0rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk.
  start 951955651.857473
  socket type=SOCK_DGRAM
index f34cdde..a54e14d 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 1/10rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk.
  start 951955690.505811
  socket type=SOCK_DGRAM
index b023124..298bec8 100644 (file)
@@ -1,4 +1,4 @@
-ndots100
+adnstest ndots100
 :1 1/10rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
  start 951956073.321566
  socket type=SOCK_DGRAM
index 8b61888..a61d920 100644 (file)
@@ -1,4 +1,4 @@
-ndots100
+adnstest ndots100
 :1 1/0rndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
  start 951956087.269350
  socket type=SOCK_DGRAM
index 6277dbd..e9e58dc 100644 (file)
@@ -1,4 +1,4 @@
-ndots100
+adnstest ndots100
 :1 1/1xxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
  start 951956136.566877
  socket type=SOCK_DGRAM
index 4df61ad..3c07b71 100644 (file)
@@ -1,4 +1,4 @@
-ndots100
+adnstest ndots100
 :1 1/xxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.llanfairpwllgwyngyllgogerychwyrndrobwlxxxxxxxxxxlllantysiliogog.relativity.greenend.org.uk
  start 951956143.624786
  socket type=SOCK_DGRAM
index 19ebb14..6bc3f84 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 1/yrndrobwlxxxxxxxxxxlllantysiliogogllanfairpwllgwyngyllgogerychw.relativity.greenend.org.uk.
  start 951955250.786132
  socket type=SOCK_DGRAM
index 5698df7..5b0e46a 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 1/hyrndrobwlxxxxxxxxxxlllantysiliogogllanfairpwllgwyngyllgogerychw.relativity.greenend.org.uk.
  start 951955261.286712
  socket type=SOCK_DGRAM
index 2144c05..9a0284f 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :131089 silly-rp.test.iwj.relativity.greenend.org.uk
  start 923859567.899146
  socket type=SOCK_DGRAM
index 8b560fa..4d1357b 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 manyaddrs.test.iwj.relativity.greenend.org.uk
  start 912888920.123769
  socket type=SOCK_DGRAM
index d5ef49b..1346753 100644 (file)
@@ -1,4 +1,4 @@
-ncipher
+adnstest ncipher
 254.0.99.203.in-addr.arpa
  start 933269010.293417
  socket type=SOCK_DGRAM
index 3b90e59..24fe00f 100644 (file)
@@ -1,4 +1,4 @@
-manyptrwrong
+adnstest manyptrwrong
 292/254.0.99.203.in-addr.arpa
  start 933286859.476326
  socket type=SOCK_DGRAM
index cb0bdf0..a577018 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 292/254.0.99.203.in-addr.arpa
  start 933289772.727140
  socket type=SOCK_DGRAM
index 826f408..1afba85 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 292/254.0.99.203.in-addr.arpa
  start 933286845.072950
  socket type=SOCK_DGRAM
index b5f6e5a..f4e7153 100644 (file)
@@ -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
index 8367d98..2471723 100644 (file)
@@ -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
index 56d5877..eaf457d 100644 (file)
@@ -1,2 +1,2 @@
-ndotsbad
+adnstest ndotsbad
 :1 5/news.davenant.greenend.org.uk
index 422b38a..ceeb290 100644 (file)
@@ -1,4 +1,4 @@
-noserver -,p
+adnstest noserver -,p
 :1 a.b.c.d
  start 940011574.766962
  socket type=SOCK_DGRAM
index bbeff65..239b282 100644 (file)
@@ -1,4 +1,4 @@
-default -0x16
+adnstest default -0x16
 4.204.50.158.in-addr.arpa
  start 939764098.821612
  socket type=SOCK_DGRAM
index 1397bbf..4029009 100644 (file)
@@ -1,4 +1,4 @@
-default -0x16
+adnstest default -0x16
 4.204.50.158.in-addr.arpa
  start 939764277.018636
  socket type=SOCK_DGRAM
index 2daa4d5..56651c2 100644 (file)
@@ -1,4 +1,4 @@
-default -0x16
+adnstest default -0x16
 2.203.156.195.in-addr.arpa1
  start 939764258.086555
  socket type=SOCK_DGRAM
index 675a9bd..ab58174 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 chiark.greenend.org.uk
  start 912888966.802483
  socket type=SOCK_DGRAM
index 5e2c335..aecce80 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 4/chiark.greenend.org.uk
  start 933206012.504679
  socket type=SOCK_DGRAM
index ba05521..a01e333 100644 (file)
@@ -1,4 +1,4 @@
-default -,p
+adnstest default -,p
 :1 chiark.greenend.org.uk
  start 931719947.391142
  socket type=SOCK_DGRAM
index 4e207f0..3da57c0 100644 (file)
@@ -1,4 +1,4 @@
-noserver -,p
+adnstest noserver -,p
 :1 chiark.greenend.org.uk
  start 931719968.733439
  socket type=SOCK_DGRAM
index 6b12372..11f376b 100644 (file)
@@ -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
index 75e44d4..0fec635 100644 (file)
@@ -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
index 4cd21b8..1a91711 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :131078 . 1/.
  start 924364442.672925
  socket type=SOCK_DGRAM
index 532d875..745100d 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 . 1/.
  start 931992019.753022
  socket type=SOCK_DGRAM
index f38522d..d342750 100644 (file)
@@ -1,4 +1,4 @@
-default -,s
+adnstest default -,s
 . 1/.
  start 924364450.165424
  socket type=SOCK_DGRAM
index c741d41..5a7f11d 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 0x5/news 0x5/chiark 1/news 1/chiark
  start 931992052.232208
  socket type=SOCK_DGRAM
index 1cbc301..29b7194 100644 (file)
@@ -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
index 9899ffd..1167a7a 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 1/news.davenant
  start 924363451.882765
  socket type=SOCK_DGRAM
index 2b28a49..3fbdb54 100644 (file)
@@ -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
index 08718fc..f17346b 100644 (file)
@@ -1,4 +1,4 @@
-anarres
+adnstest anarres
 2/test.iwj.relativity.greenend.org.uk.
  start 962142174.403028
  socket type=SOCK_DGRAM
index 5adf026..1257e1e 100644 (file)
@@ -1,4 +1,4 @@
-anarres
+adnstest anarres
 2/test.iwj.relativity.greenend.org.uk.
  start 962142246.340485
  socket type=SOCK_DGRAM
index 68ce1d7..b4f5171 100644 (file)
@@ -1,4 +1,4 @@
-anarres -0x300
+adnstest anarres -0x300
 2/test.iwj.relativity.greenend.org.uk.
  start 962143388.709150
  socket type=SOCK_DGRAM
index 61c7bf5..81864aa 100644 (file)
@@ -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
index 4979230..9e8e75b 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :65548 2/6.45.18.172.in-addr.arpa
  start 957718868.938329
  socket type=SOCK_DGRAM
index bdc3f78..d26ded2 100644 (file)
@@ -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
index bdddeea..387dc87 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :65548 2/6.45.18.172.in-addr.arpa
  start 957718868.938329
  socket type=SOCK_DGRAM
index 003d1ca..f810c3b 100644 (file)
@@ -1,4 +1,4 @@
-noserver
+adnstest noserver
 :1 chiark.greenend.org.uk
  start 912889153.349504
  socket type=SOCK_DGRAM
index 4288e5d..3698827 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :1 trunc.test.iwj.relativity.greenend.org.uk
  start 912888921.274801
  socket type=SOCK_DGRAM
index ba279bb..736210d 100644 (file)
@@ -1,4 +1,4 @@
-default
+adnstest default
 :32767 davenant.relativity.greenend.org.uk.
  start 933811310.565828
  socket type=SOCK_DGRAM
index 1f96131..3988557 100644 (file)
@@ -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);
index 2238cda..5807ddd 100644 (file)
@@ -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;
index 6f52787..429c825 100644 (file)
@@ -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', `
index 22e975a..a3c2d8b 100644 (file)
@@ -371,4 +371,6 @@ int H$1(hm_args_massage($3,void)) {
 }
 ')
 
+m4_define(`hm_specsyscall', `')
+
 m4_include(`hsyscalls.i4')
index 58d3636..d59395f 100644 (file)
@@ -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 (file)
index 0000000..8f7eeb9
--- /dev/null
@@ -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 (file)
index 0000000..b74627e
--- /dev/null
@@ -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
index a31c708..b3ccd73 100644 (file)
@@ -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)
index 81b4634..c556f8c 100755 (executable)
@@ -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"
index 57df4bb..96d7195 100755 (executable)
@@ -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
 
index 63f2da7..f276a6a 100644 (file)
@@ -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)
index b82857c..ac8de47 100644 (file)
@@ -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