chiark / gitweb /
Sensible handling of empty reads. privaterel-1999-10-16-fanf
authorian <ian>
Sat, 16 Oct 1999 19:43:26 +0000 (19:43 +0000)
committerian <ian>
Sat, 16 Oct 1999 19:43:26 +0000 (19:43 +0000)
changelog
regress/case-1stservbroken.sys
regress/hcommon.c.m4
regress/hplayback.c.m4

index c86a8d997af1d1c0c96fade90e4a25563f89e441..0ef286c82fff16c7e9e5124300e9cd4eb48a0efa 100644 (file)
--- a/changelog
+++ b/changelog
@@ -8,6 +8,7 @@ adns (0.6) unstable; urgency=high
   * adnshost prints somewhat better messages about some wrong usages.
   * Include stdlib.h in adnshost.h.
   * adnslogres: parsing and error checking improved (Tony Finch).
+  * Regresion tests can cope with zero-length reads.
 
   General improvements
   * New adns_if_logpid option (functionality suggested by Tony Finch).
index 97d861ee9f199118d50109b4b4788afd4283c16e..36c7837cb2707ffbe6087cf19281fa2db96808f6 100644 (file)
@@ -1,40 +1,37 @@
 1stservbroken
 :12 trunc.test.iwj.relativity.greenend.org.uk
- start 940100522.187436
+ start 940102940.701451
  socket type=SOCK_DGRAM
  socket=4
- +0.000592
+ +0.000612
  fcntl fd=4 cmd=F_GETFL
  fcntl=~O_NONBLOCK&...
- +0.000614
+ +0.000605
  fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
  fcntl=OK
- +0.000566
+ +0.000573
  sendto fd=4 addr=172.18.45.2:53
      311f0100 00010000 00000000 05747275 6e630474 65737403 69776a0a 72656c61
      74697669 74790867 7265656e 656e6403 6f726702 756b0000 0c0001.
  sendto=59
- +0.006062
- select max=5 rfds=[4] wfds=[] efds=[] to=1.993938
+ +0.006374
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.993626
  select=1 rfds=[4] wfds=[] efds=[]
- +0.001590
+ +0.001402
  recvfrom fd=4 buflen=512 *addrlen=16
  recvfrom=ECONNREFUSED
- +0.000661
- select max=5 rfds=[4] wfds=[] efds=[] to=1.991687
+ +0.000666
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.991558
  select=0 rfds=[] wfds=[] efds=[]
- +2.-08754
- select max=5 rfds=[4] wfds=[] efds=[] to=0.000441
- select=0 rfds=[] wfds=[] efds=[]
- +0.009803
+ +2.-02914
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 05747275 6e630474 65737403 69776a0a 72656c61
      74697669 74790867 7265656e 656e6403 6f726702 756b0000 0c0001.
  sendto=59
- +0.002097
- select max=5 rfds=[4] wfds=[] efds=[] to=1.997903
+ +0.002262
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.997738
  select=1 rfds=[4] wfds=[] efds=[]
- +0.000971
+ +0.000973
  recvfrom fd=4 buflen=512 *addrlen=16
  recvfrom=OK addr=172.18.45.6:53
      311f8380 00010008 00000000 05747275 6e630474 65737403 69776a0a 72656c61
      000c0001 0000003c 0024046c 6f6e6706 646f6d61 696e0274 6f05666f 7263650a
      7472756e 63617469 6f6e0136 c069c00c 000c0001 0000003c 0024046c 6f6e6706
      646f6d61 696e0274 6f05666f 7263650a 7472756e 63617469 6f6e0137 c069.
- +0.004198
+ +0.004340
  socket type=SOCK_STREAM
  socket=5
- +0.004875
+ +0.005126
  fcntl fd=5 cmd=F_GETFL
  fcntl=~O_NONBLOCK&...
- +0.000570
+ +0.000742
  fcntl fd=5 cmd=F_SETFL O_NONBLOCK|...
  fcntl=OK
- +0.000554
+ +0.000604
  connect fd=5 addr=172.18.45.2:53
  connect=EINPROGRESS
- +0.000793
+ +0.000797
  recvfrom fd=4 buflen=512 *addrlen=16
  recvfrom=EAGAIN
- +0.000784
- select max=6 rfds=[4] wfds=[5] efds=[] to=13.988226
+ +0.000829
+ select max=6 rfds=[4] wfds=[5] efds=[] to=13.987562
  select=1 rfds=[] wfds=[5] efds=[]
- +0.001148
+ +0.001172
  read fd=5 buflen=1
- read=OK empty
- +0.001123
+ read=OK
+     .
+ +0.001161
  write fd=5
      003b311f 01000001 00000000 00000574 72756e63 04746573 74036977 6a0a7265
      6c617469 76697479 08677265 656e656e 64036f72 6702756b 00000c00 01.
  write=61
- +0.003548
- select max=6 rfds=[4,5] wfds=[] efds=[5] to=29.982407
+ +0.003598
+ select max=6 rfds=[4,5] wfds=[] efds=[5] to=29.981631
  select=1 rfds=[5] wfds=[] efds=[]
- +0.001355
+ +0.001370
  read fd=5 buflen=2
  read=EPIPE
