Files
Sebastian Huber 827861d9c1 libtest: Sweep the time point when search stalls
T_interrupt_test() bisects a busy wait to place an interrupt inside the
action of a test.  It adjusts the bracket on an early and on a late
interrupt, but T_INTERRUPT_TEST_CONTINUE fell through both cases: the
bounds stayed as they were, the sample index did not advance, and the
next iteration used the very same busy count.  A test whose interrupt
reliably lands inside the action, yet which is not satisfied by that
particular time point, therefore repeated one time point until it ran
out of iterations.

A continue says the interrupt hit the action but reports nothing about
early or late, so there is no gradient to bisect on.  Count them, and
once the search has produced nothing else for a while, step the time
point through the bracket instead of using its middle.  A stepped time
point which leaves the action yields an early or a late result again,
which clears the counter and lets the bisection narrow the bracket
around the action.  A search which does make progress never reaches the
counter and keeps the behaviour it had.

The bracket is covered in a fixed number of steps rather than in steps
of one busy count.  This is not needed to make the search converge, it
keeps the sweep predictable: the step follows the width of the bracket,
a bracket narrower than the step count degrades to a step of one, and
there is no division by a width which may be zero.  The last point
needs the lower bound to stay below the upper bound.  The bisection did
not guarantee this, since a busy count taken from the bracket of all
samples is accounted to one sample only.  Pull the opposite bound along
in this case.

spintrcritical20 on the erc32 BSP hit exactly this.  It reported
T_INTERRUPT_TEST_TIMEOUT with 9997 of its 10000 iterations landing
inside the action and none of them satisfying the test.  It now
completes.  All twenty spintrcritical tests pass on erc32, leon2,
gr712rc, gr740 and gr740 in SMP configuration.

The simulator is deterministic, so repeating a test under it adds no
information.  A host simulation of the search over randomised action
windows, satisfied only after three distinct outcomes, completes in 200
of 200 runs with the sweep and in 1 of 200 without it.

Assisted-by: Claude:claude-opus-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
2026-08-13 17:55:06 -05:00
..
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00
2026-02-05 09:27:08 -06:00