[LTP] Rewrite ftrace_regression tests with new C API
linuxtestproject.agent@gmail.com
linuxtestproject.agent@gmail.com
Tue Apr 28 11:30:24 CEST 2026
Hi lufei,
On Tue, 28 Apr 2026, lufei wrote:
> Rewrite ftrace_regression tests with new C API
>
> Rewritten from old shell scripts.
Please explain why the conversion is being done — "Rewritten from old
shell scripts" only states what, not why. Also, this bundles two
independent test rewrites; please split into one commit per test.
> +static void run(void)
> +{
> + int i;
> +
> + for (i = 0; i < LOOP; i++) {
> + SAFE_FILE_PRINTF(STACK_TRACER_PATH, "1");
> + SAFE_FILE_PRINTF(TRACE_OPTIONS, "userstacktrace");
trace_options is modified but never saved/restored. The original
ftrace_lib.sh saved old_trace_options and restored it in
restore_old_setting(). Add TRACE_OPTIONS to .save_restore.
> + SAFE_FILE_PRINTF(page_fault_path, "%d", page_fault_origin);
This restore only runs on the normal path. If run() aborts via
tst_brk() inside the loop the enable flag is left set. Use .save_restore
or a dedicated cleanup() instead.
[...]
> +static void run(void)
> +{
> + int i;
> + const char *const cmd_ls[] = {"ls", "-l", "/sys/kernel/tracing/", NULL};
/sys/kernel/tracing/ is not guaranteed to exist on all configs. The
original used /proc; keep that or add an access() check with TCONF.
> + SAFE_FILE_PRINTF(SET_EVENT, "signal:signal_generate");
> + SAFE_FILE_PRINTF(TRACING_ON, "1");
Neither SET_EVENT nor TRACING_ON is restored. Add both to .save_restore.
---
Pre-existing issues noticed in the surrounding code (not introduced
by this patch):
- ftrace_lib.sh:109 — typo "function_pofile_enabled" (should be
"function_profile_enabled") prevents restoring profile state
---
Note:
Our agent completed the review of the patch. The agent can sometimes
produce false positives although often its findings are genuine. If
you find issues with the review, please comment this email or ignore
the suggestions.
Regards,
LTP AI Reviewer
More information about the ltp
mailing list