changeset 9818:fc76a5b22f64

Disable the fflush-after-ungetc tests, since gnulib currently does not guarantee consistent results.
author Bruno Haible <bruno@clisp.org>
date Sat, 29 Mar 2008 12:59:48 +0100
parents 8abe4cfb1a83
children 9ccce8a9bf52
files ChangeLog m4/fflush.m4 tests/test-fflush2.c
diffstat 3 files changed, 29 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Mar 28 15:50:04 2008 +0100
+++ b/ChangeLog	Sat Mar 29 12:59:48 2008 +0100
@@ -1,3 +1,10 @@
+2008-03-29  Bruno Haible  <bruno@clisp.org>
+
+	* tests/test-fflush2.c (main): Temporarily disable the contents of
+	this test.
+	* m4/fflush.m4 (gl_FUNC_FFLUSH): Add a TODO.
+	Reported by Eric Blake.
+
 2008-03-28  Simon Josefsson  <simon@josefsson.org>
 
 	* lib/gc.h (enum Gc_hash): Add GC_SHA224.
--- a/m4/fflush.m4	Fri Mar 28 15:50:04 2008 +0100
+++ b/m4/fflush.m4	Sat Mar 29 12:59:48 2008 +0100
@@ -1,6 +1,6 @@
-# fflush.m4 serial 4
+# fflush.m4 serial 5
 
-# Copyright (C) 2007 Free Software Foundation, Inc.
+# Copyright (C) 2007-2008 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -21,8 +21,11 @@
 #include <unistd.h>
        ]], [[FILE *f = fopen ("conftest.txt", "r");
 	 char buffer[10];
-	 int fd = fileno (f);
-	 if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5)
+	 int fd;
+	 if (f == NULL)
+	   return 1;
+	 fd = fileno (f);
+	 if (fd < 0 || fread (buffer, 1, 5, f) != 5)
 	   return 2;
 	 /* For deterministic results, ensure f read a bigger buffer.  */
 	 if (lseek (fd, 0, SEEK_CUR) == 5)
@@ -30,7 +33,11 @@
 	 /* POSIX requires fflush-fseek to set file offset of fd.  */
 	 if (fflush (f) != 0 || fseek (f, 0, SEEK_CUR) != 0)
 	   return 4;
-	 return !(lseek (fd, 0, SEEK_CUR) == 5);
+	 if (lseek (fd, 0, SEEK_CUR) != 5)
+	   return 5;
+	 /* TODO: Verify behaviour of fflush after ungetc, see
+	    <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>.  */
+	 return 0;
        ]])], [gl_cv_func_fflush_stdin=yes], [gl_cv_func_fflush_stdin=no],
      [dnl Pessimistically assume fflush is broken.  This is wrong for
       dnl at least glibc and cygwin; but lib/fflush.c takes this into account.
--- a/tests/test-fflush2.c	Fri Mar 28 15:50:04 2008 +0100
+++ b/tests/test-fflush2.c	Sat Mar 29 12:59:48 2008 +0100
@@ -48,6 +48,15 @@
 int
 main (int argc, char **argv)
 {
+#if 0
+  /* Check fflush after a backup ungetc() call.  This is case 1 in terms of
+     <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>.
+     The Austin Group has not yet decided how this should behave.  */
+#endif
+#if 0
+  /* Check fflush after a non-backup ungetc() call.  This is case 1 in terms of
+     <http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>.
+     The Austin Group has not yet decided how this should behave.  */
   /* Check that fflush after a non-backup ungetc() call discards the ungetc
      buffer.  This is mandated by POSIX
      <http://www.opengroup.org/susv3/functions/ungetc.html>:
@@ -73,6 +82,7 @@
 
   c = fgetc (stdin);
   ASSERT (c == '/');
+#endif
 
   return 0;
 }