summaryrefslogtreecommitdiffstats
path: root/testsuites/psxtests
diff options
context:
space:
mode:
authorZacchaeus Leung <zakthertemsdev@outlook.com>2021-08-06 11:20:41 -0400
committerJoel Sherrill <joel@rtems.org>2021-08-11 11:47:11 -0500
commit8df57649b09f31a58660d9b3c2478195f15f40ce (patch)
tree47324ca58457f783319e9e8d96a7165f91407262 /testsuites/psxtests
parentbsps: Move optfdt* files to shared parent directory (diff)
downloadrtems-8df57649b09f31a58660d9b3c2478195f15f40ce.tar.bz2
Test needed for timer_create with CLOCK_MONOTONC
the timer_create() method can use CLOCK_MONOTONIC but there was no test for this. Also it implements the functionality to create a CLOCK_MONOTONIC timer and gettime() . Closes #3888
Diffstat (limited to 'testsuites/psxtests')
-rw-r--r--testsuites/psxtests/psxtimer02/psxtimer.c26
-rw-r--r--testsuites/psxtests/psxtimer02/psxtimer02.scn5
2 files changed, 31 insertions, 0 deletions
diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c b/testsuites/psxtests/psxtimer02/psxtimer.c
index 9f79d33c42..874a789b7f 100644
--- a/testsuites/psxtests/psxtimer02/psxtimer.c
+++ b/testsuites/psxtests/psxtimer02/psxtimer.c
@@ -127,6 +127,32 @@ void *POSIX_Init (
status = timer_delete( timer );
fatal_posix_service_status_errno( status, EINVAL, "bad id" );
+ puts( "timer_create (monotonic) - bad timer id pointer - EINVAL" );
+ status = timer_create( CLOCK_MONOTONIC, &event, NULL );
+ fatal_posix_service_status_errno( status, EINVAL, "bad timer id" );
+
+ puts( "timer_create (monotonic) - OK" );
+ status = timer_create( CLOCK_MONOTONIC, NULL, &timer );
+ posix_service_failed( status, "timer_create OK" );
+
+ puts( "timer_create (monotonic) - too many - EAGAIN" );
+ status = timer_create( CLOCK_MONOTONIC, NULL, &timer1 );
+ fatal_posix_service_status_errno( status, EAGAIN, "too many" );
+
+ clock_gettime( CLOCK_MONOTONIC, &now );
+ itimer.it_value = now;
+ itimer.it_value.tv_sec = itimer.it_value.tv_sec - 1;
+ puts( "timer_settime (monotonic) - bad itimer value - previous time - EINVAL" );
+ status = timer_settime( timer, TIMER_ABSTIME, &itimer, NULL );
+ fatal_posix_service_status_errno( status, EINVAL, "bad itimer value #3" );
+
+ clock_gettime( CLOCK_MONOTONIC, &now );
+ itimer.it_value = now;
+ itimer.it_value.tv_sec = itimer.it_value.tv_sec + 1;
+ puts( "timer_settime (monotonic) - bad id - EINVAL" );
+ status = timer_settime( timer1, TIMER_ABSTIME, &itimer, NULL );
+ fatal_posix_service_status_errno( status, EINVAL, "bad id" );
+
TEST_END();
rtems_test_exit (0);
}
diff --git a/testsuites/psxtests/psxtimer02/psxtimer02.scn b/testsuites/psxtests/psxtimer02/psxtimer02.scn
index e78425a32e..71638aa413 100644
--- a/testsuites/psxtests/psxtimer02/psxtimer02.scn
+++ b/testsuites/psxtests/psxtimer02/psxtimer02.scn
@@ -13,4 +13,9 @@ timer_settime - bad itimer value - negative nanosecond - EINVAL
timer_settime - bad clock value - EINVAL
timer_delete - OK
timer_delete - bad id - EINVAL
+timer_create (monotonic) - bad timer id pointer - EINVAL
+timer_create (monotonic) - OK
+timer_create (monotonic) - too many - EAGAIN
+timer_settime (monotonic) - bad itimer value - previous time - EINVAL
+timer_settime (monotonic) - bad id - EINVAL
*** END OF POSIX Timers Test 02 ***