utest/watchdog: tolerate timeout quantize and non-stoppable close (#11446)

This commit is contained in:
seteiro authored and Rbb666 committed 2026-11-05 15:52:18 +08:00
1 parent 6e7f9e3a37
commit 5a385acca1
2 files changed
+168 -10

No files matched your search

+27
View File
@@ -23,6 +23,33 @@ if RT_UTEST_WDT
default 5
help
Timeout value written by SET_TIMEOUT and checked by GET_TIMEOUT.
The value read back may differ by up to
RT_UTEST_WDT_TIMEOUT_TOL seconds because watchdog timeouts are
derived from a divided low-speed clock (e.g. STM32 LSI 32kHz).
config RT_UTEST_WDT_TIMEOUT_TOL
int "Accepted Readback Tolerance (Seconds)"
range 0 5
default 1
help
Absolute tolerance between the programmed timeout and the value
read back through GET_TIMEOUT. 0 requires an exact round-trip.
config RT_UTEST_WDT_STOPPABLE
bool "Watchdog Can Be Stopped (RT_DEVICE_CTRL_WDT_STOP)"
default n
help
Some watchdog blocks (e.g. STM32 IWDG) cannot be stopped at all.
rt_device_close() on a watchdog issues RT_DEVICE_CTRL_WDT_STOP and
fails with -RT_ERROR when the driver has no STOP support, which
would also leave the device reference count incremented and break
a second run of this suite.
With this option disabled (default) the test never closes the
device: it is a hardware-global singleton, so the handle is only
released by the test case and a re-run reuses the already opened
device. Enable it on BSPs whose watchdog really supports STOP to
exercise the close path.
config RT_UTEST_WDT_START
bool "Also Start/Keepalive/Stop Watchdog"
File diff suppressed because it is too large. Load diff