diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-12-14 18:41:18 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-12-14 18:41:18 +0000 |
commit | 5abf63d983adbbd1c53e85f54123e99a57f86306 (patch) | |
tree | b5f0fe51adc49833c05743699fd23fe5a1af7ccb /testsuites/psxtests/psx11/init.c | |
parent | 2008-12-14 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-5abf63d983adbbd1c53e85f54123e99a57f86306.tar.bz2 |
2008-12-14 Joel Sherrill <joel.sherrill@oarcorp.com>
* psx05/init.c, psx07/init.c, psx09/init.c, psx11/init.c, psx12/init.c:
Run all tests successfully with maxixum number of priorities as 16
instead of 256. This was done by temporarily modifying the score
priority.h maximum. This allowed testing of all API code to ensure
that it worked properly with a reduced number of priorities. Most
modifications were to switch from hard-coded maximum to using the API
provided methods to determine maximum number of priority levels.
Diffstat (limited to '')
-rw-r--r-- | testsuites/psxtests/psx11/init.c | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/testsuites/psxtests/psx11/init.c b/testsuites/psxtests/psx11/init.c index cbea072ae5..254fe33801 100644 --- a/testsuites/psxtests/psx11/init.c +++ b/testsuites/psxtests/psx11/init.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -20,6 +20,10 @@ void *POSIX_Init( int status; struct sched_param param; pthread_attr_t attr; + int priority_1; + int priority_2; + int priority_3; + int priority_4; puts( "\n\n*** POSIX TEST 11 ***" ); @@ -34,32 +38,47 @@ void *POSIX_Init( /* exercise pthread_setschedparam */ - param.sched_priority = 127; + priority_1 = sched_get_priority_max( SCHED_FIFO ); /* was 127 */ + priority_2 = sched_get_priority_max( SCHED_FIFO ) - 2; /* was 125 */ + priority_3 = sched_get_priority_max( SCHED_FIFO ) - 6; /* was 121 */ + priority_4 = sched_get_priority_max( SCHED_FIFO ) - 7; /* was 120 */ - puts( "Init: Setting scheduling parameters to FIFO with priority 127" ); + param.sched_priority = priority_1; + + printf( + "Init: Setting scheduling parameters to FIFO with priority %d\n", + priority_1 + ); status = pthread_setschedparam( Init_id, SCHED_FIFO, ¶m ); assert( !status ); - param.sched_priority = 125; + param.sched_priority = priority_2; - puts( "Init: Setting scheduling parameters to RR with priority 125" ); + printf( + "Init: Setting scheduling parameters to RR with priority %d\n", + priority_2 + ); status = pthread_setschedparam( Init_id, SCHED_RR, ¶m ); assert( !status ); - param.sched_priority = 121; + param.sched_priority = priority_3; - puts( "Init: Setting scheduling parameters to OTHER with priority 121" ); + printf( + "Init: Setting scheduling parameters to OTHER with priority %d\n", + priority_3 + ); status = pthread_setschedparam( Init_id, SCHED_OTHER, ¶m ); assert( !status ); /* create a thread as SCHED_FIFO */ - puts( "Init: create a thread of SCHED_FIFO with priority 120" ); + printf( + "Init: create a thread of SCHED_FIFO with priority %d\n", priority_4 ); status = pthread_attr_init( &attr ); assert( !status ); attr.schedpolicy = SCHED_FIFO; - attr.schedparam.sched_priority = 120; + attr.schedparam.sched_priority = priority_4; status = pthread_create( &Task_id, &attr, Task_1, NULL ); assert( !status ); @@ -70,12 +89,12 @@ void *POSIX_Init( /* create a thread as SCHED_RR */ - puts( "Init: create a thread of SCHED_RR with priority 120" ); + printf( "Init: create a thread of SCHED_RR with priority %d\n", priority_4 ); status = pthread_attr_init( &attr ); assert( !status ); attr.schedpolicy = SCHED_RR; - attr.schedparam.sched_priority = 120; + attr.schedparam.sched_priority = priority_4; status = pthread_create( &Task_id, &attr, Task_1, NULL ); assert( !status ); @@ -86,12 +105,13 @@ void *POSIX_Init( /* create a thread as SCHED_OTHER */ - puts( "Init: create a thread of SCHED_OTHER with priority 120" ); + printf( + "Init: create a thread of SCHED_OTHER with priority %d\n", priority_4 ); status = pthread_attr_init( &attr ); assert( !status ); attr.schedpolicy = SCHED_OTHER; - attr.schedparam.sched_priority = 120; + attr.schedparam.sched_priority = priority_4; status = pthread_create( &Task_id, &attr, Task_1, NULL ); assert( !status ); |