Skip to content

Commit 418210d

Browse files
ananglnashif
authored andcommitted
tests: drivers: wdt_basic_api: Allow testing without PAUSE_HALTED_BY_DBG
This is a follow-up to commit e53e544. In the above commit, the calls to `wdt_setup()` were modified to use the `WDT_OPT_PAUSE_HALTED_BY_DBG` option to prevent problems with flashing of boards after this test was executed on them (the still active watchdog could interrupt such flashing), but this option is not essential to the test itself. And if a watchdog driver does not support pausing when the CPU is halted by a debugger (this is the case for example for wdt_counter), it is not able to pass the test because of that option. Add then the possibility to continue the test when pausing by debugger is not supported. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent ccedcd1 commit 418210d

File tree

1 file changed

+12
-0
lines changed
  • tests/drivers/watchdog/wdt_basic_api/src

1 file changed

+12
-0
lines changed

tests/drivers/watchdog/wdt_basic_api/src/test_wdt.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@ static int test_wdt_no_callback(void)
216216
}
217217

218218
err = wdt_setup(wdt, WDT_OPT_PAUSE_HALTED_BY_DBG);
219+
if (err == -ENOTSUP) {
220+
TC_PRINT("- pausing watchdog by debugger is not supported\n");
221+
err = wdt_setup(wdt, 0);
222+
}
219223
if (err < 0) {
220224
TC_PRINT("Watchdog setup error\n");
221225
return TC_FAIL;
@@ -270,6 +274,10 @@ static int test_wdt_callback_1(void)
270274
}
271275

272276
err = wdt_setup(wdt, WDT_OPT_PAUSE_HALTED_BY_DBG);
277+
if (err == -ENOTSUP) {
278+
TC_PRINT("- pausing watchdog by debugger is not supported\n");
279+
err = wdt_setup(wdt, 0);
280+
}
273281
if (err < 0) {
274282
TC_PRINT("Watchdog setup error\n");
275283
return TC_FAIL;
@@ -330,6 +338,10 @@ static int test_wdt_callback_2(void)
330338
}
331339

332340
err = wdt_setup(wdt, WDT_OPT_PAUSE_HALTED_BY_DBG);
341+
if (err == -ENOTSUP) {
342+
TC_PRINT("- pausing watchdog by debugger is not supported\n");
343+
err = wdt_setup(wdt, 0);
344+
}
333345
if (err < 0) {
334346
TC_PRINT("Watchdog setup error\n");
335347
return TC_FAIL;

0 commit comments

Comments
 (0)