Changeset 76117f2b in rtems


Ignore:
Timestamp:
08/09/96 19:20:54 (27 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
c03aeaf
Parents:
1406a4b
Message:

changed style of output to match other tests

Files:
2 edited

Legend:

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

    r1406a4b r76117f2b  
    9797  /* basic checkout of mutex attributes */
    9898
    99   puts( "Init: Initializing mutex attributes" );
     99  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
    100100  status = pthread_mutexattr_init( &attr );
    101101  assert( !status );
     
    128128  empty_line();
    129129
    130   puts( "Init: Creating a mutex" );
     130  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    131131  status = pthread_mutex_init( &Mutex_id, &attr );
    132132  if ( status )
     
    134134  assert( !status );
    135135
    136   puts( "Init: pthread_mutex_trylock successfully" );
     136  puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
    137137  status = pthread_mutex_trylock( &Mutex_id );
    138138  if ( status )
     
    140140  assert( !status );
    141141
    142   puts( "Init: pthread_mutex_trylock already locked" );
     142  puts( "Init: pthread_mutex_trylock - EDEADLK (already locked)" );
    143143  status = pthread_mutex_trylock( &Mutex_id );
    144144  if ( status != EDEADLK )
     
    146146  assert( status == EDEADLK );
    147147
    148   puts( "Init: pthread_mutex_lock already locked" );
     148  puts( "Init: pthread_mutex_lock - EDEADLK (already locked)" );
    149149  status = pthread_mutex_lock( &Mutex_id );
    150150  if ( status != EDEADLK )
     
    158158     /* switch to task 1 */
    159159
    160   puts( "Init: pthread_mutex_unlock successfully" );
     160  puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
    161161  status = pthread_mutex_unlock( &Mutex_id );
    162162  if ( status )
     
    164164  assert( !status );
    165165
    166   puts( "Init: pthread_mutex_unlock not owner" );
     166  puts( "Init: pthread_mutex_unlock - EPERM (not owner)" );
    167167  status = pthread_mutex_unlock( &Mutex_id );
    168168  if ( status != EPERM )
     
    172172  times.tv_sec = 0;
    173173  times.tv_nsec = 500000000;
    174   puts( "Init: pthread_mutex_timedlock time out in 1/2 second" );
     174  puts( "Init: pthread_mutex_timedlock - time out in 1/2 second" );
    175175  status = pthread_mutex_timedlock( &Mutex_id, &times );
    176176  if ( status != EAGAIN )
     
    180180     /* switch to idle */
    181181
    182   puts( "Init: correctly timed out waiting for mutex" );
     182  puts( "Init: pthread_mutex_timedlock - EAGAIN (timeout)" );
    183183
    184184  /* destroy a mutex */
     
    186186  empty_line();
    187187
    188   puts( "Init: Creating a mutex" );
     188  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    189189  status = pthread_mutex_init( &Mutex2_id, &attr );
    190190  if ( status )
     
    192192  assert( !status );
    193193
    194   puts( "Init: pthread_mutexattr_destroy" );
     194  puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" );
    195195  status = pthread_mutexattr_destroy( &attr );
    196196  assert( !status );
    197197
    198   puts( "Init: pthread_mutex_destroy" );
     198  puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
    199199  status = pthread_mutex_destroy( &Mutex2_id );
    200200  assert( !status );
     
    204204  empty_line();
    205205 
    206   puts( "Init: Initializing mutex attributes" );
    207   status = pthread_mutexattr_init( &attr );
    208   assert( !status );
    209 
    210   puts( "Init: Creating a mutex" );
     206  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
     207  status = pthread_mutexattr_init( &attr );
     208  assert( !status );
     209
     210  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    211211  status = pthread_mutex_init( &Mutex2_id, &attr );
    212212  assert( !status );
    213213 
    214   puts( "Init: pthread_mutex_trylock successfully" );
     214  puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
    215215  status = pthread_mutex_trylock( &Mutex2_id );
    216216  if ( status )
     
    218218  assert( !status );
    219219
     220  puts( "Init: pthread_mutex_destroy - EBUSY (already locked)" );
    220221  status = pthread_mutex_destroy( &Mutex2_id );
    221222  if ( status != EBUSY )
    222223    printf( "status = %d\n", status );
    223224  assert( status == EBUSY );
    224   puts( "Init: pthread_mutex_destroy - EBUSY" );
    225 
    226   puts( "Init: pthread_mutex_unlock successfully" );
     225
     226  puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
    227227  status = pthread_mutex_unlock( &Mutex2_id );
    228228  assert( !status );
    229229
    230   puts( "Init: pthread_mutex_destroy" );
     230  puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
    231231  status = pthread_mutex_destroy( &Mutex2_id );
    232232  assert( !status );
     
    236236  empty_line();
    237237 
    238   puts( "Init: Initializing mutex attributes" );
    239   status = pthread_mutexattr_init( &attr );
    240   assert( !status );
    241 
    242   puts( "Init: Setting PTHREAD_PRIO_INHERIT attribute" );
     238  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
     239  status = pthread_mutexattr_init( &attr );
     240  assert( !status );
     241
     242  puts(
     243    "Init: pthread_mutexattr_setprotocol - SUCCESSFUL (PTHREAD_PRIO_INHERIT)"
     244  );
    243245  status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT );
    244246  assert( !status );
    245247
    246   puts( "Init: Creating a mutex" );
     248  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    247249  status = pthread_mutex_init( &Mutex2_id, &attr );
    248250  assert( !status );
    249251
    250   puts( "Init: pthread_mutex_trylock successfully" );
     252  puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
    251253  status = pthread_mutex_trylock( &Mutex2_id );
    252254  assert( !status );
     
    261263  param.sched_priority = 255;
    262264 
    263   puts( "Init: Setting Task2 priority to highest" );
     265  puts( "Init: pthread_setschedparam - Setting Task2 priority to highest" );
    264266  status = pthread_setschedparam( Task2_id, SCHED_FIFO, &param );
    265267  assert( !status );
     
    269271  status = pthread_getschedparam( pthread_self(), &policy, &param );
    270272  assert( !status );
    271   printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority );
    272 
    273   puts( "Init: pthread_mutex_unlock successfully" );
     273  printf( "Init: pthread_getschedparam - priority = %d\n", param.sched_priority);
     274
     275  puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
    274276  status = pthread_mutex_unlock( &Mutex2_id );
    275277  assert( !status );
    276278 
    277   puts( "Init: pthread_mutexattr_destroy" );
     279  puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" );
    278280  status = pthread_mutexattr_destroy( &attr );
    279281  assert( !status );
    280282
    281   puts( "Init: pthread_mutex_destroy" );
     283  puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
    282284  status = pthread_mutex_destroy( &Mutex2_id );
    283285  assert( !status );
     
    287289  empty_line();
    288290 
    289   puts( "Init: Initializing mutex attributes" );
    290   status = pthread_mutexattr_init( &attr );
    291   assert( !status );
    292  
    293   puts( "Init: Setting PTHREAD_PRIO_PROTECT attribute" );
     291  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
     292  status = pthread_mutexattr_init( &attr );
     293  assert( !status );
     294 
     295  puts(
     296    "Init: pthread_mutexattr_setprotocol - SUCCESSFUL (PTHREAD_PRIO_PROTECT)"
     297  );
    294298  status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT );
    295299  assert( !status );
    296300 
    297   puts( "Init: Creating a mutex" );
     301  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    298302  status = pthread_mutex_init( &Mutex2_id, &attr );
    299303  assert( !status );
     
    301305  status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling );
    302306  assert( !status );
    303   printf( "Init: priority ceiling = %d\n", ceiling );
    304  
     307  printf( "Init: pthread_mutex_getprioceiling - %d\n", ceiling );
     308 
     309  puts( "Init: pthread_mutex_setprioceiling - new ceiling = 200" );
    305310  status = pthread_mutex_setprioceiling( &Mutex2_id, 200, &old_ceiling );
    306311  assert( !status );
    307   printf( "Init: Set ceiling = 200  old priority ceiling = %d\n",old_ceiling );
     312  printf(
     313    "Init: pthread_mutex_setprioceiling - old ceiling = %d\n",old_ceiling
     314  );
    308315 
    309316  status = pthread_getschedparam( pthread_self(), &policy, &param );
    310317  assert( !status );
    311   printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority );
    312 
    313   puts( "Init: pthread_mutex_trylock successfully" );
     318  printf(
     319    "Init: pthread_getschedparam - priority = %d\n", param.sched_priority
     320  );
     321
     322  puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
    314323  status = pthread_mutex_trylock( &Mutex2_id );
    315324  assert( !status );
     
    317326  status = pthread_getschedparam( pthread_self(), &policy, &param );
    318327  assert( !status );
    319   printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority );
     328  printf(
     329    "Init: pthread_getschedparam - priority = %d\n", param.sched_priority
     330  );
    320331
    321332  /* create a thread at a higher priority */
     
    330341  status = pthread_setschedparam( Task3_id, SCHED_FIFO, &param );
    331342  assert( !status );
    332   puts( "Init: Set Task3 priority to highest" );
     343  puts( "Init: pthread_setschedparam - set Task3 priority to highest" );
    333344 
    334345  /* DOES NOT SWITCH to Task3 */
     
    340351  /* switch to task 3 */
    341352 
    342   puts( "Init: pthread_mutex_unlock successfully" );
     353  puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
    343354  status = pthread_mutex_unlock( &Mutex2_id );
    344355  assert( !status );
     
    346357  status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling );
    347358  assert( !status );
    348   printf( "Init: priority ceiling = %d\n", ceiling );
     359  printf( "Init: pthread_mutex_getprioceiling- ceiling = %d\n", ceiling );
    349360 
    350361  /* set priority of Init to highest priority */
     
    354365  status = pthread_setschedparam( Init_id, SCHED_FIFO, &param );
    355366  assert( !status );
    356   puts( "Init: Set Init priority to highest" );
    357  
     367  puts( "Init: pthread_setschedparam - set Init priority to highest" );
     368 
     369  puts( "Init: pthread_mutex_lock - EINVAL (priority ceiling violation)" );
    358370  status = pthread_mutex_lock( &Mutex2_id );
    359371  if ( status != EDEADLK )
    360372    printf( "status = %d\n", status );
    361373  assert( status == EINVAL );
    362   puts( "Init: pthread_mutex_lock EINVAL (priority ceiling violation)" );
    363374
    364375  puts( "*** END OF POSIX TEST 5 ***" );
  • testsuites/psxtests/psx05/init.c

    r1406a4b r76117f2b  
    9797  /* basic checkout of mutex attributes */
    9898
    99   puts( "Init: Initializing mutex attributes" );
     99  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
    100100  status = pthread_mutexattr_init( &attr );
    101101  assert( !status );
     
    128128  empty_line();
    129129
    130   puts( "Init: Creating a mutex" );
     130  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    131131  status = pthread_mutex_init( &Mutex_id, &attr );
    132132  if ( status )
     
    134134  assert( !status );
    135135
    136   puts( "Init: pthread_mutex_trylock successfully" );
     136  puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
    137137  status = pthread_mutex_trylock( &Mutex_id );
    138138  if ( status )
     
    140140  assert( !status );
    141141
    142   puts( "Init: pthread_mutex_trylock already locked" );
     142  puts( "Init: pthread_mutex_trylock - EDEADLK (already locked)" );
    143143  status = pthread_mutex_trylock( &Mutex_id );
    144144  if ( status != EDEADLK )
     
    146146  assert( status == EDEADLK );
    147147
    148   puts( "Init: pthread_mutex_lock already locked" );
     148  puts( "Init: pthread_mutex_lock - EDEADLK (already locked)" );
    149149  status = pthread_mutex_lock( &Mutex_id );
    150150  if ( status != EDEADLK )
     
    158158     /* switch to task 1 */
    159159
    160   puts( "Init: pthread_mutex_unlock successfully" );
     160  puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
    161161  status = pthread_mutex_unlock( &Mutex_id );
    162162  if ( status )
     
    164164  assert( !status );
    165165
    166   puts( "Init: pthread_mutex_unlock not owner" );
     166  puts( "Init: pthread_mutex_unlock - EPERM (not owner)" );
    167167  status = pthread_mutex_unlock( &Mutex_id );
    168168  if ( status != EPERM )
     
    172172  times.tv_sec = 0;
    173173  times.tv_nsec = 500000000;
    174   puts( "Init: pthread_mutex_timedlock time out in 1/2 second" );
     174  puts( "Init: pthread_mutex_timedlock - time out in 1/2 second" );
    175175  status = pthread_mutex_timedlock( &Mutex_id, &times );
    176176  if ( status != EAGAIN )
     
    180180     /* switch to idle */
    181181
    182   puts( "Init: correctly timed out waiting for mutex" );
     182  puts( "Init: pthread_mutex_timedlock - EAGAIN (timeout)" );
    183183
    184184  /* destroy a mutex */
     
    186186  empty_line();
    187187
    188   puts( "Init: Creating a mutex" );
     188  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    189189  status = pthread_mutex_init( &Mutex2_id, &attr );
    190190  if ( status )
     
    192192  assert( !status );
    193193
    194   puts( "Init: pthread_mutexattr_destroy" );
     194  puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" );
    195195  status = pthread_mutexattr_destroy( &attr );
    196196  assert( !status );
    197197
    198   puts( "Init: pthread_mutex_destroy" );
     198  puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
    199199  status = pthread_mutex_destroy( &Mutex2_id );
    200200  assert( !status );
     
    204204  empty_line();
    205205 
    206   puts( "Init: Initializing mutex attributes" );
    207   status = pthread_mutexattr_init( &attr );
    208   assert( !status );
    209 
    210   puts( "Init: Creating a mutex" );
     206  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
     207  status = pthread_mutexattr_init( &attr );
     208  assert( !status );
     209
     210  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    211211  status = pthread_mutex_init( &Mutex2_id, &attr );
    212212  assert( !status );
    213213 
    214   puts( "Init: pthread_mutex_trylock successfully" );
     214  puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
    215215  status = pthread_mutex_trylock( &Mutex2_id );
    216216  if ( status )
     
    218218  assert( !status );
    219219
     220  puts( "Init: pthread_mutex_destroy - EBUSY (already locked)" );
    220221  status = pthread_mutex_destroy( &Mutex2_id );
    221222  if ( status != EBUSY )
    222223    printf( "status = %d\n", status );
    223224  assert( status == EBUSY );
    224   puts( "Init: pthread_mutex_destroy - EBUSY" );
    225 
    226   puts( "Init: pthread_mutex_unlock successfully" );
     225
     226  puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
    227227  status = pthread_mutex_unlock( &Mutex2_id );
    228228  assert( !status );
    229229
    230   puts( "Init: pthread_mutex_destroy" );
     230  puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
    231231  status = pthread_mutex_destroy( &Mutex2_id );
    232232  assert( !status );
     
    236236  empty_line();
    237237 
    238   puts( "Init: Initializing mutex attributes" );
    239   status = pthread_mutexattr_init( &attr );
    240   assert( !status );
    241 
    242   puts( "Init: Setting PTHREAD_PRIO_INHERIT attribute" );
     238  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
     239  status = pthread_mutexattr_init( &attr );
     240  assert( !status );
     241
     242  puts(
     243    "Init: pthread_mutexattr_setprotocol - SUCCESSFUL (PTHREAD_PRIO_INHERIT)"
     244  );
    243245  status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_INHERIT );
    244246  assert( !status );
    245247
    246   puts( "Init: Creating a mutex" );
     248  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    247249  status = pthread_mutex_init( &Mutex2_id, &attr );
    248250  assert( !status );
    249251
    250   puts( "Init: pthread_mutex_trylock successfully" );
     252  puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
    251253  status = pthread_mutex_trylock( &Mutex2_id );
    252254  assert( !status );
     
    261263  param.sched_priority = 255;
    262264 
    263   puts( "Init: Setting Task2 priority to highest" );
     265  puts( "Init: pthread_setschedparam - Setting Task2 priority to highest" );
    264266  status = pthread_setschedparam( Task2_id, SCHED_FIFO, &param );
    265267  assert( !status );
     
    269271  status = pthread_getschedparam( pthread_self(), &policy, &param );
    270272  assert( !status );
    271   printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority );
    272 
    273   puts( "Init: pthread_mutex_unlock successfully" );
     273  printf( "Init: pthread_getschedparam - priority = %d\n", param.sched_priority);
     274
     275  puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
    274276  status = pthread_mutex_unlock( &Mutex2_id );
    275277  assert( !status );
    276278 
    277   puts( "Init: pthread_mutexattr_destroy" );
     279  puts( "Init: pthread_mutexattr_destroy - SUCCESSFUL" );
    278280  status = pthread_mutexattr_destroy( &attr );
    279281  assert( !status );
    280282
    281   puts( "Init: pthread_mutex_destroy" );
     283  puts( "Init: pthread_mutex_destroy - SUCCESSFUL" );
    282284  status = pthread_mutex_destroy( &Mutex2_id );
    283285  assert( !status );
     
    287289  empty_line();
    288290 
    289   puts( "Init: Initializing mutex attributes" );
    290   status = pthread_mutexattr_init( &attr );
    291   assert( !status );
    292  
    293   puts( "Init: Setting PTHREAD_PRIO_PROTECT attribute" );
     291  puts( "Init: pthread_mutexattr_init - SUCCESSFUL" );
     292  status = pthread_mutexattr_init( &attr );
     293  assert( !status );
     294 
     295  puts(
     296    "Init: pthread_mutexattr_setprotocol - SUCCESSFUL (PTHREAD_PRIO_PROTECT)"
     297  );
    294298  status = pthread_mutexattr_setprotocol( &attr, PTHREAD_PRIO_PROTECT );
    295299  assert( !status );
    296300 
    297   puts( "Init: Creating a mutex" );
     301  puts( "Init: pthread_mutex_init - SUCCESSFUL" );
    298302  status = pthread_mutex_init( &Mutex2_id, &attr );
    299303  assert( !status );
     
    301305  status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling );
    302306  assert( !status );
    303   printf( "Init: priority ceiling = %d\n", ceiling );
    304  
     307  printf( "Init: pthread_mutex_getprioceiling - %d\n", ceiling );
     308 
     309  puts( "Init: pthread_mutex_setprioceiling - new ceiling = 200" );
    305310  status = pthread_mutex_setprioceiling( &Mutex2_id, 200, &old_ceiling );
    306311  assert( !status );
    307   printf( "Init: Set ceiling = 200  old priority ceiling = %d\n",old_ceiling );
     312  printf(
     313    "Init: pthread_mutex_setprioceiling - old ceiling = %d\n",old_ceiling
     314  );
    308315 
    309316  status = pthread_getschedparam( pthread_self(), &policy, &param );
    310317  assert( !status );
    311   printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority );
    312 
    313   puts( "Init: pthread_mutex_trylock successfully" );
     318  printf(
     319    "Init: pthread_getschedparam - priority = %d\n", param.sched_priority
     320  );
     321
     322  puts( "Init: pthread_mutex_trylock - SUCCESSFUL" );
    314323  status = pthread_mutex_trylock( &Mutex2_id );
    315324  assert( !status );
     
    317326  status = pthread_getschedparam( pthread_self(), &policy, &param );
    318327  assert( !status );
    319   printf( "Init: pthread_getschedparam priority = %d\n", param.sched_priority );
     328  printf(
     329    "Init: pthread_getschedparam - priority = %d\n", param.sched_priority
     330  );
    320331
    321332  /* create a thread at a higher priority */
     
    330341  status = pthread_setschedparam( Task3_id, SCHED_FIFO, &param );
    331342  assert( !status );
    332   puts( "Init: Set Task3 priority to highest" );
     343  puts( "Init: pthread_setschedparam - set Task3 priority to highest" );
    333344 
    334345  /* DOES NOT SWITCH to Task3 */
     
    340351  /* switch to task 3 */
    341352 
    342   puts( "Init: pthread_mutex_unlock successfully" );
     353  puts( "Init: pthread_mutex_unlock - SUCCESSFUL" );
    343354  status = pthread_mutex_unlock( &Mutex2_id );
    344355  assert( !status );
     
    346357  status = pthread_mutex_getprioceiling( &Mutex2_id, &ceiling );
    347358  assert( !status );
    348   printf( "Init: priority ceiling = %d\n", ceiling );
     359  printf( "Init: pthread_mutex_getprioceiling- ceiling = %d\n", ceiling );
    349360 
    350361  /* set priority of Init to highest priority */
     
    354365  status = pthread_setschedparam( Init_id, SCHED_FIFO, &param );
    355366  assert( !status );
    356   puts( "Init: Set Init priority to highest" );
    357  
     367  puts( "Init: pthread_setschedparam - set Init priority to highest" );
     368 
     369  puts( "Init: pthread_mutex_lock - EINVAL (priority ceiling violation)" );
    358370  status = pthread_mutex_lock( &Mutex2_id );
    359371  if ( status != EDEADLK )
    360372    printf( "status = %d\n", status );
    361373  assert( status == EINVAL );
    362   puts( "Init: pthread_mutex_lock EINVAL (priority ceiling violation)" );
    363374
    364375  puts( "*** END OF POSIX TEST 5 ***" );
Note: See TracChangeset for help on using the changeset viewer.