From 732bcc7335bcd6e800ba88753d4be048027d9cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Harter?= Date: Wed, 20 Mar 2019 15:14:54 +0100 Subject: [PATCH] tests/posix_semaphore: sem_timedwait should not return before abstime Update the test as sem_timedwait is not supposed to return before the given abstime. Source: http://pubs.opengroup.org/onlinepubs/9699919799.2016edition/functions/sem_timedwait.html The timeout shall expire when the absolute time specified by abstime passes, as measured by the clock on which timeouts are based (that is, when the value of that clock equals or exceeds abstime), or if the absolute time specified by abstime has already been passed at the time of the call. --- tests/posix_semaphore/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/posix_semaphore/main.c b/tests/posix_semaphore/main.c index c47952fef5..764aeb6849 100644 --- a/tests/posix_semaphore/main.c +++ b/tests/posix_semaphore/main.c @@ -279,7 +279,7 @@ void test4(void) } uint64_str[fmt_u64_dec(uint64_str, elapsed)] = '\0'; - if (elapsed < (exp - 100)) { + if (elapsed < exp) { printf("first: waited only %s usec => FAILED\n", uint64_str); } else if (elapsed > (exp + TEST4_TIMEOUT_EXCEEDED_MARGIN)) {