Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Medium] Unhandled error from `echo 1 > enable` causes false test failure 
under `set -e` when hardware watchpoints are unsupported.
--

commit 70eb02867fbc0203498e0161a5c4b437b562d025
Author: Masami Hiramatsu (Google) <[email protected]>

selftests: tracing: Add a basic testcase for wprobe

Add 'add_remove_wprobe.tc' testcase for testing wprobe event that
tests adding and removing operations of the wprobe event.

> diff --git 
> a/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_wprobe.tc 
> b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_wprobe.tc
> new file mode 100644
> index 0000000000000..647c37d5e4c84
> --- /dev/null
> +++ b/tools/testing/selftests/ftrace/test.d/dynevent/add_remove_wprobe.tc

[ ... ]

> +if [ ! -d events/wprobes/my_wprobe ]; then
> +    echo "Failed to create wprobe event directory"
> +    exit_fail
> +fi
> +
> +echo 1 > events/wprobes/my_wprobe/enable

[Severity: Medium]
Will this script falsely report a failure if hardware watchpoints are
exhausted or unsupported on the platform?

Writing to the enable file triggers enable_trace_wprobe() and eventually
register_wide_hw_breakpoint(), which allocates physical hardware debug
registers. If this allocation fails (e.g., returning -ENOSPC or -EOPNOTSUPP),
the echo command will return a non-zero exit status.

Because ftracetest runs test scripts with 'set -e' (errexit) active, this
error will abort the script immediately and fail the test instead of safely
skipping it.

Should this write be guarded with something like "|| exit_unsupported" to
handle expected hardware limitations?

> +
> +# Check if the event is enabled
> +if ! grep -q 1 events/wprobes/my_wprobe/enable; then
> +    echo "Failed to enable wprobe event"
> +    exit_fail
> +fi

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/178939017565.94750.9431053336761330458.stgit@devnote2?part=8

Reply via email to