Skip to content

Commit

Permalink
Update test_lock_unlock_test_check() assertion to cope with new timings
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LMESTM committed Jun 19, 2019
1 parent d6c3d79 commit 45a0fef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions TESTS/mbed_hal/sleep_manager/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,16 @@ void test_lock_unlock_test_check()
// * sleep_manager_can_deep_sleep_test_check() returns true with a 1 ms delay,
// * sleep_manager_can_deep_sleep() returns true when checked again.
unlock_deep_sleep = true;
lp_ticker_set_interrupt(lp_ticker_read() + us_to_ticks(DEEP_SLEEP_TEST_CHECK_WAIT_US / 2, p_ticker_info));

start = lp_ticker_read();
lp_ticker_set_interrupt(lp_ticker_read() + us_to_ticks(DEEP_SLEEP_TEST_CHECK_WAIT_US / 2, p_ticker_info));
// Extra wait after setting interrupt to handle CMPOK
wait_ns(100000);
TEST_ASSERT_FALSE(sleep_manager_can_deep_sleep());
TEST_ASSERT_TRUE(sleep_manager_can_deep_sleep_test_check());
stop = lp_ticker_read();
TEST_ASSERT_UINT64_WITHIN(DEEP_SLEEP_TEST_CHECK_WAIT_DELTA_US, DEEP_SLEEP_TEST_CHECK_WAIT_US / 2,
diff_us(start, stop, p_ticker_info));
TEST_ASSERT(diff_us(start, stop, p_ticker_info) >= DEEP_SLEEP_TEST_CHECK_WAIT_US/2);
TEST_ASSERT(diff_us(start, stop, p_ticker_info) < DEEP_SLEEP_TEST_CHECK_WAIT_US);
TEST_ASSERT_TRUE(sleep_manager_can_deep_sleep());
}

Expand Down

0 comments on commit 45a0fef

Please sign in to comment.