summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests/psxtime
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2010-06-28 21:00:15 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2010-06-28 21:00:15 +0000
commit89b897f020d281af18ebabbd189f78e338125d02 (patch)
treea31a6149ce7017eaeef22e5935c34e3d82682b12 /testsuites/psxtests/psxtime
parent2010-06-28 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-89b897f020d281af18ebabbd189f78e338125d02.tar.bz2
2010-06-28 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxtime/psxtime.scn, psxtime/test.c: Add test for passing a null pointer.
Diffstat (limited to 'testsuites/psxtests/psxtime')
-rw-r--r--testsuites/psxtests/psxtime/psxtime.scn1
-rw-r--r--testsuites/psxtests/psxtime/test.c40
2 files changed, 24 insertions, 17 deletions
diff --git a/testsuites/psxtests/psxtime/psxtime.scn b/testsuites/psxtests/psxtime/psxtime.scn
index 88cb1620c1..6f6602db37 100644
--- a/testsuites/psxtests/psxtime/psxtime.scn
+++ b/testsuites/psxtests/psxtime/psxtime.scn
@@ -1,4 +1,5 @@
*** POSIX TIME OF DAY TEST ***
+gettimeofday( NULL, NULL ) - EFAULT
rtems_clock_set 12:45:00 01/01/1988
adjtime - NULL delta - EINVAL
adjtime - delta out of range - EINVAL
diff --git a/testsuites/psxtests/psxtime/test.c b/testsuites/psxtests/psxtime/test.c
index 316f161ea5..41db252450 100644
--- a/testsuites/psxtests/psxtime/test.c
+++ b/testsuites/psxtests/psxtime/test.c
@@ -66,16 +66,16 @@ void check_a_tod(
print_time( "rtems_clock_set ", the_tod, "\n" );
status = rtems_clock_set( the_tod );
- rtems_test_assert( !status );
+ rtems_test_assert( !status );
do {
status = rtems_clock_get_tod( &new_tod );
- rtems_test_assert( !status );
+ rtems_test_assert( !status );
print_time( "rtems_clock_get_tod ", &new_tod, "\n" );
/* now do the posix time gets */
result = gettimeofday( &tv, 0 );
- rtems_test_assert( result == 0 );
+ rtems_test_assert( result == 0 );
a_time_t = tv.tv_sec; /* ctime() takes a time_t */
printf( "gettimeofday: %s", ctime( &a_time_t) );
@@ -109,7 +109,7 @@ void test_adjtime(void)
print_time( "rtems_clock_set ", the_tod, "\n" );
status = rtems_clock_set( the_tod );
- rtems_test_assert( !status );
+ rtems_test_assert( !status );
delta.tv_sec = 0;
delta.tv_usec = 0;
@@ -118,62 +118,62 @@ void test_adjtime(void)
puts( "adjtime - NULL delta - EINVAL" );
sc = adjtime( NULL, &olddelta );
- rtems_test_assert( sc == -1 );
- rtems_test_assert( errno == EINVAL );
+ rtems_test_assert( sc == -1 );
+ rtems_test_assert( errno == EINVAL );
puts( "adjtime - delta out of range - EINVAL" );
delta.tv_usec = 1000000000; /* 100 seconds worth */
sc = adjtime( &delta, &olddelta );
- rtems_test_assert( sc == -1 );
- rtems_test_assert( errno == EINVAL );
+ rtems_test_assert( sc == -1 );
+ rtems_test_assert( errno == EINVAL );
puts( "adjtime - delta too small - do nothing" );
delta.tv_sec = 0;
delta.tv_usec = 1;
sc = adjtime( &delta, &olddelta );
- rtems_test_assert( sc == 0 );
+ rtems_test_assert( sc == 0 );
puts( "adjtime - delta too small - do nothing, olddelta=NULL" );
sc = adjtime( &delta, NULL );
- rtems_test_assert( sc == 0 );
+ rtems_test_assert( sc == 0 );
puts( "adjtime - delta of one second forward, olddelta=NULL" );
delta.tv_sec = 1;
delta.tv_usec = 0;
sc = adjtime( &delta, NULL );
- rtems_test_assert( sc == 0 );
+ rtems_test_assert( sc == 0 );
puts( "adjtime - delta of one second forward" );
delta.tv_sec = 1;
delta.tv_usec = 0;
sc = adjtime( &delta, &olddelta );
- rtems_test_assert( sc == 0 );
+ rtems_test_assert( sc == 0 );
puts( "adjtime - delta of almost two seconds forward" );
delta.tv_sec = 1;
delta.tv_usec = 1000000 - 1;
sc = adjtime( &delta, &olddelta );
- rtems_test_assert( sc == 0 );
+ rtems_test_assert( sc == 0 );
/*
* spin until over 1/2 of the way to the
*/
ticks = rtems_clock_get_ticks_per_second();
- rtems_test_assert( ticks );
+ rtems_test_assert( ticks );
ticks /= 2;
do {
status = rtems_clock_get_tod( &tod );
- rtems_test_assert( !status );
+ rtems_test_assert( !status );
} while ( tod.ticks <= ticks );
puts( "adjtime - delta of almost one second forward which bumps second" );
delta.tv_sec = 0;
delta.tv_usec = 1000000 - 1;
sc = adjtime( &delta, &olddelta );
- rtems_test_assert( sc == 0 );
+ rtems_test_assert( sc == 0 );
status = rtems_clock_get_tod( &tod );
- rtems_test_assert( !status );
+ rtems_test_assert( !status );
print_time( "rtems_clock_get_tod ", &tod, "\n" );
}
@@ -193,9 +193,15 @@ int main(
#endif
{
int i;
+ int sc;
puts( "\n\n*** POSIX TIME OF DAY TEST ***" );
+ puts( "gettimeofday( NULL, NULL ) - EFAULT" );
+ sc = gettimeofday( NULL, NULL );
+ rtems_test_assert( sc == -1 );
+ rtems_test_assert( errno == EFAULT );
+
test_adjtime();
/*