diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-07 08:24:54 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-09-07 19:58:14 +0200 |
commit | 8f7305757d7562abdfeeebdc3c2c8671f56e9855 (patch) | |
tree | 9a6c8f0380fc801a96891d4300a98f5b06c2fa0b | |
parent | spec: Improve TLS specification (diff) | |
download | rtems-central-8f7305757d7562abdfeeebdc3c2c8671f56e9855.tar.bz2 |
spec: Improve timer order test
-rw-r--r-- | spec/rtems/timer/val/timer.yml | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/spec/rtems/timer/val/timer.yml b/spec/rtems/timer/val/timer.yml index 6dad9953..015c771d 100644 --- a/spec/rtems/timer/val/timer.yml +++ b/spec/rtems/timer/val/timer.yml @@ -10,6 +10,8 @@ test-actions: rtems_status_code sc; size_t i; + T_assert_eq_sz( TEST_MAXIMUM_TIMERS, 10 ); + _Atomic_Init_uint( &ctx->counter, 0 ); for ( i = 0; i < TEST_MAXIMUM_TIMERS ; ++i ) { @@ -21,18 +23,18 @@ test-actions: } checks: - brief: | - Schedule the timers at the same time point. + Schedule some timers at the same time point. code: | - for ( i = 0; i < TEST_MAXIMUM_TIMERS ; ++i ) { - ctx->counter_snapshots[ i ] = 0; - sc = rtems_timer_fire_after( - ctx->timer_ids[ i ], - 1, - Timer, - &ctx->counter_snapshots[ i ] - ); - T_rsc_success( sc ); - } + Fire( ctx, 3, 2 ); + Fire( ctx, 0, 1 ); + Fire( ctx, 7, 3 ); + Fire( ctx, 4, 2 ); + Fire( ctx, 5, 2 ); + Fire( ctx, 8, 3 ); + Fire( ctx, 9, 3 ); + Fire( ctx, 1, 1 ); + Fire( ctx, 2, 1 ); + Fire( ctx, 6, 2 ); links: [] - brief: | Fire the timers and check that they fired in the expected order. @@ -99,6 +101,20 @@ test-support: | ATOMIC_ORDER_RELAXED ) + 1; } + + static void Fire( Context *ctx, size_t i, rtems_interval ticks ) + { + rtems_status_code sc; + + ctx->counter_snapshots[ i ] = 0; + sc = rtems_timer_fire_after( + ctx->timer_ids[ i ], + ticks, + Timer, + &ctx->counter_snapshots[ i ] + ); + T_rsc_success( sc ); + } test-target: testsuites/validation/tc-timer.c test-teardown: null type: test-case |