These tests are fail unnecessarily easy, I think.  See:

$ rm -rf m && ./gnulib-tool --create-testdir --dir m --with-tests getlogin_r && 
cd m && ./configure && nohup make check > log 2>&1

How about this patch?

/Simon

diff --git a/ChangeLog b/ChangeLog
index 3509cdd..8c726be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-11  Simon Josefsson  <si...@josefsson.org>
+
+       * tests/test-getlogin.c (main): When invoked non-interactively,
+       skip test instead of failing.
+       * tests/test-getlogin_r.c (main): Likewise.
+
 2010-01-10  Bruno Haible  <br...@clisp.org>
 
        nproc: Work better on Linux when /proc and /sys are not mounted.
diff --git a/tests/test-getlogin.c b/tests/test-getlogin.c
index 6589289..8e107f7 100644
--- a/tests/test-getlogin.c
+++ b/tests/test-getlogin.c
@@ -35,7 +35,8 @@ main (void)
 
   /* Test value.  */
   buf = getlogin ();
-  ASSERT (buf != NULL);
+  if (buf == NULL)
+    return 77;
 
   /* Compare against the value from the environment.  */
 #if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)
diff --git a/tests/test-getlogin_r.c b/tests/test-getlogin_r.c
index f566e03..6e1fe6e 100644
--- a/tests/test-getlogin_r.c
+++ b/tests/test-getlogin_r.c
@@ -34,8 +34,11 @@ main (void)
 {
   /* Test with a large enough buffer.  */
   char buf[1024];
+  int rc;
 
-  ASSERT (getlogin_r (buf, sizeof (buf)) == 0);
+  rc = getlogin_r (buf, sizeof (buf));
+  if (rc != 0)
+    return 77;
 
   /* Compare against the value from the environment.  */
 #if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)


Reply via email to