Skip to content

Commit 98708d1

Browse files
author
Filip Jagodzinski
committed
Tests: Update Watchdog Manager test
Update the watchdog timing requirements: 1. The watchdog should trigger at, or after the timeout value. 2. The watchdog should trigger before twice the timeout value.
1 parent 19272b7 commit 98708d1

File tree

1 file changed

+11
-9
lines changed
  • TESTS/mbed_platform/watchdog_mgr_reset

1 file changed

+11
-9
lines changed

TESTS/mbed_platform/watchdog_mgr_reset/main.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,15 @@ void test_simple_reset()
8080

8181
// Phase 1. -- run the test code.
8282
// Init the watchdog and wait for a device reset.
83-
if (send_reset_notification(&current_case, HW_WATCHDOG_TIMEOUT + TIMEOUT_DELTA_MS) == false) {
83+
if (send_reset_notification(&current_case, 2 * HW_WATCHDOG_TIMEOUT) == false) {
8484
TEST_ASSERT_MESSAGE(0, "Dev-host communication error.");
8585
return;
8686
}
8787
TEST_ASSERT_TRUE(mbed_wdog_manager_start());
8888
// Block interrupts, including the one from the wdog_manager maintenance ticker.
8989
core_util_critical_section_enter();
90-
wait((HW_WATCHDOG_TIMEOUT + TIMEOUT_DELTA_MS) / 1000.0); // Device reset expected.
90+
// Watchdog should fire before twice the timeout value.
91+
wait((2 * HW_WATCHDOG_TIMEOUT) / 1000.0); // Device reset expected.
9192

9293
// Watchdog reset should have occurred during wait() above;
9394

@@ -120,17 +121,18 @@ void test_restart_reset()
120121
// Block interrupts, including the one from the wdog_manager maintenance ticker.
121122
core_util_critical_section_enter();
122123
// Check that stopping the Watchdog Manager prevents a device reset.
123-
wait((HW_WATCHDOG_TIMEOUT + TIMEOUT_DELTA_MS) / 1000.0);
124+
wait((2 * HW_WATCHDOG_TIMEOUT) / 1000.0);
124125
core_util_critical_section_exit();
125126

126-
if (send_reset_notification(&current_case, HW_WATCHDOG_TIMEOUT + TIMEOUT_DELTA_MS) == false) {
127+
if (send_reset_notification(&current_case, 2 * HW_WATCHDOG_TIMEOUT) == false) {
127128
TEST_ASSERT_MESSAGE(0, "Dev-host communication error.");
128129
return;
129130
}
130131
TEST_ASSERT_TRUE(mbed_wdog_manager_start());
131132
// Block interrupts, including the one from the wdog_manager maintenance ticker.
132133
core_util_critical_section_enter();
133-
wait((HW_WATCHDOG_TIMEOUT + TIMEOUT_DELTA_MS) / 1000.0); // Device reset expected.
134+
// Watchdog should fire before twice the timeout value.
135+
wait((2 * HW_WATCHDOG_TIMEOUT) / 1000.0); // Device reset expected.
134136

135137
// Watchdog reset should have occurred during wait() above;
136138

@@ -149,16 +151,16 @@ void test_kick_reset()
149151

150152
// Phase 1. -- run the test code.
151153
TEST_ASSERT_TRUE(mbed_wdog_manager_start());
152-
wait((HW_WATCHDOG_TIMEOUT + TIMEOUT_DELTA_MS) / 1000.0); // Device reset expected.
154+
wait((2 * HW_WATCHDOG_TIMEOUT) / 1000.0); // Device reset expected.
153155

154-
if (send_reset_notification(&current_case, HW_WATCHDOG_TIMEOUT + TIMEOUT_DELTA_MS) == false) {
156+
if (send_reset_notification(&current_case, 2 * HW_WATCHDOG_TIMEOUT) == false) {
155157
TEST_ASSERT_MESSAGE(0, "Dev-host communication error.");
156158
return;
157159
}
158160
// Block interrupts, including the one from the wdog_manager maintenance ticker.
159161
core_util_critical_section_enter();
160-
161-
wait((HW_WATCHDOG_TIMEOUT + TIMEOUT_DELTA_MS) / 1000.0); // Device reset expected.
162+
// Watchdog should fire before twice the timeout value.
163+
wait((2 * HW_WATCHDOG_TIMEOUT) / 1000.0); // Device reset expected.
162164

163165
// Watchdog reset should have occurred during wait() above;
164166

0 commit comments

Comments
 (0)