diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-05-17 20:59:23 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-05-17 20:59:23 +0000 |
commit | 7a67dfbc62810a694e2f99a48e086c322bebe984 (patch) | |
tree | 16b45d86f9c039bc03f1e4abaaff2754178c01de /testsuites | |
parent | 2009-05-17 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-7a67dfbc62810a694e2f99a48e086c322bebe984.tar.bz2 |
2009-05-17 Joel Sherrill <joel.sherrill@OARcorp.com>
* psxsem01/Makefile.am, psxsem01/init.c, psxsem01/psxsem01.scn,
psxtimer01/psxtimer.c, psxtimer01/system.h, psxtimer02/psxtimer.c:
Improved so coverage is better.
Diffstat (limited to 'testsuites')
-rw-r--r-- | testsuites/psxtests/ChangeLog | 6 | ||||
-rw-r--r-- | testsuites/psxtests/psxsem01/Makefile.am | 3 | ||||
-rw-r--r-- | testsuites/psxtests/psxsem01/init.c | 28 | ||||
-rw-r--r-- | testsuites/psxtests/psxsem01/psxsem01.scn | 3 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer01/psxtimer.c | 22 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer01/system.h | 4 | ||||
-rw-r--r-- | testsuites/psxtests/psxtimer02/psxtimer.c | 7 |
7 files changed, 61 insertions, 12 deletions
diff --git a/testsuites/psxtests/ChangeLog b/testsuites/psxtests/ChangeLog index 615512e6b6..54ce74d8e3 100644 --- a/testsuites/psxtests/ChangeLog +++ b/testsuites/psxtests/ChangeLog @@ -1,3 +1,9 @@ +2009-05-17 Joel Sherrill <joel.sherrill@OARcorp.com> + + * psxsem01/Makefile.am, psxsem01/init.c, psxsem01/psxsem01.scn, + psxtimer01/psxtimer.c, psxtimer01/system.h, psxtimer02/psxtimer.c: + Improved so coverage is better. + 2009-05-17 Joel Sherrill <joel.sherrill@oarcorp.com> * psx04/init.c: Correct errors introduced by using different variable diff --git a/testsuites/psxtests/psxsem01/Makefile.am b/testsuites/psxtests/psxsem01/Makefile.am index 1bcebd2f81..7053eccf6c 100644 --- a/testsuites/psxtests/psxsem01/Makefile.am +++ b/testsuites/psxtests/psxsem01/Makefile.am @@ -5,7 +5,8 @@ MANAGERS = all rtems_tests_PROGRAMS = psxsem01 -psxsem01_SOURCES = init.c system.h ../include/pmacros.h +psxsem01_SOURCES = init.c system.h ../include/pmacros.h \ + ../../support/src/test_support.c dist_rtems_tests_DATA = psxsem01.scn diff --git a/testsuites/psxtests/psxsem01/init.c b/testsuites/psxtests/psxsem01/init.c index 9ae00403e4..61d3586fcc 100644 --- a/testsuites/psxtests/psxsem01/init.c +++ b/testsuites/psxtests/psxsem01/init.c @@ -4,6 +4,7 @@ #include <fcntl.h> #include <time.h> #include <tmacros.h> +#include "test_support.h" void *POSIX_Init( void *argument @@ -21,6 +22,11 @@ void *POSIX_Init( puts( "\n\n*** POSIX SEMAPHORE MANAGER TEST 1 ***" ); + puts( "Init: sem_init - UNSUCCESSFUL (EINVAL)" ); + status = sem_init(NULL, 0, 1); + fatal_posix_service_status( status, -1, "sem_init error return status"); + fatal_posix_service_status( errno, EINVAL, "sem_init errorno EINVAL" ); + puts( "Init: sem_init - SUCCESSFUL" ); for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) { status = sem_init(&sems[i], 0, i); @@ -112,7 +118,8 @@ void *POSIX_Init( puts( "Init: sem_timedwait - UNSUCCESSFUL (ETIMEDOUT)" ); status = sem_timedwait(&sems[2], &waittime); fatal_posix_service_status( status, -1, "sem_timedwait error return status"); - fatal_posix_service_status( errno, ETIMEDOUT, "sem_timedwait errno ETIMEDOUT"); + fatal_posix_service_status( + errno, ETIMEDOUT, "sem_timedwait errno ETIMEDOUT"); /* * To do this case, we must be blocking when we want the semaphore. @@ -148,18 +155,29 @@ void *POSIX_Init( * Validate all sem_open return paths. */ + puts( "Init: sem_open - UNSUCCESSFUL (ENAMETOOLONG)" ); + status = sem_open(Get_Too_Long_Name(), O_CREAT, 0777, 1 ); + fatal_posix_service_status( status, -1, "sem_open error return status"); + fatal_posix_service_status( + errno, ENAMETOOLONG, "sem_open errorno ENAMETOOLONG" ); + puts( "Init: sem_open - sem1 SUCCESSFUL" ); - n_sem1 = sem_open( "sem1", O_CREAT, 00777, 1 ); + n_sem1 = sem_open( "sem1",O_CREAT, 0777, 1 ); assert( n_sem1 != SEM_FAILED ); + puts( "Init: sem_destroy - named sem1 - EINVAL" ); + status = sem_destroy(n_sem1); + fatal_posix_service_status( status, -1, "sem_destroy named semaphore"); + fatal_posix_service_status( errno, EINVAL, "sem_destroy named semaphore"); + puts( "Init: sem_open - Create an Existing sem (EEXIST)" ); - n_sem2 = sem_open("sem1", O_CREAT | O_EXCL, 00777, 1); + n_sem2 = sem_open("sem1", O_CREAT | O_EXCL, 0777, 1); fatal_posix_service_status( (int) n_sem2, (int ) SEM_FAILED, "sem_open error return status" ); fatal_posix_service_status( errno, EEXIST, "sem_open errno EEXIST"); puts( "Init: sem_open - Open new sem without create flag (ENOENT)" ); - n_sem2 = sem_open("sem3", O_EXCL, 00777, 1); + n_sem2 = sem_open("sem3", O_EXCL, 0777, 1); fatal_posix_service_status( (int) n_sem2, (int ) SEM_FAILED, "sem_open error return status" ); fatal_posix_service_status( errno, ENOENT, "sem_open errno EEXIST"); @@ -198,7 +216,7 @@ void *POSIX_Init( fatal_posix_service_status( status, 0, "sem_unlink locked semaphore"); puts( "Init: sem_open - Reopen sem1 SUCCESSFUL with a different id" ); - n_sem2 = sem_open( "sem1", O_CREAT | O_EXCL, 00777, 1); + n_sem2 = sem_open( "sem1", O_CREAT | O_EXCL, 0777, 1); assert( n_sem2 != SEM_FAILED ); assert( n_sem2 != n_sem1 ); diff --git a/testsuites/psxtests/psxsem01/psxsem01.scn b/testsuites/psxtests/psxsem01/psxsem01.scn index a63fa15bbb..70e80baf75 100644 --- a/testsuites/psxtests/psxsem01/psxsem01.scn +++ b/testsuites/psxtests/psxsem01/psxsem01.scn @@ -1,4 +1,5 @@ *** POSIX SEMAPHORE MANAGER TEST 1 *** +Init: sem_init - UNSUCCESSFUL (EINVAL) Init: sem_init - SUCCESSFUL Init: sem_init - UNSUCCESSFUL (ENOSPC) Init: sem_init - UNSUCCESSFUL (ENOSYS -- pshared not supported) @@ -18,7 +19,9 @@ Init: sem_timedwait - UNSUCCESSFUL (ETIMEDOUT) Init: sem_timedwait - UNSUCCESSFUL (EINVAL) Init: sem_post - UNSUCCESSFUL (EINVAL) Init: sem_destroy - SUCCESSFUL +Init: sem_open - UNSUCCESSFUL (ENAMETOOLONG) Init: sem_open - sem1 SUCCESSFUL +Init: sem_destroy - named sem1 - EINVAL Init: sem_open - Create an Existing sem (EEXIST) Init: sem_open - Open new sem without create flag (ENOENT) Init: sem_wait on sem1 diff --git a/testsuites/psxtests/psxtimer01/psxtimer.c b/testsuites/psxtests/psxtimer01/psxtimer.c index a78c945ee9..3d1032a254 100644 --- a/testsuites/psxtests/psxtimer01/psxtimer.c +++ b/testsuites/psxtests/psxtimer01/psxtimer.c @@ -63,9 +63,11 @@ void StopTimer( struct itimerspec *timerdata ) { + struct itimerspec prev; + timerdata->it_value.tv_sec = 0; timerdata->it_value.tv_nsec = 0; - if (timer_settime(timer_id,POSIX_TIMER_RELATIVE,timerdata,NULL) == -1) { + if (timer_settime(timer_id,POSIX_TIMER_RELATIVE,timerdata,&prev) == -1) { perror ("Error in timer setting\n"); pthread_exit ((void *) -1); } @@ -307,11 +309,11 @@ void *POSIX_Init ( pthread_mutexattr_t mutexattr; /* mutex attributes */ pthread_condattr_t condattr; /* condition attributes */ pthread_attr_t attr; /* task attributes */ - pthread_t ta,tb,tc; /* threads */ + pthread_t ta,tb,tc, tc1; /* threads */ sigset_t set; /* signals */ struct sched_param sch_param; /* schedule parameters */ - struct periodic_params params_a, params_b, params_c; + struct periodic_params params_a, params_b, params_c, params_c1; puts( "\n\n*** POSIX Timers Test 01 ***" ); @@ -412,9 +414,21 @@ void *POSIX_Init ( perror ("Error in thread create for task c\n"); } - /* execute 25 seconds and finish */ sleep (25); + + puts( "starting C again with 0.5 second periodicity" ); + /* Temporal parameters (0.5 sec. periodicity) */ + params_c1.period.tv_sec = 0; /* seconds */ + params_c1.period.tv_nsec = 500000000; /* nanoseconds */ + params_c1.count = 6; + params_c1.signo = SIGALRM; + if (pthread_create (&tc1, &attr, task_c, ¶ms_c1) != 0) { + perror ("Error in thread create for task c1\n"); + } + + sleep(5); + puts( "*** END OF POSIX Timers Test 01 ***" ); rtems_test_exit (0); } diff --git a/testsuites/psxtests/psxtimer01/system.h b/testsuites/psxtests/psxtimer01/system.h index 2fab0862ee..bd377b9cd7 100644 --- a/testsuites/psxtests/psxtimer01/system.h +++ b/testsuites/psxtests/psxtimer01/system.h @@ -41,8 +41,8 @@ void *task_c( #define CONFIGURE_POSIX_INIT_THREAD_TABLE -#define CONFIGURE_MAXIMUM_POSIX_THREADS 4 -#define CONFIGURE_MAXIMUM_POSIX_TIMERS 4 +#define CONFIGURE_MAXIMUM_POSIX_THREADS 5 +#define CONFIGURE_MAXIMUM_POSIX_TIMERS 5 #define CONFIGURE_MAXIMUM_TIMERS 4 #define CONFIGURE_MAXIMUM_POSIX_MUTEXES 2 #define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES 2 diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c b/testsuites/psxtests/psxtimer02/psxtimer.c index b660a412c7..12e9dbba17 100644 --- a/testsuites/psxtests/psxtimer02/psxtimer.c +++ b/testsuites/psxtests/psxtimer02/psxtimer.c @@ -103,6 +103,13 @@ void *POSIX_Init ( status = timer_settime( timer, TIMER_ABSTIME, &itimer, NULL ); fatal_posix_service_status_errno( status, EINVAL, "bad itimer value #3" ); + clock_gettime( CLOCK_REALTIME, &now ); + itimer.it_value = now; + itimer.it_value.tv_sec = itimer.it_value.tv_sec + 1; + puts( "timer_settime - bad id - EINVAL" ); + status = timer_settime( timer1, TIMER_ABSTIME, &itimer, NULL ); + fatal_posix_service_status_errno( status, EINVAL, "bad id" ); + itimer.it_value.tv_nsec = 0; puts( "timer_settime - bad clock value - EINVAL" ); status = timer_settime( timer, 0x80, &itimer, NULL ); |