Ignore:
Timestamp:
Sep 14, 2009, 12:15:55 AM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 5, master
Children:
7c411bd
Parents:
e7de563a
Message:

2009-09-13 Joel Sherrill <joel.sherrill@…>

  • psxclock/init.c, psxclock/psxclock.scn, psxenosys/init.c, psxenosys/psxenosys.scn, psxsignal03/Makefile.am, psxsignal03/init.c, psxsignal04/Makefile.am: Move test cases which needed to be executed when POSIX is disabled to psxclock so they will be.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/psxtests/psxclock/init.c

    re7de563a r1e2d7510  
    1414#include <errno.h>
    1515
     16void check_enosys(int status);
     17
     18void check_enosys(int status)
     19{
     20  if ( (status == -1) && (errno == ENOSYS) )
     21    return;
     22  puts( "ERROR -- did not return ENOSYS as expected" );
     23  rtems_test_exit(0);
     24}
     25
    1626rtems_task Init(
    1727  rtems_task_argument argument
     
    2030  struct timespec tv;
    2131  struct timespec tr;
    22   int             status;
     32  int             sc;
    2333  int             priority;
    2434  pthread_t       thread_id;
     
    3646
    3747  puts( "Init: clock_gettime - EINVAL (NULL timespec)" );
    38   status = clock_gettime( CLOCK_REALTIME, NULL );
    39   rtems_test_assert( status == -1 );
     48  sc = clock_gettime( CLOCK_REALTIME, NULL );
     49  rtems_test_assert( sc == -1 );
    4050  rtems_test_assert( errno == EINVAL );
    4151
    4252  puts( "Init: clock_gettime - EINVAL (invalid clockid)" );
    43   status = clock_gettime( (clockid_t)-1, &tv );
    44   rtems_test_assert( status == -1 );
     53  sc = clock_gettime( (clockid_t)-1, &tv );
     54  rtems_test_assert( sc == -1 );
    4555  rtems_test_assert( errno == EINVAL );
    4656
    4757  puts( "Init: clock_settime - EINVAL (invalid clockid)" );
    48   status = clock_settime( (clockid_t)-1, &tv );
    49   rtems_test_assert( status == -1 );
     58  sc = clock_settime( (clockid_t)-1, &tv );
     59  rtems_test_assert( sc == -1 );
    5060  rtems_test_assert( errno == EINVAL );
    5161
     
    5565  printf( ctime( &tv.tv_sec ) );
    5666  puts( "Init: clock_settime - before 1988 EINVAL" );
    57   status = clock_settime( CLOCK_REALTIME, &tv );
    58   rtems_test_assert( status == -1 );
     67  sc = clock_settime( CLOCK_REALTIME, &tv );
     68  rtems_test_assert( sc == -1 );
    5969  rtems_test_assert( errno == EINVAL );
    6070
     
    6272
    6373  puts( "Init: clock_getres - EINVAL (invalid clockid)" );
    64   status = clock_getres( (clockid_t) -1, &tv );
    65   rtems_test_assert( status == -1 );
     74  sc = clock_getres( (clockid_t) -1, &tv );
     75  rtems_test_assert( sc == -1 );
    6676  rtems_test_assert( errno == EINVAL );
    6777
    6878  puts( "Init: clock_getres - EINVAL (NULL resolution)" );
    69   status = clock_getres( CLOCK_REALTIME, NULL );
    70   rtems_test_assert( status == -1 );
     79  sc = clock_getres( CLOCK_REALTIME, NULL );
     80  rtems_test_assert( sc == -1 );
    7181  rtems_test_assert( errno == EINVAL );
    7282
    7383  puts( "Init: clock_getres - SUCCESSFUL" );
    74   status = clock_getres( CLOCK_REALTIME, &tv );
     84  sc = clock_getres( CLOCK_REALTIME, &tv );
    7585  printf( "Init: resolution = sec (%ld), nsec (%ld)\n", tv.tv_sec, tv.tv_nsec );
    76   rtems_test_assert( !status );
     86  rtems_test_assert( !sc );
    7787
    7888  /* set the time of day, and print our buffer in multiple ways */
     
    8999  printf( asctime( &tm ) );
    90100  puts( "Init: clock_settime - SUCCESSFUL" );
    91   status = clock_settime( CLOCK_REALTIME, &tv );
    92   rtems_test_assert( !status );
     101  sc = clock_settime( CLOCK_REALTIME, &tv );
     102  rtems_test_assert( !sc );
    93103
    94104  printf( asctime( &tm ) );
     
    101111 
    102112  /* print new times to make sure it has changed and we can get the realtime */
    103   status = clock_gettime( CLOCK_PROCESS_CPUTIME, &tv );
    104   rtems_test_assert( !status );
     113  sc = clock_gettime( CLOCK_PROCESS_CPUTIME, &tv );
     114  rtems_test_assert( !sc );
    105115  printf("Time since boot: (%d, %d)\n", tv.tv_sec,tv.tv_nsec );
    106116
    107   status = clock_gettime( CLOCK_REALTIME, &tv );
    108   rtems_test_assert( !status );
     117  sc = clock_gettime( CLOCK_REALTIME, &tv );
     118  rtems_test_assert( !sc );
    109119
    110120  printf( ctime( &tv.tv_sec ) );
     
    127137  empty_line();
    128138  puts( "Init: nanosleep - EINVAL (NULL time)" );
    129   status = nanosleep ( NULL, &tr );
    130   rtems_test_assert( status == -1 );
     139  sc = nanosleep ( NULL, &tr );
     140  rtems_test_assert( sc == -1 );
    131141  rtems_test_assert( errno == EINVAL );
    132142
     
    134144  tv.tv_nsec = TOD_NANOSECONDS_PER_SECOND * 2;
    135145  puts( "Init: nanosleep - EINVAL (too many nanoseconds)" );
    136   status = nanosleep ( &tv, &tr );
    137   rtems_test_assert( status == -1 );
     146  sc = nanosleep ( &tv, &tr );
     147  rtems_test_assert( sc == -1 );
    138148  rtems_test_assert( errno == EINVAL );
    139149
     
    142152  tv.tv_nsec = 0;
    143153  puts( "Init: nanosleep - negative seconds small delay " );
    144   status = nanosleep ( &tv, &tr );
    145   rtems_test_assert( status == -1 );
     154  sc = nanosleep ( &tv, &tr );
     155  rtems_test_assert( sc == -1 );
    146156  rtems_test_assert( errno == EINVAL );
    147157
     
    152162
    153163  puts( "Init: nanosleep - yield with remaining" );
    154   status = nanosleep ( &tv, &tr );
    155   rtems_test_assert( !status );
     164  sc = nanosleep ( &tv, &tr );
     165  rtems_test_assert( !sc );
    156166  rtems_test_assert( !tr.tv_sec );
    157167  rtems_test_assert( !tr.tv_nsec );
    158168
    159169  puts( "Init: nanosleep - yield with NULL time remaining" );
    160   status = nanosleep ( &tv, NULL );
    161   rtems_test_assert( !status );
     170  sc = nanosleep ( &tv, NULL );
     171  rtems_test_assert( !sc );
    162172  rtems_test_assert( !tr.tv_sec );
    163173  rtems_test_assert( !tr.tv_nsec );
     
    169179
    170180  puts( "Init: nanosleep - 1.05 seconds" );
    171   status = nanosleep ( &tv, &tr );
    172   rtems_test_assert( !status );
     181  sc = nanosleep ( &tv, &tr );
     182  rtems_test_assert( !sc );
    173183
    174184  /* print the current real time again */
    175   status = clock_gettime( CLOCK_REALTIME, &tv );
    176   rtems_test_assert( !status );
     185  sc = clock_gettime( CLOCK_REALTIME, &tv );
     186  rtems_test_assert( !sc );
    177187  printf( ctime( &tv.tv_sec ) );
    178188
     
    187197 
    188198  /* print the current real time again */
    189   status = clock_gettime( CLOCK_REALTIME, &tv );
    190   rtems_test_assert( !status );
    191   printf( ctime( &tv.tv_sec ) );
     199  sc = clock_gettime( CLOCK_REALTIME, &tv );
     200  rtems_test_assert( !sc );
     201  printf( ctime( &tv.tv_sec ) );
     202
     203  puts( "" );
     204  puts( "clock_gettime - CLOCK_THREAD_CPUTIME -- ENOSYS" );
     205  #if defined(_POSIX_THREAD_CPUTIME)
     206    {
     207      struct timespec tp;
     208      sc = clock_gettime( CLOCK_THREAD_CPUTIME, &tp );
     209      check_enosys( sc );
     210    }
     211  #endif
     212
     213  puts( "clock_settime - CLOCK_PROCESS_CPUTIME -- ENOSYS" );
     214  #if defined(_POSIX_CPUTIME)
     215    {
     216      struct timespec tp;
     217      sc = clock_settime( CLOCK_PROCESS_CPUTIME, &tp );
     218      check_enosys( sc );
     219    }
     220  #endif
     221
     222  puts( "clock_settime - CLOCK_THREAD_CPUTIME -- ENOSYS" );
     223  #if defined(_POSIX_THREAD_CPUTIME)
     224    {
     225      struct timespec tp;
     226      sc = clock_settime( CLOCK_THREAD_CPUTIME, &tp );
     227      check_enosys( sc );
     228    }
     229  #endif
    192230
    193231  puts( "*** END OF POSIX CLOCK TEST ***" );
Note: See TracChangeset for help on using the changeset viewer.