From 8f7305757d7562abdfeeebdc3c2c8671f56e9855 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 7 Sep 2021 08:24:54 +0200 Subject: spec: Improve timer order test --- spec/rtems/timer/val/timer.yml | 38 +++++++++++++++++++++++++++----------- 1 file 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 -- cgit v1.2.3