tests/posix_semaphore: unify and increase allowed test4 margin

Previously, there was a very tight allowed margin (100us), then some
special cases for platforms for which the test would otherwise fail,
increasing the margin.
This turned out to be a maintanance burden, as each slightly special
board needed a PR adding the special case.

This commit sets a quite large margin (1000us, 0.1% of total delay),
which should be large enough to not trip over platform-induced timer
inaccuracies, but still verify that the module is using timers
correctly.

(This is not a timer accuracy test.)
This commit is contained in:
Kaspar Schleiser 2019-04-30 11:41:01 +02:00
parent 5eaf45c2cb
commit a9cd9433f0

View File

@ -236,16 +236,16 @@ void test3(void)
sem_post(&s1); sem_post(&s1);
} }
#ifdef BOARD_NATIVE /*
/* native can sometime take more time to respond as it is not real time */ * Allowed margin for waiting too long.
#define TEST4_TIMEOUT_EXCEEDED_MARGIN (300) *
#elif CPU_FAM_NRF51 * Waiting too short is forbidden by POSIX, but is checked elsewhere.
/* nrf51 based boards needs a slightly higher margin value. Using 105us makes *
test4 result more reliable. */ * This allows waiting a little (0.1%) longer than exactly 1000000us.
#define TEST4_TIMEOUT_EXCEEDED_MARGIN (105) * The value should be large enough to not trip over timer inaccuracies, but
#else * small enough to catch any fundamental problems.
#define TEST4_TIMEOUT_EXCEEDED_MARGIN (100) */
#endif /* BOARD_NATIVE */ #define TEST4_TIMEOUT_EXCEEDED_MARGIN (1000)
void test4(void) void test4(void)
{ {