On a Linux 2.6.26 / SPARC machine, I'm getting these test failures:

test-getlogin.c:43: assertion failed
FAIL: test-getlogin
test-getlogin_r.c:44: assertion failed
FAIL: test-getlogin_r

Apparently getlogin's error code here is EINVAL instead of ENOTTY.
This fixes the test failure.


2011-09-21  Bruno Haible  <br...@clisp.org>

        getlogin, getlogin_r tests: Avoid test failure on Linux/SPARC.
        * tests/test-getlogin.c (main): Allow a failure with EINVAL.
        * tests/test-getlogin_r.c (main): Likewise.

--- tests/test-getlogin.c.orig  Wed Sep 21 12:20:40 2011
+++ tests/test-getlogin.c       Wed Sep 21 12:16:25 2011
@@ -40,7 +40,9 @@
   if (buf == NULL)
     {
       /* getlogin() fails when stdin is not connected to a tty.  */
-      ASSERT (errno == ENOTTY);
+      ASSERT (errno == ENOTTY
+              || errno == EINVAL /* seen on Linux/SPARC */
+             );
 #if !defined __hpux /* On HP-UX 11.11 it fails anyway.  */
       ASSERT (! isatty (0));
 #endif
--- tests/test-getlogin_r.c.orig        Wed Sep 21 12:20:40 2011
+++ tests/test-getlogin_r.c     Wed Sep 21 12:16:26 2011
@@ -41,7 +41,9 @@
   if (err != 0)
     {
       /* getlogin_r() fails when stdin is not connected to a tty.  */
-      ASSERT (err == ENOTTY);
+      ASSERT (err == ENOTTY
+              || errno == EINVAL /* seen on Linux/SPARC */
+             );
 #if !defined __hpux /* On HP-UX 11.11 it fails anyway.  */
       ASSERT (! isatty (0));
 #endif

-- 
In memoriam Orlando Letelier <http://en.wikipedia.org/wiki/Orlando_Letelier>

Reply via email to