changeset 10240:d8fe05396cf4

Avoid test failure due to SA_RESTORER. * tests/test-sigaction.c (SA_MASK): New macro. (main): Avoid failing due to extension flags being set. Reported by Jim Meyering. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Mon, 23 Jun 2008 06:24:53 -0600
parents e7f22aa7841e
children 33944c807312
files ChangeLog tests/test-sigaction.c
diffstat 2 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jun 23 06:02:40 2008 -0600
+++ b/ChangeLog	Mon Jun 23 06:24:53 2008 -0600
@@ -1,5 +1,10 @@
 2008-06-23  Eric Blake  <ebb9@byu.net>
 
+	Avoid test failure due to SA_RESTORER.
+	* tests/test-sigaction.c (SA_MASK): New macro.
+	(main): Avoid failing due to extension flags being set.
+	Reported by Jim Meyering.
+
 	Revert use of sig-handler.h in sigprocmask.c.
 	* modules/sigprocmask (Files): Don't rely on sig-handler.h, since
 	it requires the existence of struct sigaction.
--- a/tests/test-sigaction.c	Mon Jun 23 06:02:40 2008 -0600
+++ b/tests/test-sigaction.c	Mon Jun 23 06:24:53 2008 -0600
@@ -36,9 +36,24 @@
     }									     \
   while (0)
 
+#ifndef SA_NOCLDSTOP
+# define SA_NOCLDSTOP 0
+#endif
+#ifndef SA_ONSTACK
+# define SA_ONSTACK 0
+#endif
 #ifndef SA_SIGINFO
 # define SA_SIGINFO 0
 #endif
+#ifndef SA_NOCLDWAIT
+# define SA_NOCLDWAIT 0
+#endif
+
+/* Define a mask of flags required by POSIX.  Some implementations
+   provide other flags as extensions, such as SA_RESTORER, that we
+   must ignore in this test.  */
+#define SA_MASK (SA_NOCLDSTOP | SA_ONSTACK | SA_RESETHAND | SA_RESTART	\
+		 SA_SIGINFO | SA_NOCLDWAIT | SA_NODEFER)
 
 /* This test is unsafe in the presence of an asynchronous SIGABRT,
    because we install a signal-handler that is intentionally not
@@ -80,7 +95,7 @@
   ASSERT (raise (SIGABRT) == 0);
   sa.sa_flags = SA_RESETHAND | SA_NODEFER;
   ASSERT (sigaction (SIGABRT, &sa, &old_sa) == 0);
-  ASSERT (old_sa.sa_flags == 0);
+  ASSERT ((old_sa.sa_flags & SA_MASK) == 0);
   ASSERT (old_sa.sa_handler == handler);
   ASSERT (raise (SIGABRT) == 0);
   sa.sa_handler = SIG_DFL;