Changeset 644c0fa6 in rtems


Ignore:
Timestamp:
Aug 8, 1996, 4:28:24 PM (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
f55d898
Parents:
b67f5bfb
Message:

added complete test cases for pthread_once.

Files:
6 edited

Legend:

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

    rb67f5bfb r644c0fa6  
    6363  /* check the time remaining */
    6464
    65   printf( "seconds remaining (%d)\n", (int)remaining );
     65  printf( "Init: seconds remaining (%d)\n", (int)remaining );
    6666  assert( !remaining );
    6767
     
    8383  /* check the time remaining */
    8484
    85   printf( "sec (%d), nsec (%d) remaining\n", (int)tr.tv_sec, (int)tr.tv_nsec );
     85  printf( "Init: sec (%ld), nsec (%ld) remaining\n", tr.tv_sec, tr.tv_nsec );
    8686  assert( !tr.tv_sec && !tr.tv_nsec );
    8787
     
    8989
    9090  Init_id = pthread_self();
    91   printf( "Init's ID is 0x%08x\n", Init_id );
     91  printf( "Init: ID is 0x%08x\n", Init_id );
    9292
    9393  /* print the minimum priority */
    9494
    9595  priority = sched_get_priority_min( SCHED_FIFO );
    96   printf( "Minimum priority for FIFO is %d\n", priority );
     96  printf( "Init: Minimum priority for FIFO is %d\n", priority );
    9797  assert( priority != -1 );
    9898
     
    100100 
    101101  priority = sched_get_priority_max( SCHED_FIFO );
    102   printf( "Maximum priority for FIFO is %d\n", priority );
     102  printf( "Init: Maximum priority for FIFO is %d\n", priority );
    103103  assert( priority != -1 );
    104104
     
    107107  status = sched_rr_get_interval( getpid(), &tr );
    108108  printf(
    109     "Round Robin quantum is %d seconds, %d nanoseconds\n",
    110     (int) tr.tv_sec,
    111     (int) tr.tv_nsec
     109    "Init: Round Robin quantum is %ld seconds, %ld nanoseconds\n",
     110    tr.tv_sec,
     111    tr.tv_nsec
    112112  );
    113113  assert( !status );
  • c/src/tests/psxtests/psx01/system.h

    rb67f5bfb r644c0fa6  
    1919#include <pmacros.h>
    2020#include <unistd.h>
     21#include <errno.h>
    2122
    2223void *POSIX_Init(
  • c/src/tests/psxtests/psx01/task.c

    rb67f5bfb r644c0fa6  
    2222#include "system.h"
    2323
     24void Test_init_routine( void )
     25{
     26  puts( "Test_init_routine: invoked" );
     27}
     28 
     29
    2430void *Task_1_through_3(
    2531  void *argument
     
    2733{
    2834  int status;
     35  pthread_once_t once = PTHREAD_ONCE_INIT;
    2936
    30   /* XXX temporary */
     37  empty_line();
    3138
    3239  /* get id of this thread */
    3340
    3441  Task_id = pthread_self();
    35   printf( "Task's ID is 0x%08x\n", Task_id );
     42  printf( "Task_1: ID is 0x%08x\n", Task_id );
     43
     44  /* exercise pthread_equal */
    3645
    3746  status = pthread_equal( Task_id, Task_id );
    3847  if ( status )
    39     puts( "pthread_equal match case passed" );
     48    puts( "Task_1: pthread_equal match case passed" );
    4049  assert( status );
    4150
    4251  status = pthread_equal( Init_id, Task_id );
    4352  if ( !status )
    44     puts( "pthread_equal different case passed" );
     53    puts( "Task_1: pthread_equal different case passed" );
    4554  assert( !status );
    4655
    47   puts( "pthread_equal first id bad" );
     56  puts( "Task_1: pthread_equal first id bad" );
    4857  status = pthread_equal( -1, Task_id );
    49   assert( status == 0);
     58  assert( !status );
    5059
    51   puts( "pthread_equal second id bad" );
     60  puts( "Task_1: pthread_equal second id bad" );
    5261  status = pthread_equal( Init_id, -1 );
    53   assert( status == 0);
     62  assert( !status );
     63
     64  /* exercise pthread_once */
     65
     66  puts( "Task_1: pthread_once - EINVAL (NULL once_control)" );
     67  status = pthread_once( NULL, Test_init_routine );
     68  assert( status == EINVAL );
     69
     70  puts( "Task_1: pthread_once - EINVAL (NULL init_routine)" );
     71  status = pthread_once( &once, NULL );
     72  assert( status == EINVAL );
     73
     74  puts( "Task_1: pthread_once - SUCCESSFUL (init_routine executes)" );
     75  status = pthread_once( &once, Test_init_routine );
     76  assert( !status );
     77
     78  puts( "Task_1: pthread_once - SUCCESSFUL (init_routine does not execute)" );
     79  status = pthread_once( &once, Test_init_routine );
     80  assert( !status );
    5481
    5582  puts( "*** END OF POSIX TEST 1 ***" );
  • testsuites/psxtests/psx01/init.c

    rb67f5bfb r644c0fa6  
    6363  /* check the time remaining */
    6464
    65   printf( "seconds remaining (%d)\n", (int)remaining );
     65  printf( "Init: seconds remaining (%d)\n", (int)remaining );
    6666  assert( !remaining );
    6767
     
    8383  /* check the time remaining */
    8484
    85   printf( "sec (%d), nsec (%d) remaining\n", (int)tr.tv_sec, (int)tr.tv_nsec );
     85  printf( "Init: sec (%ld), nsec (%ld) remaining\n", tr.tv_sec, tr.tv_nsec );
    8686  assert( !tr.tv_sec && !tr.tv_nsec );
    8787
     
    8989
    9090  Init_id = pthread_self();
    91   printf( "Init's ID is 0x%08x\n", Init_id );
     91  printf( "Init: ID is 0x%08x\n", Init_id );
    9292
    9393  /* print the minimum priority */
    9494
    9595  priority = sched_get_priority_min( SCHED_FIFO );
    96   printf( "Minimum priority for FIFO is %d\n", priority );
     96  printf( "Init: Minimum priority for FIFO is %d\n", priority );
    9797  assert( priority != -1 );
    9898
     
    100100 
    101101  priority = sched_get_priority_max( SCHED_FIFO );
    102   printf( "Maximum priority for FIFO is %d\n", priority );
     102  printf( "Init: Maximum priority for FIFO is %d\n", priority );
    103103  assert( priority != -1 );
    104104
     
    107107  status = sched_rr_get_interval( getpid(), &tr );
    108108  printf(
    109     "Round Robin quantum is %d seconds, %d nanoseconds\n",
    110     (int) tr.tv_sec,
    111     (int) tr.tv_nsec
     109    "Init: Round Robin quantum is %ld seconds, %ld nanoseconds\n",
     110    tr.tv_sec,
     111    tr.tv_nsec
    112112  );
    113113  assert( !status );
  • testsuites/psxtests/psx01/system.h

    rb67f5bfb r644c0fa6  
    1919#include <pmacros.h>
    2020#include <unistd.h>
     21#include <errno.h>
    2122
    2223void *POSIX_Init(
  • testsuites/psxtests/psx01/task.c

    rb67f5bfb r644c0fa6  
    2222#include "system.h"
    2323
     24void Test_init_routine( void )
     25{
     26  puts( "Test_init_routine: invoked" );
     27}
     28 
     29
    2430void *Task_1_through_3(
    2531  void *argument
     
    2733{
    2834  int status;
     35  pthread_once_t once = PTHREAD_ONCE_INIT;
    2936
    30   /* XXX temporary */
     37  empty_line();
    3138
    3239  /* get id of this thread */
    3340
    3441  Task_id = pthread_self();
    35   printf( "Task's ID is 0x%08x\n", Task_id );
     42  printf( "Task_1: ID is 0x%08x\n", Task_id );
     43
     44  /* exercise pthread_equal */
    3645
    3746  status = pthread_equal( Task_id, Task_id );
    3847  if ( status )
    39     puts( "pthread_equal match case passed" );
     48    puts( "Task_1: pthread_equal match case passed" );
    4049  assert( status );
    4150
    4251  status = pthread_equal( Init_id, Task_id );
    4352  if ( !status )
    44     puts( "pthread_equal different case passed" );
     53    puts( "Task_1: pthread_equal different case passed" );
    4554  assert( !status );
    4655
    47   puts( "pthread_equal first id bad" );
     56  puts( "Task_1: pthread_equal first id bad" );
    4857  status = pthread_equal( -1, Task_id );
    49   assert( status == 0);
     58  assert( !status );
    5059
    51   puts( "pthread_equal second id bad" );
     60  puts( "Task_1: pthread_equal second id bad" );
    5261  status = pthread_equal( Init_id, -1 );
    53   assert( status == 0);
     62  assert( !status );
     63
     64  /* exercise pthread_once */
     65
     66  puts( "Task_1: pthread_once - EINVAL (NULL once_control)" );
     67  status = pthread_once( NULL, Test_init_routine );
     68  assert( status == EINVAL );
     69
     70  puts( "Task_1: pthread_once - EINVAL (NULL init_routine)" );
     71  status = pthread_once( &once, NULL );
     72  assert( status == EINVAL );
     73
     74  puts( "Task_1: pthread_once - SUCCESSFUL (init_routine executes)" );
     75  status = pthread_once( &once, Test_init_routine );
     76  assert( !status );
     77
     78  puts( "Task_1: pthread_once - SUCCESSFUL (init_routine does not execute)" );
     79  status = pthread_once( &once, Test_init_routine );
     80  assert( !status );
    5481
    5582  puts( "*** END OF POSIX TEST 1 ***" );
Note: See TracChangeset for help on using the changeset viewer.