chiark / gitweb /
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 6dbb10ac2e9af2c0ce7f28bb616f54c6b03c9a7b..09c803e4f9703e1c7eda96fa46c6041b2a5bce9c 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 905f601d06e9115601a0d22d103e68df241c75fe..5a68a1a735556000cd3f2acae9f799cf538cf0f4 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 2f603545929bb714e1cce5ff601dcb467aa4212b..2144c05ae94d2590f90b655c373d22cafcaf7c6c 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 73523b2ee830a7a5306557d6016c7534a6d226b6..8b560fabbcc11ce574b20c6e6df6744f6d3c4a1e 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 83770bacd3a69368695732af03025ea463908b94..3d1f363ee3fdf20158594a2dede85366791c4309 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 7342fde630638bfd622db33c23b6c3cac6e77a52..675a9bd7de5af01406bd1363c6106f4a97d8ba0d 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 fb1ae3d731bb1f2813d138de84fd1b18aa2442ea..acc360eb833c64ae3a30c5d3168af16209fb4765 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 f0386d2241a1c15a297f4e38e8d97247e27fcaf0..4cd21b8c177b32872e2b43daca75c5c6071d04a7 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 a5cc7124142ea6291373f534f698eade52f2f06f..e91891224c00f333c6c4df5b716242f0562285b8 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 4e6ac0f4ab4d4a69081a53f02700f2dbf8cc84f0..f333d6693dc02be5144c6de319ae1dba4d524794 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 3e30bf782db8178514b6a68804c3d80722e8df24..9899ffde1580d44c9ba386b70ac629f200f26a62 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 f236a2db53f3f3f2e3b44f9bb48acfe1c7de8241..003d1ca6530eb635f42b7baa9060385230bdfddd 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 67020096c6136843eca4140e073d34e4dc7fa0fb..4288e5dc9745e720b7e8f307da3a6fccedc58897 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 4684eafc81cc3df472e7c8fac1c486e3953acacb..d1f72b793b8382fe8f8e65cb9dd715a7d059027d 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 aec03930cecd955df60ca971df275931efbb9b10..5f8b45627d51e104ae44993d9e8b9d954cbbd447 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 e383ac5cbdd3fb8c89d5a4b95a5c3c571ed7044f..7300689e809c9a2848fc9ef71b62d8aeb51f5d64 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 dc6ff403ceb854a4f20d80001950b0491781fefd..e81072ad91ef2263bd0e0cf39fff7a2dc23a59c6 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 ce6b2831578cf5b934181745d488fec0ed0d888a..3b2bfdf15125a7d8f649228f22d582cd283da481 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