]> Savannah Git Hosting - gnulib.git/commitdiff
getlogin tests, getlogin_r tests: Avoid failure on Solaris OpenIndiana.
authorBruno Haible <bruno@clisp.org>
Wed, 30 Dec 2020 13:58:41 +0000 (14:58 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 30 Dec 2020 13:58:41 +0000 (14:58 +0100)
* tests/test-getlogin.c (main): Don't fail if getlogin() returns NULL
with no errno.
* tests/test-getlogin_r.c (main): Don't fail if getlogin_r() returns
EINVAL.

ChangeLog
tests/test-getlogin.c
tests/test-getlogin_r.c

index c2cd6496951aaa26eca1923e34e9cb7ed19b8112..1ed194e582411a8dfda33de8b82ff7a44f74b657 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2020-12-30  Bruno Haible  <bruno@clisp.org>
+
+       getlogin tests, getlogin_r tests: Avoid failure on Solaris OpenIndiana.
+       * tests/test-getlogin.c (main): Don't fail if getlogin() returns NULL
+       with no errno.
+       * tests/test-getlogin_r.c (main): Don't fail if getlogin_r() returns
+       EINVAL.
+
 2020-12-29  Jim Meyering  <meyering@fb.com>
 
        regex-tests: tweak to avoid a clang-10 warning
index a3048f2ab2ca7030920eb246ac5bcb9146c88025..f0d168b63c99aaebc24106ba28e5acb69fd6d76d 100644 (file)
@@ -31,7 +31,14 @@ main (void)
   /* Test value.  */
   char *buf = getlogin ();
   int err = buf ? 0 : errno;
-  ASSERT (buf || err);
+#if defined __sun
+  if (buf == NULL && err == 0)
+    {
+      /* This can happen on Solaris 11 OpenIndiana in the MATE desktop.  */
+      fprintf (stderr, "Skipping test: no entry in /var/adm/utmpx.\n");
+      exit (77);
+    }
+#endif
   test_getlogin_result (buf, err);
 
   return 0;
index 69d0bae120deeb6822985985aa6b75800c4d6758..88c41fe2a9ab2b1b02f1dbc5af281da44040127d 100644 (file)
@@ -32,6 +32,14 @@ main (void)
   /* Test with a large enough buffer.  */
   char buf[1024];
   int err = getlogin_r (buf, sizeof buf);
+#if defined __sun
+  if (err == EINVAL)
+    {
+      /* This can happen on Solaris 11 OpenIndiana in the MATE desktop.  */
+      fprintf (stderr, "Skipping test: no entry in /var/adm/utmpx.\n");
+      exit (77);
+    }
+#endif
   test_getlogin_result (buf, err);
 
   /* Test with a small buffer.  */