summaryrefslogtreecommitdiffstats
path: root/spec/rtems/clock/req/set.yml
diff options
context:
space:
mode:
authorFrank Kühndel <frank.kuehndel@embedded-brains.de>2021-07-23 10:47:35 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-23 16:16:09 +0200
commitfc3586fe37824e51d47840bb97df827916ddd4d3 (patch)
tree74b8766b52f4ed20dfa15353813854cb291ff218 /spec/rtems/clock/req/set.yml
parentspec: Remove always enabled interrupt attribute (diff)
downloadrtems-central-fc3586fe37824e51d47840bb97df827916ddd4d3.tar.bz2
spec: Fix unstable test of clock manager
The tests of specification get-tod.yml and set.yml were expecting that no more than five ticks pass between consecutive calls to rtems_clock_set() and rtems_clock_get_tod(). Yet, in coverage tests this limit was exceeded. * All tests are placed in a test suite without clock driver so that all ticks must be triggered by the test suite. * The grace period of five ticks has been removed. * Test which require that the realtime clock has not been set manipulate RTEMS internal data with `_TOD.is_set = false`. The old function get_tod_before_set_tod() has been removed in favor of this new solution.
Diffstat (limited to 'spec/rtems/clock/req/set.yml')
-rw-r--r--spec/rtems/clock/req/set.yml31
1 files changed, 7 insertions, 24 deletions
diff --git a/spec/rtems/clock/req/set.yml b/spec/rtems/clock/req/set.yml
index 216b435e..d99550b3 100644
--- a/spec/rtems/clock/req/set.yml
+++ b/spec/rtems/clock/req/set.yml
@@ -41,9 +41,9 @@ post-conditions:
T_eq_u32( ctx->tod_after.hour, ctx->target_tod_value.hour );
T_eq_u32( ctx->tod_after.minute, ctx->target_tod_value.minute );
T_eq_u32( ctx->tod_after.second, ctx->target_tod_value.second );
- T_ge_u32( ctx->tod_after.ticks, ctx->target_tod_value.ticks );
- T_lt_u32( ctx->tod_after.ticks,
- ctx->target_tod_value.ticks + ctx->grace_ticks );
+ /* rtems_clock_set() or rtems_clock_get_tod() cause an error of 1 tick */
+ T_ge_u32( ctx->tod_after.ticks + 1, ctx->target_tod_value.ticks );
+ T_le_u32( ctx->tod_after.ticks, ctx->target_tod_value.ticks );
text: |
The ${/glossary/clock-realtime:/term} shall be set
to the values of the object referenced by the
@@ -58,9 +58,7 @@ post-conditions:
T_eq_u32( ctx->tod_after.hour, ctx->tod_before.hour );
T_eq_u32( ctx->tod_after.minute, ctx->tod_before.minute );
T_eq_u32( ctx->tod_after.second, ctx->tod_before.second );
- T_ge_u32( ctx->tod_after.ticks, ctx->tod_before.ticks );
- T_lt_u32( ctx->tod_after.ticks,
- ctx->tod_before.ticks + 2 * ctx->grace_ticks );
+ T_eq_u32( ctx->tod_after.ticks, ctx->tod_before.ticks );
text: |
The state of the ${/glossary/clock-realtime:/term} shall not be changed
by the ${../if/set:/name} call.
@@ -76,8 +74,7 @@ post-conditions:
T_eq_u32( ctx->timer_routine_tod.day, 1 );
T_eq_u32( ctx->timer_routine_tod.minute, 0 );
T_eq_u32( ctx->timer_routine_tod.second, 0 );
- T_ge_u32( ctx->timer_routine_tod.ticks, 0 );
- T_lt_u32( ctx->timer_routine_tod.ticks, 0 + ctx->grace_ticks );
+ T_eq_u32( ctx->timer_routine_tod.ticks, 0 );
text: |
The timer routine shall be executed once after the
${/glossary/clock-realtime:/term} has been set and before
@@ -141,7 +138,7 @@ pre-conditions:
test-code: |
ctx->target_tod_value =
(rtems_time_of_day) { 2105, 12, 31, 23, 59, 59,
- rtems_clock_get_ticks_per_second() - ctx->grace_ticks };
+ rtems_clock_get_ticks_per_second() - 1 };
text: |
While the ${../if/set:/params[0]/name} parameter references the
oldest date and time accepted (2105-12-31T23:59:59.999999999Z).
@@ -312,16 +309,12 @@ test-context:
- brief: null
description: null
member: rtems_time_of_day timer_routine_tod
-- brief: Grace period in tick which may be passed between set and get ToD.
- description: null
- member: uint32_t grace_ticks
test-context-support: null
test-description: null
test-header: null
test-includes:
- rtems.h
-test-local-includes:
-- tc-clock-get-tod.h
+test-local-includes: []
test-prepare: |
rtems_status_code status;
@@ -336,10 +329,6 @@ test-setup:
rtems_name timer_name = rtems_build_name( 'T', 'M', 'R', '0' );
ctx->timer_id = RTEMS_ID_NONE;
- /* Call rtems_clock_get_tod() once before rtems_clock_set() gets called */
- get_tod_before_set_tod( NULL );
-
- ctx->grace_ticks = rtems_clock_get_ticks_per_second() * GRACE_PERIOD / 1000;
ctx->target_tod = &ctx->target_tod_value;
status = rtems_timer_create( timer_name, &ctx->timer_id );
@@ -347,12 +336,6 @@ test-setup:
description: null
test-stop: null
test-support: |
- /*
- * How much time may pass between a call to rtems_clock_set() and
- * a follow up call to rtems_clock_get_tod() in millisecond?
- */
- #define GRACE_PERIOD 5
-
static rtems_timer_service_routine _TOD_timer_routine(
rtems_id timer_id,
void *user_data