]> Savannah Git Hosting - gnulib.git/commitdiff
tests: don’t skip if LONG_MAX < pid
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 30 Dec 2023 03:20:19 +0000 (19:20 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 30 Dec 2023 03:22:42 +0000 (19:22 -0800)
* modules/pthread_sigmask-tests, modules/sigprocmask-tests:
(Depends-on): Add inttypes.
* tests/test-pthread_sigmask1.c, tests/test-sigprocmask.c:
Include inttypes.h.
(main): Don’t skip test if pid exceeds LONG_MAX.

ChangeLog
modules/pthread_sigmask-tests
modules/sigprocmask-tests
tests/test-pthread_sigmask1.c
tests/test-sigprocmask.c

index 41a85b3cf1d40faaef4cb74f5cb0979bf283e959..02edd93ac762ab6e69d858b2904ccaba3a79127a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2023-12-29  Paul Eggert  <eggert@cs.ucla.edu>
 
+       tests: don’t skip if LONG_MAX < pid
+       * modules/pthread_sigmask-tests, modules/sigprocmask-tests:
+       (Depends-on): Add inttypes.
+       * tests/test-pthread_sigmask1.c, tests/test-sigprocmask.c:
+       Include inttypes.h.
+       (main): Don’t skip test if pid exceeds LONG_MAX.
+
        Omit no-longer-needed pragmas
        * lib/anytostr.c, lib/poll.c, lib/regex.c:
        Omit pragmas that should no longer be needed.
index e4e0d5b019561895a71a92e52a9059c83a4fb03b..d40a0136876f2c01fa33636ac6fa7b5e6b84e37f 100644 (file)
@@ -5,6 +5,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+inttypes
 sleep
 pthread-thread
 
index 80fcd81fea4982a555472596a83e3ce97412a059..aba383e20af6b8d83fb3e74873b30c32e320e10e 100644 (file)
@@ -4,6 +4,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+inttypes
 sleep
 
 configure.ac:
index 06158f9d58b6d4d2bac994ffbc030af2d74400f9..c728bba5e865ec70ec637bd32c66a4db434682f7 100644 (file)
@@ -24,7 +24,7 @@
 SIGNATURE_CHECK (pthread_sigmask, int, (int, const sigset_t *, sigset_t *));
 
 #include <errno.h>
-#include <limits.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -45,15 +45,9 @@ int
 main ()
 {
   sigset_t set;
-  pid_t pid = getpid ();
+  intmax_t pid = getpid ();
   char command[80];
 
-  if (LONG_MAX < pid)
-    {
-      fputs ("Skipping test: pid too large\n", stderr);
-      return 77;
-    }
-
   signal (SIGINT, sigint_handler);
 
   sigemptyset (&set);
@@ -66,7 +60,7 @@ main ()
   ASSERT (pthread_sigmask (SIG_BLOCK, &set, NULL) == 0);
 
   /* Request a SIGINT signal from outside.  */
-  sprintf (command, "sh -c 'sleep 1; kill -INT %ld' &", (long) pid);
+  sprintf (command, "sh -c 'sleep 1; kill -INT %"PRIdMAX"' &", pid);
   ASSERT (system (command) == 0);
 
   /* Wait.  */
index 640a8e2eb0545a9bf99e1cb597504042888d813d..f9cd86677f9fa4ffb40cb2483fb3dc026221ea31 100644 (file)
@@ -24,7 +24,7 @@
 SIGNATURE_CHECK (sigprocmask, int, (int, const sigset_t *, sigset_t *));
 
 #include <errno.h>
-#include <limits.h>
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -45,15 +45,9 @@ int
 main ()
 {
   sigset_t set;
-  pid_t pid = getpid ();
+  intmax_t pid = getpid ();
   char command[80];
 
-  if (LONG_MAX < pid)
-    {
-      fputs ("Skipping test: pid too large\n", stderr);
-      return 77;
-    }
-
   signal (SIGINT, sigint_handler);
 
   sigemptyset (&set);
@@ -67,7 +61,7 @@ main ()
   ASSERT (sigprocmask (SIG_BLOCK, &set, NULL) == 0);
 
   /* Request a SIGINT signal from outside.  */
-  sprintf (command, "sh -c 'sleep 1; kill -INT %ld' &", (long) pid);
+  sprintf (command, "sh -c 'sleep 1; kill -INT %"PRIdMAX"' &", pid);
   ASSERT (system (command) == 0);
 
   /* Wait.  */