diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-02-01 00:45:08 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-02-01 00:45:08 +0000 |
commit | 66c348cb12fe8bbe2d4274246ed54bbc52c04777 (patch) | |
tree | 5f48b805dd333df1f11260c1e1ab51a8677cad5c /testsuites/psxtests | |
parent | 2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-66c348cb12fe8bbe2d4274246ed54bbc52c04777.tar.bz2 |
2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com>
* include/pmacros.h, psx01/init.c, psx01/system.h, psx13/main.c,
psxbarrier01/main.c, psxchroot01/main.c, psxfatal_support/init.c,
psxfile01/main.c, psxfile01/test.c, psxmount/main.c, psxrdwrv/main.c,
psxreaddir/main.c, psxrwlock01/main.c, psxspin01/main.c,
psxstat/main.c, psxtime/main.c: Change TEST_INIT to CONFIGURE_INIT.
Make tmacros.h available to all POSIX tests. Add a clock_settime case
for < 1988.
Diffstat (limited to '')
-rw-r--r-- | testsuites/psxtests/ChangeLog | 10 | ||||
-rw-r--r-- | testsuites/psxtests/include/pmacros.h | 7 | ||||
-rw-r--r-- | testsuites/psxtests/psx01/init.c | 109 | ||||
-rw-r--r-- | testsuites/psxtests/psx01/system.h | 6 | ||||
-rw-r--r-- | testsuites/psxtests/psx13/main.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxbarrier01/main.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxchroot01/main.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxfatal_support/init.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxfile01/main.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxfile01/test.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxmount/main.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxrdwrv/main.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxreaddir/main.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxrwlock01/main.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxspin01/main.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxstat/main.c | 2 | ||||
-rw-r--r-- | testsuites/psxtests/psxtime/main.c | 2 |
17 files changed, 86 insertions, 72 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index 2a672256cc..3895579f4f 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,5 +1,15 @@ 2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com> + * include/pmacros.h, psx01/init.c, psx01/system.h, psx13/main.c, + psxbarrier01/main.c, psxchroot01/main.c, psxfatal_support/init.c, + psxfile01/main.c, psxfile01/test.c, psxmount/main.c, psxrdwrv/main.c, + psxreaddir/main.c, psxrwlock01/main.c, psxspin01/main.c, + psxstat/main.c, psxtime/main.c: Change TEST_INIT to CONFIGURE_INIT. + Make tmacros.h available to all POSIX tests. Add a clock_settime case + for < 1988. + +2008-01-31 Joel Sherrill <joel.sherrill@OARcorp.com> + * Makefile.am, configure.ac: New tests. * psxfatal01/.cvsignore, psxfatal01/Makefile.am, psxfatal01/psxfatal01.scn, psxfatal01/testcase.h, diff --git a/testsuites/psxtests/include/pmacros.h b/testsuites/psxtests/include/pmacros.h index 34e84fe75e..b0364e6627 100644 --- a/testsuites/psxtests/include/pmacros.h +++ b/testsuites/psxtests/include/pmacros.h @@ -15,6 +15,7 @@ #include <time.h> #include <unistd.h> +#include <tmacros.h> #include <buffer_test_io.h> /* @@ -42,8 +43,8 @@ #define TM_NOVEMBER 12 #define TM_DECEMBER 12 -#ifndef build_time -#define build_time( TM, WEEKDAY, MON, DAY, YR, HR, MIN, SEC ) \ +#ifndef tm_build_time +#define tm_build_time( TM, WEEKDAY, MON, DAY, YR, HR, MIN, SEC ) \ { (TM)->tm_year = YR; \ (TM)->tm_mon = MON; \ (TM)->tm_mday = DAY; \ @@ -59,7 +60,7 @@ struct timespec tv; \ int status; \ \ - build_time( &tm, WEEKDAY, MON, DAY, YR, HR, MIN, SEC ); \ + tm_build_time( &tm, WEEKDAY, MON, DAY, YR, HR, MIN, SEC ); \ \ tv.tv_sec = mktime( &tm ); \ tv.tv_nsec = 0; \ diff --git a/testsuites/psxtests/psx01/init.c b/testsuites/psxtests/psx01/init.c index acd1986100..61796ae035 100644 --- a/testsuites/psxtests/psx01/init.c +++ b/testsuites/psxtests/psx01/init.c @@ -32,17 +32,17 @@ void *POSIX_Init( puts( "\n\n*** POSIX TEST 1 ***" ); - build_time( &tm, TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 ); + 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)" ); status = uname( NULL ); - assert( status == -1 ); - assert( errno == EFAULT ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EFAULT ); status = uname( &uts ); - assert( !status ); + rtems_test_assert( !status ); printf( "Init: uts.sysname: %s\n", uts.sysname ); printf( "Init: uts.nodename: %s\n", uts.nodename ); printf( "Init: uts.release: %s\n", uts.release ); @@ -54,40 +54,49 @@ void *POSIX_Init( puts( "Init: clock_gettime - EINVAL (NULL timespec)" ); status = clock_gettime( CLOCK_REALTIME, NULL ); - assert( status == -1 ); - assert( errno == EINVAL ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EINVAL ); puts( "Init: clock_gettime - EINVAL (invalid clockid)" ); status = clock_gettime( -1, &tv ); - assert( status == -1 ); - assert( errno == EINVAL ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EINVAL ); puts( "Init: clock_settime - EINVAL (invalid clockid)" ); status = clock_settime( -1, &tv ); - assert( status == -1 ); - assert( errno == EINVAL ); + 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( -1, &tv ); - assert( status == -1 ); - assert( errno == EINVAL ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EINVAL ); puts( "Init: clock_getres - EINVAL (NULL resolution)" ); status = clock_getres( CLOCK_REALTIME, NULL ); - assert( status == -1 ); - assert( errno == EINVAL ); + 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 ); - assert( !status ); + rtems_test_assert( !status ); /* set the time of day, and print our buffer in multiple ways */ tv.tv_sec = mktime( &tm ); - assert( tv.tv_sec != -1 ); + rtems_test_assert( tv.tv_sec != -1 ); tv.tv_nsec = 0; @@ -98,7 +107,7 @@ void *POSIX_Init( printf( asctime( &tm ) ); puts( "Init: clock_settime - SUCCESSFUL" ); status = clock_settime( CLOCK_REALTIME, &tv ); - assert( !status ); + rtems_test_assert( !status ); printf( asctime( &tm ) ); printf( ctime( &tv.tv_sec ) ); @@ -106,15 +115,15 @@ void *POSIX_Init( /* use sleep to delay */ remaining = sleep( 3 ); - assert( !remaining ); + 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 ); - assert( !status ); + rtems_test_assert( !status ); printf("Time since boot: (%d, %d)\n", tv.tv_sec,tv.tv_nsec ); status = clock_gettime( CLOCK_REALTIME, &tv ); - assert( !status ); + rtems_test_assert( !status ); printf( ctime( &tv.tv_sec ) ); @@ -124,35 +133,35 @@ void *POSIX_Init( /* just to have the value copied out through the parameter */ seconds = time( &seconds1 ); - assert( seconds == seconds1 ); + rtems_test_assert( seconds == seconds1 ); /* check the time remaining */ printf( "Init: seconds remaining (%d)\n", (int)remaining ); - assert( !remaining ); + rtems_test_assert( !remaining ); /* error cases in nanosleep */ empty_line(); puts( "Init: nanosleep - EINVAL (NULL time)" ); status = nanosleep ( NULL, &tr ); - assert( status == -1 ); - assert( errno == EINVAL ); + 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 ); - assert( status == -1 ); - assert( errno == EINVAL ); + 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 ); - assert( status == -1 ); - assert( errno == EINVAL ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EINVAL ); /* use nanosleep to yield */ @@ -161,9 +170,9 @@ void *POSIX_Init( puts( "Init: nanosleep - yield" ); status = nanosleep ( &tv, &tr ); - assert( !status ); - assert( !tr.tv_sec ); - assert( !tr.tv_nsec ); + rtems_test_assert( !status ); + rtems_test_assert( !tr.tv_sec ); + rtems_test_assert( !tr.tv_nsec ); /* use nanosleep to delay */ @@ -172,25 +181,25 @@ void *POSIX_Init( puts( "Init: nanosleep - 1.05 seconds" ); status = nanosleep ( &tv, &tr ); - assert( !status ); + rtems_test_assert( !status ); /* print the current real time again */ status = clock_gettime( CLOCK_REALTIME, &tv ); - assert( !status ); + 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 ); - assert( !tr.tv_sec && !tr.tv_nsec ); + rtems_test_assert( !tr.tv_sec && !tr.tv_nsec ); puts( "Init: usleep - 1.35 seconds" ); useconds = usleep ( 1350000 ); - assert( useconds < 1350000); + rtems_test_assert( useconds < 1350000); /* print the current real time again */ status = clock_gettime( CLOCK_REALTIME, &tv ); - assert( !status ); + rtems_test_assert( !status ); printf( ctime( &tv.tv_sec ) ); /* get id of this thread */ @@ -202,33 +211,33 @@ void *POSIX_Init( priority = sched_get_priority_min( SCHED_FIFO ); printf( "Init: sched_get_priority_min (SCHED_FIFO) -- %d\n", priority ); - assert( priority != -1 ); + rtems_test_assert( priority != -1 ); puts( "Init: sched_get_priority_min -- EINVAL (invalid policy)" ); priority = sched_get_priority_min( -1 ); - assert( priority == -1 ); - assert( errno == EINVAL ); + rtems_test_assert( priority == -1 ); + rtems_test_assert( errno == EINVAL ); /* exercise get maximum priority */ priority = sched_get_priority_max( SCHED_FIFO ); printf( "Init: sched_get_priority_max (SCHED_FIFO) -- %d\n", priority ); - assert( priority != -1 ); + rtems_test_assert( priority != -1 ); puts( "Init: sched_get_priority_max -- EINVAL (invalid policy)" ); priority = sched_get_priority_max( -1 ); - assert( priority == -1 ); - assert( errno == EINVAL ); + rtems_test_assert( priority == -1 ); + rtems_test_assert( errno == EINVAL ); puts( "Init: sched_rr_get_interval -- ESRCH (invalid PID)" ); status = sched_rr_get_interval( 4, &tr ); - assert( status == -1 ); - assert( errno == ESRCH ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == ESRCH ); puts( "Init: sched_rr_get_interval -- EINVAL (invalid interval pointer)" ); status = sched_rr_get_interval( getpid(), NULL ); - assert( status == -1 ); - assert( errno == EINVAL ); + rtems_test_assert( status == -1 ); + rtems_test_assert( errno == EINVAL ); /* print the round robin time quantum */ @@ -238,23 +247,23 @@ void *POSIX_Init( tr.tv_sec, tr.tv_nsec ); - assert( !status ); + rtems_test_assert( !status ); /* create a thread */ puts( "Init: pthread_create - SUCCESSFUL" ); status = pthread_create( &thread_id, NULL, Task_1_through_3, NULL ); - assert( !status ); + rtems_test_assert( !status ); /* too may threads error */ puts( "Init: pthread_create - EAGAIN (too many threads)" ); status = pthread_create( &thread_id, NULL, Task_1_through_3, NULL ); - assert( status == EAGAIN ); + rtems_test_assert( status == EAGAIN ); puts( "Init: sched_yield to Task_1" ); status = sched_yield(); - assert( !status ); + rtems_test_assert( !status ); /* switch to Task_1 */ diff --git a/testsuites/psxtests/psx01/system.h b/testsuites/psxtests/psx01/system.h index e1049a09aa..c1d74d1e23 100644 --- a/testsuites/psxtests/psx01/system.h +++ b/testsuites/psxtests/psx01/system.h @@ -41,12 +41,6 @@ void *Task_1_through_3( /* global variables */ -#ifdef CONFIGURE_INIT -#define TEST_EXTERN -#else -#define TEST_EXTERN extern -#endif - TEST_EXTERN pthread_t Init_id; TEST_EXTERN pthread_t Task_id; diff --git a/testsuites/psxtests/psx13/main.c b/testsuites/psxtests/psx13/main.c index 3b864ac7e7..4a75d89fbe 100644 --- a/testsuites/psxtests/psx13/main.c +++ b/testsuites/psxtests/psx13/main.c @@ -11,7 +11,7 @@ * $Id$ */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <pmacros.h> diff --git a/testsuites/psxtests/psxbarrier01/main.c b/testsuites/psxtests/psxbarrier01/main.c index 71274c9cf1..889786ffb4 100644 --- a/testsuites/psxtests/psxbarrier01/main.c +++ b/testsuites/psxtests/psxbarrier01/main.c @@ -11,7 +11,7 @@ * $Id$ */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <pmacros.h> diff --git a/testsuites/psxtests/psxchroot01/main.c b/testsuites/psxtests/psxchroot01/main.c index dcf449c85c..6bc652cee9 100644 --- a/testsuites/psxtests/psxchroot01/main.c +++ b/testsuites/psxtests/psxchroot01/main.c @@ -2,7 +2,7 @@ * Simple test program -- simplified version of sample test hello. */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <pmacros.h> diff --git a/testsuites/psxtests/psxfatal_support/init.c b/testsuites/psxtests/psxfatal_support/init.c index 20dcce306d..0ad753a1dc 100644 --- a/testsuites/psxtests/psxfatal_support/init.c +++ b/testsuites/psxtests/psxfatal_support/init.c @@ -21,7 +21,7 @@ * $Id$ */ -#define TEST_INIT +#define CONFIGURE_INIT #include "system.h" void *POSIX_Init( diff --git a/testsuites/psxtests/psxfile01/main.c b/testsuites/psxtests/psxfile01/main.c index 3b864ac7e7..4a75d89fbe 100644 --- a/testsuites/psxtests/psxfile01/main.c +++ b/testsuites/psxtests/psxfile01/main.c @@ -11,7 +11,7 @@ * $Id$ */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <pmacros.h> diff --git a/testsuites/psxtests/psxfile01/test.c b/testsuites/psxtests/psxfile01/test.c index fe14649218..6ab6366210 100644 --- a/testsuites/psxtests/psxfile01/test.c +++ b/testsuites/psxtests/psxfile01/test.c @@ -22,7 +22,7 @@ #include <stdio.h> -#include <tmacros.h> +#include <pmacros.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> diff --git a/testsuites/psxtests/psxmount/main.c b/testsuites/psxtests/psxmount/main.c index 24a4bb27cf..a176bb1c27 100644 --- a/testsuites/psxtests/psxmount/main.c +++ b/testsuites/psxtests/psxmount/main.c @@ -4,7 +4,7 @@ * Attempt to mount the IMFS file system on a mount point in the base IMFS */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <pmacros.h> diff --git a/testsuites/psxtests/psxrdwrv/main.c b/testsuites/psxtests/psxrdwrv/main.c index 3b864ac7e7..4a75d89fbe 100644 --- a/testsuites/psxtests/psxrdwrv/main.c +++ b/testsuites/psxtests/psxrdwrv/main.c @@ -11,7 +11,7 @@ * $Id$ */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <pmacros.h> diff --git a/testsuites/psxtests/psxreaddir/main.c b/testsuites/psxtests/psxreaddir/main.c index dcf449c85c..6bc652cee9 100644 --- a/testsuites/psxtests/psxreaddir/main.c +++ b/testsuites/psxtests/psxreaddir/main.c @@ -2,7 +2,7 @@ * Simple test program -- simplified version of sample test hello. */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <pmacros.h> diff --git a/testsuites/psxtests/psxrwlock01/main.c b/testsuites/psxtests/psxrwlock01/main.c index 77d6970f7e..22f8838266 100644 --- a/testsuites/psxtests/psxrwlock01/main.c +++ b/testsuites/psxtests/psxrwlock01/main.c @@ -11,7 +11,7 @@ * $Id$ */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <pmacros.h> diff --git a/testsuites/psxtests/psxspin01/main.c b/testsuites/psxtests/psxspin01/main.c index bcd208a1b8..cb5e89230d 100644 --- a/testsuites/psxtests/psxspin01/main.c +++ b/testsuites/psxtests/psxspin01/main.c @@ -11,7 +11,7 @@ * $Id$ */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <pmacros.h> diff --git a/testsuites/psxtests/psxstat/main.c b/testsuites/psxtests/psxstat/main.c index f4eb9e133e..ed5d5b60f6 100644 --- a/testsuites/psxtests/psxstat/main.c +++ b/testsuites/psxtests/psxstat/main.c @@ -11,7 +11,7 @@ * $Id$ */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <pmacros.h> diff --git a/testsuites/psxtests/psxtime/main.c b/testsuites/psxtests/psxtime/main.c index d747bdaca3..0d4d506894 100644 --- a/testsuites/psxtests/psxtime/main.c +++ b/testsuites/psxtests/psxtime/main.c @@ -11,7 +11,7 @@ * $Id$ */ -#define TEST_INIT +#define CONFIGURE_INIT #include <bsp.h> #include <tmacros.h> /* instantiate buffering code if needed */ |