Patch by Vasilis Kaoutsis:

* Added sigset() tests to the posix test suite (changes by me: fixed tests
  5, 6, and 7).
* Modified output to include the name of the test.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22948 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-11-18 16:44:49 +00:00
parent f969977bc1
commit ac30a23b8b
43 changed files with 598 additions and 40 deletions
@@ -12,4 +12,5 @@ SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance i
SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigprocmask ;
SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigrelse ;
SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces signal ;
SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigset ;
SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigsuspend ;
@@ -33,7 +33,7 @@ int main()
return PTS_FAIL;
}
printf("Test PASSED\n");
printf("difftime_1-1: Test PASSED\n");
return PTS_PASS;
}
@@ -277,7 +277,7 @@ int main( int argc, char * argv[] )
/* Test passed */
#if VERBOSE > 0
output( "Test passed\n" );
output( "fork_12-1: Test PASSED\n" );
#endif
@@ -125,7 +125,7 @@ int main(int argc, char * argv[])
/* Test passed */
#if VERBOSE > 0
output("Test passed\n");
output("fork_3-1: Test PASSED\n");
#endif
PASSED;
@@ -118,7 +118,7 @@ int main(int argc, char * argv[])
/* Test passed */
#if VERBOSE > 0
output("Test passed\n");
output("fork_4-1: Test PASSED\n");
#endif
PASSED;
@@ -189,7 +189,7 @@ int main( int argc, char * argv[] )
/* Test passed */
#if VERBOSE > 0
output( "Test passed\n" );
output( "fork_6-1: Test PASSED\n" );
#endif
@@ -226,7 +226,7 @@ int main( int argc, char * argv[] )
/* Test passed */
#if VERBOSE > 0
output( "Test passed\n" );
output( "fork_8-1: Test PASSED\n" );
#endif
@@ -143,7 +143,7 @@ int main( int argc, char * argv[] )
/* Test passed */
#if VERBOSE > 0
output( "Test passed\n" );
output( "fork_9-1: Test PASSED\n" );
#endif
@@ -24,7 +24,7 @@ int main()
return PTS_FAIL;
}
printf("Test PASSED\n");
printf("kill_2-1: Test PASSED\n");
return PTS_PASS;
}
@@ -58,7 +58,7 @@ int main()
return PTS_FAIL;
}
printf("sighold(): Test PASSED: signal was blocked\n");
printf("sighold_1-1: Test PASSED: signal was blocked\n");
return PTS_PASS;
}
@@ -22,6 +22,6 @@ int main()
perror("sighold failed -- returned -- test aborted");
return PTS_UNRESOLVED;
}
printf("sighold passed\n");
printf("sighold_2-1: Test PASSED\n");
return PTS_PASS;
}
@@ -74,8 +74,8 @@ int main(int argc, char *argv[])
if (TEST_RETURN == -1) {
if (EINVAL == errno) {
printf ("errno set to EINVAL\n");
printf("sighold(): Test passed\n");
printf ("sighold_3-core-buildonly %s: successfully set errno to EINVAL\n", argv[1]);
printf("sighold_3-core-buildonly %s: Test PASSED\n", argv[1]);
return PTS_PASS;
} else {
printf ("errno not set to EINVAL\n");
@@ -51,7 +51,7 @@ int main()
printf("FAIL: Signal was not ignored\n");
return PTS_FAIL;
}
printf("PASS\n");
printf("sigignore_1-1: Test PASSED\n");
return PTS_PASS;
}
@@ -22,6 +22,6 @@ int main()
perror("sigignore failed -- returned -- test aborted");
return PTS_UNRESOLVED;
}
printf("sigignore passed\n");
printf("sigignore_4-1: Test PASSED\n");
return PTS_PASS;
}
@@ -53,7 +53,8 @@ int main(int argc, char *argv[])
if (sigignore(signo) == -1) {
if (EINVAL == errno) {
printf ("errno set to EINVAL\n");
printf ("sigignore_5-core-buildonly %s: successfully set errno to EINVAL\n", argv[1]);
printf("sigignore_5-core-buildonly %s: Test PASSED\n", argv[1]);
return PTS_PASS;
} else {
printf ("errno not set to EINVAL\n");
@@ -23,7 +23,8 @@ int main()
{
if (sigignore(SIGKILL) == -1) {
if (EINVAL == errno) {
printf ("errno set to EINVAL\n");
printf ("sigignore_6-1: successfully set errno to EINVAL\n");
printf("sigignore_6-1: Test PASSED\n");
return PTS_PASS;
} else {
printf ("errno not set to EINVAL\n");
@@ -23,7 +23,8 @@ int main()
{
if (sigignore(SIGSTOP) == -1) {
if (EINVAL == errno) {
printf ("errno set to EINVAL\n");
printf ("sigignore_6-2: successfully set errno to EINVAL\n");
printf("sigignore_6-2: Test PASSED\n");
return PTS_PASS;
} else {
printf ("errno not set to EINVAL\n");
@@ -26,7 +26,7 @@ int handler_called = 0;
void myhandler(int signo)
{
printf("SIGCHLD called. Inside handler\n");
printf("signal_1-1: SIGCHLD called. Inside handler\n");
handler_called = 1;
}
@@ -48,6 +48,6 @@ int main()
printf("Test FAILED: handler was called even though default was expected\n");
return PTS_FAIL;
}
printf("signal(): Test passed\n");
printf("signal_1-1: Test PASSED\n");
return PTS_PASS;
}
@@ -25,7 +25,7 @@ int handler_called = 0;
void myhandler(int signo)
{
printf("SIGCHLD called. Inside handler\n");
printf("signal_2-1: SIGCHLD called. Inside handler\n");
handler_called = 1;
}
@@ -47,6 +47,6 @@ int main()
printf("Test FAILED: handler was called even though default was expected\n");
return PTS_FAIL;
}
printf("signal(): Test passed\n");
printf("signal_2-1: Test PASSED\n");
return PTS_PASS;
}
@@ -23,7 +23,7 @@ int handler_called = 0;
void myhandler(int signo)
{
printf("SIGCHLD called. Inside handler\n");
printf("signal_3-1: SIGCHLD called. Inside handler\n");
handler_called = 1;
}
@@ -40,6 +40,6 @@ int main()
printf("Test FAILED: handler was called even though default was expected\n");
return PTS_FAIL;
}
printf("signal(): Test passed\n");
printf("signal_3-1: Test PASSED\n");
return PTS_PASS;
}
@@ -24,12 +24,12 @@
void SIGUSR1_handler(int signo)
{
printf("do nothing useful\n");
printf("signal_5-1: inside SIGUSR1_handler\n");
}
void SIGUSR2_handler(int signo)
{
printf("do nothing useful\n");
printf("signal_5-1: inside SIGUSR2_handler\n");
}
int main()
@@ -48,6 +48,6 @@ int main()
printf("signal did not return the last handler that was associated with SIGUSR1\n");
return PTS_FAIL;
}
printf("signal(): Test passed\n");
printf("signal_5-1: Test PASSED\n");
return PTS_PASS;
}
@@ -19,7 +19,7 @@
void myhandler(int signo)
{
printf("handler does nothing useful.\n");
printf("signal_6-1: inside handler\n");
}
int main()
@@ -35,6 +35,6 @@ int main()
printf("Test FAILED: errno wasn't set to EINVAL even though invalid signal number was passed to the signal() function\n");
return PTS_FAIL;
}
printf("signal(): Test passed\n");
printf("signal_6-1: Test PASSED\n");
return PTS_PASS;
}
@@ -19,7 +19,7 @@
void myhandler(int signo)
{
printf("handler does nothing useful.\n");
printf("signal_7-1: inside handler\n");
}
int main()
@@ -35,6 +35,6 @@ int main()
printf("Test FAILED: errno wasn't set to EINVAL even though a non-catchable signal was passed to the signal() function\n");
return PTS_FAIL;
}
printf("signal(): Test passed\n");
printf("signal_7-1: Test PASSED\n");
return PTS_PASS;
}
@@ -81,6 +81,6 @@ int main() {
return PTS_FAIL;
}
printf("PASS: signal mask was not changed.\n");
printf("sigprocmask_12-1: Test PASSED: signal mask was not changed.\n");
return PTS_PASS;
}
@@ -58,6 +58,6 @@ int main() {
if (is_changed(oactl, SIGABRT)) {
return PTS_FAIL;
}
printf("PASS: signal mask was not changed.\n");
printf("sigprocmask_8-1: Test PASSED: signal mask was not changed.\n");
return PTS_PASS;
}
@@ -59,6 +59,6 @@ int main() {
if (is_changed(oactl, SIGABRT)) {
return PTS_FAIL;
}
printf("PASS: signal mask was not changed.\n");
printf("sigprocmask_8-2: Test PASSED: signal mask was not changed.\n");
return PTS_PASS;
}
@@ -58,6 +58,6 @@ int main() {
if (is_changed(oactl, SIGABRT)) {
return PTS_FAIL;
}
printf("PASS: signal mask was not changed.\n");
printf("sigprocmask_8-3: Test PASSED: signal mask was not changed.\n");
return PTS_PASS;
}
@@ -64,7 +64,7 @@ int main()
sleep(1);
if (handler_called) {
printf("sigrelse(): Test PASSED: SIGABRT successfully removed from signal mask\n");
printf("sigrelse_1-1: Test PASSED: SIGABRT successfully removed from signal mask\n");
return PTS_PASS;
}
printf("FAIL\n");
@@ -22,6 +22,6 @@ int main()
perror("sigrelse failed -- returned -- test aborted");
return PTS_UNRESOLVED;
}
printf("sigrelse(): Test PASSED\n");
printf("sigrelse_2-1: Test PASSED\n");
return PTS_PASS;
}
@@ -75,8 +75,8 @@ int main(int argc, char *argv[])
if (TEST_RETURN == -1) {
if (EINVAL == errno) {
printf ("errno set to EINVAL\n");
printf("sigrelse(): Test PASSED\n");
printf ("sigrelse_3-core-buildonly %s: successfully set errno to EINVAL\n", argv[1]);
printf("sigrelse_3-core-buildonly %s: Test PASSED\n", argv[1]);
return PTS_PASS;
} else {
printf ("errno not set to EINVAL\n");
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
This program tests the assertion that the default handling of the
signal shall occur if the value of the disp parameter is SIG_DFL.
How this program tests this assertion by setting up a handler
"myhandler" for SIGCHLD. Then another call to sigset() is made about
SIGCHLD, this time with SIG_DFL as the value of the func parameter.
The default action for SIGCHLD is to be ignored, so unless myhandler
gets called when SIGCHLD is raised, the test passess, otherwise
returns failure.
*/
#define _XOPEN_SOURCE 600
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "posixtest.h"
int handler_called = 0;
void myhandler(int signo)
{
printf("sigset_1-1: SIGCHLD called. Inside handler\n");
handler_called = 1;
}
int main()
{
struct sigaction act;
act.sa_handler = myhandler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
if (sigaction(SIGCHLD, &act, 0) != 0) {
perror("Unexpected error while using sigaction()");
return PTS_UNRESOLVED;
}
if (sigset(SIGCHLD,SIG_DFL) != myhandler) {
perror("Unexpected error while using signal()");
return PTS_UNRESOLVED;
}
raise(SIGCHLD);
if (handler_called == 1) {
printf("Test FAILED: handler was called even though default was expected\n");
return PTS_FAIL;
}
printf("sigset_1-1: Test PASSED\n");
return PTS_PASS;
}
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
This program tests the assertion that when unsuccessful, SIG_ERROR
shall be returned, and errno set to EINVAL.
*/
#define _XOPEN_SOURCE 600
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "posixtest.h"
int main()
{
if (sigset(SIGKILL,SIG_IGN) == SIG_ERR) {
if (errno != EINVAL) {
printf("Test FAILED: sigset() returned SIG_ERR but didn't set errno to EINVAL\n");
return PTS_FAIL;
}
} else {
printf("Test FAILED: sigset() didn't return SIG_ERROR even though SIGKILL was passed to it\n");
return PTS_FAIL;
}
printf("sigset_10-1: Test PASSED\n");
return PTS_PASS;
}
@@ -0,0 +1,59 @@
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
This program tests the assertion that the signal shall be ignored
if the value of the dist parameter is SIG_IGN.
How this program tests this assertion is by setting up a handler
"myhandler" for SIGUSR1. Then another call to signal() is made about
SIGUSR1, this time with SIG_IGN as the value of the func parameter.
SIGUSR1 should be ignored now, so unless myhandler gets called when
SIGUSR1 is raised, the test passes, otherwise returns failure.
*/
#define _XOPEN_SOURCE 600
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "posixtest.h"
int handler_called = 0;
void myhandler(int signo)
{
printf("sigset_2-1: SIGUSR1 called. Inside handler\n");
handler_called = 1;
}
int main()
{
struct sigaction act;
act.sa_flags = 0;
act.sa_handler = myhandler;
sigemptyset(&act.sa_mask);
if (sigaction(SIGUSR1, &act, 0) != 0) {
perror("Unexpected error while using sigaction()");
return PTS_UNRESOLVED;
}
if (sigset(SIGUSR1,SIG_IGN) != myhandler) {
perror("Unexpected error while using signal()");
return PTS_UNRESOLVED;
}
raise(SIGUSR1);
if (handler_called == 1) {
printf("Test FAILED: handler was called even though default was expected\n");
return PTS_FAIL;
}
printf("sigset_2-1: Test PASSED\n");
return PTS_PASS;
}
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
This program tests the assertion that the function shall be executed
when the signal occurs if the disp parameter is the address of a function.
How this program tests this assertion is by setting up a handler
"myhandler" for SIGCHLD, and then raising that signal. If the
handler_called variable is anything but 1, then fail, otherwise pass.
*/
#define _XOPEN_SOURCE 600
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "posixtest.h"
int handler_called = 0;
void myhandler(int signo)
{
printf("sigset_3-1: SIGCHLD called. Inside handler\n");
handler_called = 1;
}
int main()
{
if (sigset(SIGCHLD, myhandler) == SIG_ERR) {
perror("Unexpected error while using sigset()");
return PTS_UNRESOLVED;
}
raise(SIGCHLD);
if (handler_called != 1) {
printf("Test FAILED: handler was called even though default was expected\n");
return PTS_FAIL;
}
printf("sigset_3-1: Test PASSED\n");
return PTS_PASS;
}
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
This program tests the assertion that the signal will be added to the
signal mask before its handler is executed.
*/
#define _XOPEN_SOURCE 600
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "posixtest.h"
int signal_blocked = 0;
void myhandler(int signo)
{
sigset_t mask;
printf("sigset_4-1: SIGCHLD called. Inside handler\n");
sigprocmask(SIG_SETMASK, NULL, &mask);
if(sigismember(&mask, SIGCHLD)) {
signal_blocked = 1;
}
}
int main()
{
if (sigset(SIGCHLD, myhandler) == SIG_ERR) {
perror("Unexpected error while using sigset()");
return PTS_UNRESOLVED;
}
raise(SIGCHLD);
if (signal_blocked != 1) {
printf("Test FAILED: handler was called even though default was expected\n");
return PTS_FAIL;
}
printf("sigset_4-1: Test PASSED\n");
return PTS_PASS;
}
@@ -0,0 +1,71 @@
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
This program tests the assertion that the process's signal mask will be
restored to the state that it was in prior to the delivery of the signal
Steps:
1. Empty the signal mask
2. Deliver the signal
3. When we return from the signal handler, verify that the signal mask
is still empty, otherwise fail.
*/
#define _XOPEN_SOURCE 600
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "posixtest.h"
#define NUMSIGNALS 26
int is_empty(sigset_t *set) {
int i;
int siglist[] = {SIGABRT, SIGALRM, SIGBUS, SIGCHLD,
SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT,
SIGPIPE, SIGQUIT, SIGSEGV,
SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU,
SIGUSR1, SIGUSR2, SIGPOLL, SIGPROF, SIGSYS,
SIGTRAP, SIGURG, SIGVTALRM, SIGXCPU, SIGXFSZ };
for (i=0; i<NUMSIGNALS; i++) {
if (sigismember(set, siglist[i]) != 0)
return 0;
}
return 1;
}
void myhandler(int signo)
{
printf("sigset_5-1: SIGCHLD called. Inside handler\n");
}
int main()
{
sigset_t mask;
sigemptyset(&mask);
sigprocmask(SIG_SETMASK, &mask, NULL);
if (sigset(SIGCHLD, myhandler) == SIG_ERR) {
perror("Unexpected error while using sigset()");
return PTS_UNRESOLVED;
}
raise(SIGCHLD);
sigprocmask(SIG_SETMASK, NULL, &mask);
if (is_empty(&mask) != 1) {
printf("Test FAILED: signal mask should be empty\n");
return PTS_FAIL;
}
printf("sigset_5-1: Test passed\n");
return PTS_PASS;
}
@@ -0,0 +1,63 @@
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
This program tests the assertion that if disp is SIG_HOLD, then the
signal shall be added to the process's signal mask.
Steps:
1. Register SIGCHLD with myhandler
2. Add SIGCHLD to the process's signal mask using sigset with disp
equal to SIG_HOLD
3. raise SIGCHLD
4. Verify that SIGCHLD is pending.
*/
#define _XOPEN_SOURCE 600
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "posixtest.h"
void myhandler(int signo)
{
printf("sigset_6-1: SIGCHLD called. Inside handler\n");
}
int main()
{
sigset_t pendingset;
struct sigaction act;
act.sa_handler = myhandler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
if (sigaction(SIGCHLD, &act, 0) != 0) {
perror("Unexpected error while using sigaction()");
return PTS_UNRESOLVED;
}
if (sigset(SIGCHLD,SIG_HOLD) == SIG_ERR) {
perror("Unexpected error while using sigset()");
return PTS_UNRESOLVED;
}
raise(SIGCHLD);
if (sigpending(&pendingset) == -1) {
printf("Error calling sigpending()\n");
return PTS_UNRESOLVED;
}
if (sigismember(&pendingset, SIGCHLD) != 1) {
printf("Test FAILED: Signal SIGCHLD was not successfully blocked\n");
return PTS_FAIL;
}
printf("sigset_6-1: Test PASSED\n");
return PTS_PASS;
}
@@ -0,0 +1,74 @@
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
This program tests the assertion that if disp is SIG_HOLD, then the
signal's disposition shall remain unchanged
Steps:
1. Register SIGCHLD with myhandler
2. Add SIGCHLD to the process's signal mask using sigset with disp
equal to SIG_HOLD
3. raise SIGCHLD
4. remove SIGCHLD from the signal mask
5. Verify that the original disposition hasn't been changed, by making
sure that SIGCHLD is still handled by myhandler.
*/
#define _XOPEN_SOURCE 600
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "posixtest.h"
int handler_called = 0;
void myhandler(int signo)
{
printf("sigset_7-1: SIGCHLD called. Inside handler\n");
handler_called = 1;
}
int main()
{
sigset_t pendingset;
struct sigaction act;
act.sa_handler = myhandler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
if (sigaction(SIGCHLD, &act, 0) != 0) {
perror("Unexpected error while using sigaction()");
return PTS_UNRESOLVED;
}
if (sigset(SIGCHLD,SIG_HOLD) == SIG_ERR) {
perror("Unexpected error while using sigset()");
return PTS_UNRESOLVED;
}
raise(SIGCHLD);
if (sigpending(&pendingset) == -1) {
printf("Error calling sigpending()\n");
return PTS_UNRESOLVED;
}
if (sigismember(&pendingset, SIGCHLD) != 1) {
printf("Test UNRESOLVED: Signal SIGCHLD was not successfully blocked\n");
return PTS_UNRESOLVED;
}
sigrelse(SIGCHLD);
if (handler_called != 1) {
printf("Test FAILED: Signal wasn't delivered even though it was removed from the signal mask\n");
return PTS_FAIL;
}
printf("sigset_7-1: Test PASSED\n");
return PTS_PASS;
}
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* 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
*/
#define _XOPEN_SOURCE 600
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "posixtest.h"
int main()
{
if (sigset(SIGCHLD,SIG_HOLD) != SIG_DFL) {
printf("Test FAILED: sigset() didn't return SIG_DFL\n");
return PTS_FAIL;
}
printf("sigset_8-1: Test PASSED\n");
return PTS_PASS;
}
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2003, Intel Corporation. All rights reserved.
* Created by: salwan.searty REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
This program tests the assertion that sigset shall return the signal's
previous disposition if signal had not been blocked.
*/
#define _XOPEN_SOURCE 600
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include "posixtest.h"
void myhandler(int signo)
{
printf("sigset_9-1: SIGUSR1 called. Inside handler\n");
}
int main()
{
struct sigaction act;
act.sa_flags = 0;
act.sa_handler = myhandler;
sigemptyset(&act.sa_mask);
if (sigaction(SIGUSR1, &act, 0) != 0) {
perror("Unexpected error while using sigaction()");
return PTS_UNRESOLVED;
}
if (sigset(SIGUSR1,SIG_DFL) != myhandler) {
printf("Test FAILED: sigset didn't return myhandler even though it was SIGUSR1's original disposition\n");
return PTS_FAIL;
}
printf("sigset_9-1: Test PASSED\n");
return PTS_PASS;
}
@@ -0,0 +1,14 @@
SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigset ;
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ;
SimpleTest sigset_1-1 : 1-1.c ;
SimpleTest sigset_2-1 : 2-1.c ;
SimpleTest sigset_3-1 : 3-1.c ;
SimpleTest sigset_4-1 : 4-1.c ;
SimpleTest sigset_5-1 : 5-1.c ;
SimpleTest sigset_6-1 : 6-1.c ;
SimpleTest sigset_7-1 : 7-1.c ;
SimpleTest sigset_8-1 : 8-1.c ;
SimpleTest sigset_9-1 : 9-1.c ;
SimpleTest sigset_10-1 : 10-1.c ;
@@ -27,7 +27,7 @@
void handler(int signo)
{
printf("Now inside signal handler\n");
printf("sigsuspend_6-1: Now inside signal handler\n");
}
int main()
@@ -89,7 +89,7 @@ int main()
}
if (exit_status == 2) {
printf("Test PASSED\n");
printf("sigsuspend_6-1: Test PASSED\n");
return PTS_PASS;
}
@@ -91,6 +91,18 @@ signals_tests()
conformance/interfaces/signal/signal_6-1
conformance/interfaces/signal/signal_7-1
echo ""
echo "sigset()"
conformance/interfaces/sigset/sigset_1-1
conformance/interfaces/sigset/sigset_2-1
conformance/interfaces/sigset/sigset_3-1
conformance/interfaces/sigset/sigset_4-1
conformance/interfaces/sigset/sigset_5-1
conformance/interfaces/sigset/sigset_6-1
conformance/interfaces/sigset/sigset_7-1
conformance/interfaces/sigset/sigset_8-1
conformance/interfaces/sigset/sigset_9-1
conformance/interfaces/sigset/sigset_10-1
echo ""
echo "sigsuspend()"
echo "FIXME: haiku' sigsuspend can not 'wake up' yet."
}