Changeset f643e230 in rtems


Ignore:
Timestamp:
08/09/96 18:47:38 (27 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
d0b5249
Parents:
8699a70
Message:

added test cases for errors in sched_get_priority_min and
sched_get_priority_max.

added test case for sched_yield.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/tests/psxtests/psx01/init.c

    r8699a70 rf643e230  
    1414#include "system.h"
    1515#include <sched.h>
    16 
    1716
    1817void *POSIX_Init(
     
    9190  printf( "Init: ID is 0x%08x\n", Init_id );
    9291
    93   /* print the minimum priority */
     92  /* exercise get minimum priority */
    9493
    9594  priority = sched_get_priority_min( SCHED_FIFO );
    96   printf( "Init: Minimum priority for FIFO is %d\n", priority );
     95  printf( "Init: sched_get_priority_min (SCHED_FIFO) -- %d\n", priority );
    9796  assert( priority != -1 );
    9897
    99   /* print the maximum priority */
     98  puts( "Init: sched_get_priority_min -- EINVAL (invalid policy)" );
     99  priority = sched_get_priority_min( -1 );
     100  assert( priority == -1 );
     101  assert( errno == EINVAL );
     102
     103  /* exercise get maximum priority */
    100104 
    101105  priority = sched_get_priority_max( SCHED_FIFO );
    102   printf( "Init: Maximum priority for FIFO is %d\n", priority );
     106  printf( "Init: sched_get_priority_max (SCHED_FIFO) -- %d\n", priority );
    103107  assert( priority != -1 );
     108
     109  puts( "Init: sched_get_priority_min -- EINVAL (invalid policy)" );
     110  priority = sched_get_priority_min( -1 );
     111  assert( priority == -1 );
     112  assert( errno == EINVAL );
    104113
    105114  /* print the round robin time quantum */
     
    115124  /* create a thread */
    116125
     126  puts( "Init: pthread_create - SUCCESSFUL" );
    117127  status = pthread_create( &thread_id, NULL, Task_1_through_3, NULL );
    118128  assert( !status );
    119129
     130  /* too may threads error */
     131
     132  puts( "Init: pthread_create - EINVAL (too many threads)" );
     133  status = pthread_create( &thread_id, NULL, Task_1_through_3, NULL );
     134  assert( status == EINVAL );
     135
     136  puts( "Init: sched_yield to Task_1" );
     137  status = sched_yield();
     138  assert( !status );
     139
     140    /* switch to Task_1 */
     141
    120142  /* exit this thread */
    121143
     144  puts( "Init: pthread_exit" );
    122145  pthread_exit( NULL );
     146
     147    /* switch to Task_1 */
    123148
    124149  return NULL; /* just so the compiler thinks we returned something */
  • testsuites/psxtests/psx01/init.c

    r8699a70 rf643e230  
    1414#include "system.h"
    1515#include <sched.h>
    16 
    1716
    1817void *POSIX_Init(
     
    9190  printf( "Init: ID is 0x%08x\n", Init_id );
    9291
    93   /* print the minimum priority */
     92  /* exercise get minimum priority */
    9493
    9594  priority = sched_get_priority_min( SCHED_FIFO );
    96   printf( "Init: Minimum priority for FIFO is %d\n", priority );
     95  printf( "Init: sched_get_priority_min (SCHED_FIFO) -- %d\n", priority );
    9796  assert( priority != -1 );
    9897
    99   /* print the maximum priority */
     98  puts( "Init: sched_get_priority_min -- EINVAL (invalid policy)" );
     99  priority = sched_get_priority_min( -1 );
     100  assert( priority == -1 );
     101  assert( errno == EINVAL );
     102
     103  /* exercise get maximum priority */
    100104 
    101105  priority = sched_get_priority_max( SCHED_FIFO );
    102   printf( "Init: Maximum priority for FIFO is %d\n", priority );
     106  printf( "Init: sched_get_priority_max (SCHED_FIFO) -- %d\n", priority );
    103107  assert( priority != -1 );
     108
     109  puts( "Init: sched_get_priority_min -- EINVAL (invalid policy)" );
     110  priority = sched_get_priority_min( -1 );
     111  assert( priority == -1 );
     112  assert( errno == EINVAL );
    104113
    105114  /* print the round robin time quantum */
     
    115124  /* create a thread */
    116125
     126  puts( "Init: pthread_create - SUCCESSFUL" );
    117127  status = pthread_create( &thread_id, NULL, Task_1_through_3, NULL );
    118128  assert( !status );
    119129
     130  /* too may threads error */
     131
     132  puts( "Init: pthread_create - EINVAL (too many threads)" );
     133  status = pthread_create( &thread_id, NULL, Task_1_through_3, NULL );
     134  assert( status == EINVAL );
     135
     136  puts( "Init: sched_yield to Task_1" );
     137  status = sched_yield();
     138  assert( !status );
     139
     140    /* switch to Task_1 */
     141
    120142  /* exit this thread */
    121143
     144  puts( "Init: pthread_exit" );
    122145  pthread_exit( NULL );
     146
     147    /* switch to Task_1 */
    123148
    124149  return NULL; /* just so the compiler thinks we returned something */
Note: See TracChangeset for help on using the changeset viewer.