[haiku-commits] r41731 - haiku/branches/developer/bonefish/signals/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset

Author: bonefish
Date: 2011-05-25 03:01:29 +0200 (Wed, 25 May 2011)
New Revision: 41731
Changeset: https://dev.haiku-os.org/changeset/41731

Modified:
   
haiku/branches/developer/bonefish/signals/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/8-1.c
Log:
Changed broken test into something useful.


Modified: 
haiku/branches/developer/bonefish/signals/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/8-1.c
===================================================================
--- 
haiku/branches/developer/bonefish/signals/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/8-1.c
 2011-05-25 01:00:58 UTC (rev 41730)
+++ 
haiku/branches/developer/bonefish/signals/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/8-1.c
 2011-05-25 01:01:29 UTC (rev 41731)
@@ -5,21 +5,40 @@
  * of this license, see the COPYING file at the top level of this 
  * source tree.
 
- This program tests the assertion that if signal has been blocked, then
- sigset shall return SIG_HOLD
+ This program tests the assertion that if signal had been blocked, then
+ sigset shall return SIG_HOLD. Steps:
+ 1. block SIGCHLD via sigprocmask()
+ 2. use sigset()
 
 */
 
 #define _XOPEN_SOURCE 600
 
+#include <errno.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include "posixtest.h"
 
 int main()
 {
+       sigset_t signalMask;
+       if (sigemptyset(&signalMask) != 0) {
+               printf("sigemtpyset() failed unexpectedly: %s\n", 
strerror(errno));
+               return PTS_UNRESOLVED;
+       }
 
+       if (sigaddset(&signalMask, SIGCHLD) != 0) {
+               printf("sigaddset() failed unexpectedly: %s\n", 
strerror(errno));
+               return PTS_UNRESOLVED;
+       }
+
+       if (sigprocmask(SIG_BLOCK, &signalMask, NULL) != 0) {
+               printf("sigprocmask() failed unexpectedly: %s\n", 
strerror(errno));
+               return PTS_UNRESOLVED;
+       }
+
         if (sigset(SIGCHLD,SIG_HOLD) != SIG_HOLD) {
                printf("Test FAILED: sigset() didn't return SIG_HOLD\n");
                return PTS_FAIL;


Other related posts:

  • » [haiku-commits] r41731 - haiku/branches/developer/bonefish/signals/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset - ingo_weinhold