File tree Expand file tree Collapse file tree 4 files changed +30
-3
lines changed
mbed_drivers/watchdog_reset Expand file tree Collapse file tree 4 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,16 @@ void test_restart_reset();
64
64
*/
65
65
void test_kick_reset ();
66
66
67
+ /** Test Watchdog timeout
68
+ *
69
+ * Given a device with a Watchdog started,
70
+ * when the Watchdog timout doesn't expire,
71
+ * then the device restart is not performed.
72
+ * When the Watchdog timout do expires,
73
+ * then the device is restarted after the timeout and before twice the timeout value.
74
+ */
75
+ void test_timeout ();
76
+
67
77
#endif
68
78
69
79
#endif
Original file line number Diff line number Diff line change @@ -297,8 +297,11 @@ void test_timeout()
297
297
}
298
298
299
299
// Phase 1. -- run the test code.
300
- // Kick watchdog before timeout.
301
300
TEST_ASSERT_TRUE (watchdog.start (TIMEOUT_LOWER_LIMIT));
301
+
302
+ // Kick watchdog before timeout.
303
+ // Watchdog should not trigger before timeout.
304
+ // If device restarts while waiting for the kick, test fails.
302
305
wait_ms (TIMEOUT_LOWER_LIMIT - window);
303
306
watchdog.kick ();
304
307
@@ -308,6 +311,7 @@ void test_timeout()
308
311
}
309
312
watchdog.kick ();
310
313
314
+ // Watchdog should fire before twice the timeout value.
311
315
wait_ms (2 * TIMEOUT_LOWER_LIMIT);
312
316
313
317
// Watchdog reset should have occurred during that wait() above;
Original file line number Diff line number Diff line change @@ -283,10 +283,12 @@ void test_timeout()
283
283
}
284
284
285
285
// Phase 1. -- run the test code.
286
- // Kick watchdog before timeout.
287
286
watchdog_config_t config = { TIMEOUT_LOWER_LIMIT };
288
-
289
287
TEST_ASSERT_EQUAL (WATCHDOG_STATUS_OK, hal_watchdog_init (&config));
288
+
289
+ // Kick watchdog before timeout.
290
+ // Watchdog should not trigger before timeout.
291
+ // If device restarts while waiting for the kick, test fails.
290
292
wait_ms (TIMEOUT_LOWER_LIMIT - window);
291
293
hal_watchdog_kick ();
292
294
@@ -296,6 +298,7 @@ void test_timeout()
296
298
}
297
299
hal_watchdog_kick ();
298
300
301
+ // Watchdog should fire before twice the timeout value.
299
302
wait_ms (2 * TIMEOUT_LOWER_LIMIT);
300
303
301
304
// Watchdog reset should have occurred during that wait() above;
Original file line number Diff line number Diff line change @@ -69,6 +69,16 @@ void test_restart_reset();
69
69
*/
70
70
void test_kick_reset ();
71
71
72
+ /** Test Watchdog timeout
73
+ *
74
+ * Given a device with a Watchdog started,
75
+ * when the Watchdog timout doesn't expire,
76
+ * then the device restart is not performed.
77
+ * When the Watchdog timout do expires,
78
+ * then the device is restarted after the timeout and before twice the timeout value.
79
+ */
80
+ void test_timeout ();
81
+
72
82
#endif
73
83
74
84
#endif
You can’t perform that action at this time.
0 commit comments