tests: drivers: wdt_basic_api: Allow testing without PAUSE_HALTED_BY_DBG

This is a follow-up to commit e53e5448ee.

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 <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2024-04-05 16:01:15 +02:00 committed by Anas Nashif
commit 418210dbf3

View file

@ -216,6 +216,10 @@ static int test_wdt_no_callback(void)
}
err = wdt_setup(wdt, WDT_OPT_PAUSE_HALTED_BY_DBG);
if (err == -ENOTSUP) {
TC_PRINT("- pausing watchdog by debugger is not supported\n");
err = wdt_setup(wdt, 0);
}
if (err < 0) {
TC_PRINT("Watchdog setup error\n");
return TC_FAIL;
@ -270,6 +274,10 @@ static int test_wdt_callback_1(void)
}
err = wdt_setup(wdt, WDT_OPT_PAUSE_HALTED_BY_DBG);
if (err == -ENOTSUP) {
TC_PRINT("- pausing watchdog by debugger is not supported\n");
err = wdt_setup(wdt, 0);
}
if (err < 0) {
TC_PRINT("Watchdog setup error\n");
return TC_FAIL;
@ -330,6 +338,10 @@ static int test_wdt_callback_2(void)
}
err = wdt_setup(wdt, WDT_OPT_PAUSE_HALTED_BY_DBG);
if (err == -ENOTSUP) {
TC_PRINT("- pausing watchdog by debugger is not supported\n");
err = wdt_setup(wdt, 0);
}
if (err < 0) {
TC_PRINT("Watchdog setup error\n");
return TC_FAIL;