summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psx01/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuites/psxtests/psx01/init.c')
-rw-r--r--testsuites/psxtests/psx01/init.c164
1 files changed, 0 insertions, 164 deletions
diff --git a/testsuites/psxtests/psx01/init.c b/testsuites/psxtests/psx01/init.c
index 0f44bd193f..c548dc64a6 100644
--- a/testsuites/psxtests/psx01/init.c
+++ b/testsuites/psxtests/psx01/init.c
@@ -23,17 +23,11 @@ void *POSIX_Init(
int status;
int priority;
pthread_t thread_id;
- time_t seconds;
- time_t seconds1;
- unsigned int remaining;
struct tm tm;
struct utsname uts;
- useconds_t useconds;
puts( "\n\n*** POSIX TEST 1 ***" );
- tm_build_time( &tm, TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
-
/* print some system information */
puts( "Init: uname - EFAULT (invalid uts pointer argument)" );
@@ -50,164 +44,6 @@ void *POSIX_Init(
printf( "Init: uts.machine: %s\n", uts.machine );
puts("");
- /* error cases in clock_gettime and clock_settime */
-
- puts( "Init: clock_gettime - EINVAL (NULL timespec)" );
- status = clock_gettime( CLOCK_REALTIME, NULL );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EINVAL );
-
- puts( "Init: clock_gettime - EINVAL (invalid clockid)" );
- status = clock_gettime( (clockid_t)-1, &tv );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EINVAL );
-
- puts( "Init: clock_settime - EINVAL (invalid clockid)" );
- status = clock_settime( (clockid_t)-1, &tv );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EINVAL );
-
- /* way back near the dawn of time :D */
- tv.tv_sec = 1;
- tv.tv_nsec = 0;
- printf( ctime( &tv.tv_sec ) );
- puts( "Init: clock_settime - before 1988 EINVAL" );
- status = clock_settime( CLOCK_REALTIME, &tv );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EINVAL );
-
- /* exercise clock_getres */
-
- puts( "Init: clock_getres - EINVAL (invalid clockid)" );
- status = clock_getres( (clockid_t) -1, &tv );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EINVAL );
-
- puts( "Init: clock_getres - EINVAL (NULL resolution)" );
- status = clock_getres( CLOCK_REALTIME, NULL );
- rtems_test_assert( status == -1 );
- rtems_test_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 );
- rtems_test_assert( !status );
-
- /* set the time of day, and print our buffer in multiple ways */
-
- tv.tv_sec = mktime( &tm );
- rtems_test_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 );
- rtems_test_assert( !status );
-
- printf( asctime( &tm ) );
- printf( ctime( &tv.tv_sec ) );
-
- /* use sleep to delay */
-
- remaining = sleep( 3 );
- rtems_test_assert( !remaining );
-
- /* print new times to make sure it has changed and we can get the realtime */
- status = clock_gettime( CLOCK_PROCESS_CPUTIME, &tv );
- rtems_test_assert( !status );
- printf("Time since boot: (%d, %d)\n", tv.tv_sec,tv.tv_nsec );
-
- status = clock_gettime( CLOCK_REALTIME, &tv );
- rtems_test_assert( !status );
-
- printf( ctime( &tv.tv_sec ) );
-
- seconds = time( NULL );
- printf( ctime( &seconds ) );
-
- /* just to have the value copied out through the parameter */
-
- seconds = time( &seconds1 );
- rtems_test_assert( seconds == seconds1 );
-
- /* check the time remaining */
-
- printf( "Init: seconds remaining (%d)\n", (int)remaining );
- rtems_test_assert( !remaining );
-
- /* error cases in nanosleep */
-
- empty_line();
- puts( "Init: nanosleep - EINVAL (NULL time)" );
- status = nanosleep ( NULL, &tr );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EINVAL );
-
- tv.tv_sec = 0;
- tv.tv_nsec = TOD_NANOSECONDS_PER_SECOND * 2;
- puts( "Init: nanosleep - EINVAL (too many nanoseconds)" );
- status = nanosleep ( &tv, &tr );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EINVAL );
-
- /* this is actually a small delay or yield */
- tv.tv_sec = -1;
- tv.tv_nsec = 0;
- puts( "Init: nanosleep - negative seconds small delay " );
- status = nanosleep ( &tv, &tr );
- rtems_test_assert( status == -1 );
- rtems_test_assert( errno == EINVAL );
-
- /* use nanosleep to yield */
-
- tv.tv_sec = 0;
- tv.tv_nsec = 0;
-
- puts( "Init: nanosleep - yield with remaining" );
- status = nanosleep ( &tv, &tr );
- rtems_test_assert( !status );
- rtems_test_assert( !tr.tv_sec );
- rtems_test_assert( !tr.tv_nsec );
-
- puts( "Init: nanosleep - yield with NULL time remaining" );
- status = nanosleep ( &tv, NULL );
- rtems_test_assert( !status );
- rtems_test_assert( !tr.tv_sec );
- rtems_test_assert( !tr.tv_nsec );
-
- /* use nanosleep to delay */
-
- tv.tv_sec = 3;
- tv.tv_nsec = 500000;
-
- puts( "Init: nanosleep - 1.05 seconds" );
- status = nanosleep ( &tv, &tr );
- rtems_test_assert( !status );
-
- /* print the current real time again */
- status = clock_gettime( CLOCK_REALTIME, &tv );
- rtems_test_assert( !status );
- printf( ctime( &tv.tv_sec ) );
-
- /* check the time remaining */
-
- printf( "Init: sec (%ld), nsec (%ld) remaining\n", tr.tv_sec, tr.tv_nsec );
- rtems_test_assert( !tr.tv_sec && !tr.tv_nsec );
-
- puts( "Init: usleep - 1.35 seconds" );
- useconds = usleep ( 1350000 );
- rtems_test_assert( useconds < 1350000 );
-
- /* print the current real time again */
- status = clock_gettime( CLOCK_REALTIME, &tv );
- rtems_test_assert( !status );
- printf( ctime( &tv.tv_sec ) );
-
/* get id of this thread */
Init_id = pthread_self();