From 7a67dfbc62810a694e2f99a48e086c322bebe984 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Sun, 17 May 2009 20:59:23 +0000 Subject: 2009-05-17 Joel Sherrill * psxsem01/Makefile.am, psxsem01/init.c, psxsem01/psxsem01.scn, psxtimer01/psxtimer.c, psxtimer01/system.h, psxtimer02/psxtimer.c: Improved so coverage is better. --- testsuites/psxtests/psxtimer01/psxtimer.c | 22 ++++++++++++++++++---- testsuites/psxtests/psxtimer01/system.h | 4 ++-- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'testsuites/psxtests/psxtimer01') 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 -- cgit v1.2.3