Skip to content

Commit 8476be6

Browse files
committed
Update test_lock_unlock_test_check() assertion to cope with new timings
With the DEEP_SLEEP_TEST_CHECK_WAIT_DELTA_US increased, we now have TEST_ASSERT_UINT64_WITHIN(delta=1000, expected=1000, actual=1000) so this assertion needed to be updated. What we need is the deep sleep to be enabled after the programed interrupt has fired and before a 2ms timeout expiration, which means >= 1000 and < 2000.
1 parent d6c3d79 commit 8476be6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

TESTS/mbed_hal/sleep_manager/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,16 +281,16 @@ void test_lock_unlock_test_check()
281281
// * sleep_manager_can_deep_sleep_test_check() returns true with a 1 ms delay,
282282
// * sleep_manager_can_deep_sleep() returns true when checked again.
283283
unlock_deep_sleep = true;
284-
lp_ticker_set_interrupt(lp_ticker_read() + us_to_ticks(DEEP_SLEEP_TEST_CHECK_WAIT_US / 2, p_ticker_info));
285284

286285
start = lp_ticker_read();
286+
lp_ticker_set_interrupt(lp_ticker_read() + us_to_ticks(DEEP_SLEEP_TEST_CHECK_WAIT_US / 2, p_ticker_info));
287287
// Extra wait after setting interrupt to handle CMPOK
288288
wait_ns(100000);
289289
TEST_ASSERT_FALSE(sleep_manager_can_deep_sleep());
290290
TEST_ASSERT_TRUE(sleep_manager_can_deep_sleep_test_check());
291291
stop = lp_ticker_read();
292-
TEST_ASSERT_UINT64_WITHIN(DEEP_SLEEP_TEST_CHECK_WAIT_DELTA_US, DEEP_SLEEP_TEST_CHECK_WAIT_US / 2,
293-
diff_us(start, stop, p_ticker_info));
292+
TEST_ASSERT(diff_us(start, stop, p_ticker_info) >= DEEP_SLEEP_TEST_CHECK_WAIT_US / 2);
293+
TEST_ASSERT(diff_us(start, stop, p_ticker_info) < DEEP_SLEEP_TEST_CHECK_WAIT_US);
294294
TEST_ASSERT_TRUE(sleep_manager_can_deep_sleep());
295295
}
296296

0 commit comments

Comments
 (0)