Regression test doesn't rely on value of O_NONBLOCK.
authorian <ian>
Wed, 12 May 1999 21:33:15 +0000 (21:33 +0000)
committerian <ian>
Wed, 12 May 1999 21:33:15 +0000 (21:33 +0000)
19 files changed:
changelog
dynamic/Makefile.in
regress/case-mailboxes.sys
regress/case-manya.sys
regress/case-ndots.sys
regress/case-norm.sys
regress/case-owner.sys
regress/case-rootquery.sys
regress/case-rootqueryall.sys
regress/case-search.sys
regress/case-searchabs.sys
regress/case-timeout.sys
regress/case-trunc.sys
regress/fcntl-change.pl [new file with mode: 0644]
regress/hcommon.c.m4
regress/hplayback.c.m4
regress/hrecord.c.m4
regress/hsyscalls.i4
regress/r1test

index 6dbb10a..09c803e 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,6 +1,6 @@
 adns (0.2) experimental; urgency=low
 
-  Portability fixes:
+  Portability fixes for compilation on various platforms:
   * Include <sys/socket.h> and <netinet/in.h> in files with <arpa/inet.h>.
   * Don't use GCC union assignment feature (.rrs=0 => .rrs.untyped=0).
   * Explictly cast things to [const] struct sockaddr* in syscall args.
@@ -8,7 +8,11 @@ adns (0.2) experimental; urgency=low
   * Include <sys/times.h> in a few more files.
   * Include <unistd.h> and <sys/time.h> for select.
   * Look for inet_aton and inet_ntoa (in -lnsl and -lsocket).
-  
+
+  Portability fixes to regression test:
+  * Regression test doesn't rely on value of O_NONBLOCK.
+
+  Other changes:
   * Added COPYING (copy of the GPL).
 
  --
index 905f601..5a68a1a 100644 (file)
@@ -23,7 +23,7 @@ TARGETS=      $(SHLIBFILE)
 include                $(srcdir)/../settings.make
 include                $(srcdir)/../src/adns.make
 
-ALLOBJS=       $(addsuffix _p.o, $(basename $(LIBOBJS))) $(LDLIBS)
+ALLOBJS=       $(addsuffix _p.o, $(basename $(LIBOBJS)))
 
 install:
                $(INSTALL_PROGRAM) $(SHLIBFILE) $(lib_dir)/$(SHLIBFILE)
@@ -33,7 +33,7 @@ uninstall:
 
 $(SHLIBFILE):  $(ALLOBJS)
                rm -f $@
-               $(MKSHLIB_1) $@ $(MKSHLIB_2) $(ALLOBJS) $(MKSHLIB_3)
+               $(MKSHLIB_1) $@ $(MKSHLIB_2) $(ALLOBJS) $(LDLIBS) $(MKSHLIB_3)
 
 %_p.o:         $(srcdir)/../src/%.c $(srcdir)/../src/adns.h \
                        $(srcdir)/../src/internal.h $(srcdir)/../src/config.h
