Skip to content

apps/examples/watchdog: Improve help message and add hang test#7331

Open
seokhun-eom24 wants to merge 2 commits into
Samsung:masterfrom
seokhun-eom24:260421-watchdog-example
Open

apps/examples/watchdog: Improve help message and add hang test#7331
seokhun-eom24 wants to merge 2 commits into
Samsung:masterfrom
seokhun-eom24:260421-watchdog-example

Conversation

@seokhun-eom24
Copy link
Copy Markdown
Contributor

1. apps/examples/watchdog: Improve help message and parameter validation

Improve help message to explain parameters and their usage.
Add parameter validation to prevent invalid values in integer overflow and argument string length overflow.

[Help Message]

TASH>>Usage:
  watchdog <command> [arguments]

Commands:
  help
      Show this help message

  expire [timeout_ms] [status_period_ms]
      Start watchdog expiration test
      timeout_ms        Watchdog timeout in milliseconds
                        Default: 30001 ms
      status_period_ms  Status print interval in milliseconds
                        0 disables periodic status printing
                        Default: 0 ms

  keepalive
      Send keepalive signal to watchdog

  status
      Show current watchdog status

  stop
      Stop watchdog

  pause
      Pause watchdog

  resume
      Resume watchdog

  pause_resume [pause_ms] [resume_ms]
      Run one watchdog pause/resume test sequence
      pause_ms          Pause duration in milliseconds
                        Default: 1000 ms
      resume_ms         Resume duration in milliseconds
                        Default: 200 ms

Examples:
  watchdog expire
  watchdog expire 30001 1000
  watchdog pause_resume
  watchdog pause_resume 1000 200

Notes:
  pause_resume timeout = pause_ms * 10

2. apps/examples/watchdog: Add watchdog hang test in flat build

Implemented a new watchdog hang command to test watchdog operation in a hang situation.
This test is only available on flat build.
It uses sched_lock and enter_critical_section to make hang situation.

Improve help message to explain parameters and their usage.
Add parameter validation to prevent invalid values in integer overflow and argument string length overflow.

[Help Message]
```
TASH>>Usage:
  watchdog <command> [arguments]

Commands:
  help
      Show this help message

  expire [timeout_ms] [status_period_ms]
      Start watchdog expiration test
      timeout_ms        Watchdog timeout in milliseconds
                        Default: 30001 ms
      status_period_ms  Status print interval in milliseconds
                        0 disables periodic status printing
                        Default: 0 ms

  keepalive
      Send keepalive signal to watchdog

  status
      Show current watchdog status

  stop
      Stop watchdog

  pause
      Pause watchdog

  resume
      Resume watchdog

  pause_resume [pause_ms] [resume_ms]
      Run one watchdog pause/resume test sequence
      pause_ms          Pause duration in milliseconds
                        Default: 1000 ms
      resume_ms         Resume duration in milliseconds
                        Default: 200 ms

Examples:
  watchdog expire
  watchdog expire 30001 1000
  watchdog pause_resume
  watchdog pause_resume 1000 200

Notes:
  pause_resume timeout = pause_ms * 10
```

Signed-off-by: seokhun-eom <seokhun.eom@samsung.com>
Implemented a new `watchdog hang` command to test watchdog operation in a hang situation.
This test is only available on flat build.
It uses `sched_lock` and `enter_critical_section` to make hang situation.

Signed-off-by: seokhun-eom <seokhun.eom@samsung.com>
@seokhun-eom24
Copy link
Copy Markdown
Contributor Author

Automated nightly Codex PR review
PR: #7331 — apps/examples/watchdog: Improve help message and add hang test
PR URL: #7331
GitHub updatedAt: 2026-05-11T07:20:12Z
Refreshed (UTC): 2026-05-11 17:42:15 UTC
Refreshed (KST): 2026-05-12 02:42:15 KST
Comment model: single evolving Codex-authored PR comment

PR #7331 — apps/examples/watchdog: Improve help message and add hang test

This review done by codex. AI reviews can be inaccurate.
UTC: 2026-05-11 17:41 UTC
KST (UTC+9): 2026-05-12 02:41 KST


Repository: Samsung/TizenRT

Base → Head: masterpr/7331

HEAD Commit: ab95a2ecd3a71415f739fbc38ac5dbd48a4cf993

Scope: apps/examples/watchdog/Kconfig, apps/examples/watchdog/watchdog_main.c


Review Summary

Category Status
Build / Compile Status ⚠️ Static review only; no target build was run in this unattended pass
Functional Correctness ✅ No blocking issue found in the changed command parsing, argument validation, or hang-test control flow
Validation Coverage ⚠️ PR does not add an automated or documented target validation log for the new FLAT-only hang path

Final Verdict: 💬 Comment


Must-Fix Issues

No blocking issues found.


Nice-to-Have Improvements

1. Add explicit validation evidence for the FLAT-only hang command
Item Details
Location apps/examples/watchdog/watchdog_main.c:463
Severity Low
Type Validation

Problem
The PR introduces a new watchdog hang command that deliberately locks scheduling and enters a critical section in FLAT builds, but the PR does not include a target build/run log showing that both the FLAT implementation and the non-FLAT rejection path were exercised.

Impact

  • The static control flow looks intentional, but merge confidence still depends on board-level behavior because the success case is a hardware reset rather than a normal process return.
  • The unsupported non-FLAT path is present at apps/examples/watchdog/watchdog_main.c:463, so it is useful to document that protected/kernel builds still present a controlled error instead of pulling in FLAT-only headers or symbols.

Recommended Action

  • Add the validation commands and observed output to the PR description or a follow-up note.
  • Cover at least one FLAT target where watchdog hang [timeout_ms] resets as expected and one non-FLAT target where the command prints watchdog: hang is only supported in FLAT build.

Example Validation Matrix

Area Example Target / Check Result
FLAT hang path Enable CONFIG_EXAMPLES_WATCHDOG=y, run watchdog hang 40000, confirm watchdog reset reason Not Run
Non-FLAT compatibility Enable the example in a protected/kernel configuration, run watchdog hang Not Run
Existing commands watchdog expire, watchdog pause_resume, watchdog help Not Run

Notable Improvements

✔ Safer sleep argument bounds

  • watchdog_validate_sleep_ms() at apps/examples/watchdog/watchdog_main.c:134 rejects zero values where they would make the command meaningless and rejects values that would overflow the ms * 1000 conversion before usleep().

✔ FLAT-only hang logic is isolated

  • The FLAT-only includes are guarded at apps/examples/watchdog/watchdog_main.c:33, and the non-FLAT watchdog_run_hang() stub at apps/examples/watchdog/watchdog_main.c:463 keeps non-FLAT builds from depending on sched_lock() or enter_critical_section().

✔ Help output now describes command arguments

  • The expanded help at apps/examples/watchdog/watchdog_main.c:88 documents defaults, argument meaning, and examples for the watchdog operations, which makes the example easier to run correctly from TASH.

Final Assessment

Must-Fix Summary

  • No blocking issues were found during static review.

Nice-to-Have Summary

  • Add target validation evidence for the new hardware-reset hang scenario and the non-FLAT unsupported path.

Residual Risk / Test Gap

  • Static review only; no dbuild target build or board-level watchdog reset test was run in this unattended review.
  • Hardware watchdog behavior, reset reason capture, and command output were not validated on target hardware.

Final Verdict

💬 Comment

The PR is reasonable to continue, with no merge-blocking issue found in the reviewed diff. The main remaining gap is validation evidence for the new FLAT-only hang command because its expected success condition is a hardware watchdog reset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant