1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/tests/periph_timer_short_relative_set
Marian Buschsieweke 05bb4bb4fd
tests/periph_timer_short_relative_set: improve test
Reduce the number lines to output by only testing for intervals 0..15
to speed up the test.

In addition, run each test case 128 repetitions (it is still faster
than before) to give some confidence the short relative set actually
succeeded.
2022-12-09 22:10:18 +01:00
..
tests
app.config.test tests: add common Kconfig configuration for sync 2021-01-20 17:36:14 +01:00
main.c tests/periph_timer_short_relative_set: improve test 2022-12-09 22:10:18 +01:00
Makefile tests/periph_timer_short_relative_set: fix diff calculation for non 32 bit timers 2019-12-02 11:28:26 +01:00
README.md tests/periph_timer_short_relative_set: clarify outcome 2022-08-25 10:30:22 +02:00

Periph Timer Test for short timer_set() values

About

This test exposes if timer_set() with very low values (down to zero) underflows. For each value from 100 to 0, it'll try to set a timer with that length. In human terms, that should trigger instantly (It depends on TEST_TIMER_FREQ. The default configuration is 1MHz. Some boards configure 32768kHz, which is the slowest configuration currently. So each line should trigger after at most 31us.).

See this example of a timer_set() implementation:

int timer_set(tim_t dev, int channel, unsigned int timeout)
{
    return timer_set_absolute(dev, channel, timer_read(dev) + timeout);
}

This will probably underflow if "timeout" is 0, or if an ISR interrupts somewhere between the read and the timerSet_absolute() call. Depending on the used frequency of the underlying timer and the time it requires for the involved function calls, reading the timer register, doing the addition and writing back to the register, this will also fail for higher timeouts.

For example, as of this writing (30-Oct-19), samr21-xpro fails for values below 8, nrf52dk for values below 2.

Note: THIS IS EXPECTED TO FAIL ON MOST BOARDS.

Expected Result

After 100 "interval N ok" messages the test should print "TEST SUCCEEDED". On failure, the test will print "TEST FAILED".