diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile index 7327666c73..c6d9ddff13 100644 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile @@ -7,5 +7,6 @@ SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance i SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_key_delete ; SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_getspecific ; SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_setspecific ; +SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigignore ; SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigprocmask ; SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigsuspend ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile index d5dfbc4806..d182a31247 100644 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile @@ -2,5 +2,5 @@ SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance inter SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; -SimpleTest 1-1.test : 1-1.c ; +SimpleTest difftime_1-1 : 1-1.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile index 7f64d2fe39..65e24ebfc0 100644 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile @@ -2,5 +2,4 @@ SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance inter SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; -SimpleTest 2-1.test : 2-1.c ; - +SimpleTest kill_2-1 : 2-1.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/1-1.c new file mode 100644 index 0000000000..397e5b4a57 --- /dev/null +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/1-1.c @@ -0,0 +1,57 @@ +/* + * 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. + + Steps: + 1. Set up a handler for signal SIGABRT, such that it is called if +signal is ever raised. + 2. Call sigignore on SIGABRT. + 3. Raise a SIGABRT and verify that the signal handler was not called. + +*/ + +#define _XOPEN_SOURCE 600 + +#include +#include +#include "posixtest.h" + +int handler_called = 0; + +void handler(int signo) +{ + handler_called = 1; +} + +int main() +{ + struct sigaction act; + + act.sa_handler = handler; + act.sa_flags = 0; + sigemptyset(&act.sa_mask); + if (sigaction(SIGABRT, &act, 0) == -1) { + perror("Unexpected error while attempting to setup test " + "pre-conditions"); + return PTS_UNRESOLVED; + } + + sigignore(SIGABRT); + + if (raise(SIGABRT) == -1) { + perror("Unexpected error while attempting to setup test " + "pre-conditions"); + return PTS_UNRESOLVED; + } + + if (handler_called) { + printf("FAIL: Signal was not ignored\n"); + return PTS_FAIL; + } + printf("PASS\n"); + return PTS_PASS; +} + diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/4-1.c new file mode 100644 index 0000000000..ddc669ffa7 --- /dev/null +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/4-1.c @@ -0,0 +1,27 @@ +/* + * 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. + + Simply, if sigignore returns a 0 here, test passes. + +*/ + +#define _XOPEN_SOURCE 600 + +#include +#include +#include "posixtest.h" + +int main() +{ + + if (sigignore(SIGABRT) != 0) { + perror("sigignore failed -- returned -- test aborted"); + return PTS_UNRESOLVED; + } + printf("sigignore passed\n"); + return PTS_PASS; +} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/5-core-buildonly.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/5-core-buildonly.c new file mode 100644 index 0000000000..b765027759 --- /dev/null +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/5-core-buildonly.c @@ -0,0 +1,66 @@ +/* + * 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. + + Testing passing an invalid signals to sighold(). + After sighold is called on an invalid signal, sigignore() should +return -1 and set errno to EINVAL + + The invalid signal passed to sigignore() depends on the argument +passed to this program. There are currently 4 invalid signals. + */ + +#define _XOPEN_SOURCE 600 + +#include +#include +#include +#include +#include "posixtest.h" + +int main(int argc, char *argv[]) +{ + int signo; + + if (argc < 2) { + printf("Usage: %s [1|2|3|4]\n", argv[0]); + return PTS_UNRESOLVED; + } + + /* + Various error conditions + */ + switch (argv[1][0]) { + case '1': + signo=-1; + break; + case '2': + signo=-10000; + break; + case '3': + signo=INT32_MIN+1; + break; + case '4': + signo=INT32_MIN; + break; + default: + printf("Usage: %s [1|2|3|4]\n", argv[0]); + return PTS_UNRESOLVED; + } + + if (sigignore(signo) == -1) { + if (EINVAL == errno) { + printf ("errno set to EINVAL\n"); + return PTS_PASS; + } else { + printf ("errno not set to EINVAL\n"); + return PTS_FAIL; + } + } + + printf("sighold did not return -1\n"); + return PTS_FAIL; +} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/6-1.c new file mode 100644 index 0000000000..fed6c56178 --- /dev/null +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/6-1.c @@ -0,0 +1,36 @@ +/* + * 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. + + Testing trying to ignore a signal that cannot be ignored. + Line 1264 in Issue 6 of the Posix System Interfaces document says that + the system shall not allow the signals SIGKILL or SIGSTOP + to be ignored. + */ + +#define _XOPEN_SOURCE 600 + +#include +#include +#include +#include +#include "posixtest.h" + +int main() +{ + if (sigignore(SIGKILL) == -1) { + if (EINVAL == errno) { + printf ("errno set to EINVAL\n"); + return PTS_PASS; + } else { + printf ("errno not set to EINVAL\n"); + return PTS_FAIL; + } + } + + printf("sigignore did not return -1\n"); + return PTS_FAIL; +} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/6-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/6-2.c new file mode 100644 index 0000000000..966ca04568 --- /dev/null +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/6-2.c @@ -0,0 +1,36 @@ +/* + * 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. + + Testing trying to ignore a signal that cannot be ignored. + Line 1264 in Issue 6 of the Posix System Interfaces document says that + the system shall not allow the signals SIGKILL or SIGSTOP + to be ignored. + */ + +#define _XOPEN_SOURCE 600 + +#include +#include +#include +#include +#include "posixtest.h" + +int main() +{ + if (sigignore(SIGSTOP) == -1) { + if (EINVAL == errno) { + printf ("errno set to EINVAL\n"); + return PTS_PASS; + } else { + printf ("errno not set to EINVAL\n"); + return PTS_FAIL; + } + } + + printf("sigignore did not return -1\n"); + return PTS_FAIL; +} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/Jamfile new file mode 100644 index 0000000000..3bf4cfe03b --- /dev/null +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/Jamfile @@ -0,0 +1,9 @@ +SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigignore ; + +SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; + +SimpleTest sigignore_1-1 : 1-1.c ; +SimpleTest sigignore_4-1 : 4-1.c ; +SimpleTest sigignore_5-core-buildonly : 5-core-buildonly.c ; +SimpleTest sigignore_6-1 : 6-1.c ; +SimpleTest sigignore_6-2 : 6-2.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/Jamfile index 4fe7864602..3f2d71e981 100644 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/Jamfile +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/Jamfile @@ -2,8 +2,7 @@ SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance inter SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; -SimpleTest 8-1.test : 8-1.c ; -SimpleTest 8-2.test : 8-2.c ; -SimpleTest 8-3.test : 8-3.c ; -SimpleTest 12-1.test : 12-1.c ; - +SimpleTest sigprocmask_8-1 : 8-1.c ; +SimpleTest sigprocmask_8-2 : 8-2.c ; +SimpleTest sigprocmask_8-3 : 8-3.c ; +SimpleTest sigprocmask_12-1 : 12-1.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/Jamfile index 6568a7d79f..c7c9abbfa5 100644 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/Jamfile +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/Jamfile @@ -2,5 +2,4 @@ SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance inter SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; -SimpleTest 6-1.test : 6-1.c ; - +SimpleTest sigsuspend_6-1 : 6-1.c ;