1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-09-01 02:34:55 +00:00

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.
This commit is contained in:
Paul Eggert
2023-12-29 19:20:19 -08:00
parent 2ebbe794ac
commit 82fc38c821
5 changed files with 15 additions and 18 deletions
+7
View File
@@ -1,5 +1,12 @@
2023-12-29 Paul Eggert <eggert@cs.ucla.edu>
tests: dont 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): Dont 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.
+1
View File
@@ -5,6 +5,7 @@ tests/signature.h
tests/macros.h
Depends-on:
inttypes
sleep
pthread-thread
+1
View File
@@ -4,6 +4,7 @@ tests/signature.h
tests/macros.h
Depends-on:
inttypes
sleep
configure.ac:
+3 -9
View 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. */
+3 -9
View 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. */