index 2f60354..2144c05 100644 (file)
@@ -5,10 +5,10 @@ default
  socket=4
  +0.000411
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000094
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000073
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 0873696c 6c792d72 70047465 73740369 776a0a72
index 73523b2..8b560fa 100644 (file)
@@ -5,10 +5,10 @@ default
  socket=4
  +0.000245
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000705
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000073
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 096d616e 79616464 72730474 65737403 69776a0a
index 83770ba..3d1f363 100644 (file)
@@ -5,10 +5,10 @@ ndots
  socket=4
  +0.000212
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000087
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000069
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 056e6577 73780864 6176656e 616e7408 64617665
index 7342fde..675a9bd 100644 (file)
@@ -5,10 +5,10 @@ default
  socket=4
  +0.000204
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000670
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000072
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
index fb1ae3d..acc360e 100644 (file)
@@ -5,10 +5,10 @@ default
  socket=4
  +0.000363
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000092
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000067
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
index f0386d2..4cd21b8 100644 (file)
@@ -5,10 +5,10 @@ default
  socket=4
  +0.000222
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000085
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000069
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 00000600 01.
index a5cc712..e918912 100644 (file)
@@ -5,10 +5,10 @@ default
  socket=4
  +0.000220
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000087
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000070
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 00000100 01.
index 4e6ac0f..f333d66 100644 (file)
@@ -5,10 +5,10 @@ default
  socket=4
  +0.000200
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000084
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000067
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 046e6577 73086461 76656e61 6e740867 7265656e
index 3e30bf7..9899ffd 100644 (file)
@@ -5,10 +5,10 @@ default
  socket=4
  +0.000207
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000088
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000071
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 046e6577 73086461 76656e61 6e740000 010001.
index f236a2d..003d1ca 100644 (file)
@@ -5,10 +5,10 @@ noserver
  socket=4
  +0.000193
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000088
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000072
  sendto fd=4 addr=172.18.45.36:53
      311f0100 00010000 00000000 06636869 61726b08 67726565 6e656e64 036f7267
index 6702009..4288e5d 100644 (file)
@@ -5,10 +5,10 @@ default
  socket=4
  +0.000207
  fcntl fd=4 cmd=F_GETFL
- fcntl=2
+ fcntl=~O_NONBLOCK&...
  +0.000321
- fcntl fd=4 cmd=F_SETFL 2050
- fcntl=0
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
  +0.000443
  sendto fd=4 addr=172.18.45.6:53
      311f0100 00010000 00000000 05747275 6e630474 65737403 69776a0a 72656c61
