bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fpending test


From: Bruno Haible
Subject: fpending test
Date: Wed, 3 Oct 2007 22:51:29 +0200
User-agent: KMail/1.5.4

Hi Jim,

The fpending module has no test in gnulib, but it has one in coreutils.
How about moving that test to gnulib? So that e.g. m4's "make check"
verifies it on all kinds of platforms.

Here is a proposed patch for gnulib. On the coreutils side, if you want
to keep that test as part of the testsuite, you need to pass add
fpending-tests to the list of modules taken from gnulib, and possibly a
few Makefile.am tweaks.

Bruno


2007-10-03  Bruno Haible  <address@hidden>

        * tests/test-fpending.c: New file, mostly copied
        from coreutils/lib/t-fpending.c.
        * modules/fpending-tests: New file.

*** modules/fpending-tests.orig 2003-09-23 19:59:22.000000000 +0200
--- modules/fpending-tests      2007-10-03 22:38:45.000000000 +0200
***************
*** 0 ****
--- 1,10 ----
+ Files:
+ tests/test-fpending.c
+ 
+ Depends-on:
+ 
+ configure.ac:
+ 
+ Makefile.am:
+ TESTS += test-fpending
+ check_PROGRAMS += test-fpending
*** tests/test-fpending.c.orig  2003-09-23 19:59:22.000000000 +0200
--- tests/test-fpending.c       2007-10-03 22:41:35.000000000 +0200
***************
*** 0 ****
--- 1,50 ----
+ /* Ensure that __fpending works.
+ 
+    Copyright (C) 2004, 2007 Free Software Foundation, Inc.
+ 
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+ 
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+ 
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ 
+    Written by Jim Meyering.  */
+ 
+ #include <config.h>
+ 
+ #include "fpending.h"
+ 
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+ #define ASSERT(expr) \
+   do                                                                       \
+     {                                                                      \
+       if (!(expr))                                                         \
+         {                                                                  \
+           fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+           abort ();                                                        \
+         }                                                                  \
+     }                                                                      \
+   while (0)
+ 
+ int
+ main ()
+ {
+   ASSERT (__fpending (stdout) == 0);
+ 
+   fputs ("foo", stdout);
+   ASSERT (__fpending (stdout) == 3);
+ 
+   fflush (stdout);
+   ASSERT (__fpending (stdout) == 0);
+ 
+   exit (0);
+ }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]