psxtimer_face01: Improve coverage and documentation

Updates #4691.
This commit is contained in:
Joel Sherrill
2022-08-10 17:17:24 -05:00
parent c655c72d05
commit 996d18c212
3 changed files with 52 additions and 6 deletions

View File

@@ -54,17 +54,51 @@ static void *POSIX_Init (
timer_t timer;
/*
* If these are not filled in correctly, we don't pass its error checking.
* If these are not filled in correctly, we do not execute pass the
* error checking for a NULL event pointer.
*/
event.sigev_notify = SIGEV_SIGNAL;
event.sigev_signo = SIGUSR1;
TEST_BEGIN();
/*
* When FACE timer behavior is configured, creating a POSIX timer
* using CLOCK_REALTIME is not allowed.
*/
puts( "timer_create - CLOCK_REALTIME forbidden - EPERM" );
status = timer_create( CLOCK_REALTIME, &event, &timer );
fatal_posix_service_status_errno( status, EPERM, "not allowed" );
/*
* When FACE timer behavior is configured, creating a POSIX timer
* on a value other than CLOCK_REALTIME or CLOCK_MONOTONIC is not allowed.
*/
puts( "timer_create - CLOCK_PROCESS_CPUTIME_ID not allowed - EINVAL" );
status = timer_create( CLOCK_PROCESS_CPUTIME_ID, &event, &timer );
fatal_posix_service_status_errno( status, EINVAL, "invalid clock" );
/*
* When FACE timer behavior is configured, creating a POSIX timer
* on CLOCK_MONOTONIC allowed.
*/
puts( "timer_create - OK" );
status = timer_create( CLOCK_MONOTONIC, &event, &timer );
posix_service_failed( status, "timer_create OK" );
/*
* Delete the previously created timer.
*/
puts( "timer_delete - OK" );
status = timer_delete( timer );
posix_service_failed( status, "timer_delete ok" );
/*
*/
puts( "timer_create - CLOCK_MONOTONIC is allowed - OK" );
status = timer_create( CLOCK_MONOTONIC, &event, &timer );
posix_service_failed( status, "timer_create ok" );
TEST_END();
rtems_test_exit (0);
}

View File

@@ -36,4 +36,14 @@ directives:
concepts:
+ This test exercises the CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR configure
option which alters the behavior of timer_create().
option which alters the behavior of timer_create().
- With CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR defined, timer_create()
returns EPERM to indicate this is not allowed.
- With CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR defined, timer_create()
for CLOCK_MONOTONIC is allowed.
- With CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR defined, timer_create()
for any other clock value is an error.

View File

@@ -1,4 +1,6 @@
*** BEGIN OF TEST PSXTIMER 2 ***
*** TEST VERSION: 6.0.0.1c6ac88f938f4b135f3bbffc4b19bbc540508c80
*** END OF TEST PSXTIMER 2 ***
*** BEGIN OF TEST FACE 1 ***
timer_create - CLOCK_REALTIME forbidden - EPERM
timer_create - CLOCK_PROCESS_CPUTIME_ID not allowed - EINVAL
timer_create - OK
timer_delete - OK
*** END OF TEST PSXTIMER FACE 1 ***