Changeset 01618cc in rtems


Ignore:
Timestamp:
Jan 29, 2008, 7:00:38 PM (11 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.10, 4.11, 4.9, master
Children:
d5671b1
Parents:
1ff7e19
Message:

2008-01-29 Jennifer Averett <jennifer.averett@…>

  • psx07/init.c, psx07/system.h: Test cleanup and added testing for pthread_attr_[get|set]clock.
Location:
testsuites/psxtests
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/ChangeLog

    r1ff7e19 r01618cc  
     12008-01-29      Jennifer Averett <jennifer.averett@OARcorp.com>
     2
     3        * psx07/init.c, psx07/system.h: Test cleanup and added testing for
     4        pthread_attr_[get|set]clock.
     5
    162008-01-23      Joel Sherrill <joel.sherrill@oarcorp.com>
    27
  • testsuites/psxtests/psx07/init.c

    r1ff7e19 r01618cc  
    1313#include "system.h"
    1414#include <errno.h>
     15#include "tmacros.h"
    1516
    1617void print_schedparam(
     
    4748  pthread_attr_t      attr;
    4849  pthread_attr_t      destroyed_attr;
     50  int                 clock_allowed;
    4951
    5052  puts( "\n\n*** POSIX TEST 7 ***" );
     
    6365  puts( "Init: pthread_attr_init - EINVAL (NULL attr)" );
    6466  status = pthread_attr_init( NULL );
    65   assert( status == EINVAL );
     67  fatal_directive_check_status_only( status, EINVAL, "null attribute" );
    6668
    6769  puts( "Init: pthread_attr_init - SUCCESSFUL" );
    6870  status = pthread_attr_init( &attr );
    69   assert( !status );
     71  posix_service_failed( status, "pthread_attr_init" );
    7072
    7173  puts( "Init: initialize and destroy an attribute - SUCCESSFUL" );
    7274  status = pthread_attr_init( &destroyed_attr );
    73   assert( !status );
     75  posix_service_failed( status, "pthread_attr_init");
    7476
    7577  status = pthread_attr_destroy( &destroyed_attr );
    76   assert( !status );
     78  posix_service_failed( status, "pthread_attr_destroy");
    7779
    7880  puts( "Init: pthread_attr_destroy - EINVAL (NULL attr)" );
    7981  status = pthread_attr_destroy( NULL );
    80   assert( status == EINVAL );
     82  fatal_directive_check_status_only( status, EINVAL, "NULL attribute" );
    8183
    8284  puts( "Init: pthread_attr_destroy - EINVAL (not initialized)" );
    8385  status = pthread_attr_destroy( &destroyed_attr );
    84   assert( status == EINVAL );
     86  fatal_directive_check_status_only( status, EINVAL, "not initialized" );
    8587
    8688  /* check some errors in pthread_create */
     
    8890  puts( "Init: pthread_create - EINVAL (attr not initialized)" );
    8991  status = pthread_create( &Task_id, &destroyed_attr, Task_1, NULL );
    90   assert( status == EINVAL );
     92  fatal_directive_check_status_only( status, EINVAL, "attribute not initialized" );
    9193
    9294  /* junk stack address */
    9395  status = pthread_attr_setstackaddr( &attr, (void *)&schedparam );
    94   assert( !status );
     96  posix_service_failed( status, "setstackaddr");
    9597
    9698  /* must go around pthread_attr_setstacksize to set a bad stack size */
     
    99101  puts( "Init: pthread_create - EINVAL (stacksize too small)" );
    100102  status = pthread_create( &Task_id, &attr, Task_1, NULL );
    101   assert( status == EINVAL );
     103  fatal_directive_check_status_only( status, EINVAL, "stacksize too small" );
    102104
    103105  /* reset all the fields */
    104106  status = pthread_attr_init( &attr );
    105   assert( !status );
    106 
     107  posix_service_failed( status, "pthread_attr_init");
     108 
    107109  attr.stacksize = rtems_configuration_get_work_space_size() * 10;
    108110  puts( "Init: pthread_create - EAGAIN (stacksize too large)" );
    109111  status = pthread_create( &Task_id, &attr, Task_1, NULL );
    110   assert( status == EAGAIN );
     112  fatal_directive_check_status_only( status, EAGAIN, "stacksize too large" );
    111113
    112114  status = pthread_attr_init( &attr );
    113   assert( !status );
     115  posix_service_failed( status, "pthread_attr_init");
    114116
    115117  /* must go around pthread_attr_set routines to set a bad value */
     
    118120  puts( "Init: pthread_create - EINVAL (invalid inherit scheduler)" );
    119121  status = pthread_create( &Task_id, &attr, Task_1, NULL );
    120   assert( status == EINVAL );
     122  fatal_directive_check_status_only( status, EINVAL, "invalid inherit scheduler" );
    121123
    122124  /* check out the error case for system scope not supported */
    123125
    124126  status = pthread_attr_init( &attr );
    125   assert( !status );
     127  posix_service_failed( status, " pthread_attr_init");
     128
     129  /* Check out pthread_attr_settime and pthread_attr_gettime */
     130  puts( "Init: pthread_attr_settime - EINVAL ( null attribute )" );
     131  status = pthread_attr_setcputime( NULL, CLOCK_ENABLED );
     132  fatal_directive_check_status_only( status, EINVAL, "null attribute" );
     133
     134  puts( "Init: pthread_attr_gettime - EINVAL ( null attribute )" );
     135  status = pthread_attr_getcputime( NULL, &clock_allowed );
     136  fatal_directive_check_status_only( status, EINVAL, " null attribute" );
     137
     138  puts( "Init: pthread_attr_settime - EINVAL ( is initialized )" );
     139  status = pthread_attr_setcputime( &destroyed_attr, CLOCK_ENABLED );
     140  fatal_directive_check_status_only( status, EINVAL, "is initialized" );
     141
     142  puts( "Init: pthread_attr_gettime - EINVAL ( is initialized )" );
     143  status = pthread_attr_getcputime( &destroyed_attr, &clock_allowed  );
     144  fatal_directive_check_status_only( status, EINVAL, "is initialized" );
     145
     146  puts( "Init: pthread_attr_settime - EINVAL ( invalid clock allowed )" );
     147  status = pthread_attr_setcputime( &attr, ~(CLOCK_ENABLED | CLOCK_DISABLED) );
     148  fatal_directive_check_status_only( status, EINVAL, "invalid clock allowed" );
     149
     150  puts( "Init: pthread_attr_gettime - EINVAL ( NULL clock allowed )" );
     151  status = pthread_attr_getcputime( &attr, NULL );
     152  fatal_directive_check_status_only( status, EINVAL, "NULL clock allowed" );
     153
     154  puts( "Init: validate pthread_attr_setcputime - CLOCK_DISABLED" );
     155  status = pthread_attr_setcputime( &attr, CLOCK_DISABLED );
     156  posix_service_failed( status, "pthread_attr_setcputime");
     157  status = pthread_attr_getcputime( &attr, &clock_allowed );
     158  posix_service_failed( status, "pthread_attr_getcputime");
     159  if (attr.cputime_clock_allowed != CLOCK_DISABLED)
     160    perror("ERROR==> pthread_attr_setcputime to CLOCK_DISABLED failed");
     161
     162  puts( "Init: validate pthread_attr_setcputime - CLOCK_ENABLED" );
     163  status = pthread_attr_setcputime( &attr, CLOCK_ENABLED );
     164  posix_service_failed( status, "pthread_attr_setcputime");
     165  status = pthread_attr_getcputime( &attr, &clock_allowed );
     166  posix_service_failed( status, "pthread_attr_getcputime");
     167  if (attr.cputime_clock_allowed != CLOCK_ENABLED)
     168    perror("ERROR==> pthread_attr_setcputime to CLOCK_ENABLED failed");
    126169
    127170  /* must go around pthread_attr_set routines to set a bad value */
     
    130173  puts( "Init: pthread_create - ENOTSUP (unsupported system contention scope)" );
    131174  status = pthread_create( &Task_id, &attr, Task_1, NULL );
    132   assert( status == ENOTSUP );
     175  fatal_directive_check_status_only( status, ENOTSUP,
     176    "unsupported system contention scope" );
    133177
    134178  status = pthread_attr_init( &attr );
    135   assert( !status );
     179  posix_service_failed( status, "pthread_attr_init");
    136180
    137181  /* now check out pthread_create for inherit scheduler */
    138182
    139183  status = pthread_attr_setinheritsched( &attr, PTHREAD_INHERIT_SCHED );
    140   assert( !status );
     184  posix_service_failed( status, "pthread_attr_setinheritsched");
    141185
    142186  puts( "Init: pthread_create - SUCCESSFUL (inherit scheduler)" );
    143187  status = pthread_create( &Task_id, &attr, Task_1, NULL );
    144   assert( !status );
     188  posix_service_failed( status, "pthread_create");
    145189
    146190  status = pthread_join( Task_id, NULL );
    147   assert( !status );
     191  posix_service_failed( status, " pthread_join");
    148192
    149193    /* switch to Task_1 */
     
    154198
    155199  status = pthread_attr_init( &attr );
    156   assert( !status );
     200  posix_service_failed( status, "pthread_attr_init");
    157201
    158202  puts( "Init: pthread_attr_setscope - EINVAL (NULL attr)" );
    159203  status = pthread_attr_setscope( NULL, PTHREAD_SCOPE_PROCESS );
    160   assert( status == EINVAL );
     204  fatal_directive_check_status_only( status, EINVAL , "NULL attr" );
    161205
    162206  puts( "Init: pthread_attr_setscope - ENOTSUP" );
    163207  status = pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM );
    164   assert( status == ENOTSUP );
     208  fatal_directive_check_status_only( status, ENOTSUP, "PTHREAD_SCOPE_SYSTEM" );
    165209
    166210  puts( "Init: pthread_attr_setscope - EINVAL (not initialized attr)" );
    167211  status = pthread_attr_setscope( &destroyed_attr, PTHREAD_SCOPE_PROCESS );
    168   assert( status == EINVAL );
     212  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    169213
    170214  puts( "Init: pthread_attr_setscope - EINVAL (invalid scope)" );
    171215  status = pthread_attr_setscope( &attr, -1 );
    172   assert( status == EINVAL );
     216  fatal_directive_check_status_only( status, EINVAL, "invalid scope" );
    173217
    174218  puts( "Init: pthread_attr_setscope - SUCCESSFUL" );
    175219  status = pthread_attr_setscope( &attr, PTHREAD_SCOPE_PROCESS );
    176   assert( !status );
     220  posix_service_failed( status, "pthread_attr_setscope");
    177221
    178222  puts( "Init: pthread_attr_getscope - EINVAL (NULL attr)" );
    179223  status = pthread_attr_getscope( NULL, &scope );
    180   assert( status == EINVAL );
     224  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    181225
    182226  puts( "Init: pthread_attr_getscope - EINVAL (NULL scope)" );
    183227  status = pthread_attr_getscope( &attr, NULL );
    184   assert( status == EINVAL );
     228  fatal_directive_check_status_only( status, EINVAL, "NULL scope" );
    185229
    186230  puts( "Init: pthread_attr_getscope - EINVAL (not initialized attr)" );
    187231  status = pthread_attr_getscope( &destroyed_attr, &scope );
    188   assert( status == EINVAL );
     232  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    189233
    190234  puts( "Init: pthread_attr_getscope - SUCCESSFUL" );
    191235  status = pthread_attr_getscope( &attr, &scope );
    192   assert( !status );
     236  posix_service_failed( status, "pthread_attr_getscope");
    193237  printf( "Init: current scope attribute = %d\n", scope );
    194238
     
    199243  puts( "Init: pthread_attr_setinheritsched - EINVAL (NULL attr)" );
    200244  status = pthread_attr_setinheritsched( NULL, PTHREAD_INHERIT_SCHED );
    201   assert( status == EINVAL );
     245  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    202246
    203247  puts( "Init: pthread_attr_setinheritsched - EINVAL (not initialized attr)" );
    204248  status =
    205249     pthread_attr_setinheritsched( &destroyed_attr, PTHREAD_INHERIT_SCHED );
    206   assert( status == EINVAL );
     250  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    207251
    208252  puts( "Init: pthread_attr_setinheritsched - ENOTSUP (invalid inheritsched)" );
    209253  status = pthread_attr_setinheritsched( &attr, -1 );
    210   assert( status == ENOTSUP );
     254  fatal_directive_check_status_only( status, ENOTSUP, "invalid inheritsched" );
    211255
    212256  puts( "Init: pthread_attr_setinheritsched - SUCCESSFUL" );
    213257  status = pthread_attr_setinheritsched( &attr, PTHREAD_INHERIT_SCHED );
    214   assert( !status );
     258  posix_service_failed( status, "pthread_attr_setinheritsched");
    215259
    216260  puts( "Init: pthread_attr_getinheritsched - EINVAL (NULL attr)" );
    217261  status = pthread_attr_getinheritsched( NULL, &inheritsched );
    218   assert( status == EINVAL );
     262  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    219263
    220264  puts( "Init: pthread_attr_getinheritsched - EINVAL (NULL inheritsched)" );
    221265  status = pthread_attr_getinheritsched( &attr, NULL );
    222   assert( status == EINVAL );
     266  fatal_directive_check_status_only( status, EINVAL, "NULL inheritsched" );
    223267
    224268  puts( "Init: pthread_attr_getinheritsched - EINVAL (not initialized attr)" );
    225269  status = pthread_attr_getinheritsched( &destroyed_attr, &inheritsched );
    226   assert( status == EINVAL );
     270  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    227271
    228272  puts( "Init: pthread_attr_getinheritsched - SUCCESSFUL" );
    229273  status = pthread_attr_getinheritsched( &attr, &inheritsched );
    230   assert( !status );
     274  posix_service_failed( status, "pthread_attr_getinheritsched");
    231275  printf( "Init: current inherit scheduler attribute = %d\n", inheritsched );
    232276
     
    237281  puts( "Init: pthread_attr_setschedpolicy - EINVAL (NULL attr)" );
    238282  status = pthread_attr_setschedpolicy( NULL, SCHED_FIFO );
    239   assert( status == EINVAL );
     283  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    240284
    241285  puts( "Init: pthread_attr_setschedpolicy - EINVAL (not initialized attr)" );
    242286  status =
    243287     pthread_attr_setschedpolicy( &destroyed_attr, SCHED_OTHER );
    244   assert( status == EINVAL );
     288  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    245289
    246290  puts( "Init: pthread_attr_setschedpolicy - ENOTSUP (invalid schedpolicy)" );
    247291  status = pthread_attr_setschedpolicy( &attr, -1 );
    248   assert( status == ENOTSUP );
     292  fatal_directive_check_status_only( status, ENOTSUP, "invalid schedpolicy" );
    249293
    250294  puts( "Init: pthread_attr_setschedpolicy - SUCCESSFUL" );
    251295  status = pthread_attr_setschedpolicy( &attr, SCHED_RR );
    252   assert( !status );
     296  posix_service_failed( status, "pthread_attr_setschedpolicy");
    253297
    254298  puts( "Init: pthread_attr_getschedpolicy - EINVAL (NULL attr)" );
    255299  status = pthread_attr_getschedpolicy( NULL, &schedpolicy );
    256   assert( status == EINVAL );
     300  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    257301
    258302  puts( "Init: pthread_attr_getschedpolicy - EINVAL (NULL schedpolicy)" );
    259303  status = pthread_attr_getschedpolicy( &attr, NULL );
    260   assert( status == EINVAL );
     304  fatal_directive_check_status_only( status, EINVAL, "NULL schedpolicy" );
    261305
    262306  puts( "Init: pthread_attr_getschedpolicy - EINVAL (not initialized attr)" );
    263307  status = pthread_attr_getschedpolicy( &destroyed_attr, &schedpolicy );
    264   assert( status == EINVAL );
     308  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    265309
    266310  puts( "Init: pthread_attr_getschedpolicy - SUCCESSFUL" );
    267311  status = pthread_attr_getschedpolicy( &attr, &schedpolicy );
    268   assert( !status );
     312  posix_service_failed( status, "pthread_attr_getschedpolicy");
    269313  printf( "Init: current scheduler policy attribute = %d\n", schedpolicy );
    270314
     
    275319  puts( "Init: pthread_attr_setstacksize - EINVAL (NULL attr)" );
    276320  status = pthread_attr_setstacksize( NULL, 0 );
    277   assert( status == EINVAL );
     321  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    278322
    279323  puts( "Init: pthread_attr_setstacksize - EINVAL (not initialized attr)" );
    280324  status =
    281325     pthread_attr_setstacksize( &destroyed_attr, 0 );
    282   assert( status == EINVAL );
     326  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    283327
    284328  puts( "Init: pthread_attr_setstacksize - SUCCESSFUL (low stacksize)" );
    285329  status = pthread_attr_setstacksize( &attr, 0 );
    286   assert( !status );
     330  posix_service_failed( status, "pthread_attr_setstacksize");
    287331
    288332  puts( "Init: pthread_attr_setstacksize - SUCCESSFUL (high stacksize)" );
    289333  status = pthread_attr_setstacksize( &attr, STACK_MINIMUM_SIZE * 2 );
    290   assert( !status );
     334  posix_service_failed( status, "");
    291335
    292336  puts( "Init: pthread_attr_getstacksize - EINVAL (NULL attr)" );
    293337  status = pthread_attr_getstacksize( NULL, &stacksize );
    294   assert( status == EINVAL );
     338  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    295339
    296340  puts( "Init: pthread_attr_getstacksize - EINVAL (NULL stacksize)" );
    297341  status = pthread_attr_getstacksize( &attr, NULL );
    298   assert( status == EINVAL );
     342  fatal_directive_check_status_only( status, EINVAL, "NULL stacksize" );
    299343
    300344  puts( "Init: pthread_attr_getstacksize - EINVAL (not initialized attr)" );
    301345  status = pthread_attr_getstacksize( &destroyed_attr, &stacksize );
    302   assert( status == EINVAL );
     346  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    303347
    304348  puts( "Init: pthread_attr_getstacksize - SUCCESSFUL" );
    305349  status = pthread_attr_getstacksize( &attr, &stacksize );
    306   assert( !status );
     350  posix_service_failed( status, "pthread_attr_getstacksize");
    307351  if ( stacksize == (STACK_MINIMUM_SIZE * 2) )
    308   printf( "Init: current stack size attribute is OK\n" );
     352    printf( "Init: current stack size attribute is OK\n" );
    309353
    310354  /* exercise get and set stack address */
     
    314358  puts( "Init: pthread_attr_setstackaddr - EINVAL (NULL attr)" );
    315359  status = pthread_attr_setstackaddr( NULL, NULL );
    316   assert( status == EINVAL );
     360  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    317361
    318362  puts( "Init: pthread_attr_setstackaddr - EINVAL (not initialized attr)" );
    319363  status =
    320364     pthread_attr_setstackaddr( &destroyed_attr, NULL );
    321   assert( status == EINVAL );
     365  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    322366
    323367  puts( "Init: pthread_attr_setstackaddr - SUCCESSFUL" );
    324368  status = pthread_attr_setstackaddr( &attr, 0 );
    325   assert( !status );
     369  posix_service_failed( status, "");
    326370
    327371  puts( "Init: pthread_attr_getstackaddr - EINVAL (NULL attr)" );
    328372  status = pthread_attr_getstackaddr( NULL, &stackaddr );
    329   assert( status == EINVAL );
     373  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    330374
    331375  puts( "Init: pthread_attr_getstackaddr - EINVAL (NULL stackaddr)" );
    332376  status = pthread_attr_getstackaddr( &attr, NULL );
    333   assert( status == EINVAL );
     377  fatal_directive_check_status_only( status, EINVAL, "NULL stackaddr" );
    334378
    335379  puts( "Init: pthread_attr_getstackaddr - EINVAL (not initialized attr)" );
    336380  status = pthread_attr_getstackaddr( &destroyed_attr, &stackaddr );
    337   assert( status == EINVAL );
     381  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    338382
    339383  puts( "Init: pthread_attr_getstackaddr - SUCCESSFUL" );
    340384  status = pthread_attr_getstackaddr( &attr, &stackaddr );
    341   assert( !status );
     385  posix_service_failed( status, "pthread_attr_getstackaddr");
    342386  printf( "Init: current stack address attribute = %p\n", stackaddr );
    343387
     
    348392  puts( "Init: pthread_attr_setdetachstate - EINVAL (NULL attr)" );
    349393  status = pthread_attr_setdetachstate( NULL, PTHREAD_CREATE_DETACHED );
    350   assert( status == EINVAL );
     394  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    351395
    352396  puts( "Init: pthread_attr_setdetachstate - EINVAL (not initialized attr)" );
    353397  status =
    354398     pthread_attr_setdetachstate( &destroyed_attr, PTHREAD_CREATE_JOINABLE );
    355   assert( status == EINVAL );
     399  fatal_directive_check_status_only( status, EINVAL, "not initialized att" );
    356400
    357401  puts( "Init: pthread_attr_setdetachstate - EINVAL (invalid detachstate)" );
    358402  status = pthread_attr_setdetachstate( &attr, -1 );
    359   assert( status == EINVAL );
     403  fatal_directive_check_status_only( status, EINVAL, "invalid detachstate" );
    360404
    361405  puts( "Init: pthread_attr_setdetachstate - SUCCESSFUL" );
    362406  status = pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_JOINABLE );
    363   assert( !status );
     407  posix_service_failed( status, "pthread_attr_setdetachstate");
    364408
    365409  puts( "Init: pthread_attr_getdetachstate - EINVAL (NULL attr)" );
    366410  status = pthread_attr_getdetachstate( NULL, &detachstate );
    367   assert( status == EINVAL );
     411  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    368412
    369413  puts( "Init: pthread_attr_getdetachstate - EINVAL (NULL detatchstate)" );
    370414  status = pthread_attr_getdetachstate( &attr, NULL );
    371   assert( status == EINVAL );
     415  fatal_directive_check_status_only( status, EINVAL, "NULL detatchstate" );
    372416
    373417  puts( "Init: pthread_attr_getdetachstate - EINVAL (not initialized attr)" );
    374418  status = pthread_attr_getdetachstate( &destroyed_attr, &detachstate );
    375   assert( status == EINVAL );
     419  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    376420
    377421  puts( "Init: pthread_attr_getdetachstate - SUCCESSFUL" );
    378422  status = pthread_attr_getdetachstate( &attr, &detachstate );
    379   assert( !status );
     423  posix_service_failed( status, "pthread_attr_getdetachstate");
    380424  printf( "Init: current detach state attribute = %d\n", detachstate );
    381425
     
    386430  puts( "Init: pthread_attr_getschedparam - SUCCESSFUL" );
    387431  status = pthread_attr_getschedparam( &attr, &schedparam );
    388   assert( !status );
     432  posix_service_failed( status, "pthread_attr_getschedparam");
    389433
    390434  print_schedparam( "Init: ", &schedparam );
     
    392436  puts( "Init: pthread_attr_setschedparam - EINVAL (NULL attr)" );
    393437  status = pthread_attr_setschedparam( NULL, &schedparam );
    394   assert( status == EINVAL );
     438  fatal_directive_check_status_only( status, EINVAL, "NULL attr" );
    395439
    396440  puts( "Init: pthread_attr_setschedparam - EINVAL (not initialized attr)" );
    397441  status = pthread_attr_setschedparam( &destroyed_attr, &schedparam );
    398   assert( status == EINVAL );
     442  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    399443
    400444  puts( "Init: pthread_attr_setschedparam - EINVAL (NULL schedparam)" );
    401445  status = pthread_attr_setschedparam( &attr, NULL );
    402   assert( status == EINVAL );
     446  fatal_directive_check_status_only( status, EINVAL, "NULL schedparam" );
    403447
    404448  puts( "Init: pthread_attr_setschedparam - SUCCESSFUL" );
    405449  status = pthread_attr_setschedparam( &attr, &schedparam );
    406   assert( !status );
     450  posix_service_failed( status, "pthread_attr_setschedparam");
    407451
    408452  puts( "Init: pthread_attr_getschedparam - EINVAL (NULL attr)" );
    409453  status = pthread_attr_getschedparam( NULL, &schedparam );
    410   assert( status == EINVAL );
     454  fatal_directive_check_status_only( status, EINVAL, "pthread_attr_getschedparam" );
    411455
    412456  puts( "Init: pthread_attr_getschedparam - EINVAL (not initialized attr)" );
    413457  status = pthread_attr_getschedparam( &destroyed_attr, &schedparam );
    414   assert( status == EINVAL );
     458  fatal_directive_check_status_only( status, EINVAL, "not initialized attr" );
    415459
    416460  puts( "Init: pthread_attr_getschedparam - EINVAL (NULL schedparam)" );
    417461  status = pthread_attr_getschedparam( &attr, NULL );
    418   assert( status == EINVAL );
     462  fatal_directive_check_status_only( status, EINVAL, "NULL schedparam" );
    419463
    420464  /* exercise pthread_getschedparam */
     
    424468  puts( "Init: pthread_getschedparam - EINVAL (NULL policy)" );
    425469  status = pthread_getschedparam( pthread_self(), NULL, &schedparam );
    426   assert( status == EINVAL );
     470  fatal_directive_check_status_only( status, EINVAL, "NULL policy" );
    427471
    428472  puts( "Init: pthread_getschedparam - EINVAL (NULL schedparam)" );
    429473  status = pthread_getschedparam( pthread_self(), &schedpolicy, NULL );
    430   assert( status == EINVAL );
     474  fatal_directive_check_status_only( status, EINVAL, "NULL schedparam" );
    431475
    432476  puts( "Init: pthread_getschedparam - ESRCH (bad thread)" );
    433477  status = pthread_getschedparam( -1, &schedpolicy, &schedparam );
    434   assert( status == ESRCH );
     478  fatal_directive_check_status_only( status, ESRCH, "bad thread" );
    435479
    436480  puts( "Init: pthread_getschedparam - SUCCESSFUL" );
    437481  status = pthread_getschedparam( pthread_self(), &schedpolicy, &schedparam );
    438   assert( !status );
     482  posix_service_failed( status, "pthread_getschedparam");
    439483
    440484  printf( "Init: policy = %d\n", schedpolicy );
     
    448492  puts( "Init: pthread_setschedparam - EINVAL (NULL schedparam)" );
    449493  status = pthread_setschedparam( pthread_self(), SCHED_OTHER, NULL );
    450   assert( status == EINVAL );
     494  fatal_directive_check_status_only( status, EINVAL, "NULL schedparam" );
    451495
    452496  schedparam.sched_priority = -1;
     
    454498  puts( "Init: pthread_setschedparam - EINVAL (invalid priority)" );
    455499  status = pthread_setschedparam( pthread_self(), SCHED_OTHER, NULL );
    456   assert( status == EINVAL );
     500  fatal_directive_check_status_only( status, EINVAL, "invalid priority" );
    457501
    458502  schedparam.sched_priority = 128;
     
    460504  puts( "Init: pthread_setschedparam - EINVAL (invalid policy)" );
    461505  status = pthread_setschedparam( pthread_self(), -1, &schedparam );
    462   assert( status == EINVAL );
     506  fatal_directive_check_status_only( status, EINVAL, "invalid policy" );
    463507
    464508  puts( "Init: pthread_setschedparam - ESRCH (invalid thread)" );
    465509  status = pthread_setschedparam( -1, SCHED_OTHER, &schedparam );
    466   assert( status == ESRCH );
     510  fatal_directive_check_status_only( status, ESRCH, "invalid thread" );
    467511
    468512  /* now get sporadic server errors */
     
    475519  puts( "Init: pthread_setschedparam - EINVAL (replenish < budget)" );
    476520  status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
    477   assert( status == EINVAL );
     521  fatal_directive_check_status_only( status, EINVAL, "replenish < budget" );
    478522
    479523  schedparam.ss_replenish_period.tv_sec = 2;
     
    485529  puts( "Init: pthread_setschedparam - EINVAL (invalid priority)" );
    486530  status = pthread_setschedparam( pthread_self(), SCHED_SPORADIC, &schedparam );
    487   assert( status == EINVAL );
     531  fatal_directive_check_status_only( status, EINVAL, "invalid priority" );
    488532
    489533  puts( "*** END OF POSIX TEST 7 ***" );
  • testsuites/psxtests/psx07/system.h

    r1ff7e19 r01618cc  
    4848TEST_EXTERN pthread_t        Task_id;
    4949
     50#undef TEST_EXTERN
     51
    5052/* end of include file */
Note: See TracChangeset for help on using the changeset viewer.