Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Right-click on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(40) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(205) |
Feb
(281) |
Mar
(428) |
Apr
(444) |
May
(137) |
Jun
(341) |
Jul
(509) |
Aug
(184) |
Sep
(51) |
Oct
(70) |
Nov
(52) |
Dec
(41) |
2004 |
Jan
(27) |
Feb
|
Mar
|
Apr
(99) |
May
(562) |
Jun
(36) |
Jul
(74) |
Aug
(61) |
Sep
(33) |
Oct
(76) |
Nov
(64) |
Dec
(71) |
2005 |
Jan
(19) |
Feb
(28) |
Mar
(726) |
Apr
(310) |
May
(325) |
Jun
(496) |
Jul
(192) |
Aug
(72) |
Sep
(41) |
Oct
(294) |
Nov
(79) |
Dec
(64) |
2006 |
Jan
(112) |
Feb
(267) |
Mar
(33) |
Apr
(16) |
May
(121) |
Jun
(77) |
Jul
(43) |
Aug
(281) |
Sep
(97) |
Oct
(19) |
Nov
(15) |
Dec
(50) |
2007 |
Jan
(2) |
Feb
(31) |
Mar
(21) |
Apr
(76) |
May
(36) |
Jun
(97) |
Jul
(93) |
Aug
(85) |
Sep
(77) |
Oct
(35) |
Nov
(106) |
Dec
(81) |
2008 |
Jan
(86) |
Feb
(139) |
Mar
(378) |
Apr
(127) |
May
(196) |
Jun
(108) |
Jul
(136) |
Aug
(137) |
Sep
(114) |
Oct
(229) |
Nov
(312) |
Dec
(180) |
2009 |
Jan
(747) |
Feb
(907) |
Mar
(371) |
Apr
(174) |
May
(192) |
Jun
(163) |
Jul
(744) |
Aug
(495) |
Sep
(85) |
Oct
(950) |
Nov
(311) |
Dec
(180) |
2010 |
Jan
(303) |
Feb
(33) |
Mar
(9) |
Apr
|
May
(1) |
Jun
(4) |
Jul
(18) |
Aug
(37) |
Sep
(2) |
Oct
(2) |
Nov
(6) |
Dec
(3) |
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
(1) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(17) |
Nov
(1) |
Dec
|
2013 |
Jan
(7) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(1) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(5) |
2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(3) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(2) |
2016 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2017 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
|
2
|
3
|
4
(472) |
5
(4) |
6
(1) |
7
(1) |
8
|
9
|
10
(3) |
11
(8) |
12
(1) |
13
|
14
(5) |
15
|
16
|
17
(1) |
18
(11) |
19
(1) |
20
(2) |
21
(3) |
22
(1) |
23
|
24
(3) |
25
(3) |
26
(19) |
27
(21) |
28
|
29
(1) |
30
|
31
(1) |
|
|
|
|
|
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:55:24
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/functional/threads/robust_test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5470/functional/threads/robust_test Added Files: Makefile robust1-mode2.c robust1-sun.c robust2-mode2.c robust2-sun.c robust3-mode2.c run.sh Log Message: Update 1.4.1 --- NEW FILE: robust1-sun.c --- /* * Copyright (c) 2003, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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. */ /* Sun Mode * There are several threads that share a mutex, when the owner of mutex is * dead, a waiter locks the mutex and will get EOWNERDEAD. In * PTHREAD_MUTEX_ROBUST_SUN_NP Mode, if the owner didn't call * pthread_mutex_consistent_np(), the mutex will be set to * ENOTRECOVERABLE state when unlocked automatically. */ #include <pthread.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <stdlib.h> #include "test.h" #define THREAD_NUM 2 pthread_mutex_t mutex; void *thread_1(void *arg) { pthread_mutex_lock(&mutex); DPRINTF(stdout,"Thread 1 locked the mutex\n"); pthread_exit(NULL); return NULL; } void *thread_2(void *arg) { int rc = 0; pthread_t self = pthread_self(); int policy = SCHED_FIFO; struct sched_param param; memset(¶m, 0, sizeof(param)); param.sched_priority = sched_get_priority_min(policy); rc = pthread_setschedparam(self, policy, ¶m); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_setschedparam: %d %s", rc, strerror(rc)); exit(UNRESOLVED); } if (pthread_mutex_lock(&mutex) != EOWNERDEAD) { EPRINTF("FAIL: pthread_mutex_lock didn't return EOWNERDEAD"); exit(FAIL); } DPRINTF(stdout,"Thread 2 lock the mutex and return EOWNERDEAD\n"); pthread_mutex_unlock(&mutex); if (pthread_mutex_lock(&mutex) != ENOTRECOVERABLE) { EPRINTF("FAIL: The mutex did not transit to ENOTRECOVERABLE" "state when unlocked in Sun compatibility mode"); pthread_mutex_unlock(&mutex); exit(FAIL); } pthread_exit(NULL); return NULL; } int main() { pthread_mutexattr_t attr; pthread_t threads[THREAD_NUM]; pthread_attr_t threadattr; int rc; rc = pthread_mutexattr_init(&attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_SUN_NP); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_setrobust_np %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_mutex_init(&mutex, &attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_attr_init(&threadattr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_attr_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_create(&threads[0], &threadattr, thread_1, NULL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_create %d %s", rc, strerror(rc)); return UNRESOLVED; } pthread_join(threads[0], NULL); DPRINTF(stdout,"Thread 1 exit without unlock...\n"); rc = pthread_create(&threads[1], &threadattr, thread_2, NULL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_create %d %s", rc, strerror(rc)); return UNRESOLVED; } pthread_join(threads[1], NULL); DPRINTF(stdout,"Thread 2 exit... \n"); DPRINTF(stdout,"PASS: Test PASSED\n"); return PASS; } --- NEW FILE: robust1-mode2.c --- /* * Copyright (c) 2003, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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. */ /* In x-mode * There are several threads that shared a mutex, when the owner of the mutex * is dead, a waiter that locks the mutex shall get EOWNERDEAD. In * PTHREAD_MUTEX_ROBUST_NP Mode, if the owner didn't call * pthread_mutex_setconsistency_np, the mutex will not transit state to * ENOTRECOVERABLE state after unlock. */ #include <pthread.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <stdlib.h> #include "test.h" #define THREAD_NUM 2 pthread_mutex_t mutex; void *thread_1(void *arg) { pthread_mutex_lock(&mutex); DPRINTF(stdout,"Thread 1 locked the mutex\n"); pthread_exit(NULL); return NULL; } void *thread_2(void *arg) { int rc; pthread_t self = pthread_self(); int policy = SCHED_FIFO; struct sched_param param; memset(¶m, 0, sizeof(param)); param.sched_priority = sched_get_priority_min(policy); rc = pthread_setschedparam(self, policy, ¶m); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_setschedparam %d %s", rc, strerror(rc)); exit(UNRESOLVED); } rc = pthread_mutex_lock(&mutex); if (rc != EOWNERDEAD) { EPRINTF("FAIL: pthread_mutex_lock didn't return EOWNERDEAD"); exit(FAIL); } DPRINTF(stdout,"Thread 2 lock the mutex and return EOWNERDEAD\n"); pthread_mutex_unlock(&mutex); rc = pthread_mutex_lock(&mutex); if (rc != EOWNERDEAD) { EPRINTF("FAIL:The mutex shall remain the state EOWNERDEAD " "after unlocking in x-mode"); pthread_mutex_unlock(&mutex); exit(FAIL); } pthread_exit(NULL); return NULL; } int main() { pthread_mutexattr_t attr; pthread_t threads[THREAD_NUM]; pthread_attr_t threadattr; int rc; rc = pthread_mutexattr_init(&attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_setrobust_np %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_mutex_init(&mutex, &attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_attr_init(&threadattr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_attr_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_create(&threads[0], &threadattr, thread_1, NULL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_create %d %s", rc, strerror(rc)); return UNRESOLVED; } pthread_join(threads[0], NULL); DPRINTF(stdout,"Thread 1 exited without unlocking...\n"); rc = pthread_create(&threads[1], &threadattr, thread_2, NULL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_create %d %s", rc, strerror(rc)); return UNRESOLVED; } pthread_join(threads[1], NULL); DPRINTF(stdout,"Thread 2 exited ...\n"); DPRINTF(stdout,"Test PASSED\n"); return PASS; } --- NEW FILE: robust3-mode2.c --- /* * Copyright (c) 2003, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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. */ /* In x-mode * There are several threads that share a mutex, When the owner of mutex is * dead, a waiter locks the mutex and will get EOWNERDEAD. In * PTHREAD_MUTEX_ROBUST_NP Mode, if the owner can't recover it to * heathy state(not_recoverable state), then calling * pthread_mutex_setconsistency_np will change the mutex state to * ENOTRECOVERABLE. */ #include <pthread.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <stdlib.h> #include "test.h" #define THREAD_NUM 2 pthread_mutex_t mutex; void *thread_1(void *arg) { pthread_mutex_lock(&mutex); DPRINTF(stdout,"Thread 1 locked the mutex \n"); pthread_exit(NULL); return NULL; } void *thread_2(void *arg) { int state; int rc; pthread_t self = pthread_self(); int policy = SCHED_FIFO; struct sched_param param; memset(¶m, 0, sizeof(param)); param.sched_priority = sched_get_priority_min(policy); rc = pthread_setschedparam(self, policy, ¶m); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_setschedparam %d %s", rc, strerror(rc)); exit(UNRESOLVED); } rc = pthread_mutex_lock(&mutex); if (rc != EOWNERDEAD) { EPRINTF("FAIL:pthread_mutex_lock didn't return EOWNERDEAD \n"); exit(FAIL); } DPRINTF(stdout,"Thread 2 lock the mutex and return EOWNERDEAD \n"); state = 1; if (pthread_mutex_setconsistency_np(&mutex, state) == 0) { pthread_mutex_unlock(&mutex); rc = pthread_mutex_lock(&mutex); if (rc != ENOTRECOVERABLE) { EPRINTF("FAIL:The mutex does not set to " "ENOTRECOVERABLE when called " "pthread_mutex_setconsistency_np successfully " "in x-mode"); pthread_mutex_unlock(&mutex); exit(FAIL); } else { DPRINTF(stdout,"PASS: The mutex is set to ENOTRECOVERABLE if " "successfully called " "pthreadmutex_setconsistency_np in x-mode\n"); pthread_mutex_unlock(&mutex); } } else { pthread_mutex_unlock(&mutex); rc = pthread_mutex_lock(&mutex); if (rc != EOWNERDEAD) { EPRINTF("FAIL:The mutex shall not set to " "ENOTRECOVERABLE automaticly after unlock " "if can't recover it to normal state in x-mode"); pthread_mutex_unlock(&mutex); exit(FAIL); } else { DPRINTF(stdout,"PASS: The mutex remains in " "EOWNERDEAD state if the calling to " "pthread_mutex_consistency_np fails " "(Why fails?) in x-mode \n"); pthread_mutex_unlock(&mutex); } } pthread_exit(NULL); return NULL; } int main() { pthread_mutexattr_t attr; pthread_t threads[THREAD_NUM]; pthread_attr_t threadattr; int rc; rc = pthread_mutexattr_init(&attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_setrobust_np %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_mutex_init(&mutex, &attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_attr_init(&threadattr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_attr_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_create(&threads[0], &threadattr, thread_1, NULL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_create %d %s", rc, strerror(rc)); return UNRESOLVED; } pthread_join(threads[0], NULL); DPRINTF(stdout,"Thread 1 exit without unlock the mutex...\n "); rc = pthread_create(&threads[1], &threadattr, thread_2, NULL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_create %d %s", rc, strerror(rc)); return UNRESOLVED; } pthread_join(threads[1], NULL ); DPRINTF(stdout,"Thread 2 exit ...\n "); DPRINTF(stdout,"PASS: Test PASSED\n"); return PASS; } --- NEW FILE: run.sh --- #!/bin/bash declare -i TOTAL=0 declare -i FAIL=0 declare -i PASS=0 Run() { echo "TEST: " $1 TOTAL=$TOTAL+1 ./$1 if [ $? == 0 ]; then PASS=$PASS+1 echo -ne "\t\t\t***TEST PASSED***\n\n" else FAIL=$FAIL+1 echo -ne "\t\t\t***TEST FAILED***\n\n" fi } TESTS="robust1-sun robust2-sun robust1-mode2 robust2-mode2 robust3-mode2" for test in $TESTS; do Run $test done echo -ne "\t\t*****************\n" echo -ne "\t\t* TOTAL: " $TOTAL *"\n" echo -ne "\t\t* PASSED: " $PASS *"\n" echo -ne "\t\t* FAILED: " $FAIL *"\n" echo -ne "\t\t*****************\n" --- NEW FILE: robust2-mode2.c --- /* * Copyright (c) 2003, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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. */ /* In x-mode * There are several threads that share a mutex, when the owner of mutex is * dead, a waiter locks the mutex and will get EOWNERDEAD. In * PTHREAD_MUTEX_ROBUST_NP Mode, if the owner think he can recover it * to heathy state, he will call pthread_mutex_setconsistency_np to * make the mutex consistent, if the call succeeds, the state of the mutex * will change back to normal. */ #include <pthread.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <stdlib.h> #include "test.h" #define THREAD_NUM 2 pthread_mutex_t mutex; void *thread_1(void *arg) { pthread_mutex_lock(&mutex); DPRINTF(stdout,"Thread 1 locked the mutex\n"); pthread_exit(NULL); return NULL; } void *thread_2(void *arg) { int state; int rc; pthread_t self = pthread_self(); int policy = SCHED_FIFO; struct sched_param param; param.sched_priority = sched_get_priority_min(policy); rc = pthread_setschedparam(self, policy, ¶m); if (rc != 0) { EPRINTF("UNRESOLVED: pthreadsetschedparam: %d %s", rc, strerror(rc)); exit(UNRESOLVED); } if (pthread_mutex_lock(&mutex) != EOWNERDEAD) { EPRINTF("FAIL:pthread_mutex_lock didn't return EOWNERDEAD"); exit(FAIL); } DPRINTF(stdout,"Thread 2 lock the mutex and return EOWNERDEAD \n"); state = 0; if (pthread_mutex_setconsistency_np(&mutex,state) == 0) { pthread_mutex_unlock(&mutex); if (pthread_mutex_lock(&mutex) != 0) { EPRINTF("FAIL: The mutex didn't transit to normal " "state when the calling to " "pthread_mutex_setconsistency_np is " "successful in x-mode"); pthread_mutex_unlock(&mutex); exit(FAIL); } else { DPRINTF(stdout,"PASS: The mutex transitted to " "normal state when the calling to " "pthread_mutex_setconsistency_np is " "successful in x-mode \n"); pthread_mutex_unlock(&mutex); } } else { pthread_mutex_unlock(&mutex); if (pthread_mutex_lock(&mutex) != EOWNERDEAD) { EPRINTF("FAIL:The mutex should remain as EOWNERDEAD " "if the calling to " "pthread_mutex_setconsistency_np fails, " "unlock the mutex will not change the state " "in x-mode"); pthread_mutex_unlock(&mutex); exit(FAIL); } else { DPRINTF(stdout,"UNRESOLVED: The mutex remains in " "EOWNERDEAD state when the calling to " "pthread_mutex_setconsistency_np fails " "(why fails?) in x-mode\n"); pthread_mutex_unlock(&mutex); } } pthread_exit(NULL); return NULL; } int main() { pthread_mutexattr_t attr; pthread_t threads[THREAD_NUM]; pthread_attr_t threadattr; int rc; rc = pthread_mutexattr_init(&attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_init: %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_setrobust_np %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_mutex_init(&mutex, &attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_attr_init(&threadattr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_attr_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_create(&threads[0], &threadattr, (void *)thread_1, NULL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_create %d %s", rc, strerror(rc)); return UNRESOLVED; } pthread_join(threads[0], NULL); DPRINTF(stdout,"Thread 1 exit without unlock the mutex...\n"); rc = pthread_create(&threads[1], &threadattr, (void *)thread_2, NULL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_create %d %s", rc, strerror(rc)); return UNRESOLVED; } pthread_join(threads[1], NULL); DPRINTF(stdout,"Thread 2 exit...\n"); DPRINTF(stdout,"PASS: Test PASSED\n"); return PASS; } --- NEW FILE: Makefile --- include ../Makefile.inc SRCS=$(wildcard *.c) TARGETS=$(patsubst %.c,%,$(SRCS)) CFLAGS+=-Wall -g -I../include all:$(TARGETS) clean: rm -rf $(TARGETS) --- NEW FILE: robust2-sun.c --- /* * Copyright (c) 2003, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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. */ /* Sun mode * There are several threads that share a mutex, When the owner of mutex is * dead, a waiter lock the mutex and will get EOWNERDEAD. In * PTHREAD_MUTEX_ROBUST_SUN_NP Mode, if the owner think he can recover it * to heathy state, he will call pthread_mutex_consistent_np to make * the mutex consistent, if the call succeeds, the state of the mutex * will change back to normal, if the call fails, the state of the mutex * will remain as EOWNERDEAD. */ #include <pthread.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <stdlib.h> #include "test.h" #define THREAD_NUM 2 pthread_mutex_t mutex; void *thread_1(void *arg) { pthread_mutex_lock(&mutex); DPRINTF(stdout,"Thread 1 lock the mutex\n"); pthread_exit(NULL); return NULL; } void *thread_2(void *arg) { pthread_t self = pthread_self(); int policy = SCHED_FIFO; struct sched_param param; param.sched_priority = sched_get_priority_min(policy); int rc; rc = pthread_setschedparam(self, policy, ¶m); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_setschedparam: %d %s", rc, strerror(rc)); exit(UNRESOLVED); } if (pthread_mutex_lock(&mutex) != EOWNERDEAD) { EPRINTF("FAIL:pthread_mutex_lock didn't return EOWNERDEAD"); exit(FAIL); } DPRINTF(stdout,"Thread 2 locked the mutex and return EOWNERDEAD\n"); if (pthread_mutex_consistent_np(&mutex) == 0) { pthread_mutex_unlock(&mutex); if (pthread_mutex_lock(&mutex) != 0) { EPRINTF("FAIL: The mutex didn't transit to normal state" " when calling to pthread_mutex_consistent_np" " successfully in Sun Compability mode"); pthread_mutex_unlock(&mutex); exit(FAIL); } else { DPRINTF(stdout,"PASS: The mutex transitted to normal state " "when calling to pthread_mutex_consistent_np " "successfully in Sun compability mode\n"); pthread_mutex_unlock(&mutex); } } else { pthread_mutex_unlock(&mutex); if (pthread_mutex_lock(&mutex) != ENOTRECOVERABLE) { EPRINTF("FAIL:The mutex should remain as EOWNERDEAD " "if call pthread_mutex_consistent_np fails, " "so the mutex will transit to ENOTRECOVERABLE " "when unlocked in Sun compatibility mode"); pthread_mutex_unlock(&mutex); exit(FAIL); } else { DPRINTF(stdout,"PASS: The mutex transitted to ENOTRECOVERABLE " "state when pthread_mutex_consistent_np fails " "in Sun compatibility mode (why fails?)\n"); pthread_mutex_unlock(&mutex); } } pthread_exit(NULL); return NULL; } int main() { pthread_mutexattr_t attr; pthread_t threads[THREAD_NUM]; pthread_attr_t threadattr; int rc; rc = pthread_mutexattr_init(&attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_SUN_NP); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_setrobust_np %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_mutex_init(&mutex, &attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_attr_init(&threadattr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_attr_init %d %s", rc, strerror(rc)); return UNRESOLVED; } rc = pthread_create(&threads[0], &threadattr, thread_1, NULL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_create %d %s", rc, strerror(rc)); return UNRESOLVED; } pthread_join(threads[0], NULL); DPRINTF(stdout,"Thread 1 exited without unlock...\n"); rc = pthread_create(&threads[1], &threadattr, thread_2, NULL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_create %d %s", rc, strerror(rc)); return UNRESOLVED; } pthread_join(threads[1], NULL); DPRINTF(stdout,"Thread 2 exited ...\n"); DPRINTF(stdout,"PASS: Test PASSED\n"); return PASS; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:55:23
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/definitions/sys/shm_h In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5470/conformance/definitions/sys/shm_h Added Files: 1-1.c 10-1.c 11-1.c 12-1.c 12-2.c 12-3.c 2-1.c 2-2.c 3-1.c 4-1.c 5-1.c 6-1.c 7-1.c 7-2.c 7-3.c 7-4.c 8-1.c 9-1.c assertions.xml coverage.txt Log Message: Update 1.4.1 --- NEW FILE: 1-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the sys/shm.h header file exists. */ #include <sys/shm.h> --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XDB6:{Headers:sys/shm.h:SYNOPSIS} pt:XSI"> The sys/shm.h header file exists </assertion> <assertion id="2" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> The header define the folowing symbolic constants: - SHM_RDONLY - SHM_RND </assertion> <assertion id="3" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> The header define the folowing symbolic value: - SHMLBA </assertion> <assertion id="4" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> The header define the folowing type through typedef: - shmatt_t </assertion> <assertion id="5" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> The shmatt_t type is an unsigned integer that must be able to store values at least as large than unsigned short. </assertion> <assertion id="6" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> The header declares struct shmid_ds with the members below, at a minimum: struct ipc_perm shm_perm size_t shm_segsz pid_t shm_lpid pid_t shm_cpid shmatt_t shm_nattach time_t shm_atime time_t shm_dtime time_t shm_ctime </assertion> <assertion id="7" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> The pid_t, time_t, key_t, and size_t types shall be defined as described in sys/types.h </assertion> <assertion id="8" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> This function is defined: void *shmat(int, const void *, int) </assertion> <assertion id="9" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> This function is defined: int shmctl(int, int, struct shmid_ds *) </assertion> <assertion id="10" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> This function is defined: int shmdt(const void *) </assertion> <assertion id="11" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> This function is defined: int shmget(key_t, size_t, int) </assertion> <assertion id="12" tag="ref:XDB6:{Headers:sys/shm.h:DESCRIPTION}"> All of the symbols from sys/ipc.h are defined when the sys/shm.h header is included </assertion> </assertions> --- NEW FILE: 12-3.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * key_t ftok(const char *, int) * from sys/ipc.h is declared. */ #include <sys/shm.h> typedef key_t (*ftok_test)(const char *, int); int dummyfcn (void) { ftok_test dummyvar; dummyvar = ftok; return 0; } --- NEW FILE: 7-3.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that key_t type is defined as described in sys/types.h. */ #include <sys/shm.h> key_t this_type_should_exist; --- NEW FILE: 2-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header define the SHM_RDONLY symbolic constant. */ #include <sys/shm.h> #ifndef SHM_RDONLY #error SHM_RDONLY not defined #endif --- NEW FILE: 12-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the stuct ipc_perm from sys/ipc.h is defined. */ #include <sys/shm.h> struct ipc_perm this_type_should_exist; --- NEW FILE: 2-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header define the SHM_RND symbolic constant. */ #include <sys/shm.h> #ifndef SHM_RND #error SHM_RND not defined #endif --- NEW FILE: 6-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header declares struct shmid_ds with the members below, at a * minimum: * struct ipc_perm shm_perm * size_t shm_segsz * pid_t shm_lpid * pid_t shm_cpid * shmatt_t shm_nattch * time_t shm_atime * time_t shm_dtime * time_t shm_ctime */ #include <sys/shm.h> struct shmid_ds this_type_should_exist, t; int dummyfcn(void) { struct ipc_perm perm; size_t sz = 0; pid_t lpid = 0, cpid = 0; shmatt_t nattch = 0; time_t atime = 0, dtime = 0, ctime = 0; t.shm_perm = perm; t.shm_segsz = sz; t.shm_lpid = lpid; t.shm_cpid = cpid; t.shm_nattch = nattch; t.shm_atime = atime; t.shm_dtime = dtime; t.shm_ctime = ctime; return 0; } --- NEW FILE: 9-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int shmctl(int, int, struct shmid_ds *) * is declared. */ #include <sys/shm.h> typedef int (*shmctl_test)(int, int, struct shmid_ds *); int dummyfcn (void) { shmctl_test dummyvar; dummyvar = shmctl; return 0; } --- NEW FILE: 12-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that all of the folowing symbolic constants from sys/ipc.h are defined: * IPC_CREAT * IPC_EXCL * IPC_NOWAIT * IPC_PRIVATE * IPC_RMID * IPC_SET * IPC_STAT */ #include <sys/shm.h> #ifndef IPC_CREAT #error IPC_CREAT not defined #endif #ifndef IPC_EXCL #error IPC_EXCL not defined #endif #ifndef IPC_NOWAIT #error IPC_NOWAIT not defined #endif #ifndef IPC_PRIVATE #error IPC_PRIVATE not defined #endif #ifndef IPC_RMID #error IPC_RMID not defined #endif #ifndef IPC_SET #error IPC_SET not defined #endif #ifndef IPC_STAT #error IPC_STAT not defined #endif --- NEW FILE: 10-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int shmdt(const void *) * is declared. */ #include <sys/shm.h> typedef int (*shmdt_test)(const void *); int dummyfcn (void) { shmdt_test dummyvar; dummyvar = shmdt; return 0; } --- NEW FILE: 7-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that time_t type is defined as described in sys/types.h. */ #include <sys/shm.h> time_t this_type_should_exist; --- NEW FILE: 5-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the shmatt_t type is an unsigned integer that must be able to * store values at least as large than unsigned short. */ #include <sys/shm.h> #include <limits.h> /* The minimun acceptable value for USHRT_MAX */ #define MIN_USHRT_MAX 65535 shmatt_t tmin = 0; shmatt_t tmax = USHRT_MAX; shmatt_t tminmax = MIN_USHRT_MAX; --- NEW FILE: coverage.txt --- This document explains why certain assertions were not tested. Assertions not listed here should be covered by the tests in this directory. Assertions Tested ? Remarks 1 YES 2 YES 3 YES 4 YES 5 YES 6 YES 7 YES 8 YES 9 YES 10 YES 11 YES 12 YES --- NEW FILE: 7-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that pid_t type is defined as described in sys/types.h. */ #include <sys/shm.h> pid_t this_type_should_exist; --- NEW FILE: 8-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * void *shmat(int, const void *, int) * is declared. */ #include <sys/shm.h> typedef void* (*shmat_test)(int, const void *, int); int dummyfcn (void) { shmat_test dummyvar; dummyvar = shmat; return 0; } --- NEW FILE: 7-4.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that size_t type is defined as described in sys/types.h. */ #include <sys/shm.h> size_t this_type_should_exist; --- NEW FILE: 3-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header define the SHMLBA symbolic value. */ #include <sys/shm.h> #ifndef SHMLBA #error SHMLBA not defined #endif --- NEW FILE: 4-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header define the shmatt_t type through typedef. */ #include <sys/shm.h> shmatt_t this_type_should_exist; --- NEW FILE: 11-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int shmget(key_t, size_t, int) * is declared. */ #include <sys/shm.h> typedef int (*shmget_test)(key_t, size_t, int); int dummyfcn (void) { shmget_test dummyvar; dummyvar = shmget; return 0; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:55:23
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/functional/threads/include In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5470/functional/threads/include Added Files: pitest.h test.h Log Message: Update 1.4.1 --- NEW FILE: test.h --- /* * Copyright (c) 2003, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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. */ #include <errno.h> #include <string.h> #define EOWNERDEAD ESRCH #define ENOTRECOVERABLE EBADR #define PASS 0 #define FAIL 1 #define UNRESOLVED 2 #define DPRINTF(a, x, args...) fprintf(a, x , ##args); #define EPRINTF(x, args...) fprintf(stderr, "%s: %d: " x "\n",__FILE__, __LINE__, ##args); --- NEW FILE: pitest.h --- /* * Copyright (c) 2003, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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. */ #include <sys/time.h> #include <string.h> #include "test.h" #define PROTOCOL PTHREAD_PRIO_INHERIT static inline double seconds_read(void) { struct timeval tv; gettimeofday(&tv, 0); return tv.tv_sec + 1e-6 * tv.tv_usec; } static inline int test_set_priority(pthread_t pid, unsigned policy, unsigned prio) { struct sched_param sched_param; memset(&sched_param, 0, sizeof(sched_param)); sched_param.sched_priority = prio; if (pthread_setschedparam(pid, policy, &sched_param) == -1) { EPRINTF("UNRESOLVED: Can't set policy to %d and prio to %d", policy, prio); exit(UNRESOLVED); } return 0; } static inline void mutex_attr_init(pthread_mutexattr_t *attr) { unsigned rc; rc = pthread_mutexattr_init(attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_init: %d %s", rc, strerror(rc)); exit(UNRESOLVED); } rc = pthread_mutexattr_setprotocol(attr, PROTOCOL); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_setprotocol: %d %s", rc, strerror(rc)); exit(UNRESOLVED); } } static inline int mutex_init(pthread_mutex_t *mutex, pthread_mutexattr_t *attr) { unsigned rc; rc = pthread_mutex_init(mutex, attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init: %d %s", rc, strerror(rc)); exit(UNRESOLVED); } return 0; } static inline int threadattr_init(pthread_attr_t *threadattr) { unsigned rc; rc = pthread_attr_init(threadattr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_attr_init: %d %s", rc, strerror(rc)); exit(UNRESOLVED); } return 0; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:55:23
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid/speculative In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5470/conformance/interfaces/pthread_getcpuclockid/speculative Added Files: 3-1.c Log Message: Update 1.4.1 --- NEW FILE: 3-1.c --- /* * Copyright (c) 2004, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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_getcpuclockid() * * Steps: * 1. Create a thread * 2. pthread_join the created thread * 3. Call the API to get the clockid of this thread, it may fail. */ #include <pthread.h> #include <time.h> #include <limits.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/param.h> #include <errno.h> #include <unistd.h> #include "posixtest.h" #define TEST "3-1" #define FUNCTION "pthread_getcpuclockid" #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " void *thread_func() { pthread_exit(0); return NULL; } int main() { int rc; clockid_t cid; pthread_t new_th; rc = pthread_create(&new_th, NULL, thread_func, NULL); if (rc !=0 ) { perror(ERROR_PREFIX "failed to create a thread"); exit(PTS_UNRESOLVED); } rc = pthread_join(new_th, NULL); if(rc != 0) { perror(ERROR_PREFIX "pthread_join"); exit(PTS_UNRESOLVED); } rc = pthread_getcpuclockid(new_th, &cid); if (rc == ESRCH ) { printf("pthread_getcpuclockid returns ESRCH " "when thread_id doesn't exist\n"); } else { printf("pthread_getcpuclockid doesn't return " "ESRCH when thread_id doesn't exist\n"); } return PTS_PASS; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:54:52
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/functional/threads/tools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5470/functional/threads/tools Added Files: watchdogtimer.sh Log Message: Update 1.4.1 --- NEW FILE: watchdogtimer.sh --- #!/bin/bash PRIORITY=20 # PINUM stands for the test cases number of pi test PINUM=6 num=0 chrt -p -f $PRIORITY $$ TIMEOUT=600 echo "Start watchdogtimer script..." echo "wait 10 minutes, if pitest hangs, stop the case execution" while [ $num -lt $PINUM ] do sleep $TIMEOUT killall -9 -q pitest* echo "Timeout, kill pi test case" num=`expr $num + 1` done |
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/definitions/sys/mman_h In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5470/conformance/definitions/sys/mman_h Added Files: 1-1.c 10-1.c 11-1.c 12-1.c 13-1.c 14-1.c 15-1.c 16-1.c 17-1.c 18-1.c 19-1.c 2-1.c 2-2.c 2-3.c 2-4.c 20-1.c 21-1.c 22-1.c 23-1.c 24-1.c 3-1.c 3-2.c 3-3.c 4-1.c 4-2.c 4-3.c 5-1.c 5-2.c 6-1.c 7-1.c 7-2.c 7-3.c 7-4.c 7-5.c 8-1.c 8-2.c 8-3.c 9-1.c 9-2.c 9-3.c assertions.xml coverage.txt Log Message: Update 1.4.1 --- NEW FILE: 17-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int munlockall(void) * is declared. * * @pt:ML */ #include <sys/mman.h> typedef int (*munlockall_test)(void); int dummyfcn (void) { munlockall_test dummyvar; dummyvar = munlockall; return 0; } --- NEW FILE: 9-3.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that size_t type is defined as described in sys/types.h. */ #include <sys/mman.h> size_t this_type_should_exist; --- NEW FILE: 23-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int shm_open(const char *, int, mode_t) * is declared. * * @pt:SHM */ #include <sys/mman.h> typedef int (*shm_open_test)(const char *, int, mode_t); int dummyfcn (void) { shm_open_test dummyvar; dummyvar = shm_open; return 0; } --- NEW FILE: 2-4.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the PROT_NONE protection option. * * @pt:MF * @pt:SHM * @pt:ADV */ #include <sys/mman.h> #ifndef PROT_NONE #error PROT_NONE not defined #endif --- NEW FILE: 4-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the MS_SYNC flag option for msync(). * * @pt:MF * @pt:SIO */ #include <sys/mman.h> #ifndef MS_SYNC #error MS_SYNC not defined #endif --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}"> The sys/mman.h header file exists if the implementation supports at least one of the following options: MF SHM ML MPR TYM SIO ADV </assertion> <assertion id="2" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION} pt:MF pt:SHM pt:ADV"> The header defines the following protection options: PROT_READ PROT_WRITE PROT_EXEC PROT_NONE </assertion> <assertion id="3" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION} pt:MF pt:SHM"> The header defines the following flag options: MAP_SHARED MAP_PRIVATE MAP_FIXED </assertion> <assertion id="4" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION} pt:MF pt:SIO"> The header defines the following flag options for msync(): MS_ASYNC MS_SYNC MS_INVALIDATE </assertion> <assertion id="5" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION} pt:ML"> The header defines the following flag options for mlockall(): MCL_CURRENT MCL_FUTURE </assertion> <assertion id="6" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION} pt:MF pt:SHM"> The header defines the following symbolic constant: MAP_FAILED </assertion> <assertion id="7" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION} pt:ADV pt:MF pt:SHM"> The header defines the following symbolic values: POSIX_MADV_NORMAL POSIX_MADV_SEQUENTIAL POSIX_MADV_RANDOM POSIX_MADV_WILLNEED POSIX_MADV_DONTNEED </assertion> <assertion id="8" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION} pt:TYM"> The header defines the following flags for posix_typed_mem_open(): POSIX_TYPED_MEM_ALLOCATE POSIX_TYPED_MEM_ALLOCATE_CONTIG POSIX_TYPED_MEM_MAP_ALLOCATABLE </assertion> <assertion id="9" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}"> The mode_t, off_t, and size_t types shall be defined as described in sys/types.h </assertion> <assertion id="10" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:TYM"> The sys/mman.h header shall define the structure posix_typed_mem_info, which includes at least the following member: size_t posix_tmi_length </assertion> <assertion id="11" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:MR"> This function is defined: int mlock(const void *, size_t) </assertion> <assertion id="12" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:ML"> This function is defined: int mlockall(int) </assertion> <assertion id="13" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:MF pt:SHM pt:TYM"> This function is defined: void *mmap(void *, size_t, int, int, int, off_t) </assertion> <assertion id="14" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:MPR"> This function is defined: int mprotect(void *, size_t, int) </assertion> <assertion id="15" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:MF pt:SIO"> This function is defined: int msync(void *, size_t, int) </assertion> <assertion id="16" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:MR"> This function is defined: int munlock(const void *, size_t) </assertion> <assertion id="17" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:ML"> This function is defined: int munlockall(void) </assertion> <assertion id="18" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:MF pt:SHM pt:TYM"> This function is defined: int munmap(void *, size_t) </assertion> <assertion id="19" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:ADV"> This function is defined: int posix_madvise(void *, size_t, int) </assertion> <assertion id="20" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:TYM"> This function is defined: int posix_mem_offset(const void *restrict, size_t, off_t *restrict, size_t *restrict, int *restrict) </assertion> <assertion id="21" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:TYM"> This function is defined: int posix_typed_mem_get_info(int, struct posix_typed_mem_info *) </assertion> <assertion id="22" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:TYM"> This function is defined: int posix_typed_mem_open(const char *, int, int) </assertion> <assertion id="23" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:SHM"> This function is defined: int shm_open(const char *, int, mode_t) </assertion> <assertion id="24" tag="ref:XDB6:{Headers:sys/mman.h:DESCRIPTION}} pt:SHM"> This function is defined: int shm_unlink(const char *) </assertion> </assertions> --- NEW FILE: 4-3.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the MS_INVALIDATE flag option for msync(). * * @pt:MF * @pt:SIO */ #include <sys/mman.h> #ifndef MS_INVALIDATE #error MS_INVALIDATE not defined #endif --- NEW FILE: 3-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the MAP_PRIVATE flag option. * * @pt:MF * @pt:SHM */ #include <sys/mman.h> #ifndef MAP_PRIVATE #error MAP_PRIVATE not defined #endif --- NEW FILE: 1-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the sys/mman.h header file exists when the implementation supports * at least one of the following options: * MF * SHM * ML * MPR * TYM * SIO * ADV */ #include <unistd.h> #if defined(_POSIX_ADVISORY_INFO) || defined(_POSIX_MAPPED_FILES) || \ defined(_POSIX_MEMLOCK) || defined(_POSIX_MEMORY_PROTECTION) || \ defined(_POSIX_SHARED_MEMORY_OBJECTS) || \ defined(_POSIX_SYNCHRONIZED_IO) || defined(_POSIX_TYPED_MEMORY_OBJECTS) #include <sys/mman.h> #endif --- NEW FILE: 9-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that off_t type is defined as described in sys/types.h. */ #include <sys/mman.h> off_t this_type_should_exist; --- NEW FILE: 22-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int posix_typed_mem_open(const char *, int, int) * is declared. * * @pt:TYM */ #include <sys/mman.h> typedef int (*posix_typed_mem_open_test)(const char *, int, int); int dummyfcn (void) { posix_typed_mem_open_test dummyvar; dummyvar = posix_typed_mem_open; return 0; } --- NEW FILE: 16-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int munlock(const void *, size_t) * is declared. * * @pt:MR */ #include <sys/mman.h> typedef int (*munlock_test)(const void *, size_t); int dummyfcn (void) { munlock_test dummyvar; dummyvar = munlock; return 0; } --- NEW FILE: 3-3.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the MAP_FIXED flag option. * * @pt:MF * @pt:SHM */ #include <sys/mman.h> #ifndef MAP_FIXED #error MAP_FIXED not defined #endif --- NEW FILE: 12-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int mlockall(int) * is declared. * * @pt:ML */ #include <sys/mman.h> typedef int (*mlockall_test)(int); int dummyfcn (void) { mlockall_test dummyvar; dummyvar = mlockall; return 0; } --- NEW FILE: 2-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the PROT_WRITE protection option. * * @pt:MF * @pt:SHM * @pt:ADV */ #include <sys/mman.h> #ifndef PROT_WRITE #error PROT_WRITE not defined #endif --- NEW FILE: 7-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the POSIX_MADV_SEQUENTIAL symbolic value. * * @pt:ADV * @pt:MF * @pt:SHM */ #include <sys/mman.h> #ifndef POSIX_MADV_SEQUENTIAL #error POSIX_MADV_SEQUENTIAL not defined #endif --- NEW FILE: 7-4.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the POSIX_MADV_WILLNEED symbolic value. * * @pt:ADV * @pt:MF * @pt:SHM */ #include <sys/mman.h> #ifndef POSIX_MADV_WILLNEED #error POSIX_MADV_WILLNEED not defined #endif --- NEW FILE: 7-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the POSIX_MADV_NORMAL symbolic value. * * @pt:ADV * @pt:MF * @pt:SHM */ #include <sys/mman.h> #ifndef POSIX_MADV_NORMAL #error POSIX_MADV_NORMAL not defined #endif --- NEW FILE: 8-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the POSIX_TYPED_MEM_ALLOCATE flag for * posix_typed_mem_open()(). * * @pt:TYM */ #include <sys/mman.h> #ifndef POSIX_TYPED_MEM_ALLOCATE #error POSIX_TYPED_MEM_ALLOCATE not defined #endif --- NEW FILE: 20-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int posix_mem_offset(const void *restrict, size_t, off_t *restrict, * size_t *restrict, int *restrict) * is declared. * * @pt:TYM */ #include <sys/mman.h> typedef int (*posix_mem_offset_test)(const void *restrict, size_t, off_t *restrict, size_t *restrict, int *restrict); int dummyfcn (void) { posix_mem_offset_test dummyvar; dummyvar = posix_mem_offset; return 0; } --- NEW FILE: 3-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the MAP_SHARED flag option. * * @pt:MF * @pt:SHM */ #include <sys/mman.h> #ifndef MAP_SHARED #error MAP_SHARED not defined #endif --- NEW FILE: 2-3.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the PROT_EXEC protection option. * * @pt:MF * @pt:SHM * @pt:ADV */ #include <sys/mman.h> #ifndef PROT_EXEC #error PROT_EXEC not defined #endif --- NEW FILE: 5-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the MCL_FUTURE symbolic constant for * mlockall(). * * @pt:ML */ #include <sys/mman.h> #ifndef MCL_FUTURE #error MCL_FUTURE not defined #endif --- NEW FILE: 13-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * void *mmap(void *, size_t, int, int, int, off_t) * is declared. * * @pt:MF * @pt:SHM * @pt:TYM */ #include <sys/mman.h> typedef void* (*mmap_test)(void *, size_t, int, int, int, off_t); int dummyfcn (void) { mmap_test dummyvar; dummyvar = mmap; return 0; } --- NEW FILE: 15-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int msync(void *, size_t, int) * is declared. * * @pt:MF * @pt:SIO */ #include <sys/mman.h> typedef int (*msync_test)(void *, size_t, int); int dummyfcn (void) { msync_test dummyvar; dummyvar = msync; return 0; } --- NEW FILE: 8-3.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the POSIX_TYPED_MEM_MAP_ALLOCATABLE flag for * posix_typed_mem_open()(). * * @pt:TYM */ #include <sys/mman.h> #ifndef POSIX_TYPED_MEM_MAP_ALLOCATABLE #error POSIX_TYPED_MEM_MAP_ALLOCATABLE not defined #endif --- NEW FILE: 21-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int posix_typed_mem_get_info(int, struct posix_typed_mem_info *) * is declared. * * @pt:TYM */ #include <sys/mman.h> typedef int (*posix_typed_mem_get_info_test)(int, struct posix_typed_mem_info *); int dummyfcn (void) { posix_typed_mem_get_info_test dummyvar; dummyvar = posix_typed_mem_get_info; return 0; } --- NEW FILE: 7-3.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the POSIX_MADV_RANDOM symbolic value. * * @pt:ADV * @pt:MF * @pt:SHM */ #include <sys/mman.h> #ifndef POSIX_MADV_RANDOM #error POSIX_MADV_RANDOM not defined #endif --- NEW FILE: 2-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the PROT_READ protection option. * * @pt:MF * @pt:SHM * @pt:ADV */ #include <sys/mman.h> #ifndef PROT_READ #error PROT_READ not defined #endif --- NEW FILE: 8-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the POSIX_TYPED_MEM_ALLOCATE_CONTIG flag for * posix_typed_mem_open()(). * * @pt:TYM */ #include <sys/mman.h> #ifndef POSIX_TYPED_MEM_ALLOCATE_CONTIG #error POSIX_TYPED_MEM_ALLOCATE_CONTIG not defined #endif --- NEW FILE: 10-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header declares struct posix_typed_mem_info with at least the * following member: * size_t posix_tmi_length * * @pt:TYM */ #include <sys/mman.h> struct posix_typed_mem_info this_type_should_exist, t; int dummyfcn(void) { size_t sz = 0; t.posix_tmi_length = sz; return 0; } --- NEW FILE: 7-5.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the POSIX_MADV_DONTNEED symbolic value. * * @pt:ADV * @pt:MF * @pt:SHM */ #include <sys/mman.h> #ifndef POSIX_MADV_DONTNEED #error POSIX_MADV_DONTNEED not defined #endif --- NEW FILE: 6-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the MAP_FAILED symbolic constant. * * @pt:MF * @pt:SHM */ #include <sys/mman.h> #ifndef MAP_FAILED #error MAP_FAILED not defined #endif --- NEW FILE: 9-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that mode_t type is defined as described in sys/types.h. */ #include <sys/mman.h> mode_t this_type_should_exist; --- NEW FILE: 19-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int posix_madvise(void *, size_t, int) * is declared. * * @pt:ADV */ #include <sys/mman.h> typedef int (*posix_madvise_test)(void *, size_t, int); int dummyfcn (void) { posix_madvise_test dummyvar; dummyvar = posix_madvise; return 0; } --- NEW FILE: 18-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int munmap(void *, size_t) * is declared. * * @pt:MF * @pt:SHM * @pt:TYM */ #include <sys/mman.h> typedef int (*munmap_test)(void *, size_t); int dummyfcn (void) { munmap_test dummyvar; dummyvar = munmap; return 0; } --- NEW FILE: 5-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the MCL_CURRENT symbolic constant for * mlockall(). * * @pt:ML */ #include <sys/mman.h> #ifndef MCL_CURRENT #error MCL_CURRENT not defined #endif --- NEW FILE: coverage.txt --- This document explains why certain assertions were not tested. Assertions not listed here should be covered by the tests in this directory. Assertions Tested ? Remarks 1 YES 2 YES 3 YES 4 YES 5 YES 6 YES 7 YES 8 YES 9 YES 10 YES 11 YES 12 YES 13 YES 14 YES 15 YES 16 YES 17 YES 18 YES 19 YES 20 YES 21 YES 22 YES 23 YES 24 YES --- NEW FILE: 11-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int mlock(const void *, size_t) * is declared. * * @pt:MR */ #include <sys/mman.h> typedef int (*mlock_test)(const void *, size_t); int dummyfcn (void) { mlock_test dummyvar; dummyvar = mlock; return 0; } --- NEW FILE: 14-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int mprotect(void *, size_t, int) * is declared. * * @pt:MPR */ #include <sys/mman.h> typedef int (*mprotect_test)(void *, size_t, int); int dummyfcn (void) { mprotect_test dummyvar; dummyvar = mprotect; return 0; } --- NEW FILE: 4-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the header defines the MS_ASYNC flag option for msync(). * * @pt:MF * @pt:SIO */ #include <sys/mman.h> #ifndef MS_ASYNC #error MS_ASYNC not defined #endif --- NEW FILE: 24-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Test that the function: * int shm_unlink(const char *) * is declared. * * @pt:SHM */ #include <sys/mman.h> typedef int (*shm_unlink_test)(const char *); int dummyfcn (void) { shm_unlink_test dummyvar; dummyvar = shm_unlink; return 0; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:37
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/functional/timers/timers In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/functional/timers/timers Added Files: Makefile twoevtimers.c twoptimers.c Log Message: Update to 1.4.1 --- NEW FILE: twoptimers.c --- /* * 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 having two timers in different processes set to expire at the * same time, and ensure they both expire at the same time. */ #include <stdio.h> #include <time.h> #include <signal.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include "posixtest.h" #define EXPIREDELTA 3 #define LONGTIME 5 #define CHILDPASS 1 int main(int argc, char *argv[]) { int pid; struct timespec ts; if (clock_gettime(CLOCK_REALTIME, &ts) != 0) { perror("clock_gettime() did not return success\n"); return PTS_UNRESOLVED; } if ((pid = fork()) == 0) { /*child*/ struct sigevent ev; timer_t tid; struct itimerspec its; sigset_t set; int sig; int flags = 0; if (sigemptyset(&set) == -1 ) { perror("sigemptyset() failed\n"); return PTS_UNRESOLVED; } if (sigaddset(&set, SIGABRT) == -1) { perror("sigaddset() failed\n"); return PTS_UNRESOLVED; } ev.sigev_notify = SIGEV_SIGNAL; ev.sigev_signo = SIGABRT; if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { perror("timer_create() did not return success\n"); return PTS_UNRESOLVED; } its.it_value.tv_sec = ts.tv_sec + EXPIREDELTA; its.it_value.tv_nsec = ts.tv_nsec; its.it_interval.tv_sec = 0; its.it_interval.tv_nsec = 0; flags |= TIMER_ABSTIME; if (timer_settime(tid, flags, &its, NULL) != 0) { perror("timer_settime() did not return success\n"); return PTS_UNRESOLVED; } if (sigwait(&set, &sig) == -1) { perror("sigwait() failed\n"); return PTS_UNRESOLVED; } printf("Got it! Child\n"); sleep(LONGTIME); return CHILDPASS; } else { /*parent*/ struct sigevent ev; timer_t tid; struct itimerspec its; sigset_t set; int sig; int flags = 0; int i; if (sigemptyset(&set) == -1 ) { perror("sigemptyset() failed\n"); return PTS_UNRESOLVED; } if (sigaddset(&set, SIGALRM) == -1) { perror("sigaddset() failed\n"); return PTS_UNRESOLVED; } ev.sigev_notify = SIGEV_SIGNAL; ev.sigev_signo = SIGALRM; if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { perror("timer_create() did not return success\n"); return PTS_UNRESOLVED; } its.it_value.tv_sec = ts.tv_sec + EXPIREDELTA; its.it_value.tv_nsec = ts.tv_nsec; its.it_interval.tv_sec = 0; its.it_interval.tv_nsec = 0; flags |= TIMER_ABSTIME; if (timer_settime(tid, flags, &its, NULL) != 0) { perror("timer_settime() did not return success\n"); return PTS_UNRESOLVED; } if (sigwait(&set, &sig) == -1) { perror("sigwait() failed\n"); return PTS_UNRESOLVED; } printf("Got it! Parent\n"); if (wait(&i) == -1) { perror("Error waiting for child to exit\n"); return PTS_UNRESOLVED; } if (WEXITSTATUS(i)) { printf("Test PASSED\n"); return PTS_PASS; } else { printf("Test FAILED\n"); return PTS_FAIL; } } return PTS_UNRESOLVED; } --- NEW FILE: Makefile --- # 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. # CFLAGS = -g -O2 -Wall -Werror INCLUDE = -I../../../include LDPATH = -L/lib/libposixtime.so LIB = -lposixtime all: twoevtimers.test twoptimers.test %.test : %.c $(CC) $(CFLAGS) $(INCLUDE) $< -o $@ $(LDPATH) $(LIB) clean : rm *.test --- NEW FILE: twoevtimers.c --- /* * 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 having two timers in different processes set to expire at the * same time, and ensure they both expire at the same time. */ #include <stdio.h> #include <time.h> #include <signal.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include "posixtest.h" #define EXPIREDELTA 3 #define LONGTIME 5 #define CHILDPASS 1 int caughtabort=0; int caughtalarm=0; void handler_abrt(int signo) { printf("Caught abort signal\n"); caughtabort++; } void handler_alrm(int signo) { printf("Caught alarm signal\n"); caughtalarm++; } int main(int argc, char *argv[]) { struct sigaction act1, act2; struct sigevent ev1, ev2; timer_t tid1, tid2; struct timespec ts; struct itimerspec its; int flags = 0; act1.sa_handler=handler_abrt; act1.sa_flags=0; act2.sa_handler=handler_alrm; act2.sa_flags=0; if ( (sigemptyset(&act1.sa_mask) != 0) || (sigemptyset(&act2.sa_mask) != 0) ) { perror("sigemptyset() did not return success\n"); return PTS_UNRESOLVED; } if ( (sigaction(SIGABRT, &act1, 0) != 0) || (sigaction(SIGALRM, &act2, 0) != 0) ) { perror("sigaction() did not return success\n"); return PTS_UNRESOLVED; } ev1.sigev_notify = SIGEV_SIGNAL; ev1.sigev_signo = SIGABRT; ev2.sigev_notify = SIGEV_SIGNAL; ev2.sigev_signo = SIGALRM; if ( (timer_create(CLOCK_REALTIME, &ev1, &tid1) != 0) || (timer_create(CLOCK_REALTIME, &ev2, &tid2) != 0) ) { perror("timer_create() did not return success\n"); return PTS_UNRESOLVED; } if (clock_gettime(CLOCK_REALTIME, &ts) != 0) { perror("clock_gettime() did not return success\n"); return PTS_UNRESOLVED; } its.it_value.tv_sec = ts.tv_sec + EXPIREDELTA; its.it_value.tv_nsec = ts.tv_nsec; its.it_interval.tv_sec = 0; its.it_interval.tv_nsec = 0; flags |= TIMER_ABSTIME; if (timer_settime(tid1, flags, &its, NULL) != 0) { perror("timer_settime() did not return success\n"); return PTS_UNRESOLVED; } if (timer_settime(tid2, flags, &its, NULL) != 0) { perror("timer_settime() did not return success\n"); return PTS_UNRESOLVED; } sleep(EXPIREDELTA+1); if ( (caughtalarm == 1) && (caughtabort == 1) ) { printf("Test PASSED\n"); return PTS_PASS; } else { printf("Test FAILED\n"); return PTS_FAIL; } printf("This code should not be executed.\n"); return PTS_UNRESOLVED; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:37
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/stress/mqueues In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/stress/mqueues Added Files: Makefile assertions.xml coverage.txt multi_send_rev_1.c multi_send_rev_2.c plan.txt run.sh Log Message: Update to 1.4.1 --- NEW FILE: multi_send_rev_1.c --- /* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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 whether message queue can work correctly under lots of usage. * 1. Many threads sending/receiving on different message queue. * 2. Set different Priority to the messages in the message queue, to see whether the highest priority is received first. */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/wait.h> #include <sys/mman.h> #include <string.h> #include <getopt.h> #include <pthread.h> #include <limits.h> #include <mqueue.h> #include "posixtest.h" #define MSG_SIZE 128 #define MAX_MSG 3 #define Max_Threads 10 #define Name_Size 20 typedef struct { int ThreadID; mqd_t mqID; }mq_info; int* send(void *info) { int i; const char *s_msg_ptr[] = {"msg test 1", "msg test 2", "msg test 3"}; mq_info send_info; send_info.ThreadID = ((mq_info *)info)->ThreadID; send_info.mqID = ((mq_info *)info)->mqID; printf("Enter into send [%d], mq = %d \n", send_info.ThreadID, send_info.mqID); for (i = 0; i < MAX_MSG; i++ ) { if ( -1 == mq_send(send_info.mqID, s_msg_ptr[i], MSG_SIZE, i)) { perror("mq_send doesn't return success \n"); pthread_exit((void *) 1); } printf("[%d] send '%s' in thread send [%d]. \n", i+1, s_msg_ptr[i], send_info.ThreadID); } pthread_exit((void *)0); } int* receive(void * info) { int i; char r_msg_ptr[MAX_MSG][MSG_SIZE]; mq_info recv_info; recv_info.ThreadID = ((mq_info *)info)->ThreadID; recv_info.mqID = ((mq_info *)info)->mqID; printf("Enter into receive [%d], mq = %d \n", recv_info.ThreadID, recv_info.mqID); for (i = 0; i< MAX_MSG; i++) { if ( -1 == mq_receive(recv_info.mqID, r_msg_ptr[i], MSG_SIZE, NULL) ) { perror("mq_receive doesn't return success \n"); pthread_exit((void *)0); } printf("[%d] receive '%s' in thread receive recv [%d]. \n", i+1, r_msg_ptr[i], recv_info.ThreadID); } pthread_exit((void *)0); } int main(int argc, char *argv[]) { const char * MQ_NAME[Max_Threads] = {"/msg1", "/msg2", "/msg3", "/msg4", "/msg5", "/msg6", "/msg7", "/msg8", "/msg9", "/msg10"}; mqd_t mq[Max_Threads]; struct mq_attr mqstat; int oflag = O_CREAT|O_NONBLOCK|O_RDWR; int num, i; pthread_t sed[Max_Threads], rev[Max_Threads]; mq_info info[Max_Threads]; /* #ifndef _POSIX_MESSAGE_PASSING printf("_POSIX_MESSAGE_PASSING is not defined \n"); return PTS_UNRESOLVED; #endif */ if ( (2 != argc) || (( num = atoi(argv[1])) <= 0)) { fprintf(stderr, "Usage: %s number_of_threads\n", argv[0]); return PTS_FAIL; } if (num > Max_Threads) { printf("The num of threads are too large. Reset to %d\n", Max_Threads); num = Max_Threads; } memset(&mqstat, 0, sizeof(mqstat)); mqstat.mq_maxmsg = MAX_MSG; mqstat.mq_msgsize = MSG_SIZE; mqstat.mq_flags = 0; for (i = 0; i < num; i++) { if( ((mqd_t) -1) == (mq[i] = mq_open(MQ_NAME[i],oflag,0777, &mqstat)) ) { perror("mq_open doesn't return success \n"); return PTS_UNRESOLVED; } printf("mq[%i] created \n", i); } for ( i = 0; i < num; i++) { info[i].ThreadID = i; info[i].mqID = mq[i]; pthread_create(&sed[i], NULL, (void *)send, (void *)&info[i]); pthread_create(&rev[i], NULL, (void *)receive, (void *)&info[i]); } for ( i = 0; i < num; i++) { pthread_join(sed[i], NULL); pthread_join(rev[i], NULL); } for ( i = 0; i < num; i++) { mq_close(mq[i]); mq_close(mq[i]); mq_unlink(MQ_NAME[i]); mq_unlink(MQ_NAME[i]); } return PTS_PASS; } --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="pt:MSG" files="mqueues/multi_send_rev_1.c"> Test whether message queue can work correctly under lots of usage. Many threads sending/receiving on different message queues. </assertion> <assertion id="2" tag="pt:MSG" files="mqueues/multi_send_rev_2.c"> Test whether message queue can work correctly under lots of usage. Many threads sending/receiving on the same message queue. </assertion> </assertions> --- NEW FILE: coverage.txt --- This file defines the coverage for Message Queue stress tests. Assertion Covered? 1 YES 2 YES --- NEW FILE: run.sh --- #!/bin/sh # Copyright (c) 2002, Intel Corporation. All rights reserved. # Created by: crystal.xiong 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. # # Run all the tests in the message queues stress area. # Helper functions RunTest() { echo "TEST: " $1 $2 TOTAL=$TOTAL+1 ./$1 $2 if [ $? == 0 ]; then PASS=$PASS+1 echo -ne "\t\t\t***TEST PASSED***\n\n" else FAIL=$FAIL+1 echo -ne "\t\t\t***TEST FAILED***\n\n" fi } # Main program declare -i TOTAL=0 declare -i PASS=0 declare -i FAIL=0 # Add lists of tests to these variables for execution TESTS="multi_send_rev_1.test multi_send_rev_2.test" echo "Run the message queue stress tests" echo "==========================================" RunTest multi_send_rev_1.test 10 RunTest multi_send_rev_2.test 100 echo echo -ne "\t\t****************\n" echo -ne "\t\t* TOTAL: " $TOTAL "\n" echo -ne "\t\t* PASSED: " $PASS "\n" echo -ne "\t\t* FAILED: " $FAIL "\n" echo -ne "\t\t****************\n" exit 0 --- NEW FILE: Makefile --- ifndef POSIX_DIR_LIB POSIX_DIR_LIB=/usr/lib endif INCLUDE = -I../../include LIB=-lmqueue CC=gcc CFLAGS=-Wall -O2 -g -I$(POSIX_DIR_INC) -L$(POSIX_DIR_LIB) -lpthread all: multi_send_rev_1.test multi_send_rev_2.test %.test : %.c $(CC) $(CFLAGS) $(INCLUDE) $< -o $@ $(LIB) clean: rm *.test --- NEW FILE: multi_send_rev_2.c --- /* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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 whether message queue can work correctly under lots of usage. * 1. Many threads sending/receiving on the same message queue. * 2. Set different Priority to the messages in the message queue, to see * whether the highest priority is received first. */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/wait.h> #include <sys/mman.h> #include <string.h> #include <getopt.h> #include <pthread.h> #include <limits.h> #include <mqueue.h> #include "posixtest.h" #define MQ_NAME "/testmsg1" #define MSG_SIZE 128 #define MAX_MSG 5 #define Max_Threads 100 const char *s_msg_ptr[] = {"send_1 1", "send_1 2", "send_1 3", "send_1 4", "send_1 5"}; char r_msg_ptr[Max_Threads][MAX_MSG][MSG_SIZE]; mqd_t mq = 0; int *send(void * ID) { int i; int ThreadID = *(int *)ID; printf("Enter into send [%d] \n", ThreadID); for (i = 0; i < MAX_MSG; i++ ) { if ( -1 == mq_send(mq, s_msg_ptr[i], MSG_SIZE, i)) { perror("mq_send doesn't return success \n"); pthread_exit((void *)1); } printf("[%d] send '%s' in thread send %d. \n", i+1, s_msg_ptr[i], ThreadID); } pthread_exit((void *)0); } int *receive(void * ID ) { int i; int ThreadID = *(int *)ID; printf("Enter into receive[%d] \n", ThreadID); for (i = 0; i< MAX_MSG; i++) { if ( -1 == mq_receive(mq, r_msg_ptr[ThreadID][i], MSG_SIZE, NULL) ) { perror("mq_receive doesn't return success \n"); pthread_exit((void *)1); } printf("[%d] receive '%s' in thread receive[%d]. \n", i+1, r_msg_ptr[ThreadID][i], ThreadID); } printf("receive[%d] quit ...\n", ThreadID); pthread_exit((void *)0); } int main(int argc, char *argv[]) { struct mq_attr mqstat; int oflag = O_CREAT|O_NONBLOCK|O_RDWR; pthread_t sed[Max_Threads], rev[Max_Threads]; int ThreadID[Max_Threads]; int num, i; /* #ifndef _POSIX_MESSAGE_PASSING printf("_POSIX_MESSAGE_PASSING is not defined \n"); return PTS_UNRESOLVED; #endif */ if ( (2 != argc) || (( num = atoi(argv[1])) <= 0)) { fprintf(stderr, "Usage: %s number_of_threads\n", argv[0]); return PTS_FAIL; } if (num > Max_Threads) { printf("The num of threads are too large. Reset to %d\n", Max_Threads); num = Max_Threads; } memset(&mqstat, 0, sizeof(mqstat)); mqstat.mq_maxmsg = MAX_MSG; mqstat.mq_msgsize = MSG_SIZE; mqstat.mq_flags = 0; if( ((mqd_t) -1) == (mq = mq_open(MQ_NAME,oflag,0777, &mqstat)) ) { printf("mq_open doesn't return success \n"); return PTS_UNRESOLVED; } for (i = 0; i < num; i++) { ThreadID[i] = i; pthread_create(&sed[i], NULL, (void *)send, (void *)&ThreadID[i]); pthread_create(&rev[i], NULL, (void *)receive, (void *)&ThreadID[i]); } for (i = 0; i < num; i++) { pthread_join(sed[i], NULL); pthread_join(rev[i], NULL); } mq_close(mq); mq_unlink(MQ_NAME); return PTS_PASS; } --- NEW FILE: plan.txt --- This document defines the plan for functional testing of POSIX message queues. |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:36
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/functional/timers/clocks In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/functional/timers/clocks Added Files: Makefile invaliddates.c twopsetclock.c Log Message: Update to 1.4.1 --- NEW FILE: invaliddates.c --- /* * 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 the clock time can be set to 0, a large number, Y2K * critical dates, and times around daylight savings. * * Test for CLOCK_REALTIME. (N/A for CLOCK_MONOTONIC as that clock * cannot be set.) */ #include <stdio.h> #include <time.h> #include <stdint.h> #include "posixtest.h" #define NUMTESTS 6 #define ACCEPTABLESECDELTA 0 #define ACCEPTABLENSECDELTA 5000 static int testtimes[NUMTESTS][2] = { {0, 0}, // zero {INT32_MAX, 999999999}, // large number {946713600, 999999999}, // Y2K - Jan 1, 2000 {951811200, 999999999}, // Y2K - Feb 29, 2000 {1078041600, 999999999}, // Y2K - Feb 29, 2004 {1049623200, 999999999}, // daylight savings 2003 }; int main(int argc, char *argv[]) { struct timespec tpset, tpget, tsreset; int secdelta, nsecdelta; int failure = 0; int i; if (clock_gettime(CLOCK_REALTIME, &tsreset) != 0) { perror("clock_gettime() did not return success\n"); return PTS_UNRESOLVED; } for(i=0; i<NUMTESTS; i++) { tpset.tv_sec = testtimes[i][0]; tpset.tv_nsec = testtimes[i][1]; #ifdef DEBUG printf("Test: %ds %dns\n", testtimes[i][0], testtimes[i][1]); #endif if (clock_settime(CLOCK_REALTIME, &tpset) == 0) { if (clock_gettime(CLOCK_REALTIME, &tpget) == -1) { printf("Error in clock_gettime()\n"); return PTS_UNRESOLVED; } secdelta = tpget.tv_sec-tpset.tv_sec; nsecdelta = tpget.tv_nsec-tpset.tv_nsec; if (nsecdelta < 0) { nsecdelta = nsecdelta+1000000000; secdelta = secdelta-1; } #ifdef DEBUG printf("Delta: %ds %dns\n", secdelta, nsecdelta); #endif if ( (secdelta > ACCEPTABLESECDELTA) || (secdelta < 0) ) { printf("clock does not appear to be set\n"); failure = 1; } if ( (nsecdelta > ACCEPTABLENSECDELTA) || (nsecdelta < 0) ) { printf("clock does not appear to be set\n"); failure = 1; } } else { printf("clock_settime() failed\n"); return PTS_UNRESOLVED; } if (clock_settime(CLOCK_REALTIME, &tsreset) != 0) { perror("clock_settime() did not return success\n"); return PTS_UNRESOLVED; } } if (clock_settime(CLOCK_REALTIME, &tsreset) != 0) { perror("clock_settime() did not return success\n"); return PTS_UNRESOLVED; } if (failure) { printf("At least one test FAILED\n"); return PTS_FAIL; } printf("All tests PASSED\n"); return PTS_PASS; } --- NEW FILE: Makefile --- # 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. # #CFLAGS = -g -O2 -Wall -Werror CFLAGS = -g -O2 -Wall -Werror -DDEBUG INCLUDE = -I../../../include LDPATH = -L/usr/lib/libposixtime.so LIB = -lposixtime all: twopsetclock.test invaliddates.test %.test : %.c $(CC) $(CFLAGS) $(INCLUDE) $< -o $@ $(LDPATH) $(LIB) clean : rm *.test --- NEW FILE: twopsetclock.c --- /* * 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 having two processes attempt to set the clock at the same time. * Ensure that both actually set the clock, and it is the later one that * takes effect. [Note: It would be hard to test that they both set * the clock without setting up atomic operations. Will just test that * at least one set took place.] * The two processes will attempt to set the clock to TESTTIME+DELTA * and TESTTIME-DELTA. * * The clock_id chosen for this test is CLOCK_REALTIME. * The date chosen is Nov 12, 2002 ~11:13am. */ #include <stdio.h> #include <time.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> #include "posixtest.h" #define TESTTIME 1037128358 #define DELTA 5 #define ACCEPTABLEDELTA 1 #define LONGTIME 3 //== long enough for both clocks to be set int main(int argc, char *argv[]) { struct timespec tpget, tsreset; int pid, delta; if (clock_gettime(CLOCK_REALTIME, &tsreset) != 0) { perror("clock_getime() did not return success\n"); return PTS_UNRESOLVED; } if ((pid = fork()) == 0) { /*child*/ struct timespec tschild; tschild.tv_sec = TESTTIME+DELTA; tschild.tv_nsec = 0; if (clock_settime(CLOCK_REALTIME, &tschild) != 0) { printf("Note: clock_settime() failed\n"); } if (clock_gettime(CLOCK_REALTIME, &tpget) == -1) { printf("Note: Error in clock_gettime()\n"); } } else { /*parent*/ struct timespec tsparent; int pass = 0; tsparent.tv_sec = TESTTIME-DELTA; tsparent.tv_nsec = 0; if (clock_settime(CLOCK_REALTIME, &tsparent) != 0) { printf("Note: clock_settime() failed\n"); } sleep(LONGTIME); /* * Ensure we set clock to TESTTIME-DELTA or TESTTIME+DELTA. * Assume that clock increased monotonically and clock_gettime, * clock_settime return correct values. */ if (clock_gettime(CLOCK_REALTIME, &tpget) == -1) { printf("Note: Error in clock_gettime()\n"); } delta = (tpget.tv_sec-LONGTIME) - TESTTIME; if ( (delta <= ACCEPTABLEDELTA-DELTA) || (delta <= ACCEPTABLEDELTA+DELTA) ) { pass = 1; } if (clock_settime(CLOCK_REALTIME, &tsreset) != 0) { printf("Need to manually reset time\n"); } if (pass) { printf("Test PASSED\n"); return PTS_PASS; } else { printf("Test FAILED\n"); return PTS_FAIL; } } return PTS_UNRESOLVED; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:34
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedparam In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/interfaces/pthread_setschedparam Added Files: 1-1.c assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: coverage.txt --- This document defines the coverage for the pthread_setschedparam() function: Assertion Tested? 1 YES 2 NO 3 YES *Tested implictly by 1-1 Note: --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XSH6:33182:33185"> The pthread_setschedparam( ) function shall set the scheduling policy and associated scheduling parameters for the thread whose thread ID is given by thread to the policy and associated parameters provided in policy and param, respectively. </assertion> <assertion id="2" tag="ref:XSH6:33189:33199"> TSP If _POSIX_THREAD_SPORADIC_SERVER is defined, then the policy argument may have the value SCHED_SPORADIC, with the exception for the pthread_setschedparam( ) function that if the scheduling policy was not SCHED_SPORADIC at the time of the call, it is implementation-defined whether the function is supported; in other words, the implementation need not allow the application to dynamically change the scheduling policy to SCHED_SPORADIC. The sporadic server scheduling policy has the associated parameters sched_ss_low_priority, sched_ss_repl_period, sched_ss_init_budget, sched_priority, and sched_ss_max_repl. The specified sched_ss_repl_period shall be greater than or equal to the specified sched_ss_init_budget for the function to succeed; if it is not, then the function shall fail. The value of sched_ss_max_repl shall be within the inclusive range [1,{SS_REPL_MAX}] for the function to succeed; if not, the function shall fail. </assertion> <assertion id="3" tag="ref:XSH6:33203:33204"> If successful, the pthread_setschedparam( ) functions shall return zero; otherwise, an error number shall be returned to indicate the error. </assertion> </assertions> --- NEW FILE: 1-1.c --- /* * 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@... * */ /* Set the sched parameter with pthread_setschedparam() then get */ #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include "posixtest.h" void *a_thread_func() { struct sched_param sparam; int policy, priority, policy_1; int rc; policy = SCHED_FIFO; priority = sched_get_priority_min(policy); sparam.sched_priority = priority; rc = pthread_setschedparam(pthread_self(), policy, &sparam); if (rc != 0) { printf("Error at pthread_setschedparam: rc=%d\n", rc); exit(PTS_FAIL); } rc = pthread_getschedparam(pthread_self(), &policy_1, &sparam); if (rc != 0) { printf("Error at pthread_getschedparam: rc=%d\n", rc); exit(PTS_UNRESOLVED); } //printf("policy: %d, priority: %d\n", policy_1, sparam.sched_priority); if (policy_1 != policy || sparam.sched_priority != priority) { printf("pthread_getschedparam did not get the correct value\n"); exit(PTS_FAIL); } 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; } pthread_join(new_th, NULL); printf("Test PASSED\n"); return PTS_PASS; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:32
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutexattr_setprotocol In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/interfaces/pthread_mutexattr_setprotocol Added Files: 1-1.c 2-2.sh 3-1.c 3-2.c assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XSH6:34360:34368"> The function int pthread_mutexattr_setprotocol(const pthread_mutexattr_t *restrict attr, int protocol); Sets the protocol attribute of a mutex attribute object which was prev. created by the function pthread_mutexattr_init(). </assertion> <assertion id="2" tag="ref:XSH6:34402:34405"> Upon success, it returns 0. </assertion> <assertion id="3" tag="ref:XSH6:34406:34412"> It Shall fail if: [ENOTSUP] The value specified by protocol is an unsupported value. If may fail if: [EINVAL] - 'attr' or 'protocol' is invalid. [EPERM] - The caller doesn't have the privilege to perform the operation. Shall not return error code of [EINTR]. </assertion> </assertions> --- NEW FILE: coverage.txt --- This document defines the coverage for the pthread_mutexattr_getprotocol function: Assertion Tested? 1 YES 2 YES 3 YES NOTE: --- NEW FILE: 3-2.c --- /* * 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_mutexattr_setprotocol() * * It may fail if: * [EINVAL] The value specified by 'attr' is invalid. * * Steps: * 1. Call pthread_mutexattr_setprotocol with an uninitialized pthread_mutexattr_t object. */ #include <pthread.h> #include <stdio.h> #include <sched.h> #include <errno.h> #include "posixtest.h" int main() { pthread_mutexattr_t mta; int ret; /* Set the protocol to an invalid value. */ ret = pthread_mutexattr_setprotocol(&mta,PTHREAD_PRIO_NONE); if(ret == EINVAL) { printf("Test PASSED\n"); return PTS_PASS; } else if (ret == 0){ printf("Test PASSED: NOTE*: Expected error code EINVAL, got %d, though standard states 'may' fail.\n", ret); return PTS_PASS; } else { printf("Test FAILED: Incorrect return code %d. Expected EINVAL or 0.\n", ret); return PTS_FAIL; } } --- NEW FILE: 1-1.c --- /* * 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_mutexattr_setprotocol() * * Sets the protocol attribute of a mutexattr object (which was prev. created * by the function pthread_mutexattr_init()). * * Steps: * 1. In a for loop, call pthread_mutexattr_setprotocol with all the valid 'protocol' values. * 2. In the for loop, then call pthread_mutexattr_getprotocol and ensure that the same * value that was set was the same value that was retrieved from this function. */ #include <pthread.h> #include <stdio.h> #include <sched.h> #include "posixtest.h" int main() { pthread_mutexattr_t mta; int protocol, protcls[3],i; /* Initialize a mutex attributes object */ if(pthread_mutexattr_init(&mta) != 0) { perror("Error at pthread_mutexattr_init()\n"); return PTS_UNRESOLVED; } protcls[0]=PTHREAD_PRIO_NONE; protcls[1]=PTHREAD_PRIO_INHERIT; protcls[2]=PTHREAD_PRIO_PROTECT; for(i=0;i<3;i++) { /* Set the protocol to one of the 3 valid protocols. */ if(pthread_mutexattr_setprotocol(&mta,protcls[i]) != 0) { printf("Error setting protocol to %d\n", protcls[i]); return PTS_UNRESOLVED; } /* Get the protocol mutex attr. */ if(pthread_mutexattr_getprotocol(&mta, &protocol) != 0) { fprintf(stderr,"Error obtaining the protocol attribute.\n"); return PTS_UNRESOLVED; } /* Make sure that the protocol set is the protocl we get when calling * pthread_mutexattr_getprocol() */ if(protocol != protcls[i]) { printf("Test FAILED: Set protocol %d, but instead got protocol %d.\n", protcls[i], protocol); return PTS_FAIL; } } printf("Test PASSED\n"); return PTS_PASS; } --- NEW FILE: 2-2.sh --- #!/bin/sh # 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 success, it returns 0, and stores the value of the prioceiling in 'prioceiling'. # This is tested implicitly via assertion 1. echo "Tested implicitly via assertion 1. See output for status" exit 0 --- NEW FILE: 3-1.c --- /* * 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_mutexattr_setprotocol() * * It Shall fail if: * [ENOTSUP] The value specified by protocol is an unsupported value. * It may fail if: * [EINVAL] 'protocol' is invalid */ #include <pthread.h> #include <stdio.h> #include <sched.h> #include <errno.h> #include "posixtest.h" #define INVALID_PROTOCOL -1 int main() { pthread_mutexattr_t mta; int protocol = INVALID_PROTOCOL; int ret; /* Initialize a mutex attributes object */ if(pthread_mutexattr_init(&mta) != 0) { perror("Error at pthread_mutexattr_init()\n"); return PTS_UNRESOLVED; } while(protocol == PTHREAD_PRIO_NONE || protocol == PTHREAD_PRIO_INHERIT || protocol == PTHREAD_PRIO_PROTECT){ protocol--; } /* Set the protocol to an invalid value. */ ret = pthread_mutexattr_setprotocol(&mta,protocol); if((ret == ENOTSUP) || (ret == EINVAL)) { printf("Test PASSED\n"); return PTS_PASS; } else{ printf("Test FAILED: Expected error code ENOTSUP, got %d.\n", ret); return PTS_FAIL; } } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:32
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_mutex_getprioceiling In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/interfaces/pthread_mutex_getprioceiling Added Files: 1-1.c assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: coverage.txt --- This document defines the coverage for the pthread_mutex_getprioceiling function: Assertion Tested? 1 YES 2 NO 3 NO NOTE: --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XSH6:33838:33844"> The function int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *restrict mutex, int *restrict prioceiling); returns the current prioceiling of the mutex. </assertion> <assertion id="2" tag="ref:XSH6:33853:33854"> Upon success, it returns 0, and stores the value of the prioceiling in 'prioceiling'. </assertion> <assertion id="3" tag="ref:XSH6:33855:33860"> It MAY fail if: [EINVAL] - The priority requested by 'prioceiling' is out of range [EINVAL] - 'mutex' doesn't refer to an existing mutex [EPERM] - The caller doesn't have the privilege to perform the operation. </assertion> </assertions> --- NEW FILE: 1-1.c --- /* * 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_mutex_getprioceiling() * * returns the current prioceiling of the mutex. * * Steps:i * 1. Initialize a pthread_mutexattr_t object with pthread_mutexattr_init() * 2. Call pthread_mutex_getprioceiling() to obtain the prioceiling. * */ #include <pthread.h> #include <stdio.h> #include <sched.h> #include "posixtest.h" int main() { /* Make sure there is prioceiling capability. */ /* #ifndef _POSIX_PRIORITY_SCHEDULING fprintf(stderr,"prioceiling attribute is not available for testing\n"); return PTS_UNRESOLVED; #endif */ pthread_mutex_t mutex; int prioceiling, max_prio, min_prio; /* Initialize a mutex object */ if(pthread_mutex_init(&mutex, NULL) != 0) { perror("Error at pthread_mutex_init()\n"); return PTS_UNRESOLVED; } /* Get the prioceiling of the mutex. */ if(pthread_mutex_getprioceiling(&mutex, &prioceiling) != 0) { printf("Test FAILED: Error obtaining the priority ceiling\n"); return PTS_FAIL; } /* Get the max and min prio according to SCHED_FIFO (posix scheduling policy) */ max_prio = sched_get_priority_max(SCHED_FIFO); min_prio = sched_get_priority_min(SCHED_FIFO); /* Make sure that prioceiling is withing the legal SCHED_FIFO boundries. */ if((prioceiling < min_prio) || (prioceiling > max_prio)) { printf("Test FAILED: Default prioceiling %d is not compliant with SCHED_FIFO boundry. \n", prioceiling); return PTS_FAIL; } printf("Test PASSED: Prioceiling %d\n", prioceiling); return PTS_PASS; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:31
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_getcpuclockid In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/interfaces/pthread_getcpuclockid Added Files: 1-1.c 2-1.sh assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: coverage.txt --- This document defines the coverage for the pthread_getcpuclockid function: Assertion Tested? 1 YES 2 YES 3 YES Note: --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XSH6:33138:33139"> pthread_getcpuclockid() function shall return in the clock ID of the CPU-time clock of the thread specified by thread_id, if the thread specified by thread_id exists. </assertion> <assertion id="2" tag="ref:XSH6:33141:33141"> If success, it returns zero. </assertion> <assertion id="3" tag="ref:XSH6:33144:33145"> If fails, an error number shall be returned to indicate the error. The pthread_getcpuclockid() may fail if: [ESRCH] The value specified by thread_id does not refer to an existing thread. </assertion> </assertions> --- NEW FILE: 1-1.c --- /* * Copyright (c) 2004, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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_getcpuclockid() * * Steps: * 1. Create a thread * 2. Call the API to get the clockid in the created thread */ #include <pthread.h> #include <time.h> #include <limits.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/param.h> #include <errno.h> #include <unistd.h> #include "posixtest.h" #define TEST "1-1" #define FUNCTION "pthread_getcpuclockid" #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " void *thread_func() { int rc; clockid_t cid; rc = pthread_getcpuclockid(pthread_self(), &cid); if (rc !=0 ) { perror(ERROR_PREFIX "pthread_getcpuclockid"); exit(PTS_FAIL); } printf("clock id of new thread is %d\n", cid); pthread_exit(0); return NULL; } int main() { int rc; pthread_t new_th; rc = pthread_create(&new_th, NULL, thread_func, NULL); if (rc !=0 ) { perror(ERROR_PREFIX "failed to create a thread"); exit(PTS_UNRESOLVED); } rc = pthread_join(new_th, NULL); if(rc != 0) { perror(ERROR_PREFIX "pthread_join"); exit(PTS_UNRESOLVED); } return PTS_PASS; } --- NEW FILE: 2-1.sh --- #!/bin/sh # Copyright (c) 2004, Intel Corporation. All rights reserved. # Created by: crystal.xiong 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_getcpuclockid returns 0 on success. # This is tested implicitly via assertion 1. echo "Tested implicitly via assertion 1. See output for status" exit 0 |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:31
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_getschedparam In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/interfaces/pthread_getschedparam Added Files: 1-1.c 1-2.c assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: coverage.txt --- This document defines the coverage for the pthread_getschedparam() function: Assertion Tested? 1 YES 2 NO 3 YES *Tested implictly by 1-1 Note: --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XSH6:33172:33182"> The pthread_getschedparam( ) function shall retrieve the scheduling policy and scheduling parameters for the thread whose thread ID is given by thread and shall store those values in policy and param, respectively. The priority value returned from pthread_getschedparam( ) shall be the value specified by the most recent pthread_setschedparam( ), pthread_setschedprio( ), or pthread_create( ) call affecting the target thread. It shall not reflect any temporary adjustments to its priority as a result of any priority inheritance or ceiling functions. </assertion> <assertion id="2" tag="ref:XSH6:33189:33199"> TSP If _POSIX_THREAD_SPORADIC_SERVER is defined, then the policy argument may have the value SCHED_SPORADIC, with the exception for the pthread_setschedparam( ) function that if the scheduling policy was not SCHED_SPORADIC at the time of the call, it is implementation-defined whether the function is supported; in other words, the implementation need not allow the application to dynamically change the scheduling policy to SCHED_SPORADIC. The sporadic server scheduling policy has the associated parameters sched_ss_low_priority, sched_ss_repl_period, sched_ss_init_budget, sched_priority, and sched_ss_max_repl. The specified sched_ss_repl_period shall be greater than or equal to the specified sched_ss_init_budget for the function to succeed; if it is not, then the function shall fail. The value of sched_ss_max_repl shall be within the inclusive range [1,{SS_REPL_MAX}] for the function to succeed; if not, the function shall fail. </assertion> <assertion id="3" tag="ref:XSH6:33203:33204"> If successful, the pthread_getschedparam( ) and pthread_setschedparam( ) functions shall return zero; otherwise, an error number shall be returned to indicate the error. </assertion> </assertions> --- NEW FILE: 1-1.c --- /* * 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@... * * The pthread_getschedparam( ) function shall retrieve the scheduling * policy and scheduling parameters for the thread whose thread ID is * given by thread and shall store those values in * policy and param, respectively. The priority value returned from * pthread_getschedparam( ) shall be * the value specified by the most recent pthread_setschedparam( ), * pthread_setschedprio( ), or pthread_create( ) call affecting the * target thread. It shall not reflect any temporary adjustments to * its priority as a result of any priority inheritance or ceiling functions. * */ #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include "posixtest.h" void *a_thread_func() { struct sched_param sparam; int policy; int rc; rc = pthread_getschedparam(pthread_self(), &policy, &sparam); if (rc != 0) { printf("Error at pthread_getschedparam: rc=%d\n", rc); exit(PTS_FAIL); } printf("policy: %d, priority: %d\n", policy, sparam.sched_priority); 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; } pthread_join(new_th, NULL); printf("Test PASSED\n"); return PTS_PASS; } --- NEW FILE: 1-2.c --- /* * 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@... * * The pthread_getschedparam( ) function shall retrieve the scheduling * policy and scheduling parameters for the thread whose thread ID is * given by thread and shall store those values in * policy and param, respectively. The priority value returned from * pthread_getschedparam( ) shall be * the value specified by the most recent pthread_setschedparam( ), * pthread_setschedprio( ), or pthread_create( ) call affecting the * target thread. It shall not reflect any temporary adjustments to * its priority as a result of any priority inheritance or ceiling functions. * */ /* Set the sched parameter with pthread_setschedparam then get */ #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include "posixtest.h" void *a_thread_func() { struct sched_param sparam; int policy, priority, policy_1; int rc; policy = SCHED_FIFO; priority = sched_get_priority_min(policy); sparam.sched_priority = priority; rc = pthread_setschedparam(pthread_self(), policy, &sparam); if (rc != 0) { printf("Error at pthread_setschedparam: rc=%d\n", rc); exit(PTS_UNRESOLVED); } rc = pthread_getschedparam(pthread_self(), &policy_1, &sparam); if (rc != 0) { printf("Error at pthread_getschedparam: rc=%d\n", rc); exit(PTS_FAIL); } //printf("policy: %d, priority: %d\n", policy_1, sparam.sched_priority); if (policy_1 != policy || sparam.sched_priority != priority) { printf("pthread_getschedparam did not get the correct value\n"); exit(PTS_FAIL); } 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; } pthread_join(new_th, NULL); printf("Test PASSED\n"); return PTS_PASS; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:31
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_setstacksize In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/interfaces/pthread_attr_setstacksize Added Files: 1-1.c 2-1.c 3-1.sh 4-1.c assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XSH6:31637:31638"> The pthread_attr_setstack() shall set the thread creation stack stacksize in the attr ojbect. </assertion> <assertion id="2" tag="ref:XSH6:31639:31640"> The stacksize attribute shall define the minimum stack size (in bytes) allocated for the created thread stack. </assertion> <assertion id="3" tag="ref:XSH6:31642:31643 ref:XSH6:31644:31645"> If success, it returns zero and stores the stacksize attribute in the stacksize if successful. </assertion> <assertion id="4" tag="ref:XSH6:31643:31643 ref:XSH6:31647:31649"> if fail, an error number shall be returned to indicate the error. The pthread_attr_setstacksize() function shall fail if: [EINVAL] The value of stacksize is less than {PTHREAD_STACK_MIN} or exceeds an implementation-defined limit. </assertion> <assertion id="5" tag="ref:XSH6:31650:31650"> Shall not return an error code of [EINTR] </assertion> </assertions> --- NEW FILE: 3-1.sh --- #!/bin/sh # Copyright (c) 2004, Intel Corporation. All rights reserved. # Created by: crystal.xiong 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_attr_setstack returns 0 on success. # This is tested implicitly via assertion 1. echo "Tested implicitly via assertion 1. See output for status" exit 0 --- NEW FILE: coverage.txt --- This document defines the coverage for the pthread_attr_setstacksize function: Assertion Tested? 1 YES 2 YES (The test uses a Non-POSIX-Compliant API pthread_getattr_np to get attr in a created thread) 3 YES 4 YES 5 won't test Note: --- NEW FILE: 1-1.c --- /* * Copyright (c) 2004, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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_attr_setstacksizesize() * * Steps: * 1. Initialize pthread_attr_t object (attr) * 2. set stacksize to attr * 3. create a thread with the attr */ #include <pthread.h> #include <limits.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/param.h> #include <errno.h> #include <unistd.h> #include "posixtest.h" #define TEST "1-1" #define FUNCTION "pthread_attr_setstacksize" #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " #define STACKADDROFFSET 0x8000000 void *thread_func() { pthread_exit(0); return NULL; } int main() { pthread_t new_th; pthread_attr_t attr; size_t stack_size = PTHREAD_STACK_MIN; size_t ssize; void *saddr; int rc; /* Initialize attr */ rc = pthread_attr_init(&attr); if( rc != 0) { perror(ERROR_PREFIX "pthread_attr_init"); exit(PTS_UNRESOLVED); } printf("stack_size = %u\n", stack_size); if (posix_memalign (&saddr, sysconf(_SC_PAGE_SIZE), stack_size) != 0) { perror (ERROR_PREFIX "out of memory while " "allocating the stack memory"); exit(PTS_UNRESOLVED); } rc = pthread_attr_setstacksize(&attr, stack_size); if (rc != 0 ) { perror(ERROR_PREFIX "pthread_attr_setstacksize"); exit(PTS_UNRESOLVED); } rc = pthread_attr_getstacksize(&attr, &ssize); if (rc != 0 ) { perror(ERROR_PREFIX "pthread_attr_getstacksize"); exit(PTS_UNRESOLVED); } printf("stack_size = %u\n", ssize); rc = pthread_create(&new_th, &attr, thread_func, NULL); if (rc !=0 ) { perror(ERROR_PREFIX "failed to create a thread"); exit(PTS_FAIL); } rc = pthread_join(new_th, NULL); if(rc != 0) { perror(ERROR_PREFIX "pthread_join"); exit(PTS_UNRESOLVED); } rc = pthread_attr_destroy(&attr); if(rc != 0) { perror(ERROR_PREFIX "pthread_attr_destroy"); exit(PTS_UNRESOLVED); } printf("Test PASSED\n"); return PTS_PASS; } --- NEW FILE: 2-1.c --- /* * Copyright (c) 2004, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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_attr_setstacksize() * * Steps: * 1. Initialize pthread_attr_t object (attr) * 2. set stacksize to attr * 3. create a thread with the attr * 4. In the created thread, read stackaddr * * NOTE: pthread_getattr_np is not a POSIX compliant API. It is * provided by nptl, which is developed by Ulrich Drepper. */ #define _GNU_SOURCE #include <pthread.h> #include <limits.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/param.h> #include <errno.h> #include <unistd.h> #include "posixtest.h" #define TEST "2-1" #define FUNCTION "pthread_attr_setstacksize" #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " size_t stack_size; void *thread_func() { pthread_attr_t attr; size_t ssize; int rc; /* pthread_getattr_np is not POSIX Compliant API*/ rc = pthread_getattr_np(pthread_self(), &attr); if (rc != 0) { perror(ERROR_PREFIX "pthread_getattr_np"); exit(PTS_UNRESOLVED); } pthread_attr_getstacksize(&attr, &ssize); if (ssize != stack_size) { perror(ERROR_PREFIX "got the wrong stacksize or stackaddr"); exit(PTS_FAIL); } printf("ssize = %u\n", ssize); pthread_exit(0); return NULL; } int main() { pthread_t new_th; pthread_attr_t attr; size_t ssize; void *saddr; int rc; /* Initialize attr */ rc = pthread_attr_init(&attr); if( rc != 0) { perror(ERROR_PREFIX "pthread_attr_init"); exit(PTS_UNRESOLVED); } stack_size = PTHREAD_STACK_MIN; if (posix_memalign (&saddr, sysconf(_SC_PAGE_SIZE), stack_size) != 0) { perror (ERROR_PREFIX "out of memory while " "allocating the stack memory"); exit(PTS_UNRESOLVED); } printf("stack_size = %u\n", stack_size); rc = pthread_attr_setstacksize(&attr, stack_size); if (rc != 0 ) { perror(ERROR_PREFIX "pthread_attr_setstacksize"); exit(PTS_UNRESOLVED); } rc = pthread_attr_getstacksize(&attr, &ssize); if (rc != 0 ) { perror(ERROR_PREFIX "pthread_attr_getstacksize"); exit(PTS_UNRESOLVED); } printf("ssize = %u\n", ssize); rc = pthread_create(&new_th, &attr, thread_func, NULL); if (rc !=0 ) { perror(ERROR_PREFIX "failed to create a thread"); exit(PTS_FAIL); } rc = pthread_join(new_th, NULL); if(rc != 0) { perror(ERROR_PREFIX "pthread_join"); exit(PTS_UNRESOLVED); } rc = pthread_attr_destroy(&attr); if(rc != 0) { perror(ERROR_PREFIX "pthread_attr_destroy"); exit(PTS_UNRESOLVED); } printf("Test PASSED\n"); return PTS_PASS; } --- NEW FILE: 4-1.c --- /* * Copyright (c) 2004, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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_attr_setstacksize() * * Steps: * 1. Initialize pthread_attr_t object (attr) * 2. set the stacksize less tha PTHREAD_STACK_MIN */ #include <pthread.h> #include <limits.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/param.h> #include <errno.h> #include <unistd.h> #include "posixtest.h" #define TEST "4-1" #define FUNCTION "pthread_attr_setstacksize" #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " #define STACKSIZE PTHREAD_STACK_MIN - sysconf(_SC_PAGE_SIZE) void *thread_func() { pthread_exit(0); return NULL; } int main() { pthread_attr_t attr; void *saddr; size_t stack_size; int rc; /* Initialize attr */ rc = pthread_attr_init(&attr); if( rc != 0) { perror(ERROR_PREFIX "pthread_attr_init"); exit(PTS_UNRESOLVED); } stack_size = STACKSIZE; if (posix_memalign (&saddr, sysconf(_SC_PAGE_SIZE), stack_size) != 0) { perror (ERROR_PREFIX "out of memory while " "allocating the stack memory"); exit(PTS_UNRESOLVED); } printf("stack_size = %u\n", stack_size); rc = pthread_attr_setstacksize(&attr, stack_size); if (rc != EINVAL ) { perror(ERROR_PREFIX "Got the wrong return value"); exit(PTS_FAIL); } rc = pthread_attr_destroy(&attr); if(rc != 0) { perror(ERROR_PREFIX "pthread_attr_destroy"); exit(PTS_UNRESOLVED); } printf("Test PASSED\n"); return PTS_PASS; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:30
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getstackaddr In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/interfaces/pthread_attr_getstackaddr Added Files: 1-1.c 2-1.sh assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: coverage.txt --- This document defines the coverage for the pthread_attr_getstackaddr function: Assertion Tested? 1 YES 2 YES 3 won't test Note: --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XSH6:31585:31586"> The pthread_attr_getstackaddr() shall get the thread creation stackaddr attribute in the attr ojbect. </assertion> <assertion id="2" tag="ref:XSH6:31590:31591 ref:XSH6:31592:31593"> If success, it returns zero and stores the stackaddr attribute value in stackaddr. </assertion> <assertion id="3" tag="ref:XSH6:31595:31596"> No errors are defined. The functions shall not return an error code of [EINTR]. </assertion> </assertion> </assertions> --- NEW FILE: 1-1.c --- /* * Copyright (c) 2004, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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_attr_getstackaddr() * * Steps: * 1. Initialize pthread_attr_t object (attr) * 2. set the stackaddr to attr * 3. get the stackaddr */ #include <pthread.h> #include <limits.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/param.h> #include <errno.h> #include <unistd.h> #include "posixtest.h" #define TEST "1-1" #define FUNCTION "pthread_attr_getstackaddr" #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " int main() { pthread_attr_t attr; size_t ssize; void *stack_addr; void *saddr; int rc; /* Initialize attr */ rc = pthread_attr_init(&attr); if( rc != 0) { perror(ERROR_PREFIX "pthread_attr_init"); exit(PTS_UNRESOLVED); } /* Get the default stack_addr value */ rc = pthread_attr_getstackaddr(&attr, &stack_addr); if( rc != 0) { perror(ERROR_PREFIX "pthread_attr_getstackaddr"); exit(PTS_UNRESOLVED); } printf("stack_addr = %u\n", stack_addr); ssize = PTHREAD_STACK_MIN; if (posix_memalign (&stack_addr, sysconf(_SC_PAGE_SIZE), ssize) != 0) { perror (ERROR_PREFIX "out of memory while " "allocating the stack memory"); exit(PTS_UNRESOLVED); } printf("stack_addr = %u\n", stack_addr); rc = pthread_attr_setstackaddr(&attr, stack_addr); if (rc != 0 ) { perror(ERROR_PREFIX "pthread_attr_setstacksize"); exit(PTS_UNRESOLVED); } rc = pthread_attr_getstackaddr(&attr, &saddr); if (rc != 0 ) { perror(ERROR_PREFIX "pthread_attr_getstackaddr"); exit(PTS_UNRESOLVED); } printf("saddr = %u\n", saddr); rc = pthread_attr_destroy(&attr); if(rc != 0) { perror(ERROR_PREFIX "pthread_attr_destroy"); exit(PTS_UNRESOLVED); } printf("Test PASSED\n"); return PTS_PASS; } --- NEW FILE: 2-1.sh --- #!/bin/sh # Copyright (c) 2004, Intel Corporation. All rights reserved. # Created by: crystal.xiong 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_attr_getstackaddr returns 0 on success. # This is tested implicitly via assertion 1. echo "Tested implicitly via assertion 1. See output for status" exit 0 |
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/definitions/signal_h In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/definitions/signal_h Added Files: 1-1.c 13-1.c 14-1.c 15-1.c 16-1.c 17-1.c 18-1.c 19-1.c 2-1.c 2-2.c 2-3.c 2-4.c 20-1.c 21-1.c 22-1.c 22-10.c 22-11.c 22-12.c 22-13.c 22-14.c 22-15.c 22-16.c 22-17.c 22-18.c 22-19.c 22-2.c 22-20.c 22-21.c 22-22.c 22-23.c 22-24.c 22-25.c 22-26.c 22-27.c 22-28.c 22-29.c 22-3.c 22-30.c 22-31.c 22-32.c 22-33.c 22-34.c 22-35.c 22-36.c 22-37.c 22-38.c 22-39.c 22-4.c 22-40.c 22-5.c 22-6.c 22-7.c 22-8.c 22-9.c 23-1.c 24-1.c 25-1.c 26-1.c 27-1.c 28-1.c 29-1.c 3-1.c 30-1.c 31-1.c 32-1.c 33-1.c 34-1.c 35-1.c 36-1.c 37-1.c 38-1.c 39-1.c 4-1.c 40-1.c 41-1.c 42-1.c 43-1.c 44-1.c 45-1.c 46-1.c 47-1.c 48-1.c 49-1.c 5-1.c 50-1.c assertions.xml coverage.txt make22tests sigmacrolist.txt Log Message: Update to 1.4.1 --- NEW FILE: 42-1.c --- /* Test that the function: int sigprocmask(int, const sigset_t *restrict, sigset_t *restrict); is declared. Removed restrict keyword from typedef. */ #include <signal.h> typedef int (*sigprocmask_test)(int, const sigset_t *, sigset_t *); int dummyfcn (void) { sigprocmask_test dummyvar; dummyvar = sigprocmask; return 0; } --- NEW FILE: 19-1.c --- /* Test the definition of stack_t. */ #include <signal.h> struct stack_t this_type_should_exist, t; void *sp; size_t size; int flags; int dummyfcn (void) { sp = t.ss_sp; size = t.ss_size; flags = t.ss_flags; return 0; } --- NEW FILE: 22-18.c --- /* Test that the SEGV_ACCERR macro is defined. */ #include <signal.h> #ifndef SEGV_ACCERR #error SEGV_ACCERR not defined #endif --- NEW FILE: 22-16.c --- /* Test that the FPE_FLTSUB macro is defined. */ #include <signal.h> #ifndef FPE_FLTSUB #error FPE_FLTSUB not defined #endif --- NEW FILE: 22-31.c --- /* Test that the POLL_OUT macro is defined. */ #include <signal.h> #ifndef POLL_OUT #error POLL_OUT not defined #endif --- NEW FILE: 22-40.c --- /* Test that the SI_MESGQ macro is defined. */ #include <signal.h> #ifndef SI_MESGQ #error SI_MESGQ not defined #endif --- NEW FILE: 27-1.c --- /* Test that the function: int pthread_sigmask(int, const sigset_t *, sigset_t *); is declared. */ #include <signal.h> typedef int (*pthread_sigmask_test)(int, const sigset_t *, sigset_t *); int dummyfcn (void) { pthread_sigmask_test dummyvar; dummyvar = pthread_sigmask; return 0; } --- NEW FILE: 22-39.c --- /* Test that the SI_ASYNCIO macro is defined. */ #include <signal.h> #ifndef SI_ASYNCIO #error SI_ASYNCIO not defined #endif --- NEW FILE: 22-12.c --- /* Test that the FPE_FLTOVF macro is defined. */ #include <signal.h> #ifndef FPE_FLTOVF #error FPE_FLTOVF not defined #endif --- NEW FILE: 22-35.c --- /* Test that the POLL_HUP macro is defined. */ #include <signal.h> #ifndef POLL_HUP #error POLL_HUP not defined #endif --- NEW FILE: 31-1.c --- /* Test that the function: int sigaltstack(const stack_t *restrict, stack_t *restrict); is declared. Removed restrict keyword from typedef. */ #include <signal.h> typedef int (*sigaltstack_test)(const stack_t *, stack_t *); int dummyfcn (void) { sigaltstack_test dummyvar; dummyvar = sigaltstack; return 0; } --- NEW FILE: 2-1.c --- /* Test the definition of SIG_DFL. */ #include <signal.h> void (*dummy) (int) = SIG_DFL; --- NEW FILE: 22-25.c --- /* Test that the CLD_KILLED macro is defined. */ #include <signal.h> #ifndef CLD_KILLED #error CLD_KILLED not defined #endif --- NEW FILE: 22-33.c --- /* Test that the POLL_ERR macro is defined. */ #include <signal.h> #ifndef POLL_ERR #error POLL_ERR not defined #endif --- NEW FILE: 29-1.c --- /* Test that the function: int sigaction(int, const struct sigaction *restrict, struct sigaction *restrict); is declared. Removed restrict keyword from typedef. */ #include <signal.h> typedef int (*sigaction_test)(int, const struct sigaction *, struct sigaction *); int dummyfcn (void) { sigaction_test dummyvar; dummyvar = sigaction; return 0; } --- NEW FILE: coverage.txt --- This document explains why certain assertions were not tested. Assertions not listed here should be covered by the tests in this directory. 6 through 12 - Did not test RTS assertions. 50 - This test case needs to be much larger. Other items I am currently investigating (as of 10/28/02): The assertions: 19 21 45 fail on the system I am testing on. These appear to be valid header file failures. --- NEW FILE: 40-1.c --- /* @:pt:XSI Test that the function: int sigpause(int); is declared. */ #include <signal.h> typedef int (*sigpause_test)(int); int dummyfcn (void) { sigpause_test dummyvar; dummyvar = sigpause; return 0; } --- NEW FILE: 22-14.c --- /* Test that the FPE_FLTRES macro is defined. */ #include <signal.h> #ifndef FPE_FLTRES #error FPE_FLTRES not defined #endif --- NEW FILE: 32-1.c --- /* Test that the function: int sigdelset(sigset_t *, int); is declared. */ #include <signal.h> typedef int (*sigdelset_test)(sigset_t *, int); int dummyfcn (void) { sigdelset_test dummyvar; dummyvar = sigdelset; return 0; } --- NEW FILE: 22-24.c --- /* Test that the CLD_EXITED macro is defined. */ #include <signal.h> #ifndef CLD_EXITED #error CLD_EXITED not defined #endif --- NEW FILE: 30-1.c --- /* Test that the function: int sigaddset(sigset_t *, int); is declared. */ #include <signal.h> typedef int (*sigaddset_test)(sigset_t *, int); int dummyfcn (void) { sigaddset_test dummyvar; dummyvar = sigaddset; return 0; } --- NEW FILE: 22-5.c --- /* Test that the ILL_PRVOPC macro is defined. */ #include <signal.h> #ifndef ILL_PRVOPC #error ILL_PRVOPC not defined #endif --- NEW FILE: 49-1.c --- /* Test that the function: int sigwaitinfo(const sigset_t *restrict, siginfo_t *restrict); is declared. */ #include <signal.h> typedef int (*sigwaitinfo_test)(const sigset_t *restrict, siginfo_t *restrict); int dummyfcn (void) { sigwaitinfo_test dummyvar; dummyvar = sigwaitinfo; return 0; } --- NEW FILE: 48-1.c --- /* Test that the function: int sigwait(const sigset_t *restrict, int *restrict); is declared. */ #include <signal.h> typedef int (*sigwait_test)(const sigset_t *restrict, int *restrict); int dummyfcn (void) { sigwait_test dummyvar; dummyvar = sigwait; return 0; } --- NEW FILE: 22-23.c --- /* Test that the TRAP_TRACE macro is defined. */ #include <signal.h> #ifndef TRAP_TRACE #error TRAP_TRACE not defined #endif --- NEW FILE: 17-1.c --- /* Test the definition of ucontext_t. */ #include <ucontext.h> ucontext_t dummy; --- NEW FILE: make22tests --- #!/bin/sh # Make the tests for assertion 22. # Not named *.sh because then it would be executed during build time. declare -i i i=1 for sigmacro in `cat sigmacrolist.txt` do echo " /*" >> 22-$i.c 2>&1 echo " Test that the $sigmacro macro is defined." >> 22-$i.c 2>&1 echo " */" >> 22-$i.c 2>&1 echo "" >> 22-$i.c 2>&1 echo "#include <signal.h>" >> 22-$i.c 2>&1 echo "" >> 22-$i.c 2>&1 echo "#ifndef $sigmacro" >> 22-$i.c 2>&1 echo "#error $sigmacro not defined" >> 22-$i.c 2>&1 echo "#endif" >> 22-$i.c 2>&1 i=$i+1 done --- NEW FILE: 22-2.c --- /* Test that the ILL_ILLOPN macro is defined. */ #include <signal.h> #ifndef ILL_ILLOPN #error ILL_ILLOPN not defined #endif --- NEW FILE: 22-29.c --- /* Test that the CLD_CONTINUED macro is defined. */ #include <signal.h> #ifndef CLD_CONTINUED #error CLD_CONTINUED not defined #endif --- NEW FILE: 38-1.c --- /* Test that the function: int sigismember(const sigset_t *, int); is declared. */ #include <signal.h> typedef int (*sigismember_test)(const sigset_t *, int); int dummyfcn (void) { sigismember_test dummyvar; dummyvar = sigismember; return 0; } --- NEW FILE: 2-3.c --- /* @pt:CX Test the definition of SIG_HOLD. */ #include <signal.h> void (*dummy) (int) = SIG_HOLD; --- NEW FILE: 13-1.c --- /* Test that 0 is reserved for the null signal. This test must be executed. */ #include <signal.h> #include <stdio.h> int main() { if ( (0 == SIGABRT) || (0 == SIGALRM) || (0 == SIGBUS) || (0 == SIGCHLD) || (0 == SIGCONT) || (0 == SIGFPE) || (0 == SIGHUP) || (0 == SIGILL) || (0 == SIGINT) || (0 == SIGKILL) || (0 == SIGPIPE) || (0 == SIGQUIT) || (0 == SIGSEGV) || (0 == SIGSTOP) || (0 == SIGTERM) || (0 == SIGTSTP) || (0 == SIGTTIN) || (0 == SIGTTOU) || (0 == SIGUSR1) || (0 == SIGUSR2) || (0 == SIGPOLL) || (0 == SIGPROF) || (0 == SIGSYS) || (0 == SIGTRAP) || (0 == SIGURG) || (0 == SIGVTALRM) || (0 == SIGXCPU) || (0 == SIGXFSZ) ) { printf("Test FAILED\n"); return -1; } else { printf("Test PASSED\n"); return 0; } } --- NEW FILE: 22-27.c --- /* Test that the CLD_TRAPPED macro is defined. */ #include <signal.h> #ifndef CLD_TRAPPED #error CLD_TRAPPED not defined #endif --- NEW FILE: 22-9.c --- /* Test that the FPE_INTDIV macro is defined. */ #include <signal.h> #ifndef FPE_INTDIV #error FPE_INTDIV not defined #endif --- NEW FILE: 22-38.c --- /* Test that the SI_TIMER macro is defined. */ #include <signal.h> #ifndef SI_TIMER #error SI_TIMER not defined #endif --- NEW FILE: 44-1.c --- /* Test that the function: int sigrelse(int); is declared. */ #include <signal.h> typedef int (*sigrelse_test)(int); int dummyfcn (void) { sigrelse_test dummyvar; dummyvar = sigrelse; return 0; } --- NEW FILE: 14-1.c --- /* Test that the signals below are supported. */ #include <signal.h> int dummy1 = SIGABRT; int dummy2 = SIGALRM; int dummy3 = SIGBUS; int dummy4 = SIGCHLD; int dummy5 = SIGCONT; int dummy6 = SIGFPE; int dummy7 = SIGHUP; int dummy8 = SIGILL; int dummy9 = SIGINT; int dummy10 = SIGKILL; int dummy11 = SIGPIPE; int dummy12 = SIGQUIT; int dummy13 = SIGSEGV; int dummy14 = SIGSTOP; int dummy15 = SIGTERM; int dummy16 = SIGTSTP; int dummy17 = SIGTTIN; int dummy18 = SIGTTOU; int dummy19 = SIGUSR1; int dummy20 = SIGUSR2; int dummy21 = SIGPOLL; int dummy22 = SIGPROF; int dummy23 = SIGSYS; int dummy24 = SIGTRAP; int dummy25 = SIGURG; int dummy26 = SIGVTALRM; int dummy27 = SIGXCPU; int dummy28 = SIGXFSZ; --- NEW FILE: 22-36.c --- /* Test that the SI_USER macro is defined. */ #include <signal.h> #ifndef SI_USER #error SI_USER not defined #endif --- NEW FILE: 36-1.c --- /* @:pt:XSI Test that the function: int sigignore(int); is declared. */ #include <signal.h> typedef int (*sigignore_test)(int); int dummyfcn (void) { sigignore_test dummyvar; dummyvar = sigignore; return 0; } --- NEW FILE: 22-11.c --- /* Test that the FPE_FLTDIV macro is defined. */ #include <signal.h> #ifndef FPE_FLTDIV #error FPE_FLTDIV not defined #endif --- NEW FILE: 22-6.c --- /* Test that the ILL_PRVREG macro is defined. */ #include <signal.h> #ifndef ILL_PRVREG #error ILL_PRVREG not defined #endif --- NEW FILE: 22-21.c --- /* Test that the BUS_OBJERR macro is defined. */ #include <signal.h> #ifndef BUS_OBJERR #error BUS_OBJERR not defined #endif --- NEW FILE: 45-1.c --- /* Test that the function: void (*sigset(int, void (*)(int)))(int); is declared. */ #include <signal.h> typedef void (*(*sigset_test)(int, void (*)(int)))(int); int dummyfcn (void) { sigset_test dummyvar; dummyvar = sigset; return 0; } --- NEW FILE: 28-1.c --- /* Test that the function: int raise(int); is declared. */ #include <signal.h> typedef int (*raise_test)(int); int dummyfcn (void) { raise_test dummyvar; dummyvar = raise; return 0; } --- NEW FILE: 16-1.c --- /* Test that the constants below are supported. */ #include <signal.h> int dummy1 = SA_NOCLDSTOP; int dummy2 = SIG_BLOCK; int dummy3 = SIG_UNBLOCK; int dummy4 = SIG_SETMASK; int dummy5 = SA_ONSTACK; int dummy6 = SA_RESETHAND; int dummy7 = SA_RESTART; int dummy8 = SA_SIGINFO; int dummy9 = SA_NOCLDWAIT; int dummy10 = SA_NODEFER; int dummy11 = SS_ONSTACK; int dummy12 = SS_DISABLE; int dummy13 = MINSIGSTKSZ; int dummy14 = SIGSTKSZ; --- NEW FILE: 33-1.c --- /* Test that the function: int sigemptyset(sigset_t *); is declared. */ #include <signal.h> typedef int (*sigemptyset_test)(sigset_t *); int dummyfcn (void) { sigemptyset_test dummyvar; dummyvar = sigemptyset; return 0; } --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XBD6:10713:10996"> The signal.h header file exists </assertion> <assertion id="2" tag="ref:XBD6:10722:10729"> The signal.h header defines the symbols SIG_DFL, SIG_ERR, SIG_HOLD and SIG_IGN as 'void (*) int'. </assertion> <assertion id="3" tag="ref:XBD6:10730:10732"> The signal.h header defines sig_atomic_t. </assertion> <assertion id="4" tag="ref:XBD6:10733:10733"> The signal.h header defines sigset_t. </assertion> <assertion id="5" tag="ref:XBD6:10734:10734"> The sys/types.h header defines pid_t. </assertion> <assertion id="6" tag="ref:XBD6:10735:10741 pt:RTS"> The signal.h header defines a structure named sigevent which has at least: int sigev_notify int sigev_signo union sigval sigev_value void(*)(union sigval) sigev_notify_function (pthread_attr_t *) sigev_notify_attributes </assertion> <assertion id="7" tag="ref:XBD6:10742:10747 pt:RTS"> For sigev_notify (assertion 6), the following values are defined: SIGEV_NONE SIGEV_SIGNAL SIGEV_THREAD </assertion> <assertion id="8" tag="ref:XBD6:10748:10750 pt:RTS"> The sigval union (assertion 6) is defined as: int sival_int void *sival_ptr </assertion> <assertion id="9" tag="ref:XBD6:10751:10753 pt:RTS"> The signal.h header declares SIGRTMIN and SIGRTMAX. These are macros that evaluate to integer expressions for the minimum and maximum signal numbers reserved for realtime signals. </assertion> <assertion id="10" tag="ref:XBD6:10754:10755 pt:RTS"> The range SIGRTMIN-SIGRTMAX doesn't overlap pre-defined signals (see below). </assertion> <assertion id="11" tag="ref:XBD6:10756:10757 pt:RTS"> The SIGRTMIN-SIGRTMAX range includes at least {RTSIG_MAX} signal numbers. </assertion> <assertion id="12" tag="ref:XBD6:10758:10758 pt:RTS"> Realtime signal behavior may or may not be supported for non-realtime signals. This is defined by the implementation. </assertion> <assertion id="13" tag="ref:XBD6:10761:10762"> The value 0 is not used in any signals, but is reserved as the null signal. </assertion> <assertion id="14" tag="ref:XBD6:10765:10797"> The following signals are always (on all implementations) supported: SIGABRT SIGALRM SIGBUS SIGCHLD SIGCONT SIGFPE SIGHUP SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV SIGSTOP SIGTERM SIGTSTP SIGTTIN SIGTTOU SIGUSR1 SIGUSR2 SIGPOLL SIGPROF SIGSYS SIGTRAP SIGURG SIGVTALRM SIGXCPU SIGXFSZ </assertion> <assertion id="15" tag="ref:XBD6:10808:10817"> The signal.h header declares the struct sigaction which has, at a minimum, the following members: void (*sa_handler)(int) sigset_t sa_mask int sa_flags void (*)(int, siginfo_t *, void *) sa_sigaction </assertion> <assertion id="16" tag="ref:XBD6:10820:10839"> The constants below are declared: SA_NOCLDSTOP SIG_BLOCK SIG_UNBLOCK SIG_SETMASK SA_ONSTACK SA_RESETHAND SA_RESTART SA_SIGINFO SA_NOCLDWAIT SA_NODEFER SS_ONSTACK SS_DISABLE MINSIGSTKSZ SIGSTKSZ </assertion> <assertion id="17" tag="ref:XBD6:10840:10840"> The ucontext.h header shall define ucontext_t. </assertion> <assertion id="18" tag="ref:XBD6:10841:10841"> The ucontext.h header shall define mcontext_t. </assertion> <assertion id="19" tag="ref:XBD6:10842:10846"> The signal.h header defines the structure stack_t which includes the following, at a minimum: void *ss_sp size_t ss_size int ss_flags </assertion> <assertion id="20" tag="ref:XBD6:10847:10850"> The signal.h header defines the structure sigstack which includes the following, at a minimum: int ss_onstack void *ss_sp </assertion> <assertion id="21" tag="ref:XBD6:10852:10864"> The signal.h header defines the structure siginfo_t which includes the following, at a minimum: int si_signo int si_errno int si_code pid_t si_pid uid_t si_uid void *si_addr int si_status long si_band union sigval si_value </assertion> <assertion id="22" tag="ref:XBD6:10867:10910"> The following macros are defined: ILL_ILLOPC ILL_ILLOPN ILL_ILLADR ILL_ILLTRP ILL_PRVOPC ILL_PRVREG ILL_COPROC ILL_BADSTK FPE_INTDIV FPE_INTOVF FPE_FLTDIV FPE_FLTOVF FPE_FLTUND FPE_FLTRES FPE_FLTINV FPE_FLTSUB SEGV_MAPERR SEGV_ACCERR BUS_ADRALN BUS_ADRERR BUS_OBJERR TRAP_BRKPT TRAP_TRACE CLD_EXITED CLD_KILLED CLD_DUMPED CLD_TRAPPED CLD_STOPPED CLD_CONTINUED POLL_IN POLL_OUT POLL_MSG POLL_ERR POLL_PRI POLL_HUP SI_USER SI_QUEUE SI_TIMER SI_ASYNCIO SI_MESGQ </assertion> <assertion id="23" tag="ref:XBD6:10929:10929 pt:XSI"> The function below is declared: void (*bsd_signal(int, void (*)(int)))(int); </assertion> <assertion id="24" tag="ref:XBD6:10930:10930 pt:CX"> The function below is declared: int kill(pid_t, int); </assertion> <assertion id="25" tag="ref:XBD6:10931:10931 pt:XSI"> The function below is declared: int killpg(pid_t, int); </assertion> <assertion id="26" tag="ref:XBD6:10932:10932 pt:THR"> The function below is declared: int pthread_kill(pthread_t, int); </assertion> <assertion id="27" tag="ref:XBD6:10933:10933"> The function below is declared: int pthread_sigmask(int, const sigset_t *, sigset_t *); </assertion> <assertion id="28" tag="ref:XBD6:10934:10934"> The function below is declared: int raise(int); </assertion> <assertion id="29" tag="ref:XBD6:10935:10936 pt:CX"> The function below is declared: int sigaction(int, const struct sigaction *restrict, struct sigaction *restrict); </assertion> <assertion id="30" tag="ref:XBD6:10937:10937"> The function below is declared: int sigaddset(sigset_t *, int); </assertion> <assertion id="31" tag="ref:XBD6:10938:10938 pt:XSI"> The function below is declared: int sigaltstack(const stack_t *restrict, stack_t *restrict); </assertion> <assertion id="32" tag="ref:XBD6:10939:10939 pt:CX"> The function below is declared: int sigdelset(sigset_t *, int); </assertion> <assertion id="33" tag="ref:XBD6:10940:10940"> The function below is declared: int sigemptyset(sigset_t *); </assertion> <assertion id="34" tag="ref:XBD6:10941:10941"> The function below is declared: int sigfillset(sigset_t *); </assertion> <assertion id="35" tag="ref:XBD6:10942:10942 pt:XSI"> The function below is declared: int sighold(int); </assertion> <assertion id="36" tag="ref:XBD6:10943:10943 pt:XSI"> The function below is declared: int sigignore(int); </assertion> <assertion id="37" tag="ref:XBD6:10944:10944"> The function below is declared: int siginterrupt(int, int); </assertion> <assertion id="38" tag="ref:XBD6:10945:10945 pt:CX"> The function below is declared: int sigismember(const sigset_t *, int); </assertion> <assertion id="39" tag="ref:XBD6:10946:10946"> The function below is declared: void (*signal(int, void (*)(int)))(int); </assertion> <assertion id="40" tag="ref:XBD6:10947:10947 pt:XSI"> The function below is declared: int sigpause(int); </assertion> <assertion id="41" tag="ref:XBD6:10948:10948 pt:CX"> The function below is declared: int sigpending(sigset_t *); </assertion> <assertion id="42" tag="ref:XBD6:10949:10949"> The function below is declared: int sigprocmask(int, const sigset_t *restrict, sigset_t *restrict); </assertion> <assertion id="43" tag="ref:XBD6:10950:10950 pt:RTS"> The function below is declared: int sigqueue(pid_t, int, const union sigval); </assertion> <assertion id="44" tag="ref:XBD6:10951:10951 pt:XSI"> The function below is declared: int sigrelse(int); </assertion> <assertion id="45" tag="ref:XBD6:10952:10952"> The function below is declared: void (*sigset(int, void (*)(int)))(int); </assertion> <assertion id="46" tag="ref:XBD6:10953:10953 pt:CX"> The function below is declared: int sigsuspend(const sigset_t *); </assertion> <assertion id="47" tag="ref:XBD6:10954:10955"> The function below is declared: int sigtimedwait(const sigset_t *restrict, siginfo_t *restrict, const struct timespec *restrict); </assertion> <assertion id="48" tag="ref:XBD6:10956:10956 pt:CX"> The function below is declared: int sigwait(const sigset_t *restrict, int *restrict); </assertion> <assertion id="49" tag="ref:XBD6:10957:10957 pt:RTS"> The function below is declared: int sigwaitinfo(const sigset_t *restrict, siginfo_t *restrict); </assertion> <assertion id="50" tag="ref:XBD6:10959:10959"> Inclusion of the <signal.h> header may make visible all symbols from the <time.h> header. </assertion> </assertions> --- NEW FILE: 1-1.c --- /* Test the existence of the signal.h file and that it can be included. */ #include <signal.h> --- NEW FILE: 22-19.c --- /* Test that the BUS_ADRALN macro is defined. */ #include <signal.h> #ifndef BUS_ADRALN #error BUS_ADRALN not defined #endif --- NEW FILE: 22-30.c --- /* Test that the POLL_IN macro is defined. */ #include <signal.h> #ifndef POLL_IN #error POLL_IN not defined #endif --- NEW FILE: 37-1.c --- /* Test that the function: int siginterrupt(int, int); is declared. */ #include <signal.h> typedef int (*siginterrupt_test)(int, int); int dummyfcn (void) { siginterrupt_test dummyvar; dummyvar = siginterrupt; return 0; } --- NEW FILE: 22-4.c --- /* Test that the ILL_ILLTRP macro is defined. */ #include <signal.h> #ifndef ILL_ILLTRP #error ILL_ILLTRP not defined #endif --- NEW FILE: 15-1.c --- /* Test the definition of sigaction. */ #include <signal.h> struct sigaction this_type_should_exist, t; extern void signal_handler (int); sigset_t *set; int flags; extern void signal_action(int, siginfo_t *, void *); int dummyfcn (void) { t.sa_handler = signal_handler; set = &t.sa_mask; flags = t.sa_flags; t.sa_sigaction = signal_action; return 0; } --- NEW FILE: 26-1.c --- /* Test that the function: int pthread_kill(pthread_t, int); is declared. */ #include <signal.h> typedef int (*pthread_kill_test)(pthread_t, int); int dummyfcn (void) { pthread_kill_test dummyvar; dummyvar = pthread_kill; return 0; } --- NEW FILE: 22-34.c --- /* Test that the POLL_PRI macro is defined. */ #include <signal.h> #ifndef POLL_PRI #error POLL_PRI not defined #endif --- NEW FILE: 22-13.c --- /* Test that the FPE_FLTUND macro is defined. */ #include <signal.h> #ifndef FPE_FLTUND #error FPE_FLTUND not defined #endif --- NEW FILE: 22-28.c --- /* Test that the CLD_STOPPED macro is defined. */ #include <signal.h> #ifndef CLD_STOPPED #error CLD_STOPPED not defined #endif --- NEW FILE: 21-1.c --- /* Test the definition of siginfo_t. */ #include <signal.h> #include <sys/types.h> struct siginfo_t this_type_should_exist, t; int tsigno; int terrno; int tcode; pid_t tpid; uid_t tuid; void *taddr; int tstatus; long tband; union sigval tvalue; int dummyfcn (void) { tsigno = t.si_signo; terrno = t.si_errno; tcode = t.si_code; tpid = t.si_pid; tuid = t.si_uid; taddr = t.si_addr; tstatus = t.si_status; tband = t.si_band; tvalue = t.si_value; return 0; } --- NEW FILE: 34-1.c --- /* Test that the function: int sigfillset(sigset_t *); is declared. */ #include <signal.h> typedef int (*sigfillset_test)(sigset_t *); int dummyfcn (void) { sigfillset_test dummyvar; dummyvar = sigfillset; return 0; } --- NEW FILE: 25-1.c --- /* Test that the function: int killpg(pid_t, int); is declared. */ #include <signal.h> #include <sys/types.h> typedef int (*killpg_test)(pid_t, int); int dummyfcn (void) { killpg_test dummyvar; dummyvar = killpg; return 0; } --- NEW FILE: 22-15.c --- /* Test that the FPE_FLTINV macro is defined. */ #include <signal.h> #ifndef FPE_FLTINV #error FPE_FLTINV not defined #endif --- NEW FILE: 43-1.c --- /* Test that the function: int sigqueue(pid_t, int, const union sigval); is declared. */ #include <signal.h> #include <sys/types.h> typedef int (*sigqueue_test)(pid_t, int, const union sigval); int dummyfcn (void) { sigqueue_test dummyvar; dummyvar = sigqueue; return 0; } --- NEW FILE: 35-1.c --- /* @:pt:XSI Test that the function: int sighold(int); is declared. */ #include <signal.h> typedef int (*sighold_test)(int); int dummyfcn (void) { sighold_test dummyvar; dummyvar = sighold; return 0; } --- NEW FILE: 47-1.c --- /* @pt:RTS Test that the function: int sigtimedwait(const sigset_t *restrict, siginfo_t *restrict, const struct timespec *restrict); is declared. */ #include <signal.h> typedef int (*sigtimedwait_test)(const sigset_t *restrict, siginfo_t *restrict, const struct timespec *restrict); int dummyfcn (void) { sigtimedwait_test dummyvar; dummyvar = sigtimedwait; return 0; } --- NEW FILE: 5-1.c --- /* Test the definition of pid_t. */ #include <sys/types.h> pid_t dummy; --- NEW FILE: 22-8.c --- /* Test that the ILL_BADSTK macro is defined. */ #include <signal.h> #ifndef ILL_BADSTK #error ILL_BADSTK not defined #endif --- NEW FILE: 22-32.c --- /* Test that the POLL_MSG macro is defined. */ #include <signal.h> #ifndef POLL_MSG #error POLL_MSG not defined #endif --- NEW FILE: 24-1.c --- /* Test that the function: int kill(pid_t, int); is declared. */ #include <signal.h> #include <sys/types.h> typedef int (*kill_test)(pid_t, int); int dummyfcn (void) { kill_test dummyvar; dummyvar = kill; return 0; } --- NEW FILE: 22-22.c --- /* Test that the TRAP_BRKPT macro is defined. */ #include <signal.h> #ifndef TRAP_BRKPT #error TRAP_BRKPT not defined #endif --- NEW FILE: 23-1.c --- /* @pt:XSI Test that the function: void (*bsd_signal(int, void (*)(int)))(int); is declared. */ #include <signal.h> typedef void (*(*bsd_signal_test)(int, void (*)(int)))(int); int dummyfcn (void) { bsd_signal_test dummyvar; dummyvar=bsd_signal; return 0; } --- NEW FILE: 2-4.c --- /* Test the definition of SIG_IGN. */ #include <signal.h> void (*dummy) (int) = SIG_IGN; --- NEW FILE: 46-1.c --- /* Test that the function: int sigsuspend(const sigset_t *); is declared. */ #include <signal.h> typedef int (*sigsuspend_test)(const sigset_t *); int dummyfcn (void) { sigsuspend_test dummyvar; dummyvar = sigsuspend; return 0; } --- NEW FILE: 22-17.c --- /* Test that the SEGV_MAPERR macro is defined. */ #include <signal.h> #ifndef SEGV_MAPERR #error SEGV_MAPERR not defined #endif --- NEW FILE: 22-1.c --- /* Test that the ILL_ILLOPC macro is defined. */ #include <signal.h> #ifndef ILL_ILLOPC #error ILL_ILLOPC not defined #endif --- NEW FILE: 2-2.c --- /* Test the definition of SIG_ERR. */ #include <signal.h> void (*dummy) (int) = SIG_ERR; --- NEW FILE: 20-1.c --- /* Test the definition of sigstack. */ #include <signal.h> struct sigstack this_type_should_exist, t; int onstack; void *sp; int dummyfcn (void) { sp = t.ss_sp; onstack = t.ss_onstack; return 0; } --- NEW FILE: 3-1.c --- /* Test the definition of sig_atomic_t. */ #include <signal.h> sig_atomic_t dummy; --- NEW FILE: 22-3.c --- /* Test that the ILL_ILLADR macro is defined. */ #include <signal.h> #ifndef ILL_ILLADR #error ILL_ILLADR not defined #endif --- NEW FILE: 39-1.c --- /* Test that the function: void (*signal(int, void (*)(int)))(int); is declared. */ #include <signal.h> typedef void (*(*signal_test)(int, void (*)(int)))(int); int dummyfcn (void) { signal_test dummyvar; dummyvar = signal; return 0; } --- NEW FILE: 22-26.c --- /* Test that the CLD_DUMPED macro is defined. */ #include <signal.h> #ifndef CLD_DUMPED #error CLD_DUMPED not defined #endif --- NEW FILE: 41-1.c --- /* @:pt:CX Test that the function: int sigpending(sigset_t *); is declared. */ #include <signal.h> typedef int (*sigpending_test)(sigset_t *); int dummyfcn (void) { sigpending_test dummyvar; dummyvar = sigpending; return 0; } --- NEW FILE: 22-10.c --- /* Test that the FPE_INTOVF macro is defined. */ #include <signal.h> #ifndef FPE_INTOVF #error FPE_INTOVF not defined #endif --- NEW FILE: 22-20.c --- /* Test that the BUS_ADRERR macro is defined. */ #include <signal.h> #ifndef BUS_ADRERR #error BUS_ADRERR not defined #endif --- NEW FILE: 50-1.c --- /* Test that inclusion of signal.h makes visible all symbols in time.h. NOTE - THIS TEST CASE IS NOT COMPLETE. NEEDS TO GROW MUCH LARGER. */ #include <signal.h> struct tm *mytime; --- NEW FILE: 22-7.c --- /* Test that the ILL_COPROC macro is defined. */ #include <signal.h> #ifndef ILL_COPROC #error ILL_COPROC not defined #endif --- NEW FILE: 22-37.c --- /* Test that the SI_QUEUE macro is defined. */ #include <signal.h> #ifndef SI_QUEUE #error SI_QUEUE not defined #endif --- NEW FILE: 18-1.c --- /* Test the definition of ucontext_t. */ #include <ucontext.h> mcontext_t dummy; --- NEW FILE: 4-1.c --- /* Test the definition of sigset_t. */ #include <signal.h> sigset_t dummy; --- NEW FILE: sigmacrolist.txt --- ILL_ILLOPC ILL_ILLOPN ILL_ILLADR ILL_ILLTRP ILL_PRVOPC ILL_PRVREG ILL_COPROC ILL_BADSTK FPE_INTDIV FPE_INTOVF FPE_FLTDIV FPE_FLTOVF FPE_FLTUND FPE_FLTRES FPE_FLTINV FPE_FLTSUB SEGV_MAPERR SEGV_ACCERR BUS_ADRALN BUS_ADRERR BUS_OBJERR TRAP_BRKPT TRAP_TRACE CLD_EXITED CLD_KILLED CLD_DUMPED CLD_TRAPPED CLD_STOPPED CLD_CONTINUED POLL_IN POLL_OUT POLL_MSG POLL_ERR POLL_PRI POLL_HUP SI_USER SI_QUEUE SI_TIMER SI_ASYNCIO SI_MESGQ |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:30
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_attr_getstacksize In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/interfaces/pthread_attr_getstacksize Added Files: 1-1.c 2-1.sh assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: coverage.txt --- This document defines the coverage for the pthread_attr_getstacksize function: Assertion Tested? 1 YES 2 YES 3 won't test Note: --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XSH6:31532:31533"> The pthread_attr_getstacksize() shall get the thread creation stacksize attributes stacksize in the attr ojbect. </assertion> <assertion id="2" tag="ref:XSH6:31541:31541"> If success, it returns zero. </assertion> <assertion id="3" tag="ref:XSH6:31554:31554"> Shall not return an error code of [EINTR] </assertion> </assertions> --- NEW FILE: 1-1.c --- /* * Copyright (c) 2004, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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_attr_getstacksize() * * Steps: * 1. Initialize pthread_attr_t object (attr) * 2. set the stacksize to attr * 3. get the stacksize */ #include <pthread.h> #include <limits.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/param.h> #include <errno.h> #include <unistd.h> #include "posixtest.h" #define TEST "1-1" #define FUNCTION "pthread_attr_getstacksize" #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " int main() { pthread_attr_t attr; size_t stack_size; size_t ssize; void *saddr; int rc; /* Initialize attr */ rc = pthread_attr_init(&attr); if( rc != 0) { perror(ERROR_PREFIX "pthread_attr_init"); exit(PTS_UNRESOLVED); } /* Get the default stack_addr and stack_size value */ rc = pthread_attr_getstacksize(&attr, &stack_size); if( rc != 0) { perror(ERROR_PREFIX "pthread_attr_getstacksize"); exit(PTS_UNRESOLVED); } printf("stack_size = %u\n", stack_size); stack_size = PTHREAD_STACK_MIN; if (posix_memalign (&saddr, sysconf(_SC_PAGE_SIZE), stack_size) != 0) { perror (ERROR_PREFIX "out of memory while " "allocating the stack memory"); exit(PTS_UNRESOLVED); } printf("stack_size = %u\n", stack_size); rc = pthread_attr_setstacksize(&attr, stack_size); if (rc != 0 ) { perror(ERROR_PREFIX "pthread_attr_setstacksize"); exit(PTS_UNRESOLVED); } rc = pthread_attr_getstacksize(&attr, &ssize); if (rc != 0 ) { perror(ERROR_PREFIX "pthread_attr_getstacksize"); exit(PTS_UNRESOLVED); } printf("ssize = %u\n", ssize); rc = pthread_attr_destroy(&attr); if(rc != 0) { perror(ERROR_PREFIX "pthread_attr_destroy"); exit(PTS_UNRESOLVED); } printf("Test PASSED\n"); return PTS_PASS; } --- NEW FILE: 2-1.sh --- #!/bin/sh # Copyright (c) 2004, Intel Corporation. All rights reserved. # Created by: crystal.xiong 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_attr_getstack returns 0 on success. # This is tested implicitly via assertion 1. echo "Tested implicitly via assertion 1. See output for status" exit 0 |
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/definitions/pthread_h In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/definitions/pthread_h Added Files: 1-1.c 10.c 11-1.c 12-1.c 13-1.c 14-1.c 15-1.c 16-1.c 17-1.c 18-1.c 19-1.c 2-1.c 2-2.c 20-1.c 3-1.c 3-10.c 3-11.c 3-12.c 3-13.c 3-2.c 3-3.c 3-4.c 3-5.c 3-6.c 3-7.c 3-8.c 3-9.c 4-1.c 5-1.c 6-1.c 7-1.c 8-1.c 9-1.c assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: 3-11.c --- /* * 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_rwlockattr_t */ #include <pthread.h> pthread_rwlockattr_t dummy; --- NEW FILE: 9-1.c --- /* * 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 this function is defined: int pthread_detach(pthread_t); */ #include <pthread.h> pthread_t a; void dummy_func () { pthread_detach(a); return; } --- NEW FILE: 3-10.c --- /* * 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_rwlock_t */ #include <pthread.h> pthread_rwlock_t dummy; --- NEW FILE: 18-1.c --- /* * 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 this function is defined: int pthread_mutex_unlock(pthread_mutex_t *); */ #include <pthread.h> pthread_mutex_t a; void dummy_func () { pthread_mutex_unlock(&a); return; } --- NEW FILE: 19-1.c --- /* * 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 this function is defined: int pthread_mutexattr_init(pthread_mutexattr_t *); */ #include <pthread.h> pthread_mutexattr_t a; void dummy_func () { pthread_mutexattr_init(&a); return; } --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XBD6:10174:10176 pt:THR"> The pthread.h file exists and can be included. </assertion> <assertion id="2" tag="ref:XBD6:10179:10202"> pthread.h header shall define the following symbols PTHREAD_BARRIER_SERIAL_THREAD BAR PTHREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ENABLE PTHREAD_CANCEL_DEFERRED PTHREAD_CANCEL_DISABLE PTHREAD_CANCELED PTHREAD_COND_INITIALIZER PTHREAD_CREATE_DETACHED PTHREAD_CREATE_JOINABLE PTHREAD_EXPLICIT_SCHED PTHREAD_INHERIT_SCHED PTHREAD_MUTEX_DEFAULT XSI PTHREAD_MUTEX_ERRORCHECK XSI PTHREAD_MUTEX_INITIALIZER PTHREAD_MUTEX_NORMAL XSI PTHREAD_MUTEX_RECURSIVE XSI PTHREAD_ONCE_INIT PTHREAD_PRIO_INHERIT TPP|TPI PTHREAD_PRIO_NONE TPP|TPI PTHREAD_PRIO_PROTECT TPP|TPI PTHREAD_PROCESS_SHARED PTHREAD_PROCESS_PRIVATE PTHREAD_SCOPE_PROCESS TPS PTHREAD_SCOPE_SYSTEM TPS </assertion> <assertion id="3" tag="ref:XBD:10205:10217"> Type 'pthread_attr_t' shall be defined as described in sys/types.h Type 'pthread_barrier_t' shall be defined as described in sys/types.h Type 'pthread_barrierattr_t' shall be defined as described in sys/types.h Type 'pthread_cond_t' shall be defined as described in sys/types.h Type 'pthread_condattr_t' shall be defined as described in sys/types.h Type 'pthread_key_t' shall be defined as described in sys/types.h Type 'pthread_mutex_t' shall be defined as described in sys/types.h Type 'pthread_mutexattr_t' shall be defined as described in sys/types.h Type 'pthread_once_t' shall be defined as described in sys/types.h Type 'pthread_rwlock_t' shall be defined as described in sys/types.h Type 'pthread_rwlockattr_t' shall be defined as described in sys/types.h Type 'pthread_spinlock_t' shall be defined as described in sys/types.h Type 'pthread_t' shall be defined as described in sys/types.h </assertion> <assertion id="4" tag="ref:XBD:10280:10280"> This function is defined: pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, void *(*)(void *), void *restrict); </assertion> <assertion id="5" tag="ref:XBD:10284:10284"> This function is defined: void pthread_exit(void *); </assertion> <assertion id="6" tag="ref:XBD:10338:10338"> This function is defined: pthread_t pthread_self(void); </assertion> <assertion id="7" tag="ref:XBD:10283:10283"> This function is defined: int pthread_equal(pthread_t, pthread_t); </assertion> <assertion id="8" tag="ref:XBD:10290:10290"> This function is defined: int pthread_join(pthread_t, void **); </assertion> <assertion id="9" tag="ref:XBD:10282:10282"> This function is defined: int pthread_detach(pthread_t); </assertion> <assertion id="10" tag="ref:XBD:10240:10240"> This function is defined: int pthread_attr_init(pthread_attr_t *); </assertion> <assertion id="11" tag="ref:XBD:10222:10222"> This function is defined: int pthread_attr_destroy(pthread_attr_t *); </assertion> <assertion id="12" tag="ref:XBD:10223:10223"> This function is defined: int pthread_attr_getdetachstate(const pthread_attr_t *, int *); </assertion> <assertion id="13" tag="ref:XBD:10241:10241"> This function is defined: int pthread_attr_setdetachstate(pthread_attr_t *, int); </assertion> <assertion id="14" tag="ref:XBD:10296:10297"> This function is defined: int pthread_mutex_init(pthread_mutex_t *restrict, const pthread_mutexattr_t *restrict); </assertion> <assertion id="15" tag="ref:XBD:10293:10293"> This function is defined: int pthread_mutex_destroy(pthread_mutex_t *); </assertion> <assertion id="16" tag="ref:XBD:10298:10298"> This function is defined: int pthread_mutex_lock(pthread_mutex_t *); </assertion> <assertion id="17" tag="ref:XBD:10303:10303"> This function is defined: int pthread_mutex_trylock(pthread_mutex_t *); </assertion> <assertion id="18" tag="ref:XBD:10304:10304"> This function is defined: int pthread_mutex_unlock(pthread_mutex_t *); </assertion> <assertion id="19" tag="ref:XBD:10314:10314"> This function is defined: int pthread_mutexattr_init(pthread_mutexattr_t *); </assertion> <assertion id="20" tag="ref:XBD:10305:10305"> This function is defined: int pthread_mutexattr_destroy(pthread_mutexattr_t *); </assertion> </assertions> --- NEW FILE: 3-2.c --- /* * 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_barrier_t BAR */ #include <pthread.h> pthread_barrier_t dummy; --- NEW FILE: 1-1.c --- /* * 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 the header file pthread.h exists and can be included */ #include <pthread.h> --- NEW FILE: 17-1.c --- /* * 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 this function is defined: int pthread_mutex_trylock(pthread_mutex_t *); */ #include <pthread.h> pthread_mutex_t a; void dummy_func () { pthread_mutex_trylock(&a); return; } --- NEW FILE: 16-1.c --- /* * 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 this function is defined: int pthread_mutex_lock(pthread_mutex_t *); */ #include <pthread.h> pthread_mutex_t a; void dummy_func () { pthread_mutex_lock(&a); return; } --- NEW FILE: 3-3.c --- /* * 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_barrierattr_t BAR */ #include <pthread.h> pthread_barrierattr_t dummy; --- NEW FILE: 2-2.c --- /* * 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 the following symbols are defined by pthread.h */ #include <pthread.h> /* BAR */ #ifndef PTHREAD_BARRIER_SERIAL_THREAD #error PTHREAD_BARRIER_SERIAL_THREAD not defined #endif /* XSI */ #ifndef PTHREAD_MUTEX_DEFAULT #error PTHREAD_MUTEX_DEFAULT not defined #endif /* XSI */ #ifndef PTHREAD_MUTEX_ERRORCHECK #error PTHREAD_MUTEX_ERRORCHECK not defined #endif /* XSI */ #ifndef PTHREAD_MUTEX_NORMAL #error PTHREAD_MUTEX_NORMAL not defined #endif /* XSI */ #ifndef PTHREAD_MUTEX_RECURSIVE #error PTHREAD_MUTEX_NORMAL not defined #endif /* TPP|TPI */ #ifndef PTHREAD_PRIO_INHERIT #error PTHREAD_PRIO_INHERIT not defined #endif /* TPP|TPI */ #ifndef PTHREAD_PRIO_NONE #error PTHREAD_PRIO_NONE not defined #endif /* TPP|TPI */ #ifndef PTHREAD_PRIO_PROTECT #error PTHREAD_PRIO_PROTECT not defined #endif /* TPS */ #ifndef PTHREAD_SCOPE_PROCESS #error PTHREAD_SCOPE_PROCESS not defined #endif /* TPS */ #ifndef PTHREAD_SCOPE_SYSTEM #error PTHREAD_SCOPE_SYSTEM not defined #endif --- NEW FILE: 3-6.c --- /* * 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_key_t */ #include <pthread.h> pthread_key_t dummy; --- NEW FILE: 7-1.c --- /* * 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 this function is defined: int pthread_equal(pthread_t, pthread_t); */ #include <pthread.h> pthread_t a,b; int tmp; void dummy_func () { tmp = pthread_equal(a,b); return; } --- NEW FILE: 12-1.c --- /* * 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 this function is defined: int pthread_attr_getdetachstate(const pthread_attr_t *, int *); */ #include <pthread.h> pthread_attr_t a; int *detachstate; void dummy_func () { pthread_attr_getdetachstate(&a, detachstate); return; } --- NEW FILE: 3-5.c --- /* * 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_condattr_t */ #include <pthread.h> pthread_condattr_t dummy; --- NEW FILE: 8-1.c --- /* * 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 this function is defined: int pthread_join(pthread_t, void **); */ #include <pthread.h> pthread_t a; void dummy_func () { pthread_join(a,NULL); return; } --- NEW FILE: 20-1.c --- /* * 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 this function is defined: int pthread_mutexattr_destroy(pthread_mutexattr_t *); */ #include <pthread.h> pthread_mutexattr_t a; void dummy_func () { pthread_mutexattr_destroy(&a); return; } --- NEW FILE: 3-1.c --- /* * 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_attr_t */ #include <pthread.h> pthread_attr_t dummy; --- NEW FILE: 3-8.c --- /* * 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_mutexattr_t */ #include <pthread.h> pthread_mutexattr_t dummy; --- NEW FILE: 13-1.c --- /* * 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 this function is defined: int pthread_attr_setdetachstate(const pthread_attr_t *, int); */ #include <pthread.h> pthread_attr_t a; void dummy_func () { pthread_attr_setdetachstate(&a, PTHREAD_CREATE_DETACHED); return; } --- NEW FILE: 15-1.c --- /* * 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 this function is defined: int pthread_mutex_destroy(pthread_mutex_t *); */ #include <pthread.h> pthread_mutex_t a; void dummy_func () { pthread_mutex_destroy(&a); return; } --- NEW FILE: 3-4.c --- /* * 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_cond_t */ #include <pthread.h> pthread_cond_t dummy; --- NEW FILE: 3-9.c --- /* * 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_t */ #include <pthread.h> pthread_once_t dummy; --- NEW FILE: 14-1.c --- /* * 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 this function is defined: int pthread_mutex_init(pthread_mutex_t *restrict, const pthread_mutexattr_t *restrict); */ #include <pthread.h> pthread_mutex_t a; void dummy_func () { pthread_mutex_init(&a, NULL); return; } --- NEW FILE: 3-7.c --- /* * 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_mutex_t */ #include <pthread.h> pthread_mutex_t dummy; --- NEW FILE: 2-1.c --- /* * 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 the following symbols are defined by pthread.h */ #include <pthread.h> #ifndef PTHREAD_CANCEL_ASYNCHRONOUS #error PTHREAD_CANCEL_ASYNCHRONOUS not defined #endif #ifndef PTHREAD_CANCEL_ENABLE #error PTHREAD_CANCEL_ENABLE not defined #endif #ifndef PTHREAD_CANCEL_DEFERRED #error PTHREAD_CANCEL_DEFERRED not defined #endif #ifndef PTHREAD_CANCEL_DISABLE #error PTHREAD_CANCEL_DISABLE not defined #endif #ifndef PTHREAD_CANCELED #error PTHREAD_CANCELED not defined #endif #ifndef PTHREAD_COND_INITIALIZER #error PTHREAD_COND_INTIALIZER not defined #endif #ifndef PTHREAD_CREATE_DETACHED #error PTHREAD_CREATE_DETACHED not defined #endif #ifndef PTHREAD_CREATE_JOINABLE #error PTHREAD_CREATE_JOINABLE not defined #endif #ifndef PTHREAD_EXPLICIT_SCHED #error PTHREAD_EXPLICIT_SCHED not defined #endif #ifndef PTHREAD_INHERIT_SCHED #error PTHREAD_INHERIT_SCHED not defined #endif #ifndef PTHREAD_MUTEX_INITIALIZER #error PTHREAD_MUTEX_INITIALIZED not defined #endif #ifndef PTHREAD_ONCE_INIT #error PTHREAD_ONCE_INIT not defined #endif #ifndef PTHREAD_PROCESS_SHARED #error PTHREAD_PROCESS_SHARED not defined #endif #ifndef PTHREAD_PROCESS_PRIVATE #error PTHREAD_PROCESS_PRIVATE not defined #endif --- NEW FILE: 6-1.c --- /* * 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 this function is defined: pthread_t pthread_self(void); */ #include <pthread.h> void dummy_func () { pthread_self(); return; } --- NEW FILE: 10.c --- /* * 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 this function is defined: int pthread_attr_init(pthread_attr_t *); */ #include <pthread.h> pthread_attr_t a; void dummy_func () { pthread_attr_init(&a); return; } --- NEW FILE: 3-13.c --- /* * 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_t */ #include <pthread.h> pthread_t dummy; --- NEW FILE: 3-12.c --- /* * 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_spinlock_t SPI */ #include <pthread.h> pthread_spinlock_t dummy; --- NEW FILE: 5-1.c --- /* * 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 this function is defined: void pthread_exit(void *); */ #include <pthread.h> void dummy_func () { pthread_exit(NULL); return; } --- NEW FILE: coverage.txt --- This document defines the coverage for conformance/definitions/pthread_h testing Assertion # Covered? Notes 1 YES 2 YES The symbols with tags associated with them usually fail on my implementaion of linux (e.g. BAR, XSI, etc.) 3 YES #2,3,10,11,12 fail on my implemention of linux #2 and 3 with BAR tag, #12 with SPI tag, and #11 and 12 with no tag. 4 YES 5 YES 6 YES 7 YES 8 YES 9 YES 10 YES 11 YES 12 YES 13 YES 14 YES 15 YES 16 YES 17 YES 18 YES 19 YES 20 YES --- NEW FILE: 4-1.c --- /* * 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 this function is defined: pthread_create(pthread_t *restrict, const pthread_attr_t *restrict, void *(*)(void *), void *restrict); */ #include <pthread.h> void dummy_func() { pthread_t a_thread; void *thread_function(); pthread_create(&a_thread, NULL, thread_function, NULL); return; } void thread_function() { return; } --- NEW FILE: 11-1.c --- /* * 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 this function is defined: int pthread_attr_destroy(pthread_attr_t *); */ #include <pthread.h> pthread_attr_t a; void dummy_func () { pthread_attr_destroy(&a); return; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:29
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/definitions/sched_h In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/definitions/sched_h Added Files: 1-1.c 10-1.c 11-1.c 12-1.c 13-1.c 14-1.c 15-1.c 16-1.c 17-1.c 18-1.c 19-1.c 2-1.c 3-1.c 4-1.c 8-1.c 8-2.c 8-3.c 8-4.c assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: 13-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that the function: * int sched_getparam(pid_t, struct sched_param *); * is declared. */ #include <sched.h> #include <sys/types.h> typedef int (*sched_getparam_test) (pid_t, struct sched_param *); int dummyfcn(void) { sched_getparam_test dummyvar; dummyvar = sched_getparam; return 0; } --- NEW FILE: 15-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that the function: * int sched_rr_get_interval(pid_t, struct timespec *); * is declared. */ #include <sched.h> #include <time.h> #include <sys/types.h> typedef int (*sched_rr_get_interval_test) (pid_t, struct timespec *); int dummyfcn(void) { sched_rr_get_interval_test dummyvar; dummyvar = sched_rr_get_interval; return 0; } --- NEW FILE: 16-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that the function: * int sched_setparam(pid_t, const struct sched_param *); * is declared. */ #include <sched.h> #include <sys/types.h> typedef int (*sched_setparam_test) (pid_t, const struct sched_param *); int dummyfcn(void) { sched_setparam_test dummyvar; dummyvar = sched_setparam; return 0; } --- NEW FILE: 19-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that inclusion of sched.h makes visible all symbols in time.h. * * NOTE - THIS TEST CASE IS NOT COMPLETE. NEEDS TO GROW MUCH LARGER * see posixtestsuite / conformance / definitions / signal_h / 50-1.c */ #include <sched.h> struct tm *mytime; --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XDB6:{Headers:sched.h:SYNOPSIS} pt:PS"> The sched.h header file exists </assertion> <assertion id="2" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> The sched.h header defines the structure sched_param which includes the following, at a minimum: int sched_priority </assertion> <assertion id="3" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION} pt:SS"> When _POSIX_SPORADIC_SERVER is defined, the structure sched_param shall also include the following: int sched_ss_low_priority struct timespec sched_ss_repl_period struct timespec sched_ss_init_budget int sched_ss_max_repl </assertion> <assertion id="4" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION} pt:TSP"> When _POSIX_THREAD_SPORADIC_SERVER is defined, the structure sched_param shall also includes the following: int sched_ss_low_priority struct timespec sched_ss_repl_period struct timespec sched_ss_init_budget int sched_ss_max_repl </assertion> <assertion id="5" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> Each process is controlled by an associated scheduling policy and priority </assertion> <assertion id="6" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> Associated with each policy is a priority range </assertion> <assertion id="7" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> Each policy definition specifies the minimum priority range for that policy </assertion> <assertion id="8" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> The symbolic constants below are defining the four standard policies: SCHED_FIFO SCHED_RR SCHED_SPORADIC (SS, TSP) SCHED_OTHER </assertion> <assertion id="9" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> Other policies may be defined by the implementation. </assertion> <assertion id="10" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> The symbolic constants defined below have all distinct values SCHED_FIFO SCHED_RR SCHED_SPORADIC (SS, TSP) SCHED_OTHER </assertion> <assertion id="11" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> This function is defined: int sched_get_priority_max(int); </assertion> <assertion id="12" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> This function is defined: int sched_get_priority_min(int); </assertion> <assertion id="13" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> This function is defined: int sched_getparam(pid_t, struct sched_param *); </assertion> <assertion id="14" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> This function is defined: int sched_getscheduler(pid_t); </assertion> <assertion id="15" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> This function is defined: int sched_rr_get_interval(pid_t, struct timespec *); </assertion> <assertion id="16" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> This function is defined: int sched_setparam(pid_t, const struct sched_param *); </assertion> <assertion id="17" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> This function is defined: int sched_setscheduler(pid_t, int, const struct sched_param *); </assertion> <assertion id="18" tag="ref:XDB6:{Headers:sched.h:DESCRIPTION}"> This function is defined: int sched_yield(void); </assertion> <assertion id="19" tag="ref:XBD6:{Headers:sched.h:DESCRIPTION}"> Inclusion of the sched.h header may make visible all symbols from the time.h header. </assertion> </assertions> --- NEW FILE: 14-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that the function: * int sched_getscheduler(pid_t); * is declared. */ #include <sched.h> #include <sys/types.h> typedef int (*sched_getscheduler_test) (pid_t); int dummyfcn(void) { sched_getscheduler_test dummyvar; dummyvar = sched_getscheduler; return 0; } --- NEW FILE: 1-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test the existence of the sched.h file and that it can be included. */ #include <sched.h> --- NEW FILE: 2-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that sched_param structure is declared and includes at a minimum: * int sched_priority */ #include <sched.h> struct sched_param this_type_should_exist, s; int dummyfcn(void) { s.sched_priority = 0; return 0; } --- NEW FILE: 8-2.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that SCHED_RR is defined */ #include <sched.h> #ifndef SCHED_RR #error SCHED_RR not defined #endif --- NEW FILE: 10-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * The policies symbols shall have unique value * I try to test every symbol in a loop. */ #include <stdio.h> #include <string.h> #include <sched.h> #include <unistd.h> #include "posixtest.h" struct unique { int value; char *name; } sym[] = { { SCHED_FIFO, "SCHED_FIFO" }, { SCHED_RR, "SCHED_RR" }, #if defined(_POSIX_SPORADIC_SERVER) || defined(_POSIX_THREAD_SPORADIC_SERVER) { SCHED_SPORADIC,"SCHED_SPORADIC" }, #endif { SCHED_OTHER, "SCHED_OTHER" }, { 0, 0 } }; int main() { struct unique *tst; int i, ret = PTS_PASS; tst = sym; while (tst->name) { for (i = 0; sym[i].name; i++) { if (tst->value == sym[i].value && strcmp(tst->name, sym[i].name)) { printf("%s has a duplicate value with %s\n", tst->name, sym[i].name); ret = PTS_FAIL; } } tst++; } return ret; } --- NEW FILE: 17-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that the function: * int sched_setscheduler(pid_t, int, const struct sched_param *); * is declared. */ #include <sched.h> #include <sys/types.h> typedef int (*sched_setscheduler_test) (pid_t, int, const struct sched_param *); int dummyfcn(void) { sched_setscheduler_test dummyvar; dummyvar = sched_setscheduler; return 0; } --- NEW FILE: 8-3.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * @pt:SS * @pt:TSP * Test that SCHED_SPORADIC is defined */ #include <sched.h> #ifndef SCHED_SPORADIC #error SCHED_SPORADIC not defined #endif --- NEW FILE: 12-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that the function: * int sched_get_priority_min(int); * is declared. */ #include <sched.h> typedef int (*sched_get_priority_min_test) (int); int dummyfcn(void) { sched_get_priority_min_test dummyvar; dummyvar = sched_get_priority_min; return 0; } --- NEW FILE: 18-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that the function: * int sched_yield(void); * is declared. */ #include <sched.h> typedef int (*sched_yield_test) (void); int dummyfcn(void) { sched_yield_test dummyvar; dummyvar = sched_yield; return 0; } --- NEW FILE: coverage.txt --- This document explains why certain assertions were not tested. Assertions not listed here should be covered by the tests in this directory. Assertions Tested ? Remarks 1 YES 2 YES 3 YES 4 YES 5 NO implementation defined on where are the scheduling policy and priority stored 6 NO implementation defined on how to get the priority range 7 NO implementation defined on how to get the minimum priority range for a policy 8 YES 9 NO implementation defined on how to get the other policies 10 YES 11 YES 12 YES 13 YES 14 YES 15 YES 16 YES 17 YES 18 YES 19 NO NOT COMPLETE --- NEW FILE: 8-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that SCHED_FIFO is defined */ #include <sched.h> #ifndef SCHED_FIFO #error SCHED_FIFO not defined #endif --- NEW FILE: 8-4.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that SCHED_OTHER is defined */ #include <sched.h> #ifndef SCHED_OTHER #error SCHED_OTHER not defined #endif --- NEW FILE: 3-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that when _POSIX_SPORADIC_SERVER is defined, sched_param structure * includes the following: * int sched_ss_low_priority * struct timespec sched_ss_repl_period * struct timespec sched_ss_init_budget * int sched_ss_max_repl */ #include <sched.h> #include <unistd.h> #ifdef _POSIX_SPORADIC_SERVER struct sched_param s; int dummyfcn(void) { struct timespec ss_repl_period, ss_init_budget; s.sched_ss_low_priority = 0; ss_repl_period = s.sched_ss_repl_period; ss_init_budget = s.sched_ss_init_budget; s.sched_ss_max_repl = 0; return 0; } #endif --- NEW FILE: 4-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that when _POSIX_THREAD_SPORADIC_SERVER is defined, * sched_param structure includes the following: * int sched_ss_low_priority * struct timespec sched_ss_repl_period * struct timespec sched_ss_init_budget * int sched_ss_max_repl */ #include <sched.h> #include <unistd.h> #ifdef _POSIX_THREAD_SPORADIC_SERVER struct sched_param s; int dummyfcn(void) { struct timespec ss_repl_period, ss_init_budget; s.sched_ss_low_priority = 0; ss_repl_period = s.sched_ss_repl_period; ss_init_budget = s.sched_ss_init_budget; s.sched_ss_max_repl = 0; return 0; } #endif --- NEW FILE: 11-1.c --- /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Test that the function: * int sched_get_priority_max(int); * is declared. */ #include <sched.h> typedef int (*sched_get_priority_max_test) (int); int dummyfcn(void) { sched_get_priority_max_test dummyvar; dummyvar = sched_get_priority_max; return 0; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:07
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/functional/threads In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/functional/threads Added Files: Makefile Makefile.inc README run.sh Log Message: Update to 1.4.1 --- NEW FILE: run.sh --- #!/bin/bash CURRENT_DIR=$(pwd) TEST_DIRS="robust_test pi_test" for test_dir in $TEST_DIRS; do echo "" echo "Run $test_dir tests" echo "==============================" echo "" cd $CURRENT_DIR/$test_dir; ./run.sh done --- NEW FILE: README --- Real Time NPTL(rt-nptl) test suite README ========================================= The document describes what rt-nptl tests are, how they are created, how to make and run the tests and how to analysis the result. rt-nptl tests include two parts, one is robust mutex tests, the other is priority inheritance(pi) mutex tests. In the document, <rtnptl-tests> stands for the directory where rtnptl-tests was extracted. Building the tests ------------------- If you use the build method outlined in INSTALL-rtnptl, then just change the top Makefile and the two Makefile under pi_test and robust_test to include the Makefile.inc generated by INSTALL-rtnptl. Otherwise, you need to set the CFLAGS and LDFLAGS of the Makefile to point to where your copy of glibc+RTNPTL is built. Run the tests ---------------- Use ./run.sh to run the tests; this makes sure there is a basic watchdog timer to kill the pi mutex tests if they fail. For different tests, there are different result analysis methods. The following two sections will describe this in detail. Robust Mutex Tests ------------------------ The tests are under <rtnptl-tests>/robust_test directory. rt-nptl supports 'robust' behavior, there will be two robust modes, one is PTHREAD_MUTEX_ROBUST_NP mode, the other is PTHREAD_MUTEX_ROBUST_SUN_NP mode. When the owner of a mutex dies in the first mode, the waiter will set the mutex to ENOTRECOVERABLE state, while in the second mode, the waiter needs to call pthread_mutex_setconsistency_np to change the state manually. The tests with name robust*-sun are used to test the PTHREAD_MUTEX_ROBUST_NP mode, other tests with name robust*-mode2 are used to test the PTHREAD_MUTEX_ROBUST_SUN_NP mode. Please refer to the description in the tests for the detailed information. Using run.sh under <rtnptl-tests>/robust_test to run the robust mutex tests automatically, the PASS or FAIL result can be obtained from the stdout. Priority Inheritance Mutex Tests -------------------------- The tests are under <rtnptl-tests>/pi_test directory. rt-nptl supports priority inheritance, if task TL with priority P(TL) held a mutex, task TB with priority P(TB) claims the mutex and becomes a waiter, P(TB)>P(TL), TL will boost to TB's priority until it releases the lock. The pi mutex tests create several scenarios to test this functionality. Please refer to the description in the tests for the detailed information. Currently pi mutex tests don't provide automatic PASS or FAIL result display. Although users can use run.sh under <rtnptl-tests>/pi_test to run the pi mutex tests, they need to analyze the output to get the PASS or FAIL test result manually. After executing run.sh, the output files will be generated with the name output.<testcasename>, such as output.pitest-1. If users use run.sh from ssh, to avoid the priority inversion problem happened occasionally, users can use "chrt -p -f $PRIORITY $$PPID" to increase the priority of sshd, if use run.sh from console, users can use "chrt -p -f $PRIORITY $$" to increase the shell priority before executing run.sh. A sampling thread will sample the progress of working threads (TL, TPs and TFs) at a specified interval and print out an integer value. Progress of TL and TP is measured by how many times they execute a busy loop; the output of this count indicates how far they progress with respect to each other. The first column of the output is the time when sampling happens. The second column indicates the progress of TL thread at that time. The third column indicates the progress of TP at that time. For pitest-2 and pitest-3, the second column is TP1 and the third column is TP2. The remaining columns indicate the progress of TF (if any). If the priority of TL is higher than (or equal to) the priority of TP, TP will make not progress (the output of TP will not increase, since it will not be scheduled to execute). Otherwise, TP and TL will both make progress. As a result, Users can observe the priority change of TL by the progress of TP. Users can also use 'do-plot' utility under <rtnptl-tests>/pi_test to generate a diagram using the output of test case. To do so: 1. Redirect the output of test case into a file, e.g: pitest-1 > output.pitest-1 2. Under X term, run: do-plot output.pitest-1 do-plot will invoke 'gnuplot' to generate a diagram showing the progress of TL and TP. ('gnuplot has to be installed in the system'). Given pitest-1 as an example: If the pi function works, TF's progress should be a straight line constantly going up; TP's progress should start at about 10 seconds and should be parallel to TF's until ten seconds later (20 seconds) when TL is created; at this time TP's slope should go down a wee bit and TL's slope should not be zero. After 10 seconds (30 seconds), TB is created and TL boosted. At this moment, TP's slope should go down to zero and TL's should be parallel to TF's. After TB timeouts on waiting the mutex (50 seconds), TL and TP's slope will change back to the original trend during 20~30 seconds. You can refer to http://developer.osdl.org/dev/robustmutexes/pitest-1-0.5.png for the diagram generated by do-plot for pitest-1. --- NEW FILE: Makefile --- include Makefile.inc SUBDIRS=robust_test pi_test .PHONY : all all: $(foreach SUBDIR,$(SUBDIRS),make -C $(SUBDIR);) install: $(foreach SUBDIR,$(SUBDIRS),make -C $(SUBDIR) install;) clean: rm -f *~ $(foreach SUBDIR,$(SUBDIRS),make -C $(SUBDIR) clean;) --- NEW FILE: Makefile.inc --- # # Include this file in your Makefile for linking against the built NPTL # and GLIBC # # NOTE: Before making the test suite, you need to build glibc. $LIBC_PATCH # stands for the path of GLIBC, please export it first. GLIBCROOT :=$(LIBC_PATH)/libc GLIBCDIR := $(LIBC_PATH)/libc/build CC := /usr/lib/gcc-snapshot/bin/gcc CCINCLUDE += /usr/lib/gcc-snapshot/lib/gcc-lib/i386-linux/3.3/include GLIBC_CFLAGS := \ -nostdinc \ -I$(CCINCLUDE) \ -I$(GLIBCROOT)/root/include{,/asm,/linux} \ -I$(GLIBCROOT)/root/include \ GLIBC_LDFLAGS := $(GLIBCDIR)/nptl/libpthread.so.0 \ $(GLIBCDIR)/libc.so.6 \ -Wl,-rpath,$(GLIBCDIR):$(GLIBCDIR)/nptl:$(GLIBCDIR)/elf,-dynamic-linker,$(GLIBCDIR)/elf/ld-linux.so.2 CFLAGS += $(GLIBC_CFLAGS) LDFLAGS += $(GLIBC_LDFLAGS) |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:07
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/stress/semaphores In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/stress/semaphores Added Files: Makefile assertions.xml coverage.txt multi_con_pro.c plan.txt run.sh Log Message: Update to 1.4.1 --- NEW FILE: coverage.txt --- This file defines the coverage for Semaphore stress tests. Assertion Covered? 1 YES --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="pt:SEM"> This is a test about multiple producers and consumers. Producers send data to a buffer. Consumers keeps reading data from the buffer. </assertion> </assertions> --- NEW FILE: run.sh --- #!/bin/sh # Copyright (c) 2002, Intel Corporation. All rights reserved. # Created by: crystal.xiong 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. # # Run all the tests in the semaphore stress area. # Helper functions RunTest() { echo "TEST: " $1 $2 TOTAL=$TOTAL+1 ./$1 $2 if [ $? == 0 ]; then PASS=$PASS+1 echo -ne "\t\t\t***TEST PASSED***\n\n" else FAIL=$FAIL+1 echo -ne "\t\t\t***TEST FAILED***\n\n" fi } # Main program declare -i TOTAL=0 declare -i PASS=0 declare -i FAIL=0 # Add lists of tests to these variables for execution TESTS="multi_con_pro.test" echo "Run the semaphore stress tests" echo "==========================================" RunTest $TESTS 100 echo echo -ne "\t\t****************\n" echo -ne "\t\t* TOTAL: " $TOTAL "\n" echo -ne "\t\t* PASSED: " $PASS "\n" echo -ne "\t\t* FAILED: " $FAIL "\n" echo -ne "\t\t****************\n" exit 0 --- NEW FILE: multi_con_pro.c --- /* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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 is a test about multiple producers and consumers. Producers send data * to a buffer. Consumers keeps reading data from the buffer. */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/wait.h> #include <sys/mman.h> #include <string.h> #include <getopt.h> #include <errno.h> #include <pthread.h> #include <semaphore.h> #include "posixtest.h" #define BUF_SIZE 5 #define Max_Num 5 #define Max_Threads 127 typedef struct { int buffer[BUF_SIZE]; sem_t full; sem_t empty; sem_t lock; }buf_t; buf_t *buf; int in, out; int *producer(void *ID) { int data; int i; int ThreadID = *(int *)ID; int full_value; printf("Enter into Producer Thread %d... \n", ThreadID); for (i = 0; i< Max_Num - 1; i++) { if (-1 == sem_wait(&buf->full)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_getvalue(&buf->full, &full_value)) { perror("sem_getvalue didn't return success \n"); pthread_exit((void *)1); } printf("The value of the full semaphore is %d \n", full_value); if (-1 == sem_wait(&buf->lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } data = 100*ThreadID + i; buf->buffer[in] = data; printf("[%d] producer has added %d to the buffer[%d] \n", ThreadID, data, in); in = (in + 1) % BUF_SIZE; if (-1 == sem_post(&buf->lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_post(&buf->empty)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } } if (-1 == sem_wait(&buf->full)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_getvalue(&buf->full, &full_value)) { perror("sem_getvalue didn't return success \n"); pthread_exit((void *)1); } printf("The value of the full is %d \n", full_value); if (-1 == sem_wait(&buf->lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } data = -1; buf->buffer[in] = data; printf("[%d] producer has added %d to the buffer[%d] \n", ThreadID, data, in); in = (in + 1) % BUF_SIZE; if (-1 == sem_post(&buf->lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_post(&buf->empty)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } printf("Producer %d exit... \n", ThreadID); pthread_exit((void *)0); } int *consumer(void *ID) { int data; int ThreadID = *(int *)ID; int full_value; printf("Enter into Consumer Thread %d... \n", ThreadID); do { if (-1 == sem_wait(&buf->empty)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_wait(&buf->lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } data = buf->buffer[out]; printf("[%d] consumer has taken %d from buffer[%d] \n", ThreadID, data, out); out = (out + 1) % BUF_SIZE; if (-1 == sem_post(&buf->lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_post(&buf->full)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_getvalue(&buf->full, &full_value)) { perror("sem_getvalue didn't return success \n"); pthread_exit((void *)1); } printf("The value of the full semaphore is %d \n", full_value); } while (data != -1); printf("Consumer %d exit... \n", ThreadID); pthread_exit((void *)0); } int main(int argc, char *argv[]) { int shared = 1; int full_value = BUF_SIZE; int empty_value = 0; int lock_value=1; int num; int i; pthread_t con[Max_Threads], pro[Max_Threads]; int ThreadID[Max_Threads]; #ifndef _POSIX_SEMAPHORES printf("_POSIX_SEMAPHORES is not defined \n"); return PTS_UNRESOLVED; #endif buf = (buf_t *)malloc(sizeof(buf_t)); if ( (2 != argc) || (( num = atoi(argv[1])) <= 0)) { fprintf(stderr, "Usage: %s number_of_threads\n", argv[0]); return PTS_FAIL; } if (num > Max_Threads) { printf("The num of producers/consumers threads are too large. Reset to %d\n", Max_Threads); num = Max_Threads; } if (-1 == sem_init(&buf->full, shared, full_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } if (-1 == sem_getvalue(&buf->full, &full_value)) { perror("sem_getvalue didn't return success \n"); return PTS_UNRESOLVED; } printf("The initial value of the full semaphore is %d \n", full_value); if (-1 == sem_init(&buf->empty, shared, empty_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } if (-1 == sem_init(&buf->lock, shared, lock_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } in = out = 0; for (i = 0; i < num; i++) { ThreadID[i] = i; pthread_create(&con[i], NULL, (void *)consumer, (void *)&ThreadID[i]); } for (i = 0; i < num; i++) { ThreadID[i] = i; pthread_create(&pro[i], NULL, (void *)producer, (void *)&ThreadID[i]); } for (i = 0; i < num; i++) pthread_join(con[i], NULL); for (i = 0; i < num; i++) pthread_join(pro[i], NULL); sem_destroy(&buf->full); sem_destroy(&buf->empty); sem_destroy(&buf->lock); return PTS_PASS; } --- NEW FILE: Makefile --- ifndef POSIX_DIR_LIB POSIX_DIR_LIB=/usr/lib endif INCLUDE = -I../../include LIB=-lposix1b CC=gcc CFLAGS=-Wall -O2 -g -I$(POSIX_DIR_INC) -L$(POSIX_DIR_LIB) all: multi_con_pro.test %.test : %.c $(CC) $(CFLAGS) $(INCLUDE) $< -o $@ $(LIB) -lpthread clean: rm *.test --- NEW FILE: plan.txt --- This document defines the plan for stress testing of POSIX Semaphores. |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:07
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/stress/signals In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/stress/signals Added Files: sigismember_stress_1.c Log Message: Update to 1.4.1 --- NEW FILE: sigismember_stress_1.c --- /* * Copyright (c) 2002, 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 results are undefined if sigismember() is called without * first calling sigemptyset() or sigfillset(). * Any results are acceptable; however, the system should not crash, hang, * or do something equally as harmful. */ #include <stdio.h> #include <signal.h> #include <posixtest.h> int main() { sigset_t signalset; int returnval; returnval = sigismember(&signalset, SIGALRM); #ifdef DEBUG printf("sigismember returned returnval\n"); #endif /* * If we made it here, the test case passes. */ return PTS_PASS; } |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:07
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/functional/semaphores In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/functional/semaphores Added Files: Makefile assertions.xml coverage.txt plan.txt run.sh sem_conpro.c sem_lock.c sem_philosopher.c sem_readerwriter.c sem_sleepingbarber.c Log Message: Update to 1.4.1 --- NEW FILE: sem_conpro.c --- /* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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 is a test about producer and consumer. Producer sends data * to a buffer. Consumer keeps reading data from the buffer. */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/wait.h> #include <sys/mman.h> #include <string.h> #include <getopt.h> #include <errno.h> #include <pthread.h> #include <semaphore.h> #include "posixtest.h" #define BUF_SIZE 5 #define Max_Num 10 typedef struct { int buffer[BUF_SIZE]; sem_t occupied; sem_t empty; sem_t lock; }buf_t; int in, out; int *producer(buf_t *buf) { int data; int i; for (i = 0; i< Max_Num; i++) { if (-1 == sem_wait(&buf->occupied)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_wait(&buf->lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } data = 100*i; buf->buffer[in] = data; printf("producer has added %d to the buffer[%d] \n", data, in); in = (in + 1) % BUF_SIZE; if (-1 == sem_post(&buf->lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_post(&buf->empty)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } } pthread_exit((void *)0); } int *consumer(buf_t *buf) { int data; int i; for (i = 0; i < Max_Num; i++) { if (-1 == sem_wait(&buf->empty)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_wait(&buf->lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } data = buf->buffer[out]; printf("consumer has taken %d from buffer[%d] \n", data, out); out = (out + 1) % BUF_SIZE; if (-1 == sem_post(&buf->lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_post(&buf->occupied)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } } pthread_exit(0); } int main(int argc, char *argv[]) { int shared = 1; int occupied_value = BUF_SIZE; int empty_value = 0; int lock_value=1; buf_t *buf; pthread_t con, pro; buf = (buf_t *)malloc(sizeof(buf_t)); #ifndef _POSIX_SEMAPHORES printf("_POSIX_SEMAPHORES is not defined \n"); return PTS_UNRESOLVED; #endif if (-1 == sem_init(&(buf->occupied), shared, occupied_value)) { perror("sem_init didn't return success \n"); printf("hello \n"); return PTS_UNRESOLVED; } if (-1 == sem_init(&buf->empty, shared, empty_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } if (-1 == sem_init(&buf->lock, shared, lock_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } in = out = 0; pthread_create(&con, NULL, (void *)consumer, (void *)buf); pthread_create(&pro, NULL, (void *)producer, (void *)buf); pthread_join(con, NULL); pthread_join(pro, NULL); sem_destroy(&buf->occupied); sem_destroy(&buf->empty); return PTS_PASS; } --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="pt:SEM"> Using semaphore to protect critical section </assertion> <assertion id="2" tag="pt:SEM"> Using semaphore to implement producer and consumer mechanism </assertion> <assertion id="3" tag="pt:SEM"> Using semaphore to implement reader and writer problem </assertion> <assertion id="4" tag="pt:SEM"> Using semaphore to implement philosopher problem </assertion> <assertion id="5" tag="pt:SEM"> Using semaphore to implement sleeping Barber problem </assertion> </assertions> --- NEW FILE: sem_readerwriter.c --- /* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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 test use semaphore to implement reader and writer problem. Some readers * and some writers read/write on one blackboard. Only one writer allow to * write on the board at the same time. Reader and Writer can't use the board * the same time. Reader has higher priority than writer, which means only when * no reader reads the board, the writer can write the board. */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/wait.h> #include <sys/mman.h> #include <string.h> #include <getopt.h> #include <errno.h> #include <semaphore.h> #include <pthread.h> #include "posixtest.h" #define SEM_NAME "/tmp/semaphore" #define READ_NUM 10 #define WRITE_NUM 15 sem_t r_lock, w_lock; int reader_count = 0; int data = 0; int read_fun(int ID) { printf("read the board, data=%d \n", data); return 0; } int write_fun(int ID) { data = 100*ID + ID; printf("write the board, data=%d \n", data); return 0; } int *reader(void *ID) { int ThID = *(int*)ID; if (-1 == sem_wait(&r_lock)) { perror("sem_wait didn't return success\n"); pthread_exit((void *)1); } reader_count++; printf("Enter into Reader thread, reader_count=%d \n", reader_count); if (reader_count == 1) { if (-1 == sem_wait(&w_lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } } if (-1 == sem_post(&r_lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } sleep(1); read_fun(ThID); if (-1 == sem_wait(&r_lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } reader_count--; if (reader_count == 0) { if (-1 == sem_post(&w_lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } } if (-1 == sem_post(&r_lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } printf("Reader Thread [%d] exit...reader_count=%d \n", ThID, reader_count); pthread_exit((void *)0); } int *writer(void *ID) { int ThID = *(int*)ID; /* When ThID is equal to WRITE_NUM/2, sleep 2 second and let reader read the data */ if (ThID >= WRITE_NUM/2) sleep(2); if (-1 == sem_wait(&w_lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } write_fun(ThID); if (-1 == sem_post(&w_lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } printf("Writer Thread [%d] exit...\n", ThID); pthread_exit((void *)0); } int main(int argc, char *argv[]) { pthread_t rea[READ_NUM], wri[WRITE_NUM]; int ReadID[READ_NUM], WriteID[WRITE_NUM]; int shared = 1; int r_value = 1; int w_value = 1; int i ; #ifndef _POSIX_SEMAPHORES printf("_POSIX_SEMAPHORES is not defined \n"); return PTS_UNRESOLVED; #endif if (-1 == sem_init(&r_lock, shared, r_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } if (-1 == sem_init(&w_lock, shared, w_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } for (i = 0; i< WRITE_NUM; i++) { WriteID[i] = i; pthread_create(&wri[i], NULL, (void *)writer, &WriteID[i]); } for (i = 0; i< READ_NUM; i++) { ReadID[i] = i; pthread_create(&rea[i], NULL, (void *)reader, &ReadID[i]); } for (i = 0; i< READ_NUM; i++) pthread_join(rea[i], NULL); for (i = 0; i< WRITE_NUM; i++) pthread_join(wri[i], NULL); if (-1 == sem_destroy(&r_lock)) { perror("sem_destroy didn't return success \n"); return PTS_UNRESOLVED; } if (-1 == sem_destroy(&w_lock)) { perror("sem_destroy didn't return success \n"); return PTS_UNRESOLVED; } return PTS_PASS; } --- NEW FILE: sem_philosopher.c --- /* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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 the well-known philosophy problem. * */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/wait.h> #include <sys/mman.h> #include <string.h> #include <getopt.h> #include <errno.h> #include <semaphore.h> #include <pthread.h> #include "posixtest.h" #define PH_NUM 5 #define LOOP_NUM 20 #define thinking 0 #define hungry 1 #define eating 2 sem_t ph[PH_NUM]; sem_t lock; int state[PH_NUM]; int think(int ID) { printf("Philosoper [%d] is thinking... \n", ID); return 0; } int eat(int ID) { printf("Philosoper [%d] is eating... \n", ID); return 0; } int test(int ID) { int preID = 0, postID = 0; if ((ID - 1) < 0) preID = PH_NUM + (ID - 1); else preID = (ID - 1)%PH_NUM; if ((ID + 1) >= PH_NUM) postID = ID + 1 - PH_NUM; else postID = (ID + 1)%PH_NUM; if ((state[ID] == hungry)&&(state[preID]!= eating)&&(state[postID] != eating)) { state[ID] = eating; sem_post(&ph[ID]); } return 0; } int philosopher(void *ID) { int PhID = *(int *)ID; int prePH, postPH; int i; for (i = 0; i < LOOP_NUM; i++) { think(PhID); sleep(1); if ( -1 == sem_wait(&lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } state[PhID] = hungry; test(PhID); if ( -1 == sem_post(&lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } if ( -1 == sem_wait(&ph[PhID])) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } eat(PhID); sleep(1); if ( -1 == sem_wait(&lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } state[PhID] = thinking; if ((PhID - 1) < 0) prePH = PH_NUM + (PhID - 1); else prePH = (PhID - 1)%PH_NUM; if ((PhID + 1) >= PH_NUM) postPH = PhID + 1 - PH_NUM; else postPH = (PhID + 1)%PH_NUM; test(prePH); test(postPH); if ( -1 == sem_post(&lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } } pthread_exit((void *) 0); } int main(int argc, char *argv[]) { pthread_t phi[PH_NUM]; int PhID[PH_NUM]; int shared = 1; int ph_value = 0; int lock_value = 1; int i ; #ifndef _POSIX_SEMAPHORES printf("_POSIX_SEMAPHORES is not defined \n"); return PTS_UNRESOLVED; #endif for (i = 0; i < PH_NUM; i++) { if (-1 == sem_init(&ph[i], shared, ph_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } state[i] = 0; } if (-1 == sem_init(&lock, shared, lock_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } for (i = 0; i< PH_NUM; i++) { PhID[i] = i; pthread_create(&phi[i], NULL, (void *)philosopher, &PhID[i]); } for (i = 0; i< PH_NUM; i++) { pthread_join(phi[i], NULL); } for (i = 0; i< PH_NUM; i++) { if (-1 == sem_destroy(&ph[i])) { perror("sem_destroy didn't return success \n"); return PTS_UNRESOLVED; } } if (-1 == sem_destroy(&lock)) { perror("sem_destroy didn't return success \n"); return PTS_UNRESOLVED; } return PTS_PASS; } --- NEW FILE: coverage.txt --- This file defines the coverage for Semaphore functional tests. Assertion Covered? 1 YES 2 YES 3 YES 4 YES 5 YES --- NEW FILE: sem_sleepingbarber.c --- /* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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 the well-known sleeping barber problem. */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/wait.h> #include <sys/mman.h> #include <string.h> #include <getopt.h> #include <errno.h> #include <pthread.h> #include <semaphore.h> #include "posixtest.h" #define CHAIR_NUM 5 #define CUS_NUM 10 #define LOOP_NUM 30 sem_t customer; sem_t barber; sem_t lock; int waiting = 0; int get_haircut(int ID) { printf("Customer [%d] gets the haircut\n", ID); return 0; } int barbers() { int i; for (i = 0; i < LOOP_NUM; i++) { if (-1 == sem_wait(&lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (waiting == 0) { printf("There is no customer waiting now, barber will sleep...\n"); if (-1 == sem_post(&lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } break; } if (-1 == sem_post(&lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_wait(&customer)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_wait(&lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (waiting >= 1) waiting--; printf("reduce one customers, totoally %d customers are waiting . \n", waiting); if (-1 == sem_post(&lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_post(&barber)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } } pthread_exit((void *) 0); } int customers(void* ID) { int CusID; CusID = *(int *)ID; printf("customer %d enter into the barber room...\n", CusID); if (-1 == sem_wait(&lock)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } if (waiting < CHAIR_NUM) { waiting = waiting + 1; if (-1 == sem_post(&customer)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } printf("one customer added, totally %d customers are waiting...\n", waiting); if (-1 == sem_post(&lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } if (-1 == sem_wait(&barber)) { perror("sem_wait didn't return success \n"); pthread_exit((void *)1); } get_haircut(CusID); } else { printf("Chair is full, customer %d quit.. \n", CusID); if (-1 == sem_post(&lock)) { perror("sem_post didn't return success \n"); pthread_exit((void *)1); } } pthread_exit((void *) 0); } int main(int argc, char *argv[]) { pthread_t bar, cus[CUS_NUM]; int shared = 1; int barber_value = 0; int customer_value = 0; int lock_value=1; int i, ID[CUS_NUM]; #ifndef _POSIX_SEMAPHORES printf("_POSIX_SEMAPHORES is not defined \n"); return PTS_UNRESOLVED; #endif if (-1 == sem_init(&customer, shared, customer_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } if (-1 == sem_init(&barber, shared, barber_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } if (-1 == sem_init(&lock, shared, lock_value)) { perror("sem_init didn't return success \n"); return PTS_UNRESOLVED; } for (i = 0; i < CUS_NUM; i++) { ID[i] = i; pthread_create(&cus[i], NULL, (void *)customers, &ID[i]); } pthread_create(&bar, NULL, (void *)barbers, NULL); pthread_join(bar, NULL); for (i = 0; i< CUS_NUM; i++) pthread_join(cus[i], NULL); sem_destroy(&barber); sem_destroy(&customer); return PTS_PASS; } --- NEW FILE: plan.txt --- This document defines the plan for functional testing of POSIX Semaphores. --- NEW FILE: Makefile --- INCLUDE = -I../../include LIB=-lposix1b CC=gcc CFLAGS=-Wall -O2 -g all: make-test make-test: sem_lock.test sem_conpro.test sem_readerwriter.test sem_philosopher.test sem_sleepingbarber.test %.test : %.c $(CC) $(CFLAGS) $(INCLUDE) $< -o $@ $(LIB) -lpthread clean: rm *.test --- NEW FILE: sem_lock.c --- /* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: crystal.xiong 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 test use semaphore to protect critical section between several * processes. */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> #include <sys/wait.h> #include <sys/mman.h> #include <string.h> #include <getopt.h> #include <errno.h> #include <semaphore.h> #include "posixtest.h" #define SEM_NAME "/tmp/semaphore" #define BUF_SIZE 50 #define DEFAULT_THREADS 5 int main(int argc, char *argv[]) { sem_t *sem_lock; int shared = 1; int value = 1; pid_t pid=0; int i, num=0; char buf[BUF_SIZE]; char *c; #ifndef _POSIX_SEMAPHORES printf("_POSIX_SEMAPHORES is not defined \n"); return PTS_UNRESOLVED; #endif if ( (2 != argc) || (( num = atoi(argv[1])) <= 0)) { fprintf(stdout, "Usage: %s number_of_processes\n", argv[0]); printf("Set num_of_processes to default value %d \n", DEFAULT_THREADS); num = DEFAULT_THREADS; } sem_lock = (sem_t *)malloc(sizeof(sem_t)); if (-1 == sem_init(sem_lock, shared, value)) { perror("sem_init didn't return success\n"); return PTS_UNRESOLVED; } for (i=1; i<num; i++) if ((pid = fork())!=0) { sleep(2); break; } sprintf(buf, "%d process_ID:%ld parent_process_ID:%ld child_process_ID:%ld \n", i, (long)getpid(), (long)getppid(), (long)pid); if (-1 == sem_wait(sem_lock)) { perror("sem_wait didn't return success\n"); return PTS_UNRESOLVED; } for (i = 1; i<= 10; i++) { c=buf; while (*c != '\n') { fputc(*c, stdout); c++; } fputc('\n', stdout); } if (-1 == sem_post(sem_lock)) { perror("sem_wait didn't return success\n"); return PTS_UNRESOLVED; } return PTS_PASS; } --- NEW FILE: run.sh --- #!/bin/sh # Copyright (c) 2002, Intel Corporation. All rights reserved. # Created by: crystal.xiong 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. # # Run all the tests in the semaphore functional area. # Helper functions RunTest() { echo "TEST: " $1 TOTAL=$TOTAL+1 ./$1 if [ $? == 0 ]; then PASS=$PASS+1 echo -ne "\t\t\t***TEST PASSED***\n\n" else FAIL=$FAIL+1 echo -ne "\t\t\t***TEST FAILED***\n\n" fi } # Main program declare -i TOTAL=0 declare -i PASS=0 declare -i FAIL=0 # Add lists of tests to these variables for execution TESTS="sem_conpro.test sem_lock.test sem_philosopher.test sem_readerwriter.test sem_sleepingbarber.test" echo "Run the semaphore functional tests" echo "==========================================" for test in $TESTS; do RunTest $test done echo echo -ne "\t\t****************\n" echo -ne "\t\t* TOTAL: " $TOTAL "\n" echo -ne "\t\t* PASSED: " $PASS "\n" echo -ne "\t\t* FAILED: " $FAIL "\n" echo -ne "\t\t****************\n" exit 0 |
From: Robert Williamson <robbiew@us...> - 2004-05-04 02:52:06
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_setschedprio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4887/conformance/interfaces/pthread_setschedprio Added Files: 1-1.c assertions.xml coverage.txt Log Message: Update to 1.4.1 --- NEW FILE: coverage.txt --- This document defines the coverage for the pthread_setschedprio() function: Assertion Tested? 1 YES 2 NO 3 YES *Tested implictly by 1-1 4 NO Note: --- NEW FILE: assertions.xml --- <assertions> <assertion id="1" tag="ref:XSH6:35336:35338"> pthread_setschedprio( ) function shall set the scheduling priority for the thread whose thread ID is given by thread to the value given by prio. See Scheduling Policies (on page 44) for a description on how this function call affects the ordering of the thread in the thread list for its new priority. </assertion> <assertion id="2" tag="ref:XSH6:35339:34340"> If the pthread_setschedprio( ) function fails, the scheduling priority of the target thread shall not be changed. </assertion> <assertion id="3" tag="ref:XSH6:33343:33344"> If successful, the pthread_setschedprio( ) function shall return zero; otherwise, an error number shall be returned to indicate the error. </assertion> <assertion id="4" tag="ref:XSH6:1885:1890"> If a thread whose policy or priority has been modified by pthread_setschedprio( ) is a running thread or is runnable, the effect on its position in the thread list depends on the direction of the modification, as follows: a. If the priority is raised, the thread becomes the tail of the thread list. b. If the priority is unchanged, the thread does not change position in the thread list. c. If the priority is lowered, the thread becomes the head of the thread list. </assertion> </assertions> --- NEW FILE: 1-1.c --- /* * 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@... * * The pthread_getschedparam( ) function shall retrieve the scheduling * policy and scheduling parameters for the thread whose thread ID is * given by thread and shall store those values in * policy and param, respectively. The priority value returned from * pthread_getschedparam( ) shall be * the value specified by the most recent pthread_setschedparam( ), * pthread_setschedprio( ), or pthread_create( ) call affecting the * target thread. It shall not reflect any temporary adjustments to * its priority as a result of any priority inheritance or ceiling functions. * */ /* Set the sched parameter with pthread_setschedprio then get */ #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include "posixtest.h" void *a_thread_func() { struct sched_param sparam; int policy, priority, policy_1; int rc; policy = SCHED_FIFO; priority = sched_get_priority_min(policy); sparam.sched_priority = priority; rc = pthread_setschedparam(pthread_self(), policy, &sparam); if (rc != 0) { printf("Error at pthread_setschedparam: rc=%d\n", rc); exit(PTS_UNRESOLVED); } rc = pthread_getschedparam(pthread_self(), &policy_1, &sparam); if (rc != 0) { printf("Error at pthread_getschedparam: rc=%d\n", rc); exit(PTS_UNRESOLVED); } printf("policy: %d, priority: %d\n", policy_1, sparam.sched_priority); if (policy_1 != policy || sparam.sched_priority != priority) { printf("pthread_getschedparam did not get the correct value\n"); exit(PTS_UNRESOLVED); } rc = pthread_setschedprio(pthread_self(), priority + 1); if (rc != 0) { printf("Error at pthread_setschedprio: rc=%d\n", rc); exit(PTS_FAIL); } rc = pthread_getschedparam(pthread_self(), &policy_1, &sparam); if (rc != 0) { printf("Error at pthread_getschedparam: rc=%d\n", rc); exit(PTS_UNRESOLVED); } printf("policy: %d, priority: %d\n", policy_1, sparam.sched_priority); if (sparam.sched_priority != (priority + 1)) { printf("Priority is not set correctly\n"); exit(PTS_FAIL); } 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; } pthread_join(new_th, NULL); printf("Test PASSED\n"); return PTS_PASS; } |