- +0.001444
+ +0.001699
  close fd=5
  close=OK
- +0.000660
+ +0.000687
  socket type=SOCK_STREAM
  socket=5
- +0.004654
+ +0.004866
  fcntl fd=5 cmd=F_GETFL
  fcntl=~O_NONBLOCK&...
- +0.000570
+ +0.000611
  fcntl fd=5 cmd=F_SETFL O_NONBLOCK|...
  fcntl=OK
- +0.000602
+ +0.000574
  connect fd=5 addr=172.18.45.6:53
  connect=EINPROGRESS
- +0.001046
+ +0.001082
  select max=6 rfds=[4] wfds=[5] efds=[] to=14.000000
  select=1 rfds=[] wfds=[5] efds=[]
- +0.000999
+ +0.001011
  read fd=5 buflen=1
  read=EAGAIN
- +0.000579
+ +0.000595
  write fd=5
      003b311f 01000001 00000000 00000574 72756e63 04746573 74036977 6a0a7265
      6c617469 76697479 08677265 656e656e 64036f72 6702756b 00000c00 01.
  write=61
- +0.004802
- select max=6 rfds=[4,5] wfds=[] efds=[5] to=29.965696
+ +0.005087
+ select max=6 rfds=[4,5] wfds=[] efds=[5] to=29.964049
  select=1 rfds=[5] wfds=[] efds=[]
- +0.001239
+ +0.001295
  read fd=5 buflen=2
  read=OK
      0638.
- +0.000653
+ +0.000649
  read fd=5 buflen=1592
  read=OK
      311f8580 0001001e 00010001 05747275 6e630474 65737403 69776a0a 72656c61
      69c00c00 0c000100 00003c00 25046c6f 6e670664 6f6d6169 6e02746f 05666f72
      63650a74 72756e63 6174696f 6e023239 c069c069 00020001 0000003c 0006036e
      7330c072 036e7330 c0720001 00010001 51800004 ac122d06.
- +0.008947
+ +0.009426
  read fd=5 buflen=1594
  read=EAGAIN
- +0.032609
+ +0.033394
  close fd=4
  close=OK
- +0.051246
+ +0.054384
  close fd=5
  close=OK
- +0.001019
+ +0.000977
index 26798cbfb4fedb6cd1a6cd4b56a46679b7ec2a46..59d97ede9818e246613d8b67b9f4a69c3b847e12 100644 (file)
@@ -131,7 +131,7 @@ void Tvbbytes(const void *buf, int len) {
   const byte *bp;
   int i;
 
-  if (!len) { Tvba(" empty"); return; }
+  if (!len) { Tvba("\n     ."); return; }
   for (i=0, bp=buf; i<len; i++, bp++) {
     if (!(i&31)) Tvba("\n     ");
     else if (!(i&3)) Tvba(" ");
index 908886957f7fea3285b64811b1bd753bce12cc3d..d7b383a0c495b3fd39e5c480f114b03c25fc394b 100644 (file)
@@ -44,6 +44,7 @@ static void Tensurereportfile(void) {
   const char *fdstr;
   int fd;
 
+  if (Treportfile) return;
   Treportfile= stderr;
   fdstr= getenv("ADNS_TEST_REPORT_FD"); if (!fdstr) return;
   fd= atoi(fdstr);
@@ -271,7 +272,7 @@ void Q_vb(void) {
 m4_define(`hm_syscall', `
  hm_create_proto_h
 int H$1(hm_args_massage($3,void)) {
- int r;
+ int r, amtread;
  m4_define(`hm_rv_fd',`char *ep;')
  m4_define(`hm_rv_any',`char *ep;')
  m4_define(`hm_rv_len',`')
@@ -295,10 +296,10 @@ int H$1(hm_args_massage($3,void)) {
 
  Tensurereportfile();
  fprintf(Treportfile,"syscallr %s",vb2.buf);
vb2.avail= strlen(vb2.buf);
- if (vb.avail<=0 || vb2.buf[--vb2.avail]!=hm_squote\nhm_squote)
amtread= strlen(vb2.buf);
+ if (amtread<=0 || vb2.buf[--amtread]!=hm_squote\nhm_squote)
   Psyntax("badly formed line");
- vb2.buf[vb2.avail]= 0;
+ vb2.buf[amtread]= 0;
  if (memcmp(vb2.buf," $1=",hm_r_offset)) Psyntax("syscall reply mismatch");
 
  if (vb2.buf[hm_r_offset] == hm_squoteEhm_squote) {
@@ -346,7 +347,8 @@ int H$1(hm_args_massage($3,void)) {
  m4_define(`hm_arg_pollfds_io',`Parg("$'`1"); Ppollfds($'`1,$'`2);')
  m4_define(`hm_arg_addr_out',`Parg("$'`1"); Paddr($'`1,$'`2);')
  $3
- if (vb2.used != vb2.avail) Psyntax("junk at end of line");
+ assert(vb2.used <= amtread);
+ if (vb2.used != amtread) Psyntax("junk at end of line");
 
  hm_create_nothing
  m4_define(`hm_arg_bytes_out',`r= Pbytes($'`2,$'`4);')