From aba5ca72cd54e22276c85b79951d139af96318e9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Stekiel Date: Fri, 31 May 2019 10:33:29 +0200 Subject: [PATCH] tests-mbed_drivers-lp_timeout: Rework "Zero delay" test case Execute test case 100 times in loop since one run is not enough to catch possible failure. --- TESTS/mbed_drivers/timeout/timeout_tests.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/TESTS/mbed_drivers/timeout/timeout_tests.h b/TESTS/mbed_drivers/timeout/timeout_tests.h index 89ab92b4ce..fd71cb6a1b 100644 --- a/TESTS/mbed_drivers/timeout/timeout_tests.h +++ b/TESTS/mbed_drivers/timeout/timeout_tests.h @@ -196,13 +196,14 @@ void test_multiple(void) template void test_no_wait(void) { - Semaphore sem(0, 1); - T timeout; - timeout.attach_callback(mbed::callback(sem_callback, &sem), 0ULL); - - bool acquired = sem.try_acquire(); - TEST_ASSERT_TRUE(acquired); - timeout.detach(); + for (int i = 0; i < 100; i++) { + Semaphore sem(0, 1); + T timeout; + timeout.attach_callback(mbed::callback(sem_callback, &sem), 0ULL); + int32_t sem_slots = sem.wait(0); + TEST_ASSERT_EQUAL(1, sem_slots); + timeout.detach(); + } } /** Template for tests: accuracy of timeout delay