Skip to content

Commit 55e1a76

Browse files
author
Filip Jagodzinski
committed
Test: Watchdog: Update the deepsleep wait
Extend the deepsleep wait up to 220% of the Watchdog timeout. One of the current Watchdog timing requirements is to fire BEFORE twice the timeout value, but at least one target (K64F) is expected to fire EXACTLY at a doubled timeout value in deepsleep mode. This patch updates the test to cope with a new deepsleep timing requirement.
1 parent 945a9b3 commit 55e1a76

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

TESTS/mbed_drivers/watchdog_reset/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,12 @@ void test_deepsleep_reset()
197197
if (!sleep_manager_can_deep_sleep()) {
198198
TEST_ASSERT_MESSAGE(0, "Deepsleep should be allowed.");
199199
}
200-
// Watchdog should fire before twice the timeout value.
201-
ThisThread::sleep_for(2 * TIMEOUT_MS); // Device reset expected.
200+
201+
// The Watchdog reset is allowed to be delayed up to twice the timeout
202+
// value when the deepsleep mode is active.
203+
// To make the test less sensitive to clock/wait accuracy, add 20% extra
204+
// (making tha whole deepsleep wait equal to 2.2 * timeout).
205+
ThisThread::sleep_for(220 * TIMEOUT_MS / 100); // Device reset expected.
202206

203207
// Watchdog reset should have occurred during the deepsleep above.
204208

TESTS/mbed_hal/watchdog_reset/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,12 @@ void test_deepsleep_reset()
188188
if (!sleep_manager_can_deep_sleep()) {
189189
TEST_ASSERT_MESSAGE(0, "Deepsleep should be allowed.");
190190
}
191-
// Watchdog should fire before twice the timeout value.
192-
ThisThread::sleep_for(2 * TIMEOUT_MS); // Device reset expected.
191+
192+
// The Watchdog reset is allowed to be delayed up to twice the timeout
193+
// value when the deepsleep mode is active.
194+
// To make the test less sensitive to clock/wait accuracy, add 20% extra
195+
// (making tha whole deepsleep wait equal to 2.2 * timeout).
196+
ThisThread::sleep_for(220 * TIMEOUT_MS / 100); // Device reset expected.
193197

194198
// Watchdog reset should have occurred during the deepsleep above.
195199

0 commit comments

Comments
 (0)