Skip to content

Commit 5dff3e2

Browse files
committed
tests: drivers: watchdog: use Kconfig options for setup flags and timeout
Replace hard-coded platform definrs with Kconfig marcos Signed-off-by: Quy Tran <[email protected]>
1 parent 42bc460 commit 5dff3e2

File tree

5 files changed

+27
-9
lines changed

5 files changed

+27
-9
lines changed

tests/drivers/watchdog/wdt_basic_reset_none/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,15 @@ config TEST_WDT_SLEEP_TIME
2020
The units for this value will change based on the watchdog
2121
driver being tested. Most drivers represent this as milliseconds
2222
due to the max window reaching the millisecond feed window.
23+
24+
config TEST_WDT_SETUP_FLAGS
25+
int "WDT setup flags for test, selectable options are: No flags (0x0U), WDT_OPT_PAUSE_IN_SLEEP (0x1U), WDT_OPT_PAUSE_HALTED_BY_DBG (0x2U)"
26+
default 2
27+
help
28+
Set the watchdog setup flags for the test.
29+
30+
config TEST_WDT_TIMEOUT_UNIT_TICKS
31+
bool "Use watchdog timeout unit in ticks"
32+
default n
33+
help
34+
Enable this option to configure the watchdog timeout unit in system ticks
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_TEST_WDT_SETUP_FLAGS=0
2+
CONFIG_TEST_WDT_TIMEOUT_UNIT_TICKS=y
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_TEST_WDT_SETUP_FLAGS=0

tests/drivers/watchdog/wdt_basic_reset_none/src/main.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@
2222
#define WDT_FEED_TRIES 2
2323
#define WDT_TEST_CB_TEST_VALUE 0xCB
2424
#define WDT_TIMEOUT_VALUE CONFIG_TEST_WDT_MAX_WINDOW_TIME + 10
25+
#define WDT_SETUP_FLAGS CONFIG_TEST_WDT_SETUP_FLAGS
2526

26-
#if defined(CONFIG_WDT_NXP_EWM)
27-
#define WDT_SETUP_FLAGS 0
28-
#define WDT_TIMEOUT K_TICKS(WDT_TIMEOUT_VALUE)
29-
#define SLEEP_TIME K_TICKS(CONFIG_TEST_WDT_SLEEP_TIME)
27+
#if defined(CONFIG_TEST_WDT_TIMEOUT_UNIT_TICKS)
28+
#define WDT_TIMEOUT K_TICKS(WDT_TIMEOUT_VALUE)
29+
#define SLEEP_TIME K_TICKS(CONFIG_TEST_WDT_SLEEP_TIME)
3030
#else
31-
#define WDT_SETUP_FLAGS WDT_OPT_PAUSE_HALTED_BY_DBG
32-
#define WDT_TIMEOUT K_MSEC(WDT_TIMEOUT_VALUE)
33-
#define SLEEP_TIME K_MSEC(CONFIG_TEST_WDT_SLEEP_TIME)
31+
#define WDT_TIMEOUT K_MSEC(WDT_TIMEOUT_VALUE)
32+
#define SLEEP_TIME K_MSEC(CONFIG_TEST_WDT_SLEEP_TIME)
3433
#endif
3534

3635
static struct wdt_timeout_cfg m_cfg_wdt0;

tests/drivers/watchdog/wdt_basic_reset_none/testcase.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ tests:
2727
- frdm_mcxw72/mcxw727c/cpu0
2828
- mimxrt1180_evk/mimxrt1189/cm33
2929
- mimxrt1180_evk/mimxrt1189/cm7
30-
extra_args: DTC_OVERLAY_FILE="boards/app_ewm.overlay"
30+
extra_args:
31+
- EXTRA_CONF_FILE="boards/app_ewm.conf"
32+
- DTC_OVERLAY_FILE="boards/app_ewm.overlay"
3133
extra_configs:
3234
- CONFIG_TEST_WDT_MAX_WINDOW_TIME=254
3335
- CONFIG_TEST_WDT_SLEEP_TIME=68
@@ -37,7 +39,9 @@ tests:
3739
- frdm_ke17z
3840
integration_platforms:
3941
- frdm_ke17z
40-
extra_args: DTC_OVERLAY_FILE="boards/frdm_ke1xz.overlay"
42+
extra_args:
43+
- EXTRA_CONF_FILE="boards/app_ewm.conf"
44+
- DTC_OVERLAY_FILE="boards/frdm_ke1xz.overlay"
4145
extra_configs:
4246
- CONFIG_TEST_WDT_MAX_WINDOW_TIME=254
4347
- CONFIG_TEST_WDT_SLEEP_TIME=68

0 commit comments

Comments
 (0)