diff --git a/regress/fcntl-change.pl b/regress/fcntl-change.pl
new file mode 100644 (file)
index 0000000..d346281
--- /dev/null
@@ -0,0 +1,8 @@
+s/^( fcntl fd=\d+ cmd=F_SETFL) 2050$/$1 O_NONBLOCK\|\.\.\./;
+if ($last =~ m/^ fcntl fd=\d+ cmd=F_GETFL$/) {
+    s/^ fcntl=2$/ fcntl\=\~O_NONBLOCK\&.../;
+}
+if ($last =~ m/^ fcntl fd=\d+ cmd=F_SETFL /) {
+    s/^ fcntl=0$/ fcntl\=OK/;
+}
+$last=$_;
index 4684eaf..d1f72b7 100644 (file)
@@ -87,9 +87,11 @@ void Q$1(hm_args_massage($3,void)) {
  m4_define(`hm_arg_fd', `Tvbf(" $'`1=%d",$'`1);')
  m4_define(`hm_arg_fcntl_cmd_arg', `
   if ($'`1 == F_SETFL) {
-   Tvbf(" $'`1=F_SETFL %ld",arg);
-  } else {
+   Tvbf(" $'`1=F_SETFL %s",arg & O_NONBLOCK ? "O_NONBLOCK|..." : "~O_NONBLOCK&...");
+  } else if ($'`1 == F_GETFL) {
    Tvba(" $'`1=F_GETFL");
+  } else {
+   Tmust("$'`1","F_GETFL/F_SETFL",0);
   }')
  m4_define(`hm_arg_addr_in', `Tvba(" $'`1="); Tvbaddr($'`1,$'`2);')
  m4_define(`hm_arg_bytes_in', `')
index aec0393..5f8b456 100644 (file)
@@ -215,6 +215,7 @@ int H$1(hm_args_massage($3,void)) {
  m4_define(`hm_rv_len',`')
  m4_define(`hm_rv_must',`')
  m4_define(`hm_rv_succfail',`')
+ m4_define(`hm_rv_fcntl',`')
  $2
 
  hm_create_hqcall_vars
@@ -259,6 +260,23 @@ int H$1(hm_args_massage($3,void)) {
   vb2.used= ep - (char*)vb2.buf;
  ')
  m4_define(`hm_rv_fd',`hm_rv_any')
+ m4_define(`hm_rv_fcntl',`
+  r= 0;
+  if (cmd == F_GETFL) {
+    if (!memcmp(vb2.buf+hm_r_offset,"O_NONBLOCK|...",14)) {
+      r= O_NONBLOCK;
+      vb2.used= hm_r_offset+14;
+    } else if (!memcmp(vb2.buf+hm_r_offset,"~O_NONBLOCK&...",15)) {
+      vb2.used= hm_r_offset+15;
+    } else {
+      Psyntax("fcntl flags not O_NONBLOCK|... or ~O_NONBLOCK&...");
+    }
+  } else if (cmd == F_SETFL) {
+    hm_rv_succfail
+  } else {
+    Psyntax("fcntl not F_GETFL or F_SETFL");
+  }
+ ')
  $2
 
  hm_create_nothing
index e383ac5..7300689 100644 (file)
@@ -104,6 +104,16 @@ int H$1(hm_args_massage($3,void)) {
   if (r==-1) { Tvberrno(e); goto x_error; }
   Tmust("$1","return",r<=$'`1);
   Tvba("OK");')
+ m4_define(`hm_rv_fcntl',`
+  if (r==-1) { Tvberrno(e); goto x_error; }
+  if (cmd == F_GETFL) {
+    Tvbf(r & O_NONBLOCK ? "O_NONBLOCK|..." : "~O_NONBLOCK&...");
+  } else if (cmd == F_SETFL) {
+    Tmust("$1","return",!r);
+  } else {
+    Tmust("cmd","F_GETFL/F_SETFL",0);
+  }
+  Tvba("OK");')
  $2
 
  hm_create_nothing
@@ -119,6 +129,7 @@ int H$1(hm_args_massage($3,void)) {
  m4_define(`hm_rv_fd',`x_error:')
  m4_define(`hm_rv_succfail',`x_error:')
  m4_define(`hm_rv_len',`x_error:')
+ m4_define(`hm_rv_fcntl',`x_error:')
  m4_define(`hm_rv_must',`')
  $2
 
index dc6ff40..e81072a 100644 (file)
@@ -19,13 +19,14 @@ 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_dnl each system call has
-m4_dnl  hm_syscall(<name>,<returnvalue>,<args>
+m4_dnl  hm_syscall(<name>,<returnvalue>,<args>)
 m4_dnl <returnvalue> is one of
 m4_dnl  hm_rv_must       must succeed and return 0
 m4_dnl  hm_rv_any        any nonnegative return allowed, -1 means see errno
 m4_dnl  hm_rv_fd         file descriptor is returned, -1 means see errno
 m4_dnl  hm_rv_succfail   returns 0 (ok) or -1 (see errno)
 m4_dnl  hm_rv_len(<max>) returns length read/written, must be <=max, -1 => errno
+m4_dnl  hm_rv_fcntl      syscall is fcntl, do special processing
 m4_dnl <args> is list of macros for arguments, each followed by hm_na
 m4_dnl  hm_arg_nullptr(<type>,<arg>)    pointer of type type, must be null
 m4_dnl  hm_arg_int(<arg>)               signed integer
@@ -63,7 +64,7 @@ hm_syscall(
 ')
 
 hm_syscall(
-       fcntl, `hm_rv_any', `
+       fcntl, `hm_rv_fcntl', `
        hm_arg_fd(fd) hm_na
        hm_arg_fcntl_cmd_arg(cmd,arg) hm_na
 ')
index ce6b283..3b2bfdf 100755 (executable)
@@ -22,17 +22,23 @@ set -e
 
 echo "rc=$rc" >>$ocase.out
 
-for part in out err
+failed=false
+for part in err out
 do
        if diff -u -- "$case.$part" "$ocase.$part"
        then
                :
        else
-               echo >&2 "FAILED $case - WRONG OUTPUT"
-               exit 2
+               failed=true
        fi
 done
 
+if $failed
+then
+       echo >&2 "FAILED $case - WRONG OUTPUT - lines of syscall remaining `wc -l`"
+       exit 2
+fi
+
 echo -n "$casename "
 
 exit 0