mtest: Add watchdog test - #3719
Conversation
15bae2f to
2705534
Compare
sjanc
left a comment
There was a problem hiding this comment.
just minor comment, otherwise looks ok
| MTEST_RUN_INIT(watchdog_test); | ||
| switch (reset_count) { | ||
| case 0: | ||
| watchdog_test_case_1(); |
There was a problem hiding this comment.
while those functions should never return I'd still add break for sake of coding style
There was a problem hiding this comment.
mynewt-core/test/mtest/mtest_watchdog/src/watchdog_test_cases.c
Lines 46 to 48 in 2705534
watchdog_test_case_1(); actually does return when the time counter is at least 2x WATCHDOG_INTERVAL.
Adding a break statement would break the test flow, and watchdog_test_case_2(); would never execute.
There was a problem hiding this comment.
I can change the switch statement to something like this:
if (reset_count == 0) {
watchdog_test_case_1();
watchdog_test_case_2();
} else if (reset_count == 1) {
watchdog_test_case_2();
} else {
boot_status = 0;
reset_count = 0;
}
It will work the same but will get rid of the fallthrough in the switch statement.
There was a problem hiding this comment.
switch is fine, but comment if fall-through is on purpose
Define MTEST_START_DELAY [s] to pause before test cases begin. No delay by default.
This test adds two main test cases. The first case verifies whether periodically calling hal_watchdog_tickle prevents the watchdog from firing. The second case verifies that starving the watchdog correctly triggers a system reset.
2705534 to
1f60067
Compare
No description provided.