From: Andrea Cervesato via ltp <ltp@lists.linux.it>
To: lufei <lufei@uniontech.com>
Cc: lufei <lufei@uniontech.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] Rewrite ftrace_regression tests with new C API
Date: Mon, 30 Mar 2026 08:39:27 +0000 [thread overview]
Message-ID: <69ca36bf.df0a0220.9a4c5.bfe1@mx.google.com> (raw)
In-Reply-To: <20260330071554.49304-1-lufei@uniontech.com>
Hi lufei,
> +/**
> + * file_contains_line - Check if a file ocntains specific line, strictly
Typo: "ocntains" -> "contains".
> +static inline int file_contains(const char *path, const char *str)
> +{
> + char *buf = SAFE_MALLOC(FTRACE_FILE_BUF_SIZE);
> +
> + buf[0] = '\0';
> + SAFE_FILE_SCANF(path, "%1048575[^\x01]", buf);
The hardcoded width 1048575 must be kept in sync with FTRACE_FILE_BUF_SIZE - 1
manually. Also, allocating 1 MB on each call is heavy — file_contains() is
called twice in ftrace_regression02. Consider a simpler file reading approach.
> diff --git a/testcases/kernel/tracing/ftrace_test/ftrace_regression01.c b/testcases/kernel/tracing/ftrace_test/ftrace_regression01.c
> new file mode 100644
[...]
> + for (i = 0; i < LOOP; i++) {
> + SAFE_FILE_PRINTF(STACK_TRACER_PATH, "1");
> + SAFE_FILE_PRINTF(TRACE_OPTIONS, "userstacktrace");
[...]
> + SAFE_FILE_PRINTF(page_fault_path, "1");
> + }
The old shell script saved and restored the page fault enable value after
the loop. This version writes "1" but never restores it. Unmounting debugfs
does not reset kernel tracing state. Please add the page_fault_path to
.save_restore or save/restore it manually.
> diff --git a/testcases/kernel/tracing/ftrace_test/ftrace_regression02.c b/testcases/kernel/tracing/ftrace_test/ftrace_regression02.c
> new file mode 100644
[...]
> +/*\
> + *
> + * Check signal:signal_generate gives 2 more fields: grp res
> + *
> + */
Remove the blank lines before/after the description inside the /*\ block.
> + if (file_contains(TRACE_FILE, "grp=") && file_contains(TRACE_FILE, "res="))
The old test used 'grp=[0-9] res=[0-9]' which verified both fields appear on
the same line with digit values. This only checks for substrings independently,
which is less strict.
Also, there is no .gitignore in the ftrace_test directory. Please add one
with entries for ftrace_regression01 and ftrace_regression02.
Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-03-30 8:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 8:05 [LTP] [PATCH 1/2] Rewrite ftrace_regression01.sh with new C API lufei
2026-03-04 8:05 ` [LTP] [PATCH 2/2] Rewrite ftrace_regression02.sh " lufei
2026-03-27 10:34 ` [LTP] [PATCH 1/2] Rewrite ftrace_regression01.sh " Andrea Cervesato via ltp
2026-03-30 7:15 ` [LTP] [PATCH v2] Rewrite ftrace_regression tests " lufei
2026-03-30 8:39 ` Andrea Cervesato via ltp [this message]
2026-03-31 1:55 ` [LTP] [PATCH v3] " lufei
2026-03-31 7:53 ` Petr Vorel
2026-03-31 7:56 ` Petr Vorel
2026-03-31 18:28 ` Cyril Hrubis
2026-03-31 10:01 ` [LTP] [PATCH v4] " lufei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69ca36bf.df0a0220.9a4c5.bfe1@mx.google.com \
--to=ltp@lists.linux.it \
--cc=andrea.cervesato@suse.com \
--cc=lufei@uniontech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox