diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-08-09 18:47:38 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-08-09 18:47:38 +0000 |
commit | f643e23046c3f528f61c31fb5c22882983d1b3a0 (patch) | |
tree | 30b4be7ce3c625846b4bb6608d8f0a25d744bb4b /c/src | |
parent | sched_yield: was not invoking the dispatcher. (diff) | |
download | rtems-f643e23046c3f528f61c31fb5c22882983d1b3a0.tar.bz2 |
added test cases for errors in sched_get_priority_min and
sched_get_priority_max.
added test case for sched_yield.
Diffstat (limited to 'c/src')
-rw-r--r-- | c/src/tests/psxtests/psx01/init.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/c/src/tests/psxtests/psx01/init.c b/c/src/tests/psxtests/psx01/init.c index e62030c295..497ba1f422 100644 --- a/c/src/tests/psxtests/psx01/init.c +++ b/c/src/tests/psxtests/psx01/init.c @@ -14,7 +14,6 @@ #include "system.h" #include <sched.h> - void *POSIX_Init( void *argument ) @@ -90,18 +89,28 @@ void *POSIX_Init( Init_id = pthread_self(); printf( "Init: ID is 0x%08x\n", Init_id ); - /* print the minimum priority */ + /* exercise get minimum priority */ priority = sched_get_priority_min( SCHED_FIFO ); - printf( "Init: Minimum priority for FIFO is %d\n", priority ); + printf( "Init: sched_get_priority_min (SCHED_FIFO) -- %d\n", priority ); assert( priority != -1 ); - /* print the maximum priority */ + puts( "Init: sched_get_priority_min -- EINVAL (invalid policy)" ); + priority = sched_get_priority_min( -1 ); + assert( priority == -1 ); + assert( errno == EINVAL ); + + /* exercise get maximum priority */ priority = sched_get_priority_max( SCHED_FIFO ); - printf( "Init: Maximum priority for FIFO is %d\n", priority ); + printf( "Init: sched_get_priority_max (SCHED_FIFO) -- %d\n", priority ); assert( priority != -1 ); + puts( "Init: sched_get_priority_min -- EINVAL (invalid policy)" ); + priority = sched_get_priority_min( -1 ); + assert( priority == -1 ); + assert( errno == EINVAL ); + /* print the round robin time quantum */ status = sched_rr_get_interval( getpid(), &tr ); @@ -114,12 +123,28 @@ void *POSIX_Init( /* create a thread */ + puts( "Init: pthread_create - SUCCESSFUL" ); + status = pthread_create( &thread_id, NULL, Task_1_through_3, NULL ); + assert( !status ); + + /* too may threads error */ + + puts( "Init: pthread_create - EINVAL (too many threads)" ); status = pthread_create( &thread_id, NULL, Task_1_through_3, NULL ); + assert( status == EINVAL ); + + puts( "Init: sched_yield to Task_1" ); + status = sched_yield(); assert( !status ); + /* switch to Task_1 */ + /* exit this thread */ + puts( "Init: pthread_exit" ); pthread_exit( NULL ); + /* switch to Task_1 */ + return NULL; /* just so the compiler thinks we returned something */ } |