Skip to content

Commit afe9881

Browse files
committed
timeout_tests: do not call sleep from test thread
This is up to scheduler to call sleep when threads are inactive. So the thread should simply wait for the semaphore for ever (or test timeout).
1 parent 9cc1caa commit afe9881

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

TESTS/mbed_drivers/timeout/timeout_tests.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,7 @@ void test_sleep(void)
264264

265265
bool deep_sleep_allowed = sleep_manager_can_deep_sleep_test_check();
266266
TEST_ASSERT_FALSE_MESSAGE(deep_sleep_allowed, "Deep sleep should be disallowed");
267-
while (!sem.try_acquire()) {
268-
sleep();
269-
}
267+
sem.wait();
270268
timer.stop();
271269

272270
sleep_manager_unlock_deep_sleep();
@@ -323,9 +321,7 @@ void test_deepsleep(void)
323321

324322
bool deep_sleep_allowed = sleep_manager_can_deep_sleep_test_check();
325323
TEST_ASSERT_TRUE_MESSAGE(deep_sleep_allowed, "Deep sleep should be allowed");
326-
while (!sem.try_acquire()) {
327-
sleep();
328-
}
324+
sem.wait();
329325
timer.stop();
330326

331327
TEST_ASSERT_UINT64_WITHIN(delta_us, delay_us, timer.read_high_resolution_us());

0 commit comments

Comments
 (0)