testing/drivers: add watchdog notifier cmocka coverage#3639
Conversation
9584062 to
6ec0489
Compare
|
Updated the companion branch in response to the check results:
The test scope and watchdog-only registration behavior are unchanged. |
6ec0489 to
cdd0b1f
Compare
| #if !defined(CONFIG_ARCH_ARMV7A) || !defined(CONFIG_ARCH_HAVE_TRUSTZONE) | ||
| cmocka_unit_test_prestate(drivertest_watchdog_api, &wdg_state) | ||
| cmocka_unit_test_prestate(drivertest_watchdog_api, &wdg_state), | ||
| #endif |
There was a problem hiding this comment.
#endif
#endif
#ifdef CONFIG_WATCHDOG_TIMEOUT_NOTIFIER
cmocka_unit_test_prestate(drivertest_watchdog_notifier, &wdg_state),
cederom
left a comment
There was a problem hiding this comment.
Thank you @Zepp-Hanzj :-)
- You may want to udpate code style or leave as is if you want.
- Please add git commit messages, see https://nuttx.apache.org/docs/latest/contributing/index.html.
|
yeah we can skip this cosmetic part :-)
just a git message and we are ready to go :-)
…--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info
|
|
If you are using AI tools, please add the Could you please attach the logs from the tests you ran on sim? |
| unsigned int index; | ||
|
|
||
| test_nb = (FAR struct watchdog_notifier_test_nb_s *) | ||
| ((FAR char *)nb - offsetof(struct watchdog_notifier_test_nb_s, |
|
|
||
| #ifdef CONFIG_WATCHDOG_TIMEOUT_NOTIFIER | ||
|
|
||
| struct watchdog_notifier_test_nb_s |
There was a problem hiding this comment.
why not merge into wdg_state_s
| ifeq ($(CONFIG_TESTING_DRIVER_TEST_WATCHDOG_ONLY),y) | ||
| MAINSRC += drivertest_watchdog.c | ||
| PROGNAME += cmocka_driver_watchdog | ||
| else |
There was a problem hiding this comment.
why skip other wdog test
cdd0b1f to
f1d3688
Compare
|
Addressed the review comments in the latest push. Code updates
The watchdog-only option intentionally skips the other drivertest applications: its purpose is to produce a minimal simulator image that registers only Simulator test logConfiguration: The capture-stop pending-interrupt validation also passed: the callback returned safely after the association was cleared and did not dereference a NULL upper-half. |
Add cmocka coverage for notifier priority ordering, duplicate registration, repeated timeout delivery, unregister behavior, action propagation, and NULL callback data. Signed-off-by: hanzhijian <hanzhijian@zepp.com> Assisted-by: OpenAI Codex
Add a focused watchdog-only cmocka registration and exercise notifier ordering, duplicate registration, repeated timeout delivery, unregister behavior, NULL data, and concurrent register/timeout/unregister activity. Signed-off-by: hanzhijian <hanzhijian@zepp.com> Assisted-by: OpenAI Codex
f1d3688 to
8fa68e9
Compare
|
The checkpatch failure was caused by commit messages shorter than the repository minimum of five lines. Both commits now include a descriptive body, the requested |
Include the container_of declaration and exclude unused hardware-only helpers when the watchdog notifier test is built alone. Signed-off-by: hanzhijian <hanzhijian@zepp.com> Assisted-by: OpenAI Codex
|
The simulator build exposed and is now fixed in commit |
Assisted-by: OpenAI Codex |
|
Thanks @cederom. Agreed — the remaining cosmetic formatting discussion can be skipped. The required commit messages are now in place with both |
Keep the existing drivertest applications under the main test option and register only the watchdog notifier application for the watchdog-only mode. This prevents unrelated cmocka applications from being added to simulator configurations that do not enable the driver test option. Signed-off-by: hanzhijian <hanzhijian@zepp.com> Assisted-by: OpenAI Codex
|
The failed CI jobs were investigated. The root cause was the CMake condition in Fixed in commit
|
Summary
Add focused cmocka coverage for the watchdog timeout notifier chain and an independent watchdog-only drivertest configuration.
Changes
CONFIG_TESTING_DRIVER_TEST_WATCHDOG_ONLY.cmocka_driver_watchdogfrom the drivertest Makefile/CMake rules.WATCHDOG_NOTIFIER_ACTIONpropagation;data == NULLpropagation;Validation
The test was run using the companion NuttX simulator configuration, which registers only the watchdog cmocka driver. The final result was:
The race test repeatedly interleaves timeout delivery with notifier registration and unregistration and asserts that callbacks remain valid and receive a
NULLpayload.Additional hardware-path validation was performed in the companion NuttX PR on STM32F407 WWDG hardware. The corresponding UART logs and screenshots are linked there:
Scope
This PR contains only watchdog notifier tests and their test registration/configuration. Unrelated
O_RDONLYcompatibility changes are intentionally excluded.Merge order
Merge the companion NuttX core PR first, then enable this test configuration in CI or simulator validation.
Checklist
git diff --checkpasses.