summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests
diff options
context:
space:
mode:
authorJoel Sherrill <joel@rtems.org>2022-08-10 17:17:24 -0500
committerJoel Sherrill <joel@rtems.org>2022-08-11 13:10:11 -0500
commit996d18c2125aa5fd8ad05db44fdbe7e867841731 (patch)
treec3e2d473a1c99f086fd4cb4536ba6a0ced98a9f9 /testsuites/psxtests
parentbuild/cpukit: Add confdefs/face.h to install rule (diff)
downloadrtems-996d18c2125aa5fd8ad05db44fdbe7e867841731.tar.bz2
psxtimer_face01: Improve coverage and documentation
Updates #4691.
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r--testsuites/psxtests/psxtimer_face01/psxtimer.c36
-rw-r--r--testsuites/psxtests/psxtimer_face01/psxtimer_face01.doc12
-rw-r--r--testsuites/psxtests/psxtimer_face01/psxtimer_face01.scn10
3 files changed, 52 insertions, 6 deletions
diff --git a/testsuites/psxtests/psxtimer_face01/psxtimer.c b/testsuites/psxtests/psxtimer_face01/psxtimer.c
index 5c9dcec57b..155afc5ce0 100644
--- a/testsuites/psxtests/psxtimer_face01/psxtimer.c
+++ b/testsuites/psxtests/psxtimer_face01/psxtimer.c
@@ -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);
}
diff --git a/testsuites/psxtests/psxtimer_face01/psxtimer_face01.doc b/testsuites/psxtests/psxtimer_face01/psxtimer_face01.doc
index 823853134a..e975419539 100644
--- a/testsuites/psxtests/psxtimer_face01/psxtimer_face01.doc
+++ b/testsuites/psxtests/psxtimer_face01/psxtimer_face01.doc
@@ -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.
+
diff --git a/testsuites/psxtests/psxtimer_face01/psxtimer_face01.scn b/testsuites/psxtests/psxtimer_face01/psxtimer_face01.scn
index 4dab7981cd..b83b41f281 100644
--- a/testsuites/psxtests/psxtimer_face01/psxtimer_face01.scn
+++ b/testsuites/psxtests/psxtimer_face01/psxtimer_face01.scn
@@ -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 ***