This is an automated email from the ASF dual-hosted git repository.

kasjer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 1f4e04e18 test/mtest: Add configurable watchdog test timeout
1f4e04e18 is described below

commit 1f4e04e18d38f7259b24e9b2b38dd94353b4bca3
Author: Wiktor Kwiatkowski <[email protected]>
AuthorDate: Mon Oct 19 15:24:55 2026 +0200

    test/mtest: Add configurable watchdog test timeout
    
    Add WATCHDOG_TIMEOUT_MULT to scale test timeout relative to
    WATCHDOG_INTERVAL. Allows boards with inaccurate watchdog clock
    (e.g. nucleo-u575zi) to pass.
---
 test/mtest/mtest_watchdog/src/watchdog_test_cases.c | 7 +++++--
 test/mtest/mtest_watchdog/syscfg.yml                | 7 +++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/test/mtest/mtest_watchdog/src/watchdog_test_cases.c 
b/test/mtest/mtest_watchdog/src/watchdog_test_cases.c
index 57426d77f..722462b6c 100644
--- a/test/mtest/mtest_watchdog/src/watchdog_test_cases.c
+++ b/test/mtest/mtest_watchdog/src/watchdog_test_cases.c
@@ -23,6 +23,9 @@
 #include "mtest_watchdog/mtest_watchdog.h"
 #include "os/os_cputime.h"
 
+#define WDOG_TEST_TIMEOUT_US                                                  \
+    (MYNEWT_VAL(WATCHDOG_TIMEOUT_MULT) * MYNEWT_VAL(WATCHDOG_INTERVAL) * 1000)
+
 extern volatile int reset_count;
 
 MTEST_CASE(watchdog_test_case_1)
@@ -43,7 +46,7 @@ MTEST_CASE(watchdog_test_case_1)
             last_tickle = now;
         }
 
-        if (now - start >= 2 * (MYNEWT_VAL(WATCHDOG_INTERVAL) * 1000)) {
+        if (now - start >= WDOG_TEST_TIMEOUT_US) {
             break;
         }
     }
@@ -70,7 +73,7 @@ MTEST_CASE(watchdog_test_case_2)
     while (1) {
         now = os_cputime_ticks_to_usecs(os_cputime_get32());
 
-        if (now - start > 2 * (MYNEWT_VAL(WATCHDOG_INTERVAL) * 1000)) {
+        if (now - start > WDOG_TEST_TIMEOUT_US) {
             MTEST_CASE_ASSERT(0, "WDOG failed to fire");
         }
     }
diff --git a/test/mtest/mtest_watchdog/syscfg.yml 
b/test/mtest/mtest_watchdog/syscfg.yml
index 088f8de49..52635929d 100644
--- a/test/mtest/mtest_watchdog/syscfg.yml
+++ b/test/mtest/mtest_watchdog/syscfg.yml
@@ -16,6 +16,13 @@
 # under the License.
 #
 
+syscfg.defs:
+    WATCHDOG_TIMEOUT_MULT:
+        description: >
+            Multiplier of WATCHDOG_INTERVAL used as test timeout.
+            Increase on boards with inaccurate watchdog clock.
+        value: 2
+
 syscfg.vals:
     WATCHDOG_INTERVAL: 2000
     SANITY_INTERVAL: 500

Reply via email to