Changeset 76de65b3 in rtems


Ignore:
Timestamp:
Aug 8, 1996, 9:46:40 PM (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
79f189e
Parents:
2b613588
Message:

added cases to increase coverage of pthread_create. cases added tested
error paths as well as inherit scheduling attributes.

Files:
2 added
4 edited

Legend:

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

    r2b613588 r76de65b3  
    8585  assert( status == EINVAL );
    8686
     87  /* check some errors in pthread_create */
     88
     89  puts( "Init: pthread_create - EINVAL (attr not initialized)" );
     90  status = pthread_create( &Task_id, &destroyed_attr, Task_1, NULL );
     91  assert( status == EINVAL );
     92
     93  /* junk stack address */
     94  status = pthread_attr_setstackaddr( &attr, (void *)&schedparam );
     95  assert( !status );
     96 
     97  /* must go around pthread_attr_setstacksize to set a bad stack size */
     98  attr.stacksize = 0;
     99 
     100  puts( "Init: pthread_create - EINVAL (stacksize too small)" );
     101  status = pthread_create( &Task_id, &attr, Task_1, NULL );
     102  assert( status == EINVAL );
     103
     104  status = pthread_attr_init( &attr );
     105  assert( !status );
     106
     107  /* must go around pthread_attr_set routines to set a bad value */
     108  attr.inheritsched = -1;
     109 
     110  puts( "Init: pthread_create - EINVAL (invalid inherit scheduler)" );
     111  status = pthread_create( &Task_id, &attr, Task_1, NULL );
     112  assert( status == EINVAL );
     113
     114  /* check out the error case for system scope not supported */
     115
     116  status = pthread_attr_init( &attr );
     117  assert( !status );
     118
     119  /* must go around pthread_attr_set routines to set a bad value */
     120  attr.contentionscope = PTHREAD_SCOPE_SYSTEM;
     121
     122  puts( "Init: pthread_create - ENOSYS (unsupported system contention scope)" );
     123  status = pthread_create( &Task_id, &attr, Task_1, NULL );
     124  assert( status == ENOSYS );
     125
     126  status = pthread_attr_init( &attr );
     127  assert( !status );
     128
     129  /* now check out pthread_create for inherit scheduler */
     130
     131  status = pthread_attr_setinheritsched( &attr, PTHREAD_INHERIT_SCHED );
     132  assert( !status );
     133 
     134  puts( "Init: pthread_create - SUCCESSFUL (inherit scheduler)" );
     135  status = pthread_create( &Task_id, &attr, Task_1, NULL );
     136  assert( !status );
     137
     138  status = pthread_join( Task_id, NULL );
     139  assert( !status );
     140
     141    /* switch to Task_1 */
     142
    87143  /* exercise get and set scope */
    88144
    89145  empty_line();
     146
     147  status = pthread_attr_init( &attr );
     148  assert( !status );
    90149
    91150  puts( "Init: pthread_attr_setscope - EINVAL (NULL attr)" );
  • c/src/tests/psxtests/psx07/system.h

    r2b613588 r76de65b3  
    2323);
    2424
     25void *Task_1(
     26  void *argument
     27);
     28
    2529/* configuration information */
    2630
     
    4347
    4448TEST_EXTERN pthread_t        Init_id;
     49TEST_EXTERN pthread_t        Task_id;
    4550
    4651/* end of include file */
  • testsuites/psxtests/psx07/init.c

    r2b613588 r76de65b3  
    8585  assert( status == EINVAL );
    8686
     87  /* check some errors in pthread_create */
     88
     89  puts( "Init: pthread_create - EINVAL (attr not initialized)" );
     90  status = pthread_create( &Task_id, &destroyed_attr, Task_1, NULL );
     91  assert( status == EINVAL );
     92
     93  /* junk stack address */
     94  status = pthread_attr_setstackaddr( &attr, (void *)&schedparam );
     95  assert( !status );
     96 
     97  /* must go around pthread_attr_setstacksize to set a bad stack size */
     98  attr.stacksize = 0;
     99 
     100  puts( "Init: pthread_create - EINVAL (stacksize too small)" );
     101  status = pthread_create( &Task_id, &attr, Task_1, NULL );
     102  assert( status == EINVAL );
     103
     104  status = pthread_attr_init( &attr );
     105  assert( !status );
     106
     107  /* must go around pthread_attr_set routines to set a bad value */
     108  attr.inheritsched = -1;
     109 
     110  puts( "Init: pthread_create - EINVAL (invalid inherit scheduler)" );
     111  status = pthread_create( &Task_id, &attr, Task_1, NULL );
     112  assert( status == EINVAL );
     113
     114  /* check out the error case for system scope not supported */
     115
     116  status = pthread_attr_init( &attr );
     117  assert( !status );
     118
     119  /* must go around pthread_attr_set routines to set a bad value */
     120  attr.contentionscope = PTHREAD_SCOPE_SYSTEM;
     121
     122  puts( "Init: pthread_create - ENOSYS (unsupported system contention scope)" );
     123  status = pthread_create( &Task_id, &attr, Task_1, NULL );
     124  assert( status == ENOSYS );
     125
     126  status = pthread_attr_init( &attr );
     127  assert( !status );
     128
     129  /* now check out pthread_create for inherit scheduler */
     130
     131  status = pthread_attr_setinheritsched( &attr, PTHREAD_INHERIT_SCHED );
     132  assert( !status );
     133 
     134  puts( "Init: pthread_create - SUCCESSFUL (inherit scheduler)" );
     135  status = pthread_create( &Task_id, &attr, Task_1, NULL );
     136  assert( !status );
     137
     138  status = pthread_join( Task_id, NULL );
     139  assert( !status );
     140
     141    /* switch to Task_1 */
     142
    87143  /* exercise get and set scope */
    88144
    89145  empty_line();
     146
     147  status = pthread_attr_init( &attr );
     148  assert( !status );
    90149
    91150  puts( "Init: pthread_attr_setscope - EINVAL (NULL attr)" );
  • testsuites/psxtests/psx07/system.h

    r2b613588 r76de65b3  
    2323);
    2424
     25void *Task_1(
     26  void *argument
     27);
     28
    2529/* configuration information */
    2630
     
    4347
    4448TEST_EXTERN pthread_t        Init_id;
     49TEST_EXTERN pthread_t        Task_id;
    4550
    4651/* end of include file */
Note: See TracChangeset for help on using the changeset viewer.