Merge pull request #5147 from 0xc0170/fix_deepsleep_tests

Test: deepsleep() API replacement
pull/4955/head
Jimmy Brisson 2017-10-13 09:19:41 -05:00 committed by GitHub
commit 84f2d089f4
2 changed files with 12 additions and 2 deletions

View File

@ -59,7 +59,10 @@ void lp_timeout_1s_deepsleep(void)
*/
timer.start();
lpt.attach(&cb_done, 1);
deepsleep();
/* Make sure deepsleep is allowed, to go to deepsleep */
bool deep_sleep_allowed = sleep_manager_can_deep_sleep();
TEST_ASSERT_TRUE_MESSAGE(deep_sleep_allowed, "Deep sleep should be allowed");
sleep();
while (!complete);
/* It takes longer to wake up from deep sleep */
@ -75,6 +78,8 @@ void lp_timeout_1s_sleep(void)
sleep_manager_lock_deep_sleep();
lpt.attach(&cb_done, 1);
bool deep_sleep_allowed = sleep_manager_can_deep_sleep();
TEST_ASSERT_FALSE_MESSAGE(deep_sleep_allowed, "Deep sleep should be disallowed");
sleep();
while (!complete);
sleep_manager_unlock_deep_sleep();

View File

@ -104,7 +104,10 @@ void lp_ticker_1s_deepsleep()
lp_timer.reset();
lp_timer.start();
ticker_insert_event(lp_ticker_data, &delay_event, delay_ts, (uint32_t)&delay_event);
deepsleep();
/* Make sure deepsleep is allowed, to go to deepsleep */
bool deep_sleep_allowed = sleep_manager_can_deep_sleep();
TEST_ASSERT_TRUE_MESSAGE(deep_sleep_allowed, "Deep sleep should be allowed");
sleep();
while (!complete);
lp_timer.stop();
@ -124,6 +127,8 @@ void lp_ticker_1s_sleep()
sleep_manager_lock_deep_sleep();
timer.reset();
timer.start();
bool deep_sleep_allowed = sleep_manager_can_deep_sleep();
TEST_ASSERT_FALSE_MESSAGE(deep_sleep_allowed, "Deep sleep should be disallowed");
ticker_insert_event(lp_ticker_data, &delay_event, delay_ts, (uint32_t)&delay_event);
sleep();
while (!complete);