testsuites/sptests: Bound the timecounter error

The job runs for a number of clock ticks, so the measured duration is
quantised to the tick period.  The test required the difference from the
nominal one second to stay below a millisecond, which can only hold
where the clock tick is shorter than that.  With the default tick of ten
milliseconds it passes by luck.

It failed on the mips simulator.  Allow one clock tick and a millisecond
for the granularity of the loop which observes the stop condition.

Update #5710.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
Sebastian Huber authored and Joel Sherrill committed 2026-08-20 17:40:16 -05:00
1 parent 262b9756c7
commit 4db6143bd2
1 file changed
+10 -1
+10 -1
View File
@@ -183,9 +183,18 @@ static void test_bintime_fini(
for ( i = 0; i < active_workers; ++i ) {
sbintime_t error;
sbintime_t limit;
/*
* The job runs for a number of clock ticks, so the measured duration is
* quantised to the tick period. A limit of one millisecond only holds
* where the tick is shorter than that. Allow one tick and a millisecond
* for the granularity of the loop which observes the stop condition.
*/
limit = SBT_1S / (sbintime_t) rtems_clock_get_ticks_per_second() + SBT_1MS;
error = DURATION_IN_SECONDS * SBT_1S - ctx->duration_per_job[ i ];
rtems_test_assert( error * error < SBT_1MS * SBT_1MS );
rtems_test_assert( error * error < limit * limit );
}
test_print_results( "Clock Driver", ctx, active_workers );