From 93de3bca5f45f482ace4acc9a198d0cd3fa347ff Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 5 Apr 2010 13:09:20 +0000 Subject: [PATCH] Removed partial (unknown version) Open POSIX Test Suite from the build. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36039 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/tests/system/libroot/posix/Jamfile | 1 - .../libroot/posix/posixtestsuite/Jamfile | 6 - .../posix/posixtestsuite/conformance/Jamfile | 3 - .../conformance/interfaces/Jamfile | 19 - .../conformance/interfaces/difftime/1-1.c | 41 -- .../conformance/interfaces/difftime/Jamfile | 6 - .../conformance/interfaces/fork/12-1.c | 301 -------- .../conformance/interfaces/fork/3-1.c | 137 ---- .../conformance/interfaces/fork/4-1.c | 130 ---- .../conformance/interfaces/fork/6-1.c | 199 ------ .../conformance/interfaces/fork/8-1.c | 234 ------- .../conformance/interfaces/fork/9-1.c | 151 ---- .../conformance/interfaces/fork/Jamfile | 10 - .../interfaces/fork/assertions.xml | 93 --- .../interfaces/fork/messcat_src.txt | 26 - .../conformance/interfaces/fork/testfrmw.c | 70 -- .../conformance/interfaces/fork/testfrmw.h | 84 --- .../conformance/interfaces/kill/2-1.c | 30 - .../conformance/interfaces/kill/Jamfile | 5 - .../interfaces/pthread_attr_destroy/1-1.c | 81 --- .../interfaces/pthread_attr_destroy/2-1.c | 58 -- .../interfaces/pthread_attr_destroy/3-1.c | 47 -- .../interfaces/pthread_attr_destroy/Jamfile | 7 - .../interfaces/pthread_create/1-1.c | 53 -- .../interfaces/pthread_create/1-2.c | 57 -- .../interfaces/pthread_create/1-3.c | 82 --- .../interfaces/pthread_create/1-4.c | 234 ------- .../interfaces/pthread_create/1-5.c | 263 ------- .../interfaces/pthread_create/1-6.c | 282 -------- .../interfaces/pthread_create/10-1.c | 129 ---- .../interfaces/pthread_create/11-1.c | 66 -- .../interfaces/pthread_create/12-1.c | 48 -- .../interfaces/pthread_create/14-1.c | 333 --------- .../interfaces/pthread_create/15-1.c | 156 ----- .../interfaces/pthread_create/2-1.c | 65 -- .../interfaces/pthread_create/3-1.c | 101 --- .../interfaces/pthread_create/3-2.c | 649 ------------------ .../interfaces/pthread_create/4-1.c | 67 -- .../interfaces/pthread_create/5-1.c | 56 -- .../interfaces/pthread_create/5-2.c | 59 -- .../interfaces/pthread_create/8-1.c | 163 ----- .../interfaces/pthread_create/8-2.c | 270 -------- .../interfaces/pthread_create/Jamfile | 23 - .../interfaces/pthread_getspecific/1-1.c | 72 -- .../interfaces/pthread_getspecific/3-1.c | 52 -- .../interfaces/pthread_getspecific/Jamfile | 7 - .../interfaces/pthread_key_create/1-1.c | 75 -- .../interfaces/pthread_key_create/1-2.c | 93 --- .../interfaces/pthread_key_create/2-1.c | 59 -- .../interfaces/pthread_key_create/3-1.c | 92 --- .../interfaces/pthread_key_create/Jamfile | 9 - .../interfaces/pthread_key_delete/1-1.c | 56 -- .../interfaces/pthread_key_delete/1-2.c | 62 -- .../interfaces/pthread_key_delete/2-1.c | 103 --- .../interfaces/pthread_key_delete/Jamfile | 8 - .../conformance/interfaces/pthread_once/1-1.c | 62 -- .../conformance/interfaces/pthread_once/1-2.c | 118 ---- .../conformance/interfaces/pthread_once/1-3.c | 183 ----- .../conformance/interfaces/pthread_once/2-1.c | 118 ---- .../conformance/interfaces/pthread_once/3-1.c | 121 ---- .../conformance/interfaces/pthread_once/4-1.c | 17 - .../conformance/interfaces/pthread_once/6-1.c | 365 ---------- .../interfaces/pthread_once/Jamfile | 11 - .../interfaces/pthread_once/testfrmw.c | 70 -- .../interfaces/pthread_once/testfrmw.h | 84 --- .../interfaces/pthread_setspecific/1-1.c | 73 -- .../interfaces/pthread_setspecific/1-2.c | 103 --- .../interfaces/pthread_setspecific/Jamfile | 7 - .../conformance/interfaces/sighold/1-1.c | 64 -- .../conformance/interfaces/sighold/2-1.c | 27 - .../interfaces/sighold/3-core-buildonly.c | 101 --- .../conformance/interfaces/sighold/Jamfile | 7 - .../conformance/interfaces/sigignore/1-1.c | 58 -- .../conformance/interfaces/sigignore/4-1.c | 27 - .../interfaces/sigignore/5-core-buildonly.c | 66 -- .../conformance/interfaces/sigignore/6-1.c | 36 - .../conformance/interfaces/sigignore/6-2.c | 36 - .../conformance/interfaces/sigignore/Jamfile | 9 - .../conformance/interfaces/signal/1-1.c | 53 -- .../conformance/interfaces/signal/2-1.c | 52 -- .../conformance/interfaces/signal/3-1.c | 45 -- .../conformance/interfaces/signal/5-1.c | 53 -- .../conformance/interfaces/signal/6-1.c | 41 -- .../conformance/interfaces/signal/7-1.c | 41 -- .../conformance/interfaces/signal/Jamfile | 10 - .../conformance/interfaces/sigprocmask/12-1.c | 86 --- .../conformance/interfaces/sigprocmask/8-1.c | 63 -- .../conformance/interfaces/sigprocmask/8-2.c | 64 -- .../conformance/interfaces/sigprocmask/8-3.c | 63 -- .../interfaces/sigprocmask/Jamfile | 8 - .../conformance/interfaces/sigrelse/1-1.c | 73 -- .../conformance/interfaces/sigrelse/2-1.c | 27 - .../interfaces/sigrelse/3-core-buildonly.c | 104 --- .../conformance/interfaces/sigrelse/Jamfile | 7 - .../conformance/interfaces/sigset/1-1.c | 61 -- .../conformance/interfaces/sigset/10-1.c | 34 - .../conformance/interfaces/sigset/2-1.c | 59 -- .../conformance/interfaces/sigset/3-1.c | 47 -- .../conformance/interfaces/sigset/4-1.c | 47 -- .../conformance/interfaces/sigset/5-1.c | 71 -- .../conformance/interfaces/sigset/6-1.c | 63 -- .../conformance/interfaces/sigset/7-1.c | 74 -- .../conformance/interfaces/sigset/8-1.c | 29 - .../conformance/interfaces/sigset/9-1.c | 43 -- .../conformance/interfaces/sigset/Jamfile | 14 - .../conformance/interfaces/sigsuspend/6-1.c | 104 --- .../conformance/interfaces/sigsuspend/Jamfile | 5 - .../posix/posixtestsuite/include/posixtest.h | 24 - .../posix/posixtestsuite/run_posix_tests.sh | 191 ------ 109 files changed, 9002 deletions(-) delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/12-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/3-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/4-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/6-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/8-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/9-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/assertions.xml delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/messcat_src.txt delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.h delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/2-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/3-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-2.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-3.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-4.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-5.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-6.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/10-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/11-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/12-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/14-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/15-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/2-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-2.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/4-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/5-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/5-2.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/8-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/8-2.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/3-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/1-2.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/2-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/3-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/1-2.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/2-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-2.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-3.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/2-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/3-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/4-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/6-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.h delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/1-2.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/2-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/3-core-buildonly.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/4-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/5-core-buildonly.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/6-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/6-2.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/2-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/3-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/5-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/6-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/7-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/12-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/8-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/8-2.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/8-3.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/2-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/3-core-buildonly.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/1-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/10-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/2-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/3-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/4-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/5-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/6-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/7-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/8-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/9-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/6-1.c delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/Jamfile delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/include/posixtest.h delete mode 100644 src/tests/system/libroot/posix/posixtestsuite/run_posix_tests.sh diff --git a/src/tests/system/libroot/posix/Jamfile b/src/tests/system/libroot/posix/Jamfile index d89b31218c..cb651e42ff 100644 --- a/src/tests/system/libroot/posix/Jamfile +++ b/src/tests/system/libroot/posix/Jamfile @@ -159,5 +159,4 @@ SEARCH on [ FGristFiles SubInclude HAIKU_TOP src tests system libroot posix bonnie++-1.03d ; SubInclude HAIKU_TOP src tests system libroot posix math ; -SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite ; SubInclude HAIKU_TOP src tests system libroot posix string ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/Jamfile deleted file mode 100644 index a244a5b17a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/Jamfile +++ /dev/null @@ -1,6 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite ; - -MakeLocatePlatform run_posix_tests ; -Shell run_posix_tests : run_posix_tests.sh ; - -SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/Jamfile deleted file mode 100644 index 187d08451a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/Jamfile +++ /dev/null @@ -1,3 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance ; - -SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile deleted file mode 100644 index 58451bef4a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile +++ /dev/null @@ -1,19 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces ; - -HaikuSubInclude difftime ; -HaikuSubInclude fork ; -HaikuSubInclude kill ; -HaikuSubInclude pthread_attr_destroy ; -HaikuSubInclude pthread_create ; -HaikuSubInclude pthread_key_create ; -HaikuSubInclude pthread_key_delete ; -HaikuSubInclude pthread_getspecific ; -HaikuSubInclude pthread_once ; -HaikuSubInclude pthread_setspecific ; -HaikuSubInclude sighold ; -HaikuSubInclude sigignore ; -HaikuSubInclude sigprocmask ; -HaikuSubInclude sigrelse ; -HaikuSubInclude signal ; -HaikuSubInclude sigset ; -HaikuSubInclude sigsuspend ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c deleted file mode 100644 index e4bba8ac72..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002-3, 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. - - Test that the difftime function shall return the difference between - two calendar times. - */ - -#define WAIT_DURATION 1 - -#include -#include -#include -#include -#include "posixtest.h" - -int main() -{ - time_t time1, time0; - - double time_diff; - time_diff = 0; - time0 = time(NULL); - sleep(WAIT_DURATION); - time1 = time(NULL); - time_diff = difftime(time1, time0); - - if (time_diff != WAIT_DURATION) { - printf("%sdifftime_1-1: Test FAILED: " - "difftime did not return the correct value%s\n", - red, normal); - return PTS_FAIL; - } - - printf("%sdifftime_1-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile deleted file mode 100644 index d182a31247..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile +++ /dev/null @@ -1,6 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces difftime ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest difftime_1-1 : 1-1.c ; - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/12-1.c deleted file mode 100644 index 3c6ea0fc84..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/12-1.c +++ /dev/null @@ -1,301 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write the Free Software Foundation, Inc., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The child process is created with no pending signal - -* The steps are: -* -> block SIGUSR1 and SIGUSR2 -* -> send those signals and wait they are pending -* -> fork -* -> check the signals are blocked but not pending in the new process. - -* The test fails if the signals are pending or if -* they are not blocked (this counters assertion 2). - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - sigset_t mask, pending; - - /* Initialize output */ - output_init(); - - /* block SIGUSR1 and SIGUSR2 */ - ret = sigemptyset( &mask ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to initialize signal set" ); - } - - ret = sigaddset( &mask, SIGUSR1 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to add SIGUSR1 to signal set" ); - } - - ret = sigaddset( &mask, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to add SIGUSR2 to signal set" ); - } - - ret = sigprocmask( SIG_BLOCK, &mask, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Sigprocmask failed" ); - } - - /* Make the signals pending */ - ret = kill( getpid(), SIGUSR1 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "failed to kill with SIGUSR1" ); - } - - ret = kill( getpid(), SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "failed to kill with SIGUSR2" ); - } - - do - { - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "failed to examine pending signal set" ); - } - - ret = sigismember( &pending, SIGUSR1 ); - - if ( ret < 0 ) - { - UNRESOLVED( errno, "Unable to check signal USR1 presence" ); - } - - if ( ret == 1 ) - { - ret = sigismember( &pending, SIGUSR2 ); - - if ( ret < 0 ) - { - UNRESOLVED( errno, "Unable to check signal USR2 presence" ); - } - } - } - while ( ret != 1 ); - -#if VERBOSE > 1 - - output( "SIGUSR1 and SIGUSR2 are pending, we can fork\n" ); - -#endif - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - /* Examine the current blocked signal set. USR1 & USR2 shall be present */ - ret = sigprocmask( 0, NULL, &mask ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Sigprocmask failed in child" ); - } - - ret = sigismember( &mask, SIGUSR1 ); - - if ( ret < 0 ) - { - UNRESOLVED( errno, "Unable to check signal USR1 presence" ); - } - - if ( ret == 0 ) - { - FAILED( "The new process does not mask SIGUSR1 as its parent" ); - } - - ret = sigismember( &mask, SIGUSR2 ); - - if ( ret < 0 ) - { - UNRESOLVED( errno, "Unable to check signal USR2 presence" ); - } - - if ( ret == 0 ) - { - FAILED( "The new process does not mask SIGUSR2 as its parent" ); - } - -#if VERBOSE > 1 - output( "SIGUSR1 and SIGUSR2 are blocked in child\n" ); - -#endif - - /* Examine pending signals */ - ret = sigpending( &pending ); - - if ( ret != 0 ) - { - printf("%sfork_12-1:%s " - "%sFAILED: failed to examine pending signal set in child: %s%s\n", - boldOn, boldOff, red, strerror(errno), normal); - } - - ret = sigismember( &pending, SIGUSR1 ); - - if ( ret < 0 ) - { - printf("%sfork_12-1:%s " - "%sFAILED: Unable to check signal USR1 presence%s\n", - boldOn, boldOff, red, normal); - } - - if ( ret != 0 ) - { - printf("%sfork_12-1:%s " - "%sFAILED: The new process was created with SIGUSR1 pending%s\n", - boldOn, boldOff, red, normal); - } - - ret = sigismember( &pending, SIGUSR2 ); - - if ( ret < 0 ) - { - printf("%sfork_12-1:%s " - "%sFAILED: Unable to check signal USR2 presence: %s%s\n", - boldOn, boldOff, red, strerror(errno), normal); - } - - if ( ret != 0 ) - { - printf("%sfork_12-1:%s " - "%sFAILED: The new process was created with SIGUSR2 pending%s\n", - boldOn, boldOff, red, normal); - } - -#if VERBOSE > 1 - output( "SIGUSR1 and SIGUSR2 are not pending in child\n" ); - -#endif - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - printf("%sfork_12-1:%s " - "%sFAILED: Waitpid returned the wrong PID: %s%s\n", - boldOn, boldOff, red, strerror(errno), normal); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - printf("%sfork_12-1:%s %sFAILED: Child exited abnormally%s\n", - boldOn, boldOff, red, normal); - - } - - /* Test passed */ -#if VERBOSE > 0 - - printf("%sfork_12-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/3-1.c deleted file mode 100644 index 53ad68b615..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/3-1.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The new process' ID does not match any existing process or group ID. - - * The steps are: - * -> create a child; then terminate this child. - * -> check that no other process or group has the same ID. - - * The test fails if another object shares the same ID. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main(int argc, char * argv[]) -{ - int ret, status; - pid_t child, ctl; - - /* Initialize output */ - output_init(); - - /* Create the child */ - child = fork(); - if (child == (pid_t) -1) { UNRESOLVED(errno, "Failed to fork"); } - - /* child */ - if (child == (pid_t) 0) - { - /* The child stops immediatly */ - exit(PTS_PASS); - } - - /* Parent joins the child */ - ctl = waitpid(child, &status, 0); - if (ctl != child) { UNRESOLVED(errno, "Waitpid returned the wrong PID"); } - if ((!WIFEXITED(status)) || (WEXITSTATUS(status) != PTS_PASS)) - { - UNRESOLVED(status, "Child exited abnormally"); - } - - ret = kill(child, 0); - if ((ret == 0) || (errno != ESRCH)) { - printf("%sfork_3-1:%s " - "%sFAILED: Another process with the same PID as the child exists: %s%s\n", - boldOn, boldOff, red, strerror(errno), normal); - printf("%sfork_3-1:%s %sFAILED: See bug #1639%s\n", boldOn, boldOff, red, normal); - return 1; - } - - ret = kill((pid_t) (0 - (int)child), 0); - if ((ret == 0) || (errno != ESRCH)) { - printf("%sfork_3-1:%s " - "%sFAILED: A process group with the same PID as the child exists: %s%s\n", - boldOn, boldOff, red, strerror(errno), normal); - printf("%sfork_3-1:%s %sFAILED: See bug #1639%s\n", boldOn, boldOff, red, normal); - return 1; - } - - /* Test passed */ - #if VERBOSE > 0 - printf("%sfork_3-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/4-1.c deleted file mode 100644 index 2e22e9f7ab..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/4-1.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The parent process ID of the child is the process ID of the parent (caller of fork()) - - * The steps are: - * -> create a child - * -> check its parent process ID is the PID of its parent. - - * The test fails if the IDs differ. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main(int argc, char * argv[]) -{ - int status; - pid_t child, ctl; - - /* Initialize output */ - output_init(); - - /* Get parent process ID */ - ctl = getpid(); - - /* Create the child */ - child = fork(); - if (child == (pid_t) -1) { - UNRESOLVED(errno, "Failed to fork"); - } - - /* child */ - if (child == (pid_t) 0) - { - /* Check the parent process ID */ - if (ctl != getppid()) - { - FAILED("The parent process ID is not the PID of the parent"); - } - - /* We're done */ - exit(PTS_PASS); - } - - /* Parent joins the child */ - ctl = waitpid(child, &status, 0); - if (ctl != child) { UNRESOLVED(errno, "Waitpid returned the wrong PID"); } - if ((!WIFEXITED(status)) || (WEXITSTATUS(status) != PTS_PASS)) - { - printf("%sfork_4-1:%s " - "%sFAILED Child exited abnormally %s%s\n", - boldOn, boldOff, red, strerror(status), normal); - } - - /* Test passed */ - #if VERBOSE > 0 - printf("%sfork_4-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/6-1.c deleted file mode 100644 index 46c7a54a9b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/6-1.c +++ /dev/null @@ -1,199 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write the Free Software Foundation, Inc., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The opened directory streams are copied to the child process. -* Positionning information may be shared between both processes. - -* The steps are: -* -> Open the current directory, -* -> Count the directory entries, then rewind. -* -> create a child -* -> The child counts the directory entries. - -* The test fails if the directory is read in the parent and not in the child. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -int count( DIR * thedir ) -{ - int counter = 0; - - struct dirent *dp; - - rewinddir( thedir ); - - /* Count the directory entries */ - - do - { - dp = readdir( thedir ); - - if ( dp != NULL ) - counter++; - } - while ( dp != NULL ); - - return counter; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - int counted; - - /* the '.' directory pointers */ - DIR *dotdir; - - /* Initialize output */ - output_init(); - - /* Open the directory */ - dotdir = opendir( "." ); - - if ( dotdir == NULL ) - { - UNRESOLVED( errno, "opendir failed" ); - } - - /* Count entries */ - counted = count( dotdir ); - -#if VERBOSE > 1 - - output( "Found %d entries in current dir\n", counted ); - -#endif - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - /* Count in child process */ - counted = count( dotdir ); - -#if VERBOSE > 1 - - output( "Found %d entries in current dir from child\n", counted ); -#endif - - ret = closedir( dotdir ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to close dir in child" ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally -- dir stream not copied?" ); - } - - /* close the directory stream */ - ret = closedir( dotdir ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Failed to closedir in parent" ); - } - - /* Test passed */ -#if VERBOSE > 0 - printf("%sfork_6-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/8-1.c deleted file mode 100644 index 33f9c593a1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/8-1.c +++ /dev/null @@ -1,234 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write the Free Software Foundation, Inc., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* tms_{,c}{u,s}time values are set to 0 in the child process. - - -* The steps are: -* -> Work for 1 second and save the tms information -* -> fork -* -> Check that the child has tms values less than the saved tms. -* -> join the child process -* -> check tms_c{u,s}time are not 0 anymore. - -* The test fails if one of the described checking fails. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int status; - pid_t child, ctl; - - clock_t st_time, cur_time; - - struct tms ini_tms, parent_tms, child_tms; - - /* Initialize output */ - output_init(); - - /* Initialize first times */ - st_time = times( &ini_tms ); - - if ( st_time == ( clock_t ) - 1 ) - { - UNRESOLVED( errno, "times failed" ); - } - - if ( ( ini_tms.tms_cutime != 0 ) || ( ini_tms.tms_cstime != 0 ) ) - { - FAILED( "The process is created with non-zero tms_cutime or tms_cstime" ); - } - -#if VERBOSE > 1 - output( "Starting loop...\n" ); - -#endif - - /* Busy loop for some times */ - do - { - cur_time = times( &parent_tms ); - - if ( cur_time == ( clock_t ) - 1 ) - { - UNRESOLVED( errno, "times failed" ); - } - } - while ( ( cur_time - st_time ) < sysconf( _SC_CLK_TCK ) ); - -#if VERBOSE > 1 - - output( "Busy loop terminated\n" ); - - output( " Real time: %ld, User Time %ld, System Time %ld, Ticks per sec %ld\n", - ( long ) ( cur_time - st_time ), - ( long ) ( parent_tms.tms_utime - ini_tms.tms_utime ), - ( long ) ( parent_tms.tms_stime - ini_tms.tms_stime ), - sysconf( _SC_CLK_TCK ) ); - -#endif - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - - cur_time = times( &child_tms ); - - if ( cur_time == ( clock_t ) - 1 ) - { - UNRESOLVED( errno, "times failed" ); - } - - if ( child_tms.tms_utime + child_tms.tms_stime >= sysconf( _SC_CLK_TCK ) ) - { - FAILED( "The tms struct was not reset during fork() operation" ); - } - - do - { - cur_time = times( &child_tms ); - - if ( cur_time == ( clock_t ) - 1 ) - { - UNRESOLVED( errno, "times failed" ); - } - } - while ( ( child_tms.tms_utime + child_tms.tms_stime ) <= 0 ); - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ) - ; - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ) - ; - } - - /* Check the children times were reported as expected */ - cur_time = times( &parent_tms ); - -#if VERBOSE > 1 - - output( "Child joined\n" ); - - output( " Real time: %ld,\n" - " User Time %ld, System Time %ld,\n" - " Child User Time %ld, Child System Time %ld\n", - ( long ) ( cur_time - st_time ), - ( long ) ( parent_tms.tms_utime - ini_tms.tms_utime ), - ( long ) ( parent_tms.tms_stime - ini_tms.tms_stime ), - ( long ) ( parent_tms.tms_cutime - ini_tms.tms_cutime ), - ( long ) ( parent_tms.tms_cstime - ini_tms.tms_cstime ) - ); - -#endif - - if ( cur_time == ( clock_t ) - 1 ) - { - UNRESOLVED( errno, "times failed" ); - } - - if ( ( parent_tms.tms_cutime == 0 ) && ( parent_tms.tms_cstime == 0 ) ) - { - FAILED( "The process is created with non-zero tms_cutime or tms_cstime" ); - } - - - /* Test passed */ -#if VERBOSE > 0 - printf("%sfork_8-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/9-1.c deleted file mode 100644 index 8614c9caaf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/9-1.c +++ /dev/null @@ -1,151 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write the Free Software Foundation, Inc., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The time left until an alarm clock is triggered is reset to zero, -* and the alarm, if any, is canceled - -* The steps are: -* -> Trig an alarm -* -> fork -* -> Check the alarm is not running in the child process. -* -> join the child - -* The test fails if the child has a pending alarm. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, status; - pid_t child, ctl; - - /* Initialize output */ - output_init(); - - /* Set the alarm pending */ - alarm( 10 ); - - /* Check the alarm() behavior */ - ret = alarm( 10 ); - - if ( ret == 0 ) - { - FAILED( "the alarm() routine does not behave as expected" ); - } - - /* Create the child */ - child = fork(); - - if ( child == ( pid_t ) - 1 ) - { - UNRESOLVED( errno, "Failed to fork" ); - } - - /* child */ - if ( child == ( pid_t ) 0 ) - { - - ret = alarm( 10 ); - - if ( ret != 0 ) - { - FAILED( "The child alarm pending was not reset." ); - } - - /* We're done */ - exit( PTS_PASS ); - } - - /* Parent joins the child */ - ctl = waitpid( child, &status, 0 ); - - if ( ctl != child ) - { - UNRESOLVED( errno, "Waitpid returned the wrong PID" ); - } - - if ( ( !WIFEXITED( status ) ) || ( WEXITSTATUS( status ) != PTS_PASS ) ) - { - FAILED( "Child exited abnormally" ); - } - - alarm( 0 ); - - /* Test passed */ -#if VERBOSE > 0 - printf("%sfork_9-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); -#endif - - PASSED; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/Jamfile deleted file mode 100644 index 6d37c77984..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/Jamfile +++ /dev/null @@ -1,10 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces fork ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest fork_3-1 : 3-1.c ; -SimpleTest fork_4-1 : 4-1.c ; -SimpleTest fork_6-1 : 6-1.c ; -SimpleTest fork_8-1 : 8-1.c ; -SimpleTest fork_9-1 : 9-1.c ; -SimpleTest fork_12-1 : 12-1.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/assertions.xml b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/assertions.xml deleted file mode 100644 index 34fba955c6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/assertions.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - fork() creates a new process. - - - The new process is a copy of the original process - -- unless specified otherwise below. - - - The new process' ID does not match any existing - process or group ID. - - - The parent process ID (ppid) of the child process - is the process ID (pid) of the parent process - (caller of fork()). - - - The opened file descriptors are copied to the child process - and refer to the same object. - - - The opened directory streams are copied to the child process. - Positioning information may be shared between both processes. - - - The child process gets a copy of the parent message catalog descriptor. - - - tms_utime, tms_stime, tms_cutime, and tms_cstime values - are set to 0 in the child process. - - - The time left until an alarm clock signal is reset to zero, - and the alarm, if any, is canceled. - - - semadj values are cleared. - - - The file locks are not inherited by the child process. - - - The child process is created with no pending signals. - - - Interval timers are reset in the child process. - - - The opened semaphores are inherited in the child process. - - - The child process does not inherit memory locks set by - the parent process with mlock or mlockall. - - - Memory mappings created in the parent are retained in the - child process. If the mapping is MAP_PRIVATE, any modification - done after the fork() is visible only to the process doing the - modification. - - - For the SCHED_RR and SCHED_FIFO scheduling policies, the child - process inherits the policy and priority settings of the parent - process during the fork() execution. - - - The per-process timers are not inherited. - - - The opened message queue descriptors are copied to the child - process and refer to the same object. - - - Asynchronous IO operations are not inherited by the child. - - - The new process has only one thread. - - - The CPU-time clocks of the new process/ new process' thread - are initialized to 0. - - - fork() returns 0 to the child and the child PID to the parent process when - succesful. - - - fork() returns -1, errno is set to EAGAIN, and no child process - is created if the system lacks a resource to create the new process - or CHILD_MAX process are already running. - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/messcat_src.txt b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/messcat_src.txt deleted file mode 100644 index e0067d9cc5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/messcat_src.txt +++ /dev/null @@ -1,26 +0,0 @@ -$ Copyright (c) 2004, Bull S.A.. All rights reserved. -$ Created by: Sebastien Decugis -$ -$ This program is free software; you can redistribute it and/or modify it -$ under the terms of version 2 of the GNU General Public License as -$ published by the Free Software Foundation. -$ -$ This program is distributed in the hope that it would be useful, but -$ WITHOUT ANY WARRANTY; without even the implied warranty of -$ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -$ -$ You should have received a copy of the GNU General Public License along -$ with this program; if not, write the Free Software Foundation, Inc., 59 -$ Temple Place - Suite 330, Boston MA 02111-1307, USA. -$ -$ -$ This file is part of the 7-1.c test case for the fork() routine. - -$set 1 Message set for OPTS fork test case, English language -1 This is the first message -2 And this is the second - -$set 2 Message set for OPTS fork test case, French language -1 Voici le premier message -2 Et voilĂ  le second - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.c deleted file mode 100644 index 6ecf98592a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -void output_init() -{ - /* do nothing */ - return; -} -void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -void output_fini() -{ - /*do nothing */ - return; -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.h deleted file mode 100644 index 96543ac39e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/fork/testfrmw.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c deleted file mode 100644 index ba8fab7911..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include -#include -#include "posixtest.h" - -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer 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. - - * Test that if the signal is the null signal (0), no signal is sent. - * 1) Call kill on the current process with the null signal. - * 2) If process is still functional after kill() is called, consider - * the test a pass (most likely no signal was sent). - */ - -int main() -{ - if (kill(getpid(), 0) != 0) { - printf("Could not call kill with sig = 0\n"); - return PTS_FAIL; - } - - printf("%skill_2-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile deleted file mode 100644 index 65e24ebfc0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile +++ /dev/null @@ -1,5 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces kill ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest kill_2-1 : 2-1.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/1-1.c deleted file mode 100644 index 49e7ea50f3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/1-1.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Test that pthread_attr_destroy() - * shall destory a thread attributes object. An implementation may cause - * pthread_attr_destroy() to set 'attr' to an implementation-defined invalid - * value. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Destroy that initialized attribute using pthread_attr_destroy() - * 3. Using pthread_attr_create(), pass to it the destroyed attribute. It - * should return the error EINVAL, the value specified by 'attr' is - * is invalid. - * - */ - -#include -#include -#include -#include "posixtest.h" - - -void *a_thread_func() -{ - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - pthread_attr_t new_attr; - int ret; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy attribute */ - if(pthread_attr_destroy(&new_attr) != 0) - { - perror("Cannot destroy the attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Creating a thread, passing to it the destroyed attribute, should - * result in an error value of EINVAL (invalid 'attr' value). */ - ret=pthread_create(&new_th, &new_attr, a_thread_func, NULL); - - if(ret==EINVAL) - { - printf("Test PASSED\n"); - return PTS_PASS; - } - else if((ret != 0) && ((ret == EPERM) || (ret == EAGAIN))) - { - perror("Error created a new thread\n"); - return PTS_UNRESOLVED; - } - else if(ret==0) - { - printf("Test PASSED: NOTE*: Though returned 0 when creating a thread with a destroyed attribute, this behavior is compliant with garbage-in-garbage-out. \n"); - return PTS_PASS; - } else - { - printf("Test FAILED: (1) Incorrect return code from pthread_create(); %d not EINVAL or (2) Error in pthread_create()'s behavior in returning error codes \n", ret); - return PTS_FAIL; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/2-1.c deleted file mode 100644 index 5731020d7d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/2-1.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * A destroyed 'attr' attributes object can be reinitialized using - * pthread_attr_init(); the results of otherwise referencing the object - * after it has been destroyed are undefined. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Destroy that initialized attribute using pthread_attr_destroy() - * 3. Initialize the pthread_attr_t object again. This should not result - * in an error. - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_attr_t new_attr; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy attribute */ - if(pthread_attr_destroy(&new_attr) != 0) - { - perror("Cannot destroy the attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Initialize attribute. This shouldn't result in an error. */ - if(pthread_attr_init(&new_attr) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/3-1.c deleted file mode 100644 index 794ab2d8c8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/3-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Upon successful completion, pthread_attr_destroy() shall return a value of 0. - * - * Steps: - * 1. Initialize a pthread_attr_t object using pthread_attr_init() - * 2. Destroy that initialized attribute using pthread_attr_destroy(). - * This should return 0; - * - */ - -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_attr_t new_attr; - - /* Initialize attribute */ - if(pthread_attr_init(&new_attr) != 0) - { - perror("Cannot initialize attribute object\n"); - return PTS_UNRESOLVED; - } - - /* Destroy attribute */ - if(pthread_attr_destroy(&new_attr) != 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - else - { - printf("Test PASSED\n"); - return PTS_PASS; - } -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/Jamfile deleted file mode 100644 index 1a67e2edc1..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_attr_destroy/Jamfile +++ /dev/null @@ -1,7 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_attr_destroy ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest pthread_attr_destroy_1-1 : 1-1.c ; -SimpleTest pthread_attr_destroy_2-1 : 2-1.c ; -SimpleTest pthread_attr_destroy_3-1 : 3-1.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-1.c deleted file mode 100644 index cfbfcae9cc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Test that pthread_create() creates a new thread with attributes specified - * by 'attr', within a process. - * - * Steps: - * 1. Create a thread using pthread_create() - * 2. Compare the thread ID of 'main' to the thread ID of the newly created - * thread. They should be different. - */ - -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t main_th, new_th; - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Obtain the thread ID of this main function */ - main_th=pthread_self(); - - /* Compare the thread ID of the new thread to the main thread. - * They should be different. If not, the test fails. */ - if(pthread_equal(new_th, main_th) != 0) - { - printf("Test FAILED: A new thread wasn't created\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-2.c deleted file mode 100644 index 723e2b5555..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-2.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Test that pthread_create() creates a new thread with attributes specified - * by 'attr', within a process. - * - * Steps: - * 1. Create a thread using pthread_create() - * 2. Cancel that thread with pthread_cancel() - * 3. If that thread doesn't exist, then it pthread_cancel() will return - * an error code. This would mean that pthread_create() did not create - * a thread successfully. - */ - -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - sleep(10); - - /* Shouldn't reach here. If we do, then the pthread_cancel() - * function did not succeed. */ - perror("Could not send cancel request correctly\n"); - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) < 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Try to cancel the newly created thread. If an error is returned, - * then the thread wasn't created successfully. */ - if(pthread_cancel(new_th) != 0) - { - printf("Test FAILED: A new thread wasn't created\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-3.c deleted file mode 100644 index 017babfe52..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-3.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Test that pthread_create() creates a new thread with attributes specified - * by 'attr', within a process. - * - * Steps: - * 1. Create a new thread that will go into a never-ending while loop. - * 2. If the thread is truly asynchronise, then the main function will - * continue instead of waiting for the thread to return (which in never - * does in this test case). - * 3. An alarm is set to go off (i.e. send the SIGARLM signal) after 3 - * seconds. This is done for 'timeing-out' reasons, in case main DOES - * wait for the thread to return. This would also mean that the test - * failed. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -void *a_thread_function(); -void alarm_handler(); - -pthread_t a; - -int main() -{ - - /* Set the action for SIGALRM to generate an error if it is - * reached. This is because if SIGALRM was sent, then the - * test timed out. */ - if (signal(SIGALRM, alarm_handler) == SIG_ERR) - { - printf("Error in signal()\n"); - return PTS_UNRESOLVED; - } - - /* SIGALRM will be sent in 5 seconds. */ - alarm(5); - - /* Create a new thread. */ - if(pthread_create(&a, NULL, a_thread_function, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - pthread_cancel(a); - /* If 'main' has reached here, then the test passed because it means - * that the thread is truly asynchronise, and main isn't waiting for - * it to return in order to move on. */ - printf("Test PASSED\n"); - return PTS_PASS; -} - -/* A never-ending thread function */ -void *a_thread_function() -{ - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - - while(1) - sleep(1); - - pthread_exit(0); - return NULL; -} - -/* If this handler is called, that means that the test has failed. */ -void alarm_handler() -{ - printf("Test FAILED\n"); - exit(PTS_FAIL); -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-4.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-4.c deleted file mode 100644 index 053f46df5b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-4.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * pthread_create creates a new thread within the process - - * The steps are: - * - * -> get the thread ID and the process ID of the main thread. - * -> create a new thread, get the thread & process ID. - * -> check that the thread IDs are different but process IDs are the same - - * The test fails if the thread IDs are the same or the proces IDs are different. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -struct testdata -{ - pthread_t tid; - pid_t pid; - sem_t * sem; -}; - -int global; /* This value is used to check both threads share the same process memory (and not a copy) */ - -void * threaded (void * arg) -{ - struct testdata * td=(struct testdata *) arg; - pthread_t mytid; - pid_t mypid; - int ret = 0; - - /* Compare the process IDs */ - mypid=getpid(); - #if VERBOSE > 0 - output(" Main pid: %i thread pid: %i\n", td->pid, mypid); - #endif - - if (mypid != td->pid) - { - FAILED("New thread does not belong to the same process as its parent thread"); - } - - /* Compare the threads IDs */ - mytid = pthread_self(); - #if VERBOSE > 0 - /* pthread_t is a pointer with Linux/nptl. This output can be erroneous for other arcs */ - output(" Main tid: %p thread tid: %p\n", td->tid, mytid); - #endif - - if (pthread_equal(mytid, td->tid) != 0) - { - FAILED("The created thread has the same thread ID as its parent"); - } - - /* Change the global value */ - global++; - - /* Post the semaphore to unlock the main thread in case of a detached thread */ - do { ret = sem_post(td->sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - return arg; -} - -int main (int argc, char *argv[]) -{ - int ret=0; - struct testdata td; - void * rval; - pthread_t child; - int i; - - output_init(); - - td.tid=pthread_self(); - td.pid=getpid(); - - scenar_init(); - - for (i=0; i < NSCENAR; i++) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", i, scenarii[i].descr); - #endif - - td.sem = &scenarii[i].sem; - - global = 2*i; - - ret = pthread_create(&child, &scenarii[i].ta, threaded, &td); - switch (scenarii[i].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - if (scenarii[i].detached == 0) - { - ret = pthread_join(child, &rval); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - - if (rval != &td) - { - FAILED("Could not get the thread return value. Did it execute?"); - } - } - else - { - /* Just wait for the thread terminate */ - do { ret = sem_wait(td.sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - } - - if (global != (2*i + 1)) - { - /* Maybe a possible issue with CPU memory-caching here? */ - FAILED("The threads do not share the same process memory."); - } - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-5.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-5.c deleted file mode 100644 index 72902abbf0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-5.c +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * pthread_create creates a thread with attributes as specified in the attr parameter. - - * The steps are: - * - * -> Create a new thread with known parameters. - * -> Check the thread behavior conforms to these parameters. - * This checking consists in: - * -> If an alternative stack has been specified, check that the new thread stack is within this specified area. - * -> If stack size and guard size are known, check that accessing the guard size fails. (new process) - * -> If we are able to run threads with high priority and known sched policy, check that a high priority thread executes before a low priority thread. - (This will be done in another test has it fails with Linux kernel (2.6.8 at least) - * -> The previous test could be extended to cross-process threads to check the scope attribute behavior (postponned for now). - * (*) The detachstate attribute is not tested cause this would mean a speculative test. Moreover, it is already tested elsewhere. - - * The test fails if one of those tests fails. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ -#define STD_MAIN /* This allows main() to be defined in the included file */ -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -/* The overflow function is used to test the stack overflow */ -void * overflow(void * arg) -{ - void * current; - void * pad[50]; /* We want to consume the stack quickly */ - long stacksize = sysconf(_SC_THREAD_STACK_MIN); /* make sure we touch the current stack memory */ - int ret=0; - - pad[1]=NULL; /* so compiler stops complaining about unused variables */ - - if (arg == NULL) - { - /* first call */ - current = overflow(¤t); - - /* Terminate the overflow thread */ - /* Post the semaphore to unlock the main thread in case of a detached thread */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - return NULL; - } - - - /* we cast the pointers into long, which might be a problem on some architectures... */ - if ( ((long)arg) < ((long)¤t)) - { - /* the stack is growing up */ - if ( ((long)¤t) - ((long)arg) >= stacksize) - { - output("Growing up stack started below %p and we are currently up to %p\n", arg, ¤t); - return (void *)0; - } - } - else - { - /* the stack is growing down */ - if ( ((long)arg) - ((long)¤t) >= stacksize) - { - output("Growing down stack started upon %p and we are currently down to %p\n", arg, ¤t); - return (void *)0; - } - } - - /* We are not yet overflowing, so we loop */ - { - return overflow(arg); - } -} - - -void * threaded (void * arg) -{ - int ret = 0; - - #if VERBOSE > 4 - output("Thread %i starting...\n", sc); - #endif - - /* Alternate stack test */ - if (scenarii[sc].bottom != NULL) - { - #ifdef WITHOUT_XOPEN - output("Unable to test the alternate stack feature; need an integer pointer cast\n"); - #else - intptr_t stack_start, stack_end, current_pos; - - stack_start = (intptr_t) scenarii[sc].bottom; - stack_end = stack_start + (intptr_t)sysconf(_SC_THREAD_STACK_MIN); - current_pos = (intptr_t)&ret; - - #if VERBOSE > 2 - output("Stack bottom: %p\n", scenarii[sc].bottom); - output("Stack end : %p (stack is 0x%lx bytes)\n", (void *)stack_end, stack_end - stack_start); - output("Current pos : %p\n", &ret); - #endif - if ((stack_start > current_pos) || (current_pos > stack_end)) - { FAILED("The specified stack was not used.\n"); } - - #endif // WITHOUT_XOPEN - } - - - /* Guard size test */ - if ((scenarii[sc].bottom == NULL) /* no alternative stack was specified */ - && (scenarii[sc].guard == 2) /* guard area size is 1 memory page */ - && (scenarii[sc].altsize == 1))/* We know the stack size */ - { - pid_t child, ctrl; - int status; - - child=fork(); /* We'll test the feature in another process as this test may segfault */ - - if (child == -1) { UNRESOLVED(errno, "Failed to fork()"); } - - if (child != 0) /* father */ - { - /* Just wait for the child and check its return value */ - ctrl = waitpid(child, &status, 0); - if (ctrl != child) { UNRESOLVED(errno, "Failed to wait for process termination"); } - - if (WIFEXITED(status)) /* The process exited */ - { - if (WEXITSTATUS(status) == 0) - { FAILED("Overflow into the guard area did not fail"); } - if (WEXITSTATUS(status) == PTS_UNRESOLVED) - { UNRESOLVED(-1, "The child process returned unresolved status"); } - #if VERBOSE > 4 - else - { output("The child process returned: %i\n", WEXITSTATUS(status)); } - } - else - { - output("The child process did not returned\n"); - if (WIFSIGNALED(status)) - output("It was killed with signal %i\n", WTERMSIG(status)); - else - output("neither was it killed. (status = %i)\n", status); - #endif - } - } - - if (child == 0) /* this is the new process */ - { - pthread_t th; - - ret = pthread_create(&th, &scenarii[sc].ta, overflow, NULL); /* Create a new thread with the same attributes */ - if (ret != 0) { UNRESOLVED(ret, "Unable to create another thread with the same attributes in the new process"); } - - if (scenarii[sc].detached == 0) - { - ret = pthread_join(th, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - else - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - - /* Terminate the child process here */ - exit(0); - } - } - - - /* Post the semaphore to unlock the main thread in case of a detached thread */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - return arg; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-6.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-6.c deleted file mode 100644 index 8793db0751..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/1-6.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * pthread_create creates a thread with attributes as specified in the attr parameter. - - * The steps are: - * - * -> See test 1-5.c for details - * -> This one will test the scheduling behavior is correct. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/* The value below shall be >= to the # of CPU on the test architecture */ -#define NCPU (4) - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ -#define STD_MAIN /* This allows main() to be defined in the included file */ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - - -/* The 2 following functions are used for the scheduling tests */ -void * lp_func(void * arg) -{ - int * ctrl = (int *) arg; - *ctrl=2; - return NULL; -} - -void * hp_func(void * arg) -{ - int *ctrl = (int *) arg; - int dummy=0, i; - do - { - /* some dummy task */ - dummy += 3; - dummy %= 17; - dummy *= 47; - for (i=0; i<1000000000; i++); - #if VERBOSE > 6 - output("%p\n", pthread_self()); - #endif - } - while (*ctrl == 0); - return NULL; -} - - -void * threaded (void * arg) -{ - int ret = 0; - - #if VERBOSE > 4 - output("Thread %i starting...\n", sc); - #endif - - /* Scheduling (priority) tests */ - if ((sysconf(_SC_THREAD_PRIORITY_SCHEDULING) > 0) - && (scenarii[sc].explicitsched != 0) - && (scenarii[sc].schedpolicy != 0) - && (scenarii[sc].schedparam == 1)) - { - /* We will create NCPU threads running with a high priority with the same sched policy policy - and one with a low-priority. - The low-priority thread should not run until the other threads stop running, - unless the machine has more than NCPU processors... */ - - pthread_t hpth[NCPU]; /* High priority threads */ - pthread_t lpth; /* Low Priority thread */ - int ctrl; /* Check value */ - pthread_attr_t ta; - struct sched_param sp; - int policy; - int i=0; - struct timespec now, timeout; - - /* Start with checking we are executing with the required parameters */ - ret = pthread_getschedparam(pthread_self(), &policy, &sp); - if (ret != 0) { UNRESOLVED(ret , "Failed to get current thread policy"); } - - if (((scenarii[sc].schedpolicy == 1) && (policy != SCHED_FIFO)) - || ((scenarii[sc].schedpolicy == 2) && (policy != SCHED_RR))) - { - FAILED("The thread is not using the scheduling policy that was required"); - } - if (((scenarii[sc].schedparam == 1) && (sp.sched_priority != sched_get_priority_max(policy))) - || ((scenarii[sc].schedparam ==-1) && (sp.sched_priority != sched_get_priority_min(policy)))) - { - - FAILED("The thread is not using the scheduling parameter that was required"); - } - - ctrl = 0; /* Initial state */ - - /* Get the policy information */ - ret = pthread_attr_getschedpolicy(&scenarii[sc].ta, &policy); - if (ret != 0) { UNRESOLVED(ret, "Failed to read sched policy"); } - - /* We put a timeout cause the test might lock the machine when it runs */ - alarm(60); - - /* Create the high priority threads */ - ret = pthread_attr_init(&ta); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a thread attribute object"); } - - ret = pthread_attr_setinheritsched(&ta, PTHREAD_EXPLICIT_SCHED); - if (ret != 0) { UNRESOLVED(ret, "Unable to set inheritsched attribute"); } - - ret = pthread_attr_setschedpolicy(&ta, policy); - if (ret != 0) { UNRESOLVED(ret, "Unable to set the sched policy"); } - - sp.sched_priority = sched_get_priority_max(policy) - 1; - - ret = pthread_attr_setschedparam(&ta, &sp); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the sched param"); } - - #if VERBOSE > 1 - output("Starting %i high- and 1 low-priority threads.\n", NCPU); - #endif - for (i=0; i 5 - output("The %i high-priority threads are running\n", NCPU); - #endif - - /* Create the low-priority thread */ - sp.sched_priority = sched_get_priority_min(policy); - - ret = pthread_attr_setschedparam(&ta, &sp); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the sched param"); } - - ret = pthread_create(&lpth, &ta, lp_func, &ctrl); - if (ret != 0) { UNRESOLVED(ret, "Failed to create enough threads"); } - - /* Keep going */ - ret = clock_gettime(CLOCK_REALTIME, &now); - if (ret != 0) { UNRESOLVED(errno, "Failed to read current time"); } - - timeout.tv_sec = now.tv_sec; - timeout.tv_nsec = now.tv_nsec + 500000000; - while (timeout.tv_nsec >= 1000000000) - { - timeout.tv_sec++; - timeout.tv_nsec -= 1000000000; - } - - do - { - if (ctrl != 0) - { - output("The low priority thread executed. This might be normal if you have more than %i CPU.\n", NCPU + 1); - FAILED("Low priority thread executed -- the sched parameters are ignored?"); - } - ret = clock_gettime(CLOCK_REALTIME, &now); - if (ret != 0) { UNRESOLVED(errno, "Failed to read current time"); } - #if VERBOSE > 5 - output("Time: %d.%09d (to: %d.%09d)\n", now.tv_sec, now.tv_nsec, timeout.tv_sec, timeout.tv_nsec); - #endif - } - while ((now.tv_sec <= timeout.tv_sec) && (now.tv_nsec <= timeout.tv_nsec)); - - /* Ok the low priority thread did not execute :) */ - - /* tell the other high priority to terminate */ - ctrl = 1; - - for (i=0; i 1 - output("The scheduling parameter was set accordingly to the thread attribute.\n"); - #endif - - /* We're done. */ - ret = pthread_attr_destroy(&ta); - if (ret != 0) { UNRESOLVED(ret, "Failed to destroy a thread attribute object"); } - } - - /* Post the semaphore to unlock the main thread in case of a detached thread */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - return arg; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/10-1.c deleted file mode 100644 index 5d5a6afce0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/10-1.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Test pthread_create(). - * - * If pthread_create() fails, no new thread is created and the contents of the - * location referenced by 'thread' is undefined. - * - * EXPLANATION: 3 ways that pthread_create can fail is if (1) The system lacked memory - * resources. (2) The caller did not have the appropriate permissions. (3) An invalid - * attributes object was passed. Since the last situation is the easiest to implement, that - * is the one I chose to use in order to make pthread_create fail. - * - * The problem with that is that accessing an uninitialized attributes object will cause a - * segmentation fault (since it usually points to garbage). So the idea here is to catch - * the SIGSEGV signal (segmentation faults), and to see if the thread was ever created, by - * setting a flag in the thread's starting routine. - * - * I recognize that causing pthread_create() to fail gracefully is a very difficult task, - * especially taking into consideration that a lot of it is implementation-specific. I did - * try to manually set the members of a pthread_attr_t object to invalid values, but that didn't - * seem to make pthread_create() fail at all, in any of the implementations I tested on. So for - * now, this is what we have. - * - * - * Steps: - * 1. Create a thread using pthread_create() with an invalid attributes object (uninitialized). - * 2. Catch the SIGSEGV (seg fault) signal. In the signal handler, check to make sure that - * the start routine for the thread was never reached, meaning the thread was never created. - * 3. If SIGSEGV was not caught in 10 seconds, the test times out and fails. If the signal - * was caught, but the thread start routine was called at some point, the test also fails. - * - * - * - adam.li@intel.com: 2004-04-30 - * This case will end with segmentation fault. - * I happened to find on NPTL pthread_create() can fail is - * pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_INHERIT), while - * does not call pthread_attr_setschedparam() to set the prority. (since - * by default the priority will be 0. But this is implementation specific. - */ - -#include -#include -#include -#include -#include -#include "posixtest.h" - -int created_thread; /* Flag indicating that the thread start routine was reached, and - therefore, the thread was created. */ -int segfault_flag; /* Flag indicating that a segmentation fault occured. */ - -/* Thread's start routine. */ -void *a_thread_func() -{ - /* Indicate that the thread start routine was reached. If it was reached, the test - * fails, as the thread should have not been created in the first place. */ - created_thread = 1; - pthread_exit(0); - return NULL; -} - -/* Signal handler for SIGSEGV (segmentation fault signal) */ -void sig_handler(int sig) -{ - /* If a segmentation fault occured when it was supposed to (i.e. when pthread_create() - * was called with the invalid attributes object). */ - if(segfault_flag == 1) - { - /* check if the thread start routine was called. If yes, then the thread was - * created, meaning the test fails. */ - if(created_thread == 1) - { - printf("Test FAILED: Created thread though an invalid attribute was passed to pthread_create().\n"); - pthread_exit((void*)PTS_FAIL); - } - - printf("Test PASSED\n"); - pthread_exit((void*)PTS_PASS); - return; - } - - printf("Test FAILED: Did not receive segmentation fault signal, waited 10 seconds.\n"); - pthread_exit((void*)PTS_FAIL); - return; -} - -/* MAIN */ -int main() -{ - pthread_t new_th; - pthread_attr_t inv_attr; - struct sigaction act; - - /* Inializing flags. */ - segfault_flag = 1; - created_thread = 0; - - /* Set signal handler for SIGSEGV (seg fault) */ - act.sa_handler = sig_handler; - act.sa_flags = 0; - sigaction(SIGSEGV, &act, NULL); - - /* Create the thread with the invalid, uninitialized attributes object. */ - pthread_create(&new_th, &inv_attr, a_thread_func, NULL); - - /* Should not reach here if process correctly seg-faulted. */ - segfault_flag = 0; - - /* Timeout after 10 seconds if a segfault was not encountered. The test then fails. */ - sleep(10); - - /* Manually send the SIGSEGV signal to the signal handler. If this point is reached, - * the test fails. */ - if(raise(SIGSEGV) != 0) - { - perror("Error in raise()\n"); - return PTS_UNRESOLVED; - } - - printf("Test FAILED.\n"); - return PTS_FAIL; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/11-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/11-1.c deleted file mode 100644 index 9b62db0066..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/11-1.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2004, Intel Corporation. All rights reserved. - * 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. - * - * adam.li@intel.com - * - * if _POSIX_THREAD_CPUTIME is defined, the new thread shall have a CPU-time - * clock accessible, and the initial value of this clock shall be set to 0. - */ - /* Create a new thread and get the time of the thread CUP-time clock - * using clock_gettime(). - * Note, the tv_nsec cannot be exactly 0 at the time of calling - * clock_gettime() since the thread has executed some time. */ - -#define _XOPEN_SOURCE 600 -#include -#include -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - clockid_t cpuclock; - struct timespec ts = {.tv_sec = 1, .tv_nsec = 1}; - pthread_getcpuclockid(pthread_self(), &cpuclock); - clock_gettime(cpuclock, &ts); - /* Just test the tv_sec field here. */ - if (ts.tv_sec != 0) - { - printf("ts.tv_sec: %ld, ts.tv_nsec: %ld\n", - ts.tv_sec, ts.tv_nsec); - exit(PTS_FAIL); - } - pthread_exit(0); - return NULL; -} - -int main() -{ -#if _POSIX_THREAD_CPUTIME == -1 - printf("_POSIX_THREAD_CPUTIME not supported\n"); - return PTS_UNSUPPORTED; -#endif - pthread_t new_th; - - if (sysconf(_SC_THREAD_CPUTIME) == -1) { - printf("_POSIX_THREAD_CPUTIME not supported\n"); - return PTS_UNSUPPORTED; - } - - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - pthread_join(new_th, NULL); - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/12-1.c deleted file mode 100644 index e6b7662494..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/12-1.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Test pthread_create() - * - * If success, pthread_create() returns zero. - * - * Steps: - * 1. Create a thread using pthread_create(), passing to it all valid values. - * 2. If the return code was not EGAIN, EPERM or EINVAL, it should return 0. - */ - -#include -#include -#include -#include "posixtest.h" - -/* Thread starting routine that really does nothing. */ -void *a_thread_func() -{ - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - int ret; - - /* Create new thread and check the return value. */ - ret = pthread_create(&new_th, NULL, a_thread_func, NULL); - if(ret != 0) - { - if((ret != EINVAL) && (ret != EAGAIN) && (ret != EPERM)) - - printf("Test FAILED: Wrong return code: %d\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/14-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/14-1.c deleted file mode 100644 index 5448b359fc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/14-1.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The function does not return EINTR - - * The steps are: - * -> pthread_kill a thread which creates threads - * -> check that EINTR is never returned - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -char do_it=1; -char woken=0; -unsigned long count_ope=0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig=0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig (void * arg) -{ - thestruct *thearg = (thestruct *) arg; - int ret; - pid_t process; - - process=getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread"); } - - while (do_it) - { - #ifdef WITH_SYNCHRO - if ((ret = sem_wait(thearg->sem))) - { UNRESOLVED(errno, "Sem_wait in sendsig"); } - count_sig++; - #endif - - ret = kill(process, thearg->sig); - if (ret != 0) { UNRESOLVED(errno, "Kill in sendsig"); } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig1)) - { UNRESOLVED(errno, "Sem_post in signal handler 1"); } -#endif -} -/* This one is registered for signal SIGUSR2 */ -void sighdl2(int sig) -{ -#ifdef WITH_SYNCHRO - if (sem_post(&semsig2)) - { UNRESOLVED(errno, "Sem_post in signal handler 2"); } -#endif -} - -/* Thread function -- almost does nothing */ -void * threaded(void * arg) -{ - int ret; - - /* Signal we're done (especially in case of a detached thread) */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - /* return */ - return arg; -} - -/* Test function -- creates the threads and check that EINTR is never returned. */ -void * test(void * arg) -{ - int ret=0; - pthread_t child; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_UNBLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread"); } - - sc = 0; - - while (do_it) - { - #if VERBOSE > 5 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - count_ope++; - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, NULL); - if (ret == EINTR) { FAILED("pthread_create returned EINTR"); } - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 5 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - ; - } - if (ret == 0) /* The new thread is running */ - { - if (scenarii[sc].detached == 0) - { - ret = pthread_join(child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - else - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - } - - /* Change thread attribute for the next loop */ - sc++; - sc %= NSCENAR; - } - return NULL; -} - -/* Main function */ -int main (int argc, char * argv[]) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* Initialize thread attribute objects */ - scenar_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset (&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - if ((ret = sigaction (SIGUSR1, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler1"); } - sa.sa_handler = sighdl2; - if ((ret = sigaction (SIGUSR2, &sa, NULL))) - { UNRESOLVED(ret, "Unable to register signal handler2"); } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset(&usersigs); - ret = sigaddset(&usersigs, SIGUSR1); - ret |= sigaddset(&usersigs, SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Unable to add SIGUSR1 or 2 to a signal set"); } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask(SIG_BLOCK, &usersigs, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread"); } - - #ifdef WITH_SYNCHRO - if (sem_init(&semsig1, 0, 1)) - { UNRESOLVED(errno, "Semsig1 init"); } - if (sem_init(&semsig2, 0, 1)) - { UNRESOLVED(errno, "Semsig2 init"); } - #endif - - if ((ret = pthread_create(&th_work, NULL, test, NULL))) - { UNRESOLVED(ret, "Worker thread creation failed"); } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - if ((ret = pthread_create(&th_sig1, NULL, sendsig, (void *)&arg1))) - { UNRESOLVED(ret, "Signal 1 sender thread creation failed"); } - if ((ret = pthread_create(&th_sig2, NULL, sendsig, (void *)&arg2))) - { UNRESOLVED(ret, "Signal 2 sender thread creation failed"); } - - /* Let's wait for a while now */ - sleep(1); - - /* Now stop the threads and join them */ - do { do_it=0; } - while (do_it); - - if ((ret = pthread_join(th_sig1, NULL))) - { UNRESOLVED(ret, "Signal 1 sender thread join failed"); } - if ((ret = pthread_join(th_sig2, NULL))) - { UNRESOLVED(ret, "Signal 2 sender thread join failed"); } - - if ((ret = pthread_join(th_work, NULL))) - { UNRESOLVED(ret, "Worker thread join failed"); } - - scenar_fini(); - - #if VERBOSE > 0 - output("Test executed successfully.\n"); - output(" %d thread creations.\n", count_ope); - #ifdef WITH_SYNCHRO - output(" %d signals were sent meanwhile.\n", count_sig); - #endif - #endif - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/15-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/15-1.c deleted file mode 100644 index 2dcd59c542..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/15-1.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * If the current thread has an alternate stack, the new thread does not inherit - * this stack - - * The steps are: - * -> Create a thread with an alternate stack. - * -> From this thread, create another thread. - * -> Check that the new thread does not use the same stack. - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#define STD_MAIN -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -void * teststack(void * arg) -{ - int ret=0; - *(int **)arg = &ret; - return NULL; -} - -/* Thread function */ -void * threaded(void * arg) -{ - int ret; - int * child_stack; - pthread_t gchild; - - int sz = sysconf(_SC_THREAD_STACK_MIN); - - if (scenarii[sc].bottom != NULL) - { - #if VERBOSE > 1 - output("Processing test\n"); - #endif - - /* Create a new thread and get a location inside its stack */ - ret = pthread_create(&gchild, NULL, teststack, &child_stack); - if (ret != 0) { UNRESOLVED(ret, "Failed to create a thread with default attribute"); } - - ret = pthread_join(gchild, NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to join the test thread"); } - - /* Check the new thread stack location was outside of the current thread location */ - /* We convert all the @ to longs */ - #if VERBOSE > 4 - output("Current stack : %p -> %p\n", scenarii[sc].bottom, sz + (long)scenarii[sc].bottom); - output("Child location: %p\n", child_stack); - #endif - - if ( (((long)scenarii[sc].bottom) < ((long)child_stack)) - && (((long)child_stack) < (((long)scenarii[sc].bottom) + sz))) - { - FAILED("The new thread inherited th alternate stack from its parent"); - } - } - - /* Signal we're done (especially in case of a detached thread) */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - /* return */ - return arg; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/2-1.c deleted file mode 100644 index f2075f3eb0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/2-1.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Test If 'attr' is NULL, the default attributes shall be used. - * The attribute that will be tested is the detached state, because that is - * the only state that has a default listed in the specification. - * - * default: PTHREAD_CREATE_JOINABLE - * Other valid values: PTHREAD_CREATE_DETACHED - - * - * Steps: - * 1. Create a thread using pthread_create() and passing 'NULL' for 'attr'. - * 2. Check to see if the thread is joinable, since that is the default. - * 3. We do this by calling pthread_join() and pthread_detach(). If - * they fail, then the thread is not joinable, and the test fails. - */ - -#include -#include -#include -#include "posixtest.h" - -void *a_thread_func() -{ - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - - /* Create a new thread. The default attribute should be that - * it is joinable. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* The new thread should be able to be joined. */ - if(pthread_join(new_th, NULL) == EINVAL) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - /* The new thread should be able to be detached. */ - if(pthread_detach(new_th) == EINVAL) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-1.c deleted file mode 100644 index 0e03f0d8d2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-1.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Test if the attributes specified by 'attr' are modified later, the thread's - * attributes shall not be affected. - * The attribute that will be tested is the detached state. - * - * - * Steps: - * 1. Set a pthread_attr_t object to be PTHREAD_CREATE_JOINABLE. - * 2. Create a new thread using pthread_create() and passing this attribute - * object. - * 3. Change the attribute object to be in a detached state rather than - * joinable. - * 4. Doing this should not effect the fact that the thread that was created - * is joinable, and so calling the functions pthread_detach() should not fail. - */ - -#include -#include -#include -#include -#include "posixtest.h" - -# define TIMEOUT 10 /* Timeout value of 10 seconds. */ -# define INTHREAD 0 /* Control going to or is already for Thread */ -# define INMAIN 1 /* Control going to or is already for Main */ - -int sem1; /* Manual semaphore */ - -void *a_thread_func() -{ - /* Indicate to main() that the thread was created. */ - sem1=INTHREAD; - - /* Wait for main to detach change the attribute object and try and detach this thread. - * Wait for a timeout value of 10 seconds before timing out if the thread was not able - * to be detached. */ - sleep(TIMEOUT); - - printf("Test FAILED: Did not detach the thread, main still waiting for it to end execution.\n"); - pthread_exit((void*)PTS_FAIL); - return NULL; -} - -int main() -{ - pthread_t new_th; - pthread_attr_t new_attr; - int ret; - - /* Initializing */ - sem1 = INMAIN; - if(pthread_attr_init(&new_attr) != 0) - { - perror("Error intializing attribute object\n"); - return PTS_UNRESOLVED; - - } - - /* Make the new attribute object joinable */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_JOINABLE) != 0) - { - perror("Error setting the detached state of the attribute\n"); - return PTS_UNRESOLVED; - } - - /* Create a new thread and pass it the attribute object that will - * make it joinable. */ - if(pthread_create(&new_th, &new_attr, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - while(sem1==INMAIN) - sleep(1); - - /* Now change the attribute object to be in a detached state */ - if(pthread_attr_setdetachstate(&new_attr, PTHREAD_CREATE_DETACHED) != 0) - { - perror("Error setting the detached state of the attribute\n"); - return PTS_UNRESOLVED; - } - - /* The new thread should still be able to be detached. */ - if((ret=pthread_detach(new_th)) == EINVAL) - { - printf("Test FAILED: pthread_detach failed on joinable thread. Return value is %d\n", ret); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-2.c deleted file mode 100644 index 3c3d8768dd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/3-2.c +++ /dev/null @@ -1,649 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * Once the thread has been created, subsequent changes to the - * thread attribute object don't affect the running thread. - - * The steps are: - * -> stack grow - * -> create a thread with minimal stack size - * -> change the stack size to a bigger value - * -> check that the thread stack size did not change. - * -> stack decrease - * -> create a thread with a known stack size (> minimum) - * -> change the stack size to the min value - * -> check that the thread stack size did not change. - * -> sched policy/param change - * -> create a new thread with a known policy - * -> change the policy in the thread attribute and check the thread policy did not change - * -> change the schedparam in the thread attribute and check the thread priority did not change - * -> change the policy in the running thread and check the thread attribute did not change. - * -> change the priority in the running thread and check the thread attribute did not change. - - * The test fails if one of the checking fails - - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -sem_t semsync[2]; /* These semaphores will only be used in child process! */ - -/* The overflow function is used to test the stack overflow */ -void * overflow(void * arg) -{ - void * current; - void * pad[50]; /* We want to consume the stack quickly */ - long stacksize = sysconf(_SC_THREAD_STACK_MIN); /* make sure we touch the current stack memory */ - - pad[1]=NULL; /* so compiler stops complaining about unused variables */ - int ret = 0; - - if (arg == NULL) - { - /* first call */ - - /* Synchronize with the parent */ - do { ret = sem_wait(&semsync[0]); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - - /* Go to recursion */ - current = overflow(¤t); - - /* Terminated */ - do { ret = sem_post(&semsync[1]); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - /* Terminate the overflow thread */ - return current; - } - - /* we cast the pointers into long, which might be a problem on some architectures... */ - if ( ((long)arg) < ((long)¤t)) - { - /* the stack is growing up */ - if ( ((long)¤t) - ((long)arg) >= stacksize) - { - output("Growing up stack started below %p and we are currently up to %p\n", arg, ¤t); - return (void *)0; - } - } - else - { - /* the stack is growing down */ - if ( ((long)arg) - ((long)¤t) >= stacksize) - { - output("Growing down stack started upon %p and we are currently down to %p\n", arg, ¤t); - return (void *)0; - } - } - - /* We are not yet overflowing, so we loop */ - return overflow(arg); -} - -/* The following function will return - 0 if a thread created with the attribute ta is able to fill the stack up to {minstacksize}. - 1 if the operation failed. - 2 if an error prevented the test to complete - - If newsize is not 0, the stack size in ta will be set to this value once the thread is created. - -*/ -int test_stack(pthread_attr_t * ta, size_t newsize) -{ - pid_t child, ctrl; - int status; - int ret; - - child=fork(); /* We'll test the feature in another process as this test may segfault */ - - if (child == -1) - { - output("Failed to fork (%s)\n", strerror(errno)); - return 2; - } - - if (child != 0) /* father */ - { - /* Just wait for the child and check its return value */ - ctrl = waitpid(child, &status, 0); - if (ctrl != child) - { - output("Failed to wait for process termination (%s)\n", strerror(errno)); - return 2; - } - - if (WIFEXITED(status)) /* The process exited */ - { - if (WEXITSTATUS(status) == 0) - { return 0; } /* We were able to fill the stack */ - if (WEXITSTATUS(status) == PTS_UNRESOLVED) - { - output("The child process returned unresolved status\n"); - return 2; - } - else - { - output("The child process returned: %i\n", WEXITSTATUS(status)); - return 2; - } - } - else - { - #if VERBOSE > 4 - output("The child process did not return\n"); - if (WIFSIGNALED(status)) - output("It was killed with signal %i\n", WTERMSIG(status)); - else - output("neither was it killed. (status = %i)\n", status); - #endif - } - - return 1; - } - - /* else */ - /* this is the new process */ - { - pthread_t th; - void * rc; - int detach; - - /* Semaphore to force the child to wait */ - ret = sem_init(&semsync[0], 0,0); - if (ret == -1) { UNRESOLVED(errno, "Unable to init a semaphore"); } - /* Semaphore to detect thread ending */ - ret = sem_init(&semsync[1], 0,0); - if (ret == -1) { UNRESOLVED(errno, "Unable to init a semaphore"); } - - ret = pthread_create(&th, ta, overflow, NULL); /* Create a new thread with the same attributes */ - if (ret != 0) { UNRESOLVED(ret, "Unable to create a thread in the new process"); } - - /* If we were asked to perform a change on ta, do it now. */ - if (newsize) - { - ret = pthread_attr_setstacksize(ta, newsize); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the new stack size"); } - } - - /* Ok the child can run now */ - do { ret = sem_post(&semsync[0]); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - - /* Wait for its termination */ - do { ret = sem_wait(&semsync[1]); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - if (ta != NULL) - { - ret = pthread_attr_getdetachstate(ta, &detach); - if (ret != 0) { UNRESOLVED(ret, "Failed to get detach state from the thread attribute"); } - } - else - { - detach = PTHREAD_CREATE_JOINABLE; /* default */ - } - - if (detach == PTHREAD_CREATE_JOINABLE) - { - ret = pthread_join(th, &rc); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - if (rc != (void *)0) - { UNRESOLVED((int)(long)rc, "The overflow function returned an unexpected value"); } - } - - - /* Terminate the child process here */ - exit(0); - } -} - - -typedef struct -{ - pthread_barrier_t bar; - int policy; - struct sched_param param; -} testdata_t; - -void * schedtest(void * arg) -{ - testdata_t * td = (testdata_t *)arg; - int newpol, ret=0; - struct sched_param newparam; - - /* Read the current sched policy & param */ - ret = pthread_getschedparam(pthread_self(), &(td->policy), &(td->param)); - if (ret != 0) { UNRESOLVED(ret, "Failed to read current thread policy / param"); } - - /* sync 1 */ - ret = pthread_barrier_wait(&(td->bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* sync 2 */ - ret = pthread_barrier_wait(&(td->bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* Read the current sched policy & param */ - ret = pthread_getschedparam(pthread_self(), &(td->policy), &(td->param)); - if (ret != 0) { UNRESOLVED(ret, "Failed to read current thread policy / param"); } - - /* sync 3 */ - ret = pthread_barrier_wait(&(td->bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* sync 4 */ - ret = pthread_barrier_wait(&(td->bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* Change the current sched policy & param */ - if (td->policy == SCHED_RR) - newpol = SCHED_FIFO; - else - newpol = SCHED_RR; - - newparam.sched_priority = sched_get_priority_max(newpol); - - if (newparam.sched_priority == td->param.sched_priority) - newparam.sched_priority--; - - ret = pthread_setschedparam(pthread_self(), newpol, &newparam); - #if VERBOSE > 0 - if (ret != 0) - output("Changing the current thread sched policy failed with error: %s\n", strerror(ret)); - #endif - #if VERBOSE > 2 - else - output("Executing thread scheduling policy changed\n"); - #endif - - /* sync 5 */ - ret = pthread_barrier_wait(&(td->bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* Post the sem in case of a detached thread */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to post the semaphore"); } - - return NULL; -} - - - -int main (int argc, char *argv[]) -{ - int ret=0; - int do_stack_tests; - int do_sched_tests; - - /* Initialize output routine */ - output_init(); - - /* Test abilities */ - do_sched_tests = (sysconf(_SC_THREAD_PRIORITY_SCHEDULING)>0?1:0); - do_stack_tests = (test_stack(NULL,0)==0?1:0); - #if VERBOSE > 0 - output("Test starting\n Stack tests %s be executed.\n Sched tests %s be executed.\n", - do_stack_tests?"will":"won't", - do_sched_tests?"will":"won't"); - #endif - - /* Initialize thread attribute objects */ - scenar_init(); - - for (sc=0; sc < NSCENAR; sc++) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - if (do_stack_tests) - { - /* stack grow test */ - /* We need the thread attribute to specify a minimal stack */ - if ((scenarii[sc].altstack == 0) && (scenarii[sc].altsize == 1)) - { - #if VERBOSE > 2 - output("Processing stack grow test\n"); - #endif - - ret = test_stack(&scenarii[sc].ta, 2*sysconf(_SC_THREAD_STACK_MIN)); - - if (ret == 0) - { - if (scenarii[sc].guard == 2) - { - FAILED("Changing the stacksize after the thread was created changed the running thread stack size"); - } - #if VERBOSE > 2 - else - output("We were able to overflow the stack, but the guard area is unknow or null\n"); - #endif - - } - - if ((ret != 2) && (scenarii[sc].result == 1)) - { - UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); - } - - #if VERBOSE > 2 - if ((ret == 1)) - { - output("Stack grow test passed\n"); - } - - if ((ret == 2) && (scenarii[sc].result == 2)) - { - output("Something went wrong -- we don't care in this case\n"); - } - #endif - - if ((ret == 2) && (scenarii[sc].result == 0)) - { - UNRESOLVED(-1, "An unexpected error occured\n"); - } - - /* Ok, set back the thread attribute object to a correct value */ - ret = pthread_attr_setstacksize(&scenarii[sc].ta, sysconf(_SC_THREAD_STACK_MIN)); - if (ret != 0) { UNRESOLVED(ret, "Failed to set stacksize back"); } - } - - - /* stack decrease test */ - if ((scenarii[sc].altstack == 0) && (scenarii[sc].altsize == 0)) - { - #if VERBOSE > 2 - output("Processing stack decrease test\n"); - #endif - - ret = test_stack(&scenarii[sc].ta, sysconf(_SC_THREAD_STACK_MIN)); - - if (ret == 1) { FAILED("Decreasing the stack size after thread is created had an influence on the thread"); } - - if ((ret == 0) && (scenarii[sc].result == 1)) - { - UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); - } - - if ((ret == 2) && (scenarii[sc].result == 0)) - { - UNRESOLVED(-1, "An unexpected error occured\n"); - } - - #if VERBOSE > 2 - if (ret == 0) - output("Stack decrease test passed.\n"); - else - output("Something failed but we don't care here.\n"); - #endif - } - - - } /* if do_stack_tests */ - - if (do_sched_tests) - { - /* Sched policy/param change test */ - if (scenarii[sc].explicitsched != 0) /* We need a specified policy */ - { - pthread_t child; - int policy_ori, newpol_max; - struct sched_param param_ori, tmp; - - testdata_t td; - - #if VERBOSE > 2 - output("Processing sched policy/param change test\n"); - #endif - - /* Backup the scenario object */ - ret = pthread_attr_getschedpolicy(&(scenarii[sc].ta), &policy_ori); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched policy from thread attribute"); } - ret = pthread_attr_getschedparam(&(scenarii[sc].ta), ¶m_ori); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched param from thread attribute"); } - - /* Initialize the barrier */ - ret = pthread_barrier_init(&(td.bar), NULL, 2); - if (ret != 0) { UNRESOLVED(ret, "Unable to initialize the barrier"); } - - /* Create a new thread with this scenario attribute */ - ret = pthread_create(&child, &(scenarii[sc].ta), schedtest, &td); - if (ret != 0) - { - if (scenarii[sc].result == 0) - { UNRESOLVED(ret , "Failed to create a thread"); } - - #if VERBOSE > 2 - if (scenarii[sc].result == 2) - { - output("The thread creation failed -- we don't care\n"); - } - if (scenarii[sc].result == 1) - { - output("The thread creation failed as expected\n"); - } - #endif - } - else /* Thread created */ - { - if (scenarii[sc].result == 1) - { UNRESOLVED(-1, "The thread was created where an error was expected"); } - - #if VERBOSE > 2 - if (scenarii[sc].result == 2) - output("Thread is created\n"); - #endif - - /* sync 1 */ - ret = pthread_barrier_wait(&(td.bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* Check the new thread reports the attributes */ - if (td.policy != policy_ori) - { FAILED("The new thread does not report the scheluling policy that was specified"); } - - if (td.param.sched_priority != param_ori.sched_priority) - { FAILED("The new thread does not report the scheduling priority that was specified at creation"); } - - /* Change the thread attribute object policy & param */ - if (policy_ori == SCHED_RR) - { - ret = pthread_attr_setschedpolicy(&(scenarii[sc].ta), SCHED_FIFO); - newpol_max = sched_get_priority_max(SCHED_FIFO); - } - else - { - ret = pthread_attr_setschedpolicy(&(scenarii[sc].ta), SCHED_RR); - newpol_max = sched_get_priority_max(SCHED_RR); - } - if (ret != 0) { UNRESOLVED(ret, "Failed to change the attribute object"); } - - if (newpol_max == param_ori.sched_priority) - newpol_max--; - - tmp.sched_priority = newpol_max; - - ret = pthread_attr_setschedparam(&(scenarii[sc].ta), &tmp); - if (ret != 0) { UNRESOLVED(ret, "Failed to set the attribute sched param"); } - - /* sync 2 */ - ret = pthread_barrier_wait(&(td.bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* sync 3 */ - ret = pthread_barrier_wait(&(td.bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* Check if the thread saw the change (should not) */ - if (td.policy != policy_ori) - { FAILED("The new thread does not report the scheluling policy that was specified"); } - - if (td.param.sched_priority != param_ori.sched_priority) - { FAILED("The new thread does not report the scheduling priority that was specified at creation"); } - - /* Check what we can see for the child thread from here */ - ret = pthread_getschedparam(child, &(td.policy), &(td.param)); - if (ret != 0) { UNRESOLVED(ret, "Failed to read child thread policy / param"); } - - if (td.policy != policy_ori) - { FAILED("The child thread does not report the scheduling policy that was specified at creation"); } - - if (td.param.sched_priority != param_ori.sched_priority) - { FAILED("The child thread does not report the scheduling priority that was specified at creation"); } - - /* Restore the thread attribute */ - ret = pthread_attr_setschedpolicy(&(scenarii[sc].ta), policy_ori); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched policy from thread attribute"); } - ret = pthread_attr_setschedparam(&(scenarii[sc].ta), ¶m_ori); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched param from thread attribute"); } - - /* sync 4*/ - ret = pthread_barrier_wait(&(td.bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* sync 5*/ - ret = pthread_barrier_wait(&(td.bar)); - if ((ret != 0) && (ret != PTHREAD_BARRIER_SERIAL_THREAD)) { UNRESOLVED(ret, "Failed to synchronize on the barrier"); } - - /* check if the thread attribute reports a change (should not) */ - ret = pthread_attr_getschedpolicy(&(scenarii[sc].ta), &(td.policy)); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched policy from thread attribute"); } - ret = pthread_attr_getschedparam(&(scenarii[sc].ta), &(td.param)); - if (ret != 0) { UNRESOLVED(ret, "Unable to read sched param from thread attribute"); } - - if (td.policy != policy_ori) - { FAILED("The child thread does not report the scheduling policy that was specified at creation"); } - - if (td.param.sched_priority != param_ori.sched_priority) - { FAILED("The child thread does not report the scheduling priority that was specified at creation"); } - - /* Wait for the sem and join eventually the thread */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - if (scenarii[sc].detached == 0) - { - ret = pthread_join(child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - - #if VERBOSE > 2 - output("Sched policy/param change test passed\n"); - #endif - } /* thread created */ - } - - /* We could also test if the inheritsched does not influence the new thread */ - - } /* if do_sched_tests */ - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/4-1.c deleted file mode 100644 index cdd6601f3b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/4-1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - * - * Test upon successful completion, pthread_create() shall store the ID of the - * the created thread in the location referenced by 'thread'. - * - * Steps: - * 1. Create a thread using pthread_create() - * 2. Save the thread ID resulting from pthread_create() - * 3. Get the thread ID from the new thread by calling - * pthread_self(). - * 4. These 2 values should be equal. (i.e. the one from pthread_create() - * and the one from pthread_self()). - */ - -#include -#include -#include "posixtest.h" - -void *a_thread_func(); - -pthread_t self_th; /* Save the value of the function call pthread_self() - within the thread. Keeping it global so 'main' can - see it too. */ - -int main() -{ - pthread_t new_th; - - /* Create a new thread */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for the thread function to return to make sure we got - * the thread ID value from pthread_self(). */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error calling pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* If the value of pthread_self() and the return value from - * pthread_create() is equal, then the test passes. */ - if(pthread_equal(new_th, self_th) == 0) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - -/* The thread function that calls pthread_self() to obtain its thread ID */ -void *a_thread_func() -{ - self_th=pthread_self(); - pthread_exit(0); - return NULL; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/5-1.c deleted file mode 100644 index 087faa4dc9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/5-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Test pthread_create() - * The thread is created executing 'start_routine' with 'arg' as its only - * argument. - * - * Steps: - * 1. Create 5 separete threads using pthread_create() passing to it a single int 'arg'. - * 2. Use that passed int argument in the thread function start routine and make sure no - * errors occur. - */ - -#include -#include -#include -#include "posixtest.h" - -#define NUM_THREADS 5 - -/* The thread start routine. */ -void *a_thread_func(void* num) -{ - intptr_t i = (intptr_t) num; - printf("Passed argument for thread: %d\n", (int)i); - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - long i; - - for(i=1;i -#include -#include "posixtest.h" - -#define NUM_THREADS 5 - -/* The thread start routine. */ -void *a_thread_func(void* num) -{ - int *i, j; - - i = (int *)num; - - for(j=0;j -#include -#include -#include "posixtest.h" - -sigset_t th_pendingset, th_sigmask; - -void *a_thread_func() -{ - /* Obtain the signal mask of this thread. */ - pthread_sigmask(SIG_SETMASK, NULL, &th_sigmask); - - /* Obtain the pending signals of this thread. It should be empty. */ - if (sigpending(&th_pendingset) != 0) { - printf("Error calling sigpending()\n"); - return (void *)PTS_UNRESOLVED; - } - - pthread_exit(0); - return NULL; -} - -int main() -{ - pthread_t new_th; - sigset_t main_sigmask, main_pendingset; - int ret; - - /* Empty set of signal mask and blocked signals */ - if ( (sigemptyset(&main_sigmask) != 0) || - (sigemptyset(&main_pendingset) != 0) ) - { - perror("Error in sigemptyset()\n"); - return PTS_UNRESOLVED; - } - - /* Add SIGCONT, SIGUSR1 and SIGUSR2 to the set of blocked signals */ - if (sigaddset(&main_sigmask, SIGUSR1) != 0) - { - perror("Error in sigaddset()\n"); - return PTS_UNRESOLVED; - } - - if (sigaddset(&main_sigmask, SIGUSR2) != 0) - { - perror("Error in sigaddset()\n"); - return PTS_UNRESOLVED; - } - - /* Block those signals. */ - if (pthread_sigmask(SIG_SETMASK, &main_sigmask, NULL) != 0) - { - printf("Error in pthread_sigmask()\n"); - return PTS_UNRESOLVED; - } - - /* Raise those signals so they are now pending. */ - if (raise(SIGUSR1) != 0) { - printf("Could not raise SIGALRM\n"); - return -1; - } - if (raise(SIGUSR2) != 0) { - printf("Could not raise SIGALRM\n"); - return -1; - } - - /* Create a new thread. */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait until the thread has finished execution. */ - if(pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check to make sure that the sigmask of the thread is the same as the main thread */ - ret = sigismember(&th_sigmask, SIGUSR1); - if(ret != 1) - { - if(ret == 0) - { - printf("Error: Thread did not inherit main()s signal mask. SIGUSR1 not a member of the signal set.\n"); - return PTS_FAIL; - } - - perror("Error is sigismember()\n"); - return PTS_UNRESOLVED; - } - - ret = sigismember(&th_sigmask, SIGUSR2); - if(ret != 1) - { - if(ret == 0) - { - printf("Test FAILED: Thread did not inherit main()s signal mask. SIGUSR2 not a member of the signal set.\n"); - return PTS_FAIL; - } - - perror("Error is sigismember()\n"); - return PTS_UNRESOLVED; - } - - /* Check to make sure that the pending set of the thread does not contain SIGUSR1 or - * SIGUSR2. */ - - ret = sigismember(&th_pendingset, SIGUSR1); - if(ret != 0) - { - if(ret == 1) - { - printf("Error: Thread did not inherit main()s signal mask. SIGUSR1 not a member of the signal set.\n"); - return PTS_FAIL; - } - - perror("Error is sigismember()\n"); - return PTS_UNRESOLVED; - } - - ret = sigismember(&th_pendingset, SIGUSR2); - if(ret != 0) - { - if(ret == 1) - { - printf("Test FAILED: Thread did not inherit main()s signal mask. SIGUSR2 not a member of the signal set.\n"); - return PTS_FAIL; - } - - perror("Error is sigismember()\n"); - return PTS_UNRESOLVED; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/8-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/8-2.c deleted file mode 100644 index c23a8e2bfd..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/8-2.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - - - * This sample test aims to check the following assertion: - * - * The new thread inherits is signal mask from the calling thread, - * and has no pending signal at creation time. - - * The steps are: - * 1. In main(), create a signal mask with a few signals in the set (SIGUSR1 and SIGUSR2). - * 2. Raise those signals in main. These signals now should be pending. - * 3. Create a thread using pthread_create(). - * 4. The thread should have the same signal mask, but no signals should be pending. - - * Parts of this test are copied from 8-1.c (author: rolla.n.selbak REMOVE-THIS AT intel DOT com) - */ - - - /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ - #define _POSIX_C_SOURCE 200112L - - /* Some routines are part of the XSI Extensions */ -#ifndef WITHOUT_XOPEN - #define _XOPEN_SOURCE 600 -#endif -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ - #include "testfrmw.h" - #include "testfrmw.c" - /* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -#include "threads_scenarii.c" - -/* This file will define the following objects: - * scenarii: array of struct __scenario type. - * NSCENAR : macro giving the total # of scenarii - * scenar_init(): function to call before use the scenarii array. - * scenar_fini(): function to call after end of use of the scenarii array. - */ - - -/********************************************************************************************/ -/*********************************** Real Test *****************************************/ -/********************************************************************************************/ - -typedef struct -{ - sigset_t mask; - sigset_t pending; -} testdata_t; - - -/* Thread function; which will check the signal mask and pending signals */ -void * threaded(void * arg) -{ - int ret; - testdata_t * td=(testdata_t *)arg; - - /* Obtain the signal mask of this thread. */ - ret = pthread_sigmask(SIG_SETMASK, NULL, &(td->mask)); - if (ret != 0) { UNRESOLVED(ret, "Failed to get the signal mask of the thread"); } - - /* Obtain the pending signals of this thread. It should be empty. */ - ret = sigpending(&(td->pending)); - if (ret != 0) { UNRESOLVED(errno, "Failed to get pending signals from the thread"); } - - /* Signal we're done (especially in case of a detached thread) */ - do { ret = sem_post(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - - /* return */ - return arg; -} - -int main (int argc, char *argv[]) -{ - int ret=0; - pthread_t child; - - testdata_t td_parent, td_thread; - - /* Initialize output routine */ - output_init(); - - /* Initialize thread attribute objects */ - scenar_init(); - - /* Initialize the signal state */ - ret = sigemptyset(&(td_parent.mask)); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a signal set"); } - - ret = sigemptyset(&(td_parent.pending)); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a signal set"); } - - /* Add SIGCONT, SIGUSR1 and SIGUSR2 to the set of blocked signals */ - ret = sigaddset(&(td_parent.mask), SIGUSR1); - if (ret != 0) { UNRESOLVED(ret, "Failed to add SIGUSR1 to the signal set"); } - - ret = sigaddset(&(td_parent.mask), SIGUSR2); - if (ret != 0) { UNRESOLVED(ret, "Failed to add SIGUSR2 to the signal set"); } - - /* Block those signals. */ - ret = pthread_sigmask(SIG_SETMASK, &(td_parent.mask), NULL); - if (ret != 0) { UNRESOLVED(ret, "Failed to mask the singals in main"); } - - /* Raise those signals so they are now pending. */ - ret = raise(SIGUSR1); - if (ret != 0) { UNRESOLVED(errno, "Failed to raise SIGUSR1"); } - ret = raise(SIGUSR2); - if (ret != 0) { UNRESOLVED(errno, "Failed to raise SIGUSR2"); } - - /* Do the testing for each thread */ - for (sc=0; sc < NSCENAR; sc++) - { - #if VERBOSE > 0 - output("-----\n"); - output("Starting test with scenario (%i): %s\n", sc, scenarii[sc].descr); - #endif - - /* (re)initialize thread signal sets */ - ret = sigemptyset(&(td_thread.mask)); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a signal set"); } - - ret = sigemptyset(&(td_thread.pending)); - if (ret != 0) { UNRESOLVED(ret, "Failed to initialize a signal set"); } - - - ret = pthread_create(&child, &scenarii[sc].ta, threaded, &td_thread); - switch (scenarii[sc].result) - { - case 0: /* Operation was expected to succeed */ - if (ret != 0) { UNRESOLVED(ret, "Failed to create this thread"); } - break; - - case 1: /* Operation was expected to fail */ - if (ret == 0) { UNRESOLVED(-1, "An error was expected but the thread creation succeeded"); } - break; - - case 2: /* We did not know the expected result */ - default: - #if VERBOSE > 0 - if (ret == 0) - { output("Thread has been created successfully for this scenario\n"); } - else - { output("Thread creation failed with the error: %s\n", strerror(ret)); } - #endif - } - if (ret == 0) /* The new thread is running */ - { - if (scenarii[sc].detached == 0) - { - ret = pthread_join(child, NULL); - if (ret != 0) { UNRESOLVED(ret, "Unable to join a thread"); } - } - else - { - /* Just wait for the thread to terminate */ - do { ret = sem_wait(&scenarii[sc].sem); } - while ((ret == -1) && (errno == EINTR)); - if (ret == -1) { UNRESOLVED(errno, "Failed to wait for the semaphore"); } - } - - /* The thread has terminated its work, so we can now control */ - ret = sigismember(&(td_thread.mask), SIGUSR1); - if (ret != 1) - { - if (ret == 0) { FAILED("The thread did not inherit the signal mask"); } - /* else */ - UNRESOLVED(ret, "sigismember() failed"); - } - - ret = sigismember(&(td_thread.mask), SIGUSR2); - if (ret != 1) - { - if (ret == 0) { FAILED("The thread did not inherit the signal mask"); } - /* else */ - UNRESOLVED(ret, "sigismember() failed"); - } - - ret = sigismember(&(td_thread.pending), SIGUSR1); - if (ret != 0) - { - if (ret == 1) { FAILED("The thread inherited the pending signal SIGUSR1"); } - /* else */ - UNRESOLVED(ret, "sigismember() failed"); - } - - ret = sigismember(&(td_thread.pending), SIGUSR2); - if (ret != 0) - { - if (ret == 1) { FAILED("The thread inherited the pending signal SIGUSR2"); } - /* else */ - UNRESOLVED(ret, "sigismember() failed"); - } - - - } - } - - scenar_fini(); - #if VERBOSE > 0 - output("-----\n"); - output("All test data destroyed\n"); - output("Test PASSED\n"); - #endif - - PASSED; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/Jamfile deleted file mode 100644 index d5173beca6..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_create/Jamfile +++ /dev/null @@ -1,23 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_create ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest pthread_create_1-1 : 1-1.c ; -SimpleTest pthread_create_1-2 : 1-2.c ; -SimpleTest pthread_create_1-3 : 1-3.c ; -#SimpleTest pthread_create_1-4 : 1-4.c ; -#SimpleTest pthread_create_1-5 : 1-5.c ; -#SimpleTest pthread_create_1-6 : 1-6.c ; -SimpleTest pthread_create_2-1 : 2-1.c ; -SimpleTest pthread_create_3-1 : 3-1.c ; -#SimpleTest pthread_create_3-2 : 3-2.c ; -SimpleTest pthread_create_4-1 : 4-1.c ; -SimpleTest pthread_create_5-1 : 5-1.c ; -SimpleTest pthread_create_5-2 : 5-2.c ; -SimpleTest pthread_create_8-1 : 8-1.c ; -#SimpleTest pthread_create_8-2 : 8-2.c ; -SimpleTest pthread_create_10-1 : 10-1.c ; -#SimpleTest pthread_create_11-1 : 11-1.c ; -SimpleTest pthread_create_12-1 : 12-1.c ; -#SimpleTest pthread_create_14-1 : 14-1.c ; -#SimpleTest pthread_create_15-1 : 15-1.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/1-1.c deleted file mode 100644 index d81a284b0b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/1-1.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu 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. - - * Test that pthread_getspecific() - * - * shall return the value currently bound to the specified key on behalf of the calling thread. - * Calling pthread_getspecific() with a key value not obtained from pthread_key_create() or - * after key has been deleted with pthread_key_delete() is undefined. - * - * Steps: - * 1. Create NUM_OF_KEYS pthread_key_t objects - * 2. Set each key to a thread-specific value with pthread_setspecific() - * 3. Call pthread_getspecific() on each key and check that the value returned is correct. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_KEYS 10 -#define KEY_VALUE 0 - -int main() -{ - pthread_key_t keys[NUM_OF_KEYS]; - int i; - void* rc; - - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - -int main() -{ - pthread_key_t key; - void* rc; - - if(pthread_key_create(&key, NULL) != 0) - { - printf("pthread_getspecific_3-1 Error: pthread_key_create() failed\n"); - return PTS_UNRESOLVED; - } - - rc = pthread_getspecific(key); - if(rc != NULL) - { - printf("pthread_getspecific_3-1 Test FAILED: Did not return correct value, expected NULL, but got %ld\n", (long)rc); - return PTS_FAIL; - } - - if(pthread_key_delete(key) != 0) - { - printf("pthread_getspecific_3-1 Error: pthread_key_delete() failed\n"); - return PTS_UNRESOLVED; - } - - printf("%spthread_getspecific_3-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/Jamfile deleted file mode 100644 index 2205e2b503..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_getspecific/Jamfile +++ /dev/null @@ -1,7 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_getspecific ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest pthread_getspecific_1-1 : 1-1.c ; -SimpleTest pthread_getspecific_3-1 : 3-1.c ; - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/1-1.c deleted file mode 100644 index 11ada26e27..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/1-1.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu 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. - - * Test that pthread_key_create() - * - * shall create a thread-specific data key visible to all threaads in the process. Key values - * provided by pthread_key_create() are opaque objects used to locate thread-specific data. - * Although the same key value may be used by different threads, the values bound to the key - * by pthread_setspecific() are maintained on a per-thread basis and persist for the life of - * the calling thread. - * - * Steps: - * 1. Define an array of keys - * 2. Use pthread_key_create() and create those keys - * 3. Verify that you can set and get specific values for those keys without errors. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_KEYS 10 -#define KEY_VALUE 0 - -pthread_key_t keys[NUM_OF_KEYS]; - -int main() -{ - int i; - void* rc; - - for(i = 0;i -#include -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_THREADS 10 -#define KEY_VALUE 1000 -pthread_key_t keys[NUM_OF_THREADS]; -int i; - -/* Thread function that sets the key to KEY_VALUE */ -void *a_thread_func() -{ - /* Set the key to KEY_VALUE */ - if(pthread_setspecific(keys[i], (void *)(KEY_VALUE)) != 0) - { - printf("pthread_key_create_1-2 Error: pthread_setspecific() failed\n"); - pthread_exit((void*)PTS_FAIL); - } - - pthread_exit(0); -} - -int main() -{ - pthread_t new_th; - void *value_ptr; - int error; - - /* Create a key */ - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - - -int main() -{ - pthread_key_t key; - void* rc; - - /* Verify that the value associated with "key" in a new thread is NULL */ -// rc = pthread_getspecific(key); -// if(rc != NULL) -// { -// printf("pthread_key_create_2-1 Test FAILED\n"); -// return PTS_FAIL; -// } - - if(pthread_key_create(&key, NULL) != 0) - { - printf("pthread_key_create_2-1 pthread_key_create_2-1 Error: pthread_key_create() failed\n"); - return PTS_UNRESOLVED; - } else - { - /* Verify that the value associated with "key" after it is newly created is - * NULL */ - rc = pthread_getspecific(key); - if(rc != NULL) - { - printf("pthread_key_create_2-1 Test FAILED\n"); - return PTS_FAIL; - } - - } - - printf("%spthread_key_create_2-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/3-1.c deleted file mode 100644 index 70bd49588c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/3-1.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu 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. - - * Test that pthread_key_create() - * - * An optional destructor function may be associated with each key value. At thread exit, if - * a key value has a non-NULL destructor pointer, and the thread has a non-NULL value associated - * with that key, the value of the key is set to NULL, and then the function pointed to is called - * with the previously associated value as its sole argument. The order of destructor calls is - * unspecified if more than one destructor exists for a thread when it exits. - * - * Steps: - * 1. Define an array of keys - * 2. Use pthread_key_create() and create those keys - * 3. Verify that you can set and get specific values for those keys without errors. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define KEY_VALUE 1000 - -pthread_key_t key; -int dest_cnt; - -/* Destructor funciton */ -void dest_func(void *p) -{ - dest_cnt++; -} - -/* Thread function */ -void *a_thread_func() -{ - - /* Set the value of the key to a value */ - if(pthread_setspecific(key, (void *)(KEY_VALUE)) != 0) - { - printf("pthread_key_create_3-1 Error: pthread_setspecific() failed\n"); - pthread_exit((void*) PTS_UNRESOLVED); - } - - /* The thread ends here, the destructor for the key should now be called after this */ - pthread_exit(0); -} - -int main() -{ - pthread_t new_th; - - /* Inialize the destructor flag */ - dest_cnt = 0; - - /* Create a key with a destructor function */ - if(pthread_key_create(&key, dest_func) != 0) - { - printf("pthread_key_create_3-1 Error: pthread_key_create() failed\n"); - pthread_exit((void*) PTS_UNRESOLVED); - } - - /* Create a thread */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("pthread_key_create_3-1 Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for the thread's return */ - if(pthread_join(new_th, NULL) != 0) - { - perror("pthread_key_create_3-1 Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check if the destructor was called */ - if(dest_cnt == 0) - { - printf("pthread_key_create_3-1 Test FAILED: Destructor not called\n"); - return PTS_FAIL; - } - - printf("%spthread_key_create_3-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/Jamfile deleted file mode 100644 index 4d2daeb31e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_create/Jamfile +++ /dev/null @@ -1,9 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_key_create ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest pthread_key_create_1-1 : 1-1.c ; -SimpleTest pthread_key_create_1-2 : 1-2.c ; -SimpleTest pthread_key_create_2-1 : 2-1.c ; -SimpleTest pthread_key_create_3-1 : 3-1.c ; - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/1-1.c deleted file mode 100644 index 4a3dad8734..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/1-1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu 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. - - * Test that pthread_key_delete() - * - * Shall delete a thread-specific data key previously returned by pthread_key_create. The - * thread-specific data values specified data values associated with 'key' need not be NULL at - * the time pthread_key_delete is called. It is the responsibility of the application to free - * any application storage or perform any cleanup actions for data structures related to the - * deleted key or associated thread-specific data in any threads; this cleanup can be done - * either before or after pthread_key_delete is called. Any attempt to use 'key' following - * the call to pthread_key_delete results in undefined behavior. - * - * Steps: - * 1. Create many keys, and do not specify and value to them (default is NULL) - * 2. Delete the keys with pthread_key_delete - * 3. Verify that this will not result in an error - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_KEYS 10 - -int main() -{ - pthread_key_t keys[NUM_OF_KEYS]; - int i; - - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_KEYS 10 -#define KEY_VALUE 100 - -int main() -{ - pthread_key_t keys[NUM_OF_KEYS]; - int i; - - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - -#define KEY_VALUE 1000 - -pthread_key_t key; -int dest_cnt; - -/* Destructor funciton */ -void dest_func(void *p) -{ - dest_cnt++; - /* Delete the key and check if an error has occured */ - if(pthread_key_delete(key) != 0) - { - dest_cnt++; - } -} - -/* Thread function */ -void *a_thread_func() -{ - - /* Set the value of the key to a value */ - if(pthread_setspecific(key, (void *)(KEY_VALUE)) != 0) - { - printf("pthread_key_delete_2-1 Error: pthread_setspecific() failed\n"); - pthread_exit((void*) PTS_UNRESOLVED); - } - - /* The thread ends here, the destructor for the key should now be called after this */ - pthread_exit(0); -} - -int main() -{ - pthread_t new_th; - - /* Inialize the destructor flag */ - dest_cnt = 0; - - /* Create a key with a destructor function */ - if(pthread_key_create(&key, dest_func) != 0) - { - printf("pthread_key_delete_2-1 Error: pthread_key_create() failed\n"); - pthread_exit((void*) PTS_UNRESOLVED); - } - - /* Create a thread */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("pthread_key_delete_2-1 Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait for the thread's return */ - if(pthread_join(new_th, NULL) != 0) - { - perror("pthread_key_delete_2-1 Error in pthread_join()\n"); - return PTS_UNRESOLVED; - } - - /* Check if the destructor was called and if the pthread_key_delete function was - * called successfully */ - if(dest_cnt != 1) - { - if(dest_cnt == 0) - { - printf("pthread_key_delete_2-1 Error calling the key destructor function\n"); - return PTS_UNRESOLVED; - } else - { - printf("pthread_key_delete_2-1 Test FAILED: pthread_key_delete failed to be called from the destructor function\n"); - return PTS_FAIL; - } - } - - printf("%spthread_key_delete_2-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/Jamfile deleted file mode 100644 index 7cf3dff98f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_key_delete/Jamfile +++ /dev/null @@ -1,8 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_key_delete ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest pthread_key_delete_1-1 : 1-1.c ; -SimpleTest pthread_key_delete_1-2 : 1-2.c ; -SimpleTest pthread_key_delete_2-1 : 2-1.c ; - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-1.c deleted file mode 100644 index 74805fd521..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - * Test that pthread_once() - * - * Dynamic package installation. Tihe first call to pthread_once() by any - * thread in a process, with a given 'once_control', shall call the - * 'init_routine' with no arguments. Subsequent calls of pthread_once() - * with the same once_control shall not call the 'init_routine'. The - * 'once_control' paramter shall determine whether the associated - * initialization routine has been called. - * - * STEPS: - * 1.Initialize a pthread_once object - * 2.Call pthread_once passing it this object - * 3.Call pthread_once again, this time, it shouldn't execute the function - * passed to it. If it does, the test fails. - */ - -#include -#include -#include "posixtest.h" - -/* Keeps track of how many times the init function has been called. */ -int init_flag; - -/* The init function that pthread_once calls */ -void *an_init_func() -{ - init_flag++; - return NULL; -} - -int main() -{ - pthread_once_t once_control = PTHREAD_ONCE_INIT; - - init_flag=0; - - /* Call pthread_once, passing it the once_control */ - pthread_once(&once_control, (void*)an_init_func); - - /* Call pthread_once again. The init function should not be - * called. */ - pthread_once(&once_control, (void*)an_init_func); - - if(init_flag != 1) - { - printf("Test FAILED\n"); - return PTS_FAIL; - } - - printf("%spthread_once_1-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; - -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-2.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-2.c deleted file mode 100644 index 8ccb9c1693..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-2.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write the Free Software Foundation, Inc., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* In a process, the first call to pthread_once with a given once_control -* calls the init routine. - -* The steps are: -* -> call pthread_once -* -> check the init_routine executed - -* The test fails if the init_routine has not been called after pthread_once -* has returned. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include -#include -#include -#include -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -int control; - -void my_init( void ) -{ - - control = 1; - - return ; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - - pthread_once_t myctl = PTHREAD_ONCE_INIT; - - /* Initialize output */ - output_init(); - - control = 0; - - /* Call the initializer */ - ret = pthread_once( &myctl, my_init ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_once failed" ); - } - - if ( control != 1 ) - { - FAILED( "The initializer function did not execute" ); - } - - printf("%spthread_once_1-2:%s %sPASSED%s\n", boldOn, boldOff, green, normal); -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-3.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-3.c deleted file mode 100644 index a1916f249c..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/1-3.c +++ /dev/null @@ -1,183 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write the Free Software Foundation, Inc., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* Subsequent calls with the same once_control do not call init routine. - -* The steps are: -* -> Create several threads -* -> each call pthread_once -* -> check the init_routine executed once - -* The test fails if the init_routine has not been called or has -* been called several times. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include -#include -#include -#include -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define NTHREADS 30 - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -int control; -pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; - -void my_init( void ) -{ - int ret = 0; - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex in initializer" ); - } - - control++; - - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex in initializer" ); - } - - return ; -} - -/* Thread function */ -void * threaded ( void * arg ) -{ - int ret; - - ret = pthread_once( arg, my_init ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_once failed" ); - } - - return NULL; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret, i; - - pthread_once_t myctl = PTHREAD_ONCE_INIT; - - pthread_t th[ NTHREADS ]; - - /* Initialize output */ - output_init(); - - control = 0; - - /* Create the children */ - - for ( i = 0; i < NTHREADS; i++ ) - { - ret = pthread_create( &th[ i ], NULL, threaded, &myctl ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to create a thread" ); - } - } - - /* Then join */ - for ( i = 0; i < NTHREADS; i++ ) - { - ret = pthread_join( th[ i ], NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to join a thread" ); - } - } - - /* Fetch the memory */ - ret = pthread_mutex_lock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to lock mutex in initializer" ); - } - - if ( control != 1 ) - { - output( "Control: %d\n", control ); - FAILED( "The initializer function did not execute once" ); - } - - ret = pthread_mutex_unlock( &mtx ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Failed to unlock mutex in initializer" ); - } - - printf("%spthread_once_1-3:%s %sPASSED%s\n", boldOn, boldOff, green, normal); -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/2-1.c deleted file mode 100644 index 7f29c1c92a..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/2-1.c +++ /dev/null @@ -1,118 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write the Free Software Foundation, Inc., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* pthread_once returns only when init routine has completed. - -* The steps are: -* -> call pthread_once (the init routine lasts for 1 second) -* -> check the init_routine executed - -* The test fails if the init_routine has not been completed when pthread_once -* returns. - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include -#include -#include -#include -#include -#include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -int control; - -void my_init( void ) -{ - sleep( 1 ); - - control = 1; - - return ; -} - -/* The main test function. */ -int main( int argc, char * argv[] ) -{ - int ret; - - pthread_once_t myctl = PTHREAD_ONCE_INIT; - - /* Initialize output */ - output_init(); - - control = 0; - - /* Call the initializer */ - ret = pthread_once( &myctl, my_init ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_once failed" ); - } - - if ( control != 1 ) - { - FAILED( "The initializer function did not execute" ); - } - - printf("%spthread_once_2-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/3-1.c deleted file mode 100644 index f1ceb9e19f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/3-1.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - * - * Test pthread_once() - * - * The pthread_once() function is not a cancelation point. However if - * 'init_routine'is a cancelation point and is canceled, the effect on - * 'once_control' shall be as if pthread_once() was never called. - * - * STEPS: - * 1. Create a cancelable thread. - * 2. In the thread routine, call pthread_once using a global pthread_once_t - * object. - * 3. Cancel the thread during the pthread_once init function - * 4. Call pthread_once again with the same pthread once_t object - * 5. This should call the pthread_once init function. If not, the test fails. - */ - -#include -#include -#include -#include "posixtest.h" - -/* Global pthread_once_t object */ -pthread_once_t once_control; - -/* Keeps track of how many times the init function has been called. */ -int init_flag; - -/* The init function that pthread_once calls */ -void *an_init_func() -{ - /* Indicate to main() that the init function has been reached */ - init_flag=1; - - /* Stay in a continuous loop until the thread that called - * this function gets canceled */ - sleep(10); - - /* The thread could not be canceled, timeout after 10 secs */ - perror("Init function timed out (10 secs), thread could not be canceled\n"); - init_flag=-1; - return NULL; -} - -/* Thread function */ -void *a_thread_func() -{ - /* Make the thread cancelable immediately */ - pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); - - pthread_once(&once_control, (void*)an_init_func); - return NULL; -} - -/* 2nd init function used by the 2nd call of pthread_once */ -void *an_init_func2() -{ - /* Indicate to main() that this init function has been reached */ - init_flag=1; - return NULL; -} - -int main() -{ - pthread_t new_th; - once_control = PTHREAD_ONCE_INIT; - init_flag=0; - - /* Create a thread that will execute the first call to pthread_once() */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait until the init function is reached to cancel the thread */ - while(init_flag==0) - sleep(1); - - /* Send cancel request to the thread*/ - if(pthread_cancel(new_th) != 0) - { - perror("Could send cancel request to thread\n"); - return PTS_UNRESOLVED; - } - - /* Wait until the thread is canceled */ - pthread_join(new_th, NULL); - - /* If the thread could not be canceled and timed out, send - * an error */ - if (init_flag == -1) - { - perror("Error: could not cancel thread\n"); - return PTS_UNRESOLVED; - } - - init_flag=0; - - /* Should be able to call pthread_once() again with the same - * pthread_once_t object. */ - pthread_once(&once_control, (void*)an_init_func2); - - /* If the init function from the 2nd call to pthread_once() was not - * reached, the test fails. */ - if(init_flag != 1) - { - printf("Test FAILED\n: %d", init_flag); - return PTS_FAIL; - } - - printf("Test PASSED\n"); - return PTS_PASS; -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/4-1.c deleted file mode 100644 index 45b72f2087..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/4-1.c +++ /dev/null @@ -1,17 +0,0 @@ - /* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: rolla.n.selbak 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. - - Test pthread_once() - - *The constant PTHREAD_ONCE_INIT is defined in the pthread.h header. - */ - -#include - -pthread_once_t dummy = PTHREAD_ONCE_INIT; - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/6-1.c deleted file mode 100644 index 221ba6a665..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/6-1.c +++ /dev/null @@ -1,365 +0,0 @@ -/* -* Copyright (c) 2004, Bull S.A.. All rights reserved. -* Created by: Sebastien Decugis - -* This program is free software; you can redistribute it and/or modify it -* under the terms of version 2 of the GNU General Public License as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it would be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -* -* You should have received a copy of the GNU General Public License along -* with this program; if not, write the Free Software Foundation, Inc., 59 -* Temple Place - Suite 330, Boston MA 02111-1307, USA. - - -* This sample test aims to check the following assertion: -* -* The function does not return EINTR - -* The steps are: -* -> kill a thread which calls pthread_once -* -> check that EINTR is never returned - -*/ - - -/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ -#define _POSIX_C_SOURCE 200112L - -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ -#include - #include - #include - #include - #include - #include - -#include - #include - #include - -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ -#include "testfrmw.h" - #include "testfrmw.c" -/* This header is responsible for defining the following macros: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate in any other maneer. - * - * The other file defines the functions - * void output_init() - * void output(char * string, ...) - * - * Those may be used to output information. - */ - -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ -#ifndef VERBOSE -#define VERBOSE 1 -#endif - -#define WITH_SYNCHRO - - -/********************************************************************************************/ -/*********************************** Test cases *****************************************/ -/********************************************************************************************/ - -char do_it = 1; -unsigned long count_ope = 0; -#ifdef WITH_SYNCHRO -sem_t semsig1; -sem_t semsig2; -unsigned long count_sig = 0; -#endif - -sigset_t usersigs; - -typedef struct -{ - int sig; -#ifdef WITH_SYNCHRO - sem_t *sem; -#endif -} - -thestruct; - -/* the following function keeps on sending the signal to the process */ -void * sendsig ( void * arg ) -{ - thestruct * thearg = ( thestruct * ) arg; - int ret; - pid_t process; - - process = getpid(); - - /* We block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in signal thread" ); - } - - while ( do_it ) - { -#ifdef WITH_SYNCHRO - - if ( ( ret = sem_wait( thearg->sem ) ) ) - { - UNRESOLVED( errno, "Sem_wait in sendsig" ); - } - - count_sig++; -#endif - - ret = kill( process, thearg->sig ); - - if ( ret != 0 ) - { - UNRESOLVED( errno, "Kill in sendsig" ); - } - - } - - return NULL; -} - -/* Next are the signal handlers. */ -/* This one is registered for signal SIGUSR1 */ -void sighdl1( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig1 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 1" ); - } - -#endif -} - -/* This one is registered for signal SIGUSR2 */ -void sighdl2( int sig ) -{ -#ifdef WITH_SYNCHRO - - if ( sem_post( &semsig2 ) ) - { - UNRESOLVED( errno, "Sem_post in signal handler 2" ); - } - -#endif -} - -int init_ctl; -/* Init function */ -void initializer( void ) -{ - init_ctl++; - return ; -} - - -/* Test function -- calls pthread_equal() and checks that EINTR is never returned. */ -void * test( void * arg ) -{ - int ret = 0; - pthread_once_t once_ctl; - - /* We don't block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_UNBLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to unblock SIGUSR1 and SIGUSR2 in worker thread" ); - } - - - while ( do_it ) - { - count_ope++; - - once_ctl = PTHREAD_ONCE_INIT; - init_ctl = 0; - - ret = pthread_once( &once_ctl, initializer ); - - if ( ret == EINTR ) - { - FAILED( "pthread_once returned EINTR" ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_once failed" ); - } - - ret = pthread_once( &once_ctl, initializer ); - - if ( ret == EINTR ) - { - FAILED( "pthread_once returned EINTR" ); - } - - if ( ret != 0 ) - { - UNRESOLVED( ret, "pthread_once failed" ); - } - - if ( init_ctl != 1 ) - { - output( "init_ctl:%d\n", init_ctl ); - FAILED( "The initializer did not execute as expected" ); - } - - } - - return NULL; -} - -/* Main function */ -int main ( int argc, char * argv[] ) -{ - int ret; - pthread_t th_work, th_sig1, th_sig2; - thestruct arg1, arg2; - - struct sigaction sa; - - /* Initialize output routine */ - output_init(); - - /* We need to register the signal handlers for the PROCESS */ - sigemptyset ( &sa.sa_mask ); - sa.sa_flags = 0; - sa.sa_handler = sighdl1; - - if ( ( ret = sigaction ( SIGUSR1, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler1" ); - } - - sa.sa_handler = sighdl2; - - if ( ( ret = sigaction ( SIGUSR2, &sa, NULL ) ) ) - { - UNRESOLVED( ret, "Unable to register signal handler2" ); - } - - /* We prepare a signal set which includes SIGUSR1 and SIGUSR2 */ - sigemptyset( &usersigs ); - - ret = sigaddset( &usersigs, SIGUSR1 ); - - ret |= sigaddset( &usersigs, SIGUSR2 ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to add SIGUSR1 or 2 to a signal set" ); - } - - /* We now block the signals SIGUSR1 and SIGUSR2 for this THREAD */ - ret = pthread_sigmask( SIG_BLOCK, &usersigs, NULL ); - - if ( ret != 0 ) - { - UNRESOLVED( ret, "Unable to block SIGUSR1 and SIGUSR2 in main thread" ); - } - -#ifdef WITH_SYNCHRO - if ( sem_init( &semsig1, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig1 init" ); - } - - if ( sem_init( &semsig2, 0, 1 ) ) - { - UNRESOLVED( errno, "Semsig2 init" ); - } - -#endif - - if ( ( ret = pthread_create( &th_work, NULL, test, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread creation failed" ); - } - - arg1.sig = SIGUSR1; - arg2.sig = SIGUSR2; -#ifdef WITH_SYNCHRO - arg1.sem = &semsig1; - arg2.sem = &semsig2; -#endif - - - - if ( ( ret = pthread_create( &th_sig1, NULL, sendsig, ( void * ) & arg1 ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread creation failed" ); - } - - if ( ( ret = pthread_create( &th_sig2, NULL, sendsig, ( void * ) & arg2 ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread creation failed" ); - } - - - - /* Let's wait for a while now */ - sleep( 1 ); - - - /* Now stop the threads and join them */ - do - { - do_it = 0; - } - while ( do_it ); - - - if ( ( ret = pthread_join( th_sig1, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 1 sender thread join failed" ); - } - - if ( ( ret = pthread_join( th_sig2, NULL ) ) ) - { - UNRESOLVED( ret, "Signal 2 sender thread join failed" ); - } - - - if ( ( ret = pthread_join( th_work, NULL ) ) ) - { - UNRESOLVED( ret, "Worker thread join failed" ); - } - - -#if VERBOSE > 0 - output( "Test executed successfully.\n" ); - - output( " %d initializations.\n", count_ope ); - -#ifdef WITH_SYNCHRO - output( " %d signals were sent meanwhile.\n", count_sig ); - -#endif - #endif - PASSED; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/Jamfile deleted file mode 100644 index 6f93cbba79..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/Jamfile +++ /dev/null @@ -1,11 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_once ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest pthread_once_1-1 : 1-1.c ; -SimpleTest pthread_once_1-2 : 1-2.c ; -SimpleTest pthread_once_1-3 : 1-3.c ; -SimpleTest pthread_once_2-1 : 2-1.c ; -#SimpleTest pthread_once_3-1 : 3-1.c ; -#SimpleTest pthread_once_4-1 : 4-1.c ; -#SimpleTest pthread_once_6-1 : 6-1.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.c deleted file mode 100644 index b313cfd260..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following function are defined: - * void output_init() - * void output_fini() - * void output(char * string, ...) - * - * The are used to output informative text (as a printf). - */ - -#include -#include - -/* We use a mutex to avoid conflicts in traces */ -static pthread_mutex_t m_trace = PTHREAD_MUTEX_INITIALIZER; - -/*****************************************************************************************/ -/******************************* stdout module *****************************************/ -/*****************************************************************************************/ -/* The following functions will output to stdout */ -#if (1) -static void output_init() -{ - /* do nothing */ - return; -} -static void output( char * string, ... ) -{ - va_list ap; - char *ts="[??:??:??]"; - struct tm * now; - time_t nw; - - pthread_mutex_lock(&m_trace); - nw = time(NULL); - now = localtime(&nw); - if (now == NULL) - printf(ts); - else - printf("[%2.2d:%2.2d:%2.2d]", now->tm_hour, now->tm_min, now->tm_sec); - va_start( ap, string); - vprintf(string, ap); - va_end(ap); - pthread_mutex_unlock(&m_trace); -} -static void output_fini() -{ - /*do nothing */ - return; -} -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.h b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.h deleted file mode 100644 index 96543ac39e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_once/testfrmw.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2004, Bull S.A.. All rights reserved. - * Created by: Sebastien Decugis - - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it would be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write the Free Software Foundation, Inc., 59 - * Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - - - * This file is a wrapper to use the tests from the NPTL Test & Trace Project - * with either the Linux Test Project or the Open POSIX Test Suite. - - * The following macros are defined here: - * UNRESOLVED(ret, descr); - * where descr is a description of the error and ret is an int (error code for example) - * FAILED(descr); - * where descr is a short text saying why the test has failed. - * PASSED(); - * No parameter. - * - * Both three macros shall terminate the calling process. - * The testcase shall not terminate without calling one of those macros. - * - * - */ - -#include "posixtest.h" -#include /* for the strerror() routine */ - - -#ifdef __GNUC__ /* We are using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test %s unresolved: got %i (%s) on line %i (%s)\n", __FILE__, x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test %s FAILED: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("File %s cannot test: %s\n", __FILE__, s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#else /* not using GCC */ - - #define UNRESOLVED(x, s) \ - { output("Test unresolved: got %i (%s) on line %i (%s)\n", x, strerror(x), __LINE__, s); \ - output_fini(); \ - exit(PTS_UNRESOLVED); } - - #define FAILED(s) \ - { output("Test FAILED: %s\n", s); \ - output_fini(); \ - exit(PTS_FAIL); } - - #define PASSED \ - output_fini(); \ - exit(PTS_PASS); - - #define UNTESTED(s) \ -{ output("Unable to test: %s\n", s); \ - output_fini(); \ - exit(PTS_UNTESTED); \ -} - -#endif diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/1-1.c deleted file mode 100644 index b3038f3dbf..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/1-1.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: bing.wei.liu 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. - - * Test that pthread_setspecific() - * - * shall associate a thread-specific value with a key obtained via a previouse call to - * pthread_key_create. Different threads may bind different values to the same key. - * Calling pthread_setspecific with a key value not obtiained from pthread_key_create of after - * the key has been deleted with pthread_key_delete is undefined. - * - * Steps: - * 1. Create NUM_OF_KEYS pthread_key_t objects - * 2. Set each key to a thread-specific value with pthread_setspecific() - * 3. Call pthread_getspecific() on each key and check that the value returned is correct. - * - */ - -#include -#include -#include -#include -#include "posixtest.h" - -#define NUM_OF_KEYS 10 -#define KEY_VALUE 0 - -int main() -{ - pthread_key_t keys[NUM_OF_KEYS]; - int i; - void* rc; - - for(i = 0;i -#include -#include -#include -#include "posixtest.h" - -#define KEY_VALUE_1 100 -#define KEY_VALUE_2 200 - -pthread_key_t key; -void* rc1; -void* rc2; - -void *a_thread_func() -{ - /* Bind a value to key for this thread (this will be different from the value - * that we bind for the main thread) */ - if(pthread_setspecific(key, (void *)(KEY_VALUE_2)) != 0) - { - printf("pthread_setspecific_1-2 Test FAILED: Could not set the value of the key to %d\n", (KEY_VALUE_2)); - pthread_exit((void*)PTS_FAIL); - return NULL; - } - - /* Get the bound value of the key that we just set. */ - rc2 = pthread_getspecific(key); - - pthread_exit(0); - return NULL; - -} - -int main() -{ - pthread_t new_th; - - /* Create the key */ - if(pthread_key_create(&key, NULL) != 0) - { - printf("pthread_setspecific_1-2 Error: pthread_key_create() failed\n"); - return PTS_UNRESOLVED; - } - - /* Bind a value for this main thread */ - if(pthread_setspecific(key, (void *)(KEY_VALUE_1)) != 0) - { - printf("pthread_setspecific_1-2 Test FAILED: Could not set the value of the key to %d\n", (KEY_VALUE_1)); - return PTS_FAIL; - } - - /* Create another thread. This thread will also bind a value to the key */ - if(pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - printf("pthread_setspecific_1-2 Error: in pthread_create()\n"); - return PTS_UNRESOLVED; - } - - /* Wait for thread to end execution */ - pthread_join(new_th, NULL); - - /* Get the value associated for the key in this main thread */ - rc1 = pthread_getspecific(key); - - /* Compare this value with the value associated for the key in the newly created - * thread, they should be different. */ - if(rc1 != (void *)(KEY_VALUE_1)) - { - printf("pthread_setspecific_1-2 Test FAILED: Incorrect value bound to key, expected %d, got %ld\n", KEY_VALUE_1, (long)rc1); - return PTS_FAIL; - } - - if(rc2 != (void *)(KEY_VALUE_2)) - { - printf("pthread_setspecific_1-2 Test FAILED: Incorrect value bound to key, expected %d, got %ld\n", KEY_VALUE_2, (long)rc2); - return PTS_FAIL; - } - - printf("%spthread_setspecific_1-2:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/Jamfile deleted file mode 100644 index f310a723a0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/pthread_setspecific/Jamfile +++ /dev/null @@ -1,7 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces pthread_setspecific ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest pthread_setspecific_1-1 : 1-1.c ; -SimpleTest pthread_setspecific_1-2 : 1-2.c ; - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/1-1.c deleted file mode 100644 index 649073f60f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/1-1.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 sighold on that SIGABRT. - 3. Raise a SIGABRT and verify that the signal handler was not called. - - -*/ - -#define _XOPEN_SOURCE 600 - -#include -#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; - } - - if (sighold(SIGABRT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - sleep(1); - if (handler_called) { - printf("FAIL: Signal was not blocked\n"); - return PTS_FAIL; - } - - printf("%ssighold_1-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/2-1.c deleted file mode 100644 index e513e9bb37..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/2-1.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 sighold returns a 0 here, test passes. - -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - - if ((int)sighold(SIGABRT) != 0) { - perror("sighold failed -- returned -- test aborted"); - return PTS_UNRESOLVED; - } - printf("%ssighold_2-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/3-core-buildonly.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/3-core-buildonly.c deleted file mode 100644 index 64e5c95e18..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/3-core-buildonly.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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, sighold() should return -1 and set - errno to EINVAL - - The invalid signal passed to sighold() depends on the argument passed to this program. - There are currently 4 invalid signals. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -jmp_buf sig11_recover; -void sig11_handler(int sig); - -int main(int argc, char *argv[]) -{ - int signo, TEST_RETURN; - struct sigaction sa, osa; - - 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; - } - - /* special sig11 case */ - sa.sa_handler = &sig11_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - - sigaction(SIGSEGV, NULL, &osa); - sigaction(SIGSEGV, &sa, NULL); - - if (setjmp(sig11_recover)) { - errno = EINVAL; - TEST_RETURN=-2; - } else { - TEST_RETURN=sighold(signo); - } - sigaction(SIGSEGV, &osa, NULL); - - if (TEST_RETURN == -1) { - if (EINVAL == errno) { - printf("%ssighold_3-core-buildonly%s:%s %s PASSED%s\n", boldOn, argv[1], boldOff, green, normal); - return PTS_PASS; - } else { - printf ("errno not set to EINVAL\n"); - return PTS_FAIL; - } - } - if (TEST_RETURN == -2) { - printf ("test received SIGSEGV\n"); - return PTS_UNRESOLVED; - } - - printf("sighold did not return -1\n"); - return PTS_FAIL; -} - -/****************************************************************** - * sig11_handler() - our segfault recover hack - ******************************************************************/ -void -sig11_handler(int sig) -{ - longjmp(sig11_recover, 1); -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/Jamfile deleted file mode 100644 index d3fbe02c8d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sighold/Jamfile +++ /dev/null @@ -1,7 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sighold ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest sighold_1-1 : 1-1.c ; -SimpleTest sighold_2-1 : 2-1.c ; -SimpleTest sighold_3-core-buildonly : 3-core-buildonly.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 deleted file mode 100644 index 4d48cdf843..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/1-1.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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("%ssigignore_1-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - 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 deleted file mode 100644 index a2bcd898ec..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/4-1.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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("%ssigignore_4-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - 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 deleted file mode 100644 index c6f3835c2f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/5-core-buildonly.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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("%ssigignore_5-core-buildonly%s:%s%sPASSED%s\n", boldOn, argv[1], boldOff, green, normal); - 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 deleted file mode 100644 index 6241e23c72..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/6-1.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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("%ssigignore_6-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - 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 deleted file mode 100644 index 39744a9093..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/6-2.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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("%ssigignore_6-2:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - 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 deleted file mode 100644 index 3bf4cfe03b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigignore/Jamfile +++ /dev/null @@ -1,9 +0,0 @@ -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/signal/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/1-1.c deleted file mode 100644 index 81f8dcb6c8..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/1-1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 func parameter is SIG_DFL. - - How this program tests this assertion by setting up a handler - "myhandler" for SIGCHLD. Then another call to signal() 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. - -*/ - -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void myhandler(int signo) -{ - printf("signal_1-1: SIGCHLD called. Inside handler\n"); - handler_called = 1; -} - -int main() -{ - if (signal(SIGCHLD, myhandler) == SIG_ERR) { - perror("Unexpected error while using signal()"); - return PTS_UNRESOLVED; - } - - if (signal(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("%ssignal_1-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/2-1.c deleted file mode 100644 index 97589c0921..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/2-1.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 func parameter is SIG_IGN. - - How this program tests this assertion is by setting up a handler - "myhandler" for SIGCHLD. Then another call to signal() is made about - SIGCHLD, this time with SIG_IGN as the value of the func parameter. - SIGCHLD should be ignored now, so unless myhandler gets called when - SIGCHLD is raised, the test passes, otherwise returns failure. - -*/ - -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void myhandler(int signo) -{ - printf("signal_2-1: SIGCHLD called. Inside handler\n"); - handler_called = 1; -} - -int main() -{ - if (signal(SIGCHLD, myhandler) == SIG_ERR) { - perror("Unexpected error while using signal()"); - return PTS_UNRESOLVED; - } - - if (signal(SIGCHLD,SIG_IGN) != 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("%ssignal_2-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/3-1.c deleted file mode 100644 index 8b29a5c74f..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/3-1.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 func parameter is SIG_IGN. - - 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. - -*/ - -#include -#include -#include -#include "posixtest.h" - -int handler_called = 0; - -void myhandler(int signo) -{ - /* printf("signal_3-1: SIGCHLD called. Inside handler\n"); */ - handler_called = 1; -} - -int main() -{ - if (signal(SIGCHLD, myhandler) == SIG_ERR) { - 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("%ssignal_3-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/5-1.c deleted file mode 100644 index 5cbb348d15..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/5-1.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 function shall return - the function name of the last signal handler that was associated with - sig. - - How this program tests this assertion is by setting up handlers - SIGUSR1_handler and SIGUSR2_handler for signals SIGUSR1 and SIGUSR2 - respectively. A third call to signal() is made regarding signal SIGUSR1. - If this call returns anything but SIGUSR1_handler, fail the test, - otherwise the test passes. - -*/ - -#include -#include -#include -#include "posixtest.h" - -void SIGUSR1_handler(int signo) -{ - printf("signal_5-1: inside SIGUSR1_handler\n"); -} - -void SIGUSR2_handler(int signo) -{ - printf("signal_5-1: inside SIGUSR2_handler\n"); -} - -int main() -{ - if (signal(SIGUSR1, SIGUSR1_handler) == SIG_ERR) { - perror("Unexpected error while using signal()"); - return PTS_UNRESOLVED; - } - - if (signal(SIGUSR2, SIGUSR2_handler) == SIG_ERR) { - perror("Unexpected error while using signal()"); - return PTS_UNRESOLVED; - } - - if (signal(SIGUSR1,SIG_IGN) != SIGUSR1_handler) { - printf("signal did not return the last handler that was associated with SIGUSR1\n"); - return PTS_FAIL; - } - printf("%ssignal_5-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/6-1.c deleted file mode 100644 index b812aa4caa..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/6-1.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 signal() shall return SIG_ERR - and set errno to a positive value if an invalid signal number was - passed to it. - -*/ - -#include -#include -#include -#include -#include "posixtest.h" - -void myhandler(int signo) -{ - printf("signal_6-1: inside handler\n"); -} - -int main() -{ - errno = 0; - - if (signal(-1, myhandler) != SIG_ERR) { - printf("Test FAILED: signal() didn't return SIG_ERR even though invalid signal number was passed to it\n"); - return PTS_FAIL; - } - - if (errno != EINVAL) { - 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("%ssignal_6-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/7-1.c deleted file mode 100644 index 00ee683e8d..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/7-1.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 signal() shall return SIG_ERR - and set errno to a positive value if an invalid signal number was - passed to it. - -*/ - -#include -#include -#include -#include -#include "posixtest.h" - -void myhandler(int signo) -{ - printf("signal_7-1: inside handler\n"); -} - -int main() -{ - errno = 0; - - if (signal(SIGKILL, myhandler) != SIG_ERR) { - printf("Test FAILED: signal() didn't return SIG_ERR even though a non-catchable signal was passed to it\n"); - return PTS_FAIL; - } - - if (errno != EINVAL) { - 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("%ssignal_7-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/Jamfile deleted file mode 100644 index 3711fd4bdc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/signal/Jamfile +++ /dev/null @@ -1,10 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces signal ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest signal_1-1 : 1-1.c ; -SimpleTest signal_2-1 : 2-1.c ; -SimpleTest signal_3-1 : 3-1.c ; -SimpleTest signal_5-1 : 5-1.c ; -SimpleTest signal_6-1 : 6-1.c ; -SimpleTest signal_7-1 : 7-1.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/12-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/12-1.c deleted file mode 100644 index 2e4f435492..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigprocmask/12-1.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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 the signal mask to only having SIGABRT. - 2. Call sigprocmask again, this time with a randomly generated value of - how that is checked to make sure it does not equal any of the three defined - values of how which are SIG_SETMASK, SIG_BLOCK, or SIG_UNBLOCK. This should - cause sigprocmask() to return -1. For the second parameter in the sigprocmask() - function, use a set which contains SIGABRT and SIGALRM. - 3. Now verify using the is_changed() function that the only signal that is still - in the signal mask is SIGABRT. Neither SIGALRM nor any other signal should be - in the signal mask of the process. - -*/ - -#include -#include -#include -#include "posixtest.h" - -#define NUMSIGNALS 25 - -int is_changed(sigset_t set) { - - int i; - int siglist[] = {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 -#include -#include "posixtest.h" - -#define NUMSIGNALS 26 - -int is_changed(sigset_t set, int sig) { - - 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 }; - - if (sigismember(&set, sig) != 1) { - return 1; - } - for (i=0; i -#include -#include "posixtest.h" - -#define NUMSIGNALS 26 - -int is_changed(sigset_t set, int sig) { - - 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 }; - - if (sigismember(&set, sig) != 1) { - return 1; - } - for (i=0; i -#include -#include "posixtest.h" - -#define NUMSIGNALS 26 - -int is_changed(sigset_t set, int sig) { - - 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 }; - - if (sigismember(&set, sig) != 1) { - return 1; - } - for (i=0; i -#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; - } - - sighold(SIGABRT); - - if (raise(SIGABRT) == -1) { - perror("Unexpected error while attempting to setup test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - if (handler_called) { - printf("UNRESOLVED. possible problem in sigrelse\n"); - return PTS_UNRESOLVED; - } - - if (sigrelse(SIGABRT) == -1) { - printf("UNRESOLVED. possible problem in sigrelse\n"); - return PTS_UNRESOLVED; - } - - sleep(1); - - if (handler_called) { - printf("%ssigrelse_1-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; - } - printf("FAIL\n"); - return PTS_FAIL; -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/2-1.c deleted file mode 100644 index e6eab22fcc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/2-1.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 sigrelse returns a 0 here, test passes. - -*/ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include "posixtest.h" - -int main() -{ - - if ((int)sigrelse(SIGABRT) != 0) { - perror("sigrelse failed -- returned -- test aborted"); - return PTS_UNRESOLVED; - } - printf("%ssigrelse_2-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/3-core-buildonly.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/3-core-buildonly.c deleted file mode 100644 index dd5d3799ac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/3-core-buildonly.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 sigrelse(). - After sighold is called on an invalid signal, sigrelse() should -return -1 and set errno to EINVAL - - The invalid signal passed to sigrelse() depends on the argument -passed to this program. - There are currently 4 invalid signals. - */ - -#define _XOPEN_SOURCE 600 - -#include -#include -#include -#include -#include -#include "posixtest.h" - -jmp_buf sig11_recover; -void sig11_handler(int sig); - -int main(int argc, char *argv[]) -{ - int signo, TEST_RETURN; - struct sigaction sa, osa; - - 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; - } - - /* special sig11 case */ - sa.sa_handler = &sig11_handler; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - - sigaction(SIGSEGV, NULL, &osa); - sigaction(SIGSEGV, &sa, NULL); - - if (setjmp(sig11_recover)) { - errno = EINVAL; - TEST_RETURN=-2; - } else { - TEST_RETURN=sigrelse(signo); - } - sigaction(SIGSEGV, &osa, NULL); - - if (TEST_RETURN == -1) { - if (EINVAL == errno) { - printf("%ssigrelse_3-core-buildonly%s:%s %sPASSED%s\n", boldOn, argv[1], boldOff, green, normal); - return PTS_PASS; - } else { - printf ("errno not set to EINVAL\n"); - return PTS_FAIL; - } - } - if (TEST_RETURN == -2) { - printf ("test received SIGSEGV\n"); - return PTS_UNRESOLVED; - } - - printf("sigrelse did not return -1\n"); - return PTS_FAIL; - -} - -/****************************************************************** - * sig11_handler() - our segfault recover hack - ******************************************************************/ -void -sig11_handler(int sig) -{ - longjmp(sig11_recover, 1); -} - - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/Jamfile deleted file mode 100644 index 31ae8c5341..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigrelse/Jamfile +++ /dev/null @@ -1,7 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigrelse ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest sigrelse_1-1 : 1-1.c ; -SimpleTest sigrelse_2-1 : 2-1.c ; -SimpleTest sigrelse_3-core-buildonly : 3-core-buildonly.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/1-1.c deleted file mode 100644 index 068c40aec2..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/1-1.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 -#include -#include -#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("%ssigset_1-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/10-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/10-1.c deleted file mode 100644 index 33e65a73b9..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/10-1.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 -#include -#include -#include -#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("%ssigset_10-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/2-1.c deleted file mode 100644 index 04deca78d3..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/2-1.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 -#include -#include -#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("%ssigset_2-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/3-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/3-1.c deleted file mode 100644 index f8ef184289..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/3-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 -#include -#include -#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("%ssigset_3-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/4-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/4-1.c deleted file mode 100644 index 160a4790bc..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/4-1.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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 -#include -#include -#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("%ssigset_4-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/5-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/5-1.c deleted file mode 100644 index 50d53d98c7..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/5-1.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 -#include -#include -#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 -#include -#include -#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("%ssigset_6-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/7-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/7-1.c deleted file mode 100644 index 6b055363ac..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/7-1.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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 -#include -#include -#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("%ssigset_7-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/8-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/8-1.c deleted file mode 100644 index 268117b977..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/8-1.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 -#include -#include -#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("%ssigset_8-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/9-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/9-1.c deleted file mode 100644 index 961a08b1b0..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/9-1.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 -#include -#include -#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("%ssigset_9-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; -} diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/Jamfile deleted file mode 100644 index 19ba602d90..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigset/Jamfile +++ /dev/null @@ -1,14 +0,0 @@ -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 ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/6-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/6-1.c deleted file mode 100644 index fff60cb24b..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/6-1.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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. - - Assumption: The test assumes that this program is run under normal conditions, - and not when the processor and other resources are too stressed. - - Steps: - 1. Fork() a child process. Have the child suspend itself. - 2. From the parent, send the child a SIGUSR1 signal so that the child returns from - suspension. - 3. In the child process, make sure that sigsuspend returns a -1 and pass that info - to the parent process. - -*/ - -#include -#include -#include -#include -#include -#include -#include "posixtest.h" - -void handler(int signo) -{ - /* printf("sigsuspend_6-1: Now inside signal handler\n"); */ -} - -int main() -{ - pid_t pid; - pid = fork(); - - if (pid == 0) { - /* child */ - - sigset_t tempmask; - - struct sigaction act; - - act.sa_handler = handler; - act.sa_flags=0; - sigemptyset(&act.sa_mask); - - sigemptyset(&tempmask); - - if (sigaction(SIGUSR1, &act, 0) == -1) { - perror("sigsuspend_6-1: Unexpected error while attempting to pre-conditions"); - return 3; - } - - /* printf("sigsuspend_6-1: suspending child\n"); */ - if (sigsuspend(&tempmask) != -1) { - perror("sigsuspend_6-1: sigsuspend error"); - return 1; - } - /* printf("sigsuspend_6-1: returned from suspend\n"); */ - - sleep(1); - return 2; - - } else { - int s; - int exit_status; - - /* parent */ - sleep(1); - - /* printf("sigsuspend_6-1: parent sending child a SIGUSR1 signal\n"); */ - kill (pid, SIGUSR1); - - if (wait(&s) == -1) { - perror("sigsuspend_6-1: Unexpected error while setting up test " - "pre-conditions"); - return PTS_UNRESOLVED; - } - - exit_status = WEXITSTATUS(s); - - /* printf("sigsuspend_6-1: Exit status from child is %d\n", exit_status); */ - - if (exit_status == 1) { - printf("sigsuspend_6-1: Test FAILED\n"); - return PTS_FAIL; - } - - if (exit_status == 2) { - printf("%ssigsuspend_6-1:%s %sPASSED%s\n", boldOn, boldOff, green, normal); - return PTS_PASS; - } - - if (exit_status == 3) { - return PTS_UNRESOLVED; - } - - printf("sigsuspend_6-1: Child didn't exit with any of the expected return codes\n"); - return PTS_UNRESOLVED; - } -} - diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/Jamfile deleted file mode 100644 index c7c9abbfa5..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/sigsuspend/Jamfile +++ /dev/null @@ -1,5 +0,0 @@ -SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigsuspend ; - -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; - -SimpleTest sigsuspend_6-1 : 6-1.c ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/include/posixtest.h b/src/tests/system/libroot/posix/posixtestsuite/include/posixtest.h deleted file mode 100644 index 6b4fae6f7e..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/include/posixtest.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer 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. - */ - -/* - * return codes - */ -#define PTS_PASS 0 -#define PTS_FAIL 1 -#define PTS_UNRESOLVED 2 -#define PTS_UNSUPPORTED 4 -#define PTS_UNTESTED 5 - -/* colors */ -const char* const normal = "\033[0m"; -const char* const green = "\033[32m"; -const char* const red = "\033[31m"; - -const char* const boldOn = "\033[1m"; -const char* const boldOff = "\033[22m"; diff --git a/src/tests/system/libroot/posix/posixtestsuite/run_posix_tests.sh b/src/tests/system/libroot/posix/posixtestsuite/run_posix_tests.sh deleted file mode 100644 index 717ee36780..0000000000 --- a/src/tests/system/libroot/posix/posixtestsuite/run_posix_tests.sh +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/sh - -usage() -{ - cat <