diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-08-12 21:15:15 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1996-08-12 21:15:15 +0000 |
commit | 5da2ae8b72c051cbd6c776b861a9421b5f214f90 (patch) | |
tree | 341028d2001c38b5ed2e0701a677138311b9db5c /testsuites/psxtests | |
parent | clock_getres: added error check for NULL pointer being passed in. (diff) | |
download | rtems-5da2ae8b72c051cbd6c776b861a9421b5f214f90.tar.bz2 |
added test cases for clock_getres
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r-- | testsuites/psxtests/psx01/init.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/testsuites/psxtests/psx01/init.c b/testsuites/psxtests/psx01/init.c index 35788eceb7..631634b443 100644 --- a/testsuites/psxtests/psx01/init.c +++ b/testsuites/psxtests/psx01/init.c @@ -30,15 +30,6 @@ void *POSIX_Init( puts( "\n\n*** POSIX TEST 1 ***" ); - /* set the time of day, and print our buffer in multiple ways */ - - build_time( &tm, TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 ); - - tv.tv_sec = mktime( &tm ); - assert( tv.tv_sec != -1 ); - - tv.tv_nsec = 0; - /* error cases in clock_gettime and clock_settime */ puts( "Init: clock_gettime - EINVAL (invalid clockid)" ); @@ -51,8 +42,34 @@ void *POSIX_Init( assert( status == -1 ); assert( errno == EINVAL ); + /* exercise clock_getres */ + + puts( "Init: clock_getres - EINVAL (invalid clockid)" ); + status = clock_getres( -1, &tv ); + assert( status == -1 ); + assert( errno == EINVAL ); + + puts( "Init: clock_getres - EINVAL (NULL resolution)" ); + status = clock_getres( CLOCK_REALTIME, NULL ); + assert( status == -1 ); + assert( errno == EINVAL ); + + puts( "Init: clock_getres - SUCCESSFUL" ); + status = clock_getres( CLOCK_REALTIME, &tv ); + printf( "Init: resolution = sec (%ld), nsec (%ld)\n", tv.tv_sec, tv.tv_nsec ); + assert( !status ); + + /* set the time of day, and print our buffer in multiple ways */ + + tv.tv_sec = mktime( &tm ); + assert( tv.tv_sec != -1 ); + + tv.tv_nsec = 0; + /* now set the time of day */ + empty_line(); + printf( asctime( &tm ) ); puts( "Init: clock_settime - SUCCESSFUL" ); status = clock_settime( CLOCK_REALTIME, &tv ); @@ -88,6 +105,7 @@ void *POSIX_Init( /* error cases in nanosleep */ + empty_line(); puts( "Init: nanosleep - EINVAL (NULL time)" ); status = nanosleep ( NULL, &tr ); assert( status == -1 ); |