[PATCH] Use FAIL_UNSUPPORTED more

Sam James <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <ba3907835f966296a251097b7c00a330e0ee101f.1787913452.git.sam@gentoo.org>
In a few places, we weren't exiting w/ 77 when skipping. Fix that by using
our standard macro for it.
---
OK? I've only lightly tested it (not forced the failure/skip case).

 io/tst-fchmod-errors.c       | 2 +-
 nptl/tst-setuid1.c           | 7 +++----
 rt/tst-cpuclock2.c           | 4 ++--
 sysdeps/pthread/tst-cond23.c | 3 ++-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/io/tst-fchmod-errors.c b/io/tst-fchmod-errors.c
index 6df492fd57..63ee38a759 100644
--- a/io/tst-fchmod-errors.c
+++ b/io/tst-fchmod-errors.c
@@ -30,7 +30,7 @@ do_test (void)
     /* Permissions on /dev/null (the opened descriptor) cannot be changed.  */
     int fd = xopen ("/dev/null", O_RDWR, 0);
     if (getuid () == 0)
-      puts ("info: /dev/null fchmod test skipped because of root privileges");
+      FAIL_UNSUPPORTED ("/dev/null fchmod test skipped because of root privileges");
     else
       {
         errno = 0;
diff --git a/nptl/tst-setuid1.c b/nptl/tst-setuid1.c
index 34eb58be11..f25aff30ea 100644
--- a/nptl/tst-setuid1.c
+++ b/nptl/tst-setuid1.c
@@ -23,6 +23,7 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
+#include <support/check.h>
 
 static pthread_barrier_t b3, b4;
 static uid_t prev_ruid, prev_euid, prev_suid, nobody_uid;
@@ -1049,15 +1050,13 @@ do_test (void)
   if (prev_ruid == nobody_uid || prev_euid == nobody_uid
       || prev_suid == nobody_uid)
     {
-      puts ("already running as user nobody, skipping tests");
-      exit (0);
+      FAIL_UNSUPPORTED ("already running as user nobody");
     }
 
   if (prev_rgid == nobody_gid || prev_egid == nobody_gid
       || prev_sgid == nobody_gid)
     {
-      puts ("already running as group nobody, skipping tests");
-      exit (0);
+      FAIL_UNSUPPORTED ("already running as group nobody");
     }
 
   if (pthread_barrier_init (&b3, NULL, 3) != 0)
diff --git a/rt/tst-cpuclock2.c b/rt/tst-cpuclock2.c
index 32a05c6111..b3761867bf 100644
--- a/rt/tst-cpuclock2.c
+++ b/rt/tst-cpuclock2.c
@@ -37,6 +37,7 @@ do_test ()
 #include <errno.h>
 #include <pthread.h>
 
+#include <support/check.h>
 #include <support/xunistd.h>
 
 static pthread_barrier_t barrier;
@@ -156,8 +157,7 @@ do_test (void)
   if (timer_create (my_thread_clock, NULL, &t) != 0)
     {
       printf ("timer_create: %m\n");
-      puts ("No support for CPU clocks with good semantics, skipping test");
-      return 0;
+      FAIL_UNSUPPORTED ("No support for CPU clocks with good semantics");
     }
   timer_delete (t);
 
diff --git a/sysdeps/pthread/tst-cond23.c b/sysdeps/pthread/tst-cond23.c
index ac79aac603..2479bf77d3 100644
--- a/sysdeps/pthread/tst-cond23.c
+++ b/sysdeps/pthread/tst-cond23.c
@@ -21,6 +21,7 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <support/check.h>
 #include <support/test-driver.h>
 
 #if defined _POSIX_CLOCK_SELECTION && _POSIX_CLOCK_SELECTION >= 0
@@ -162,7 +163,7 @@ do_test (void)
 #  if _POSIX_MONOTONIC_CLOCK == 0
   int e = sysconf (_SC_MONOTONIC_CLOCK);
   if (e < 0)
-    puts ("CLOCK_MONOTONIC not supported");
+    FAIL_UNSUPPORTED ("CLOCK_MONOTONIC not supported");
   else if (e == 0)
     {
       puts ("sysconf (_SC_MONOTONIC_CLOCK) must not return 0");

base-commit: ea99fc77eaac0c1abb00c6b17d5dd7e7611406dd
-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.