From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: [PATCH v2 0/4] selftests/ftrace: Add a boottime tracing test framework
Date: Wed, 12 Aug 2026 00:34:17 +0900 [thread overview]
Message-ID: <178646245730.428104.4400499381224001727.stgit@devnote2> (raw)
Hi,
This is the v2 series of the boottime tracing test framework to selftests/ftrace.
Previous version is here:
https://lore.kernel.org/all/178635442508.380779.3709136256425432083.stgit@devnote2/
In this version, I fixed some issues pointed by Sashiko[1]. See below changelog
for details.
[1] https://sashiko.dev/#/patchset/178635442508.380779.3709136256425432083.stgit%40devnote2
Changes in v2:
[1/4]
- Add top-level boottime-ktap wrapper script and include it in
TEST_PROGS in Makefile.
- Define BUSYBOX_APPLETS as a global array variable including sleep
and sed.
- Require timeout tool in run_boottime_test.sh and README, and always
invoke QEMU under timeout command to prevent infinite execution loops.
- Add fallback sleep loop safeguard (sleep 100 || break) in guest
init script.
- Support multi-line .qemuopts files using read -r -d '' -a qemu_args.
[3/4]
- Fix buffer_size_kb parsing in cmdline-03-trace-buf-size.sh to handle
unexpanded buffer string output '1 (expanded: 2048)'.
- Use grep -qw in cmdline-04-trace-options.sh to match word options
and avoid matching disabled 'no<option>' entries.
[4/4]
- Increase reserve_mem alignment to 32M (reserve_mem=12M:32M:trace) to
ensure stable physical memory placement across KASLR reboots.
The new run_boottime_test.sh can run tests not only for boottime trace
but also other kernel cmdline tracing options, including persistent
ring buffer and its backup.
Overview
--------
The test runner (`run_boottime_test.sh`) constructs a lightweight initramfs
with busybox and a tracefs checker script from `tests/`, attaches optional
bootconfigs from `bootconfigs/` using the `bootconfig` tool, applies optional
command-line parameters from `cmdlines/`, boots the target kernel image under
QEMU, and reports results according to TAP version 13 format.
Here is an example of the test output.
-----
TAP version 13
1..14
ok 1 01-kprobe
ok 2 02-synth
ok 3 03-eprobe
ok 4 04-fprobe
ok 5 05-tprobe
ok 6 06-instance
ok 7 cmdline-01-ftrace
ok 8 cmdline-02-trace-event
ok 9 cmdline-03-trace-buf-size
ok 10 cmdline-04-trace-options
ok 11 cmdline-05-trace-clock
ok 12 cmdline-06-trace-instance
ok 13 persistent-01-reserve-mem
ok 14 persistent-02-backup-instance
# Totals: pass:14 fail:0 xfail:0 xpass:0 skip:0 error:0
-----
Note that this requires QEMU, busybox and some other tools to run, see README
for more information. If those tools are not installed, this test will be
skipped.
Other discussion
----------------
BTW, I found other similar shell scripts under kselftest for other subsystems.
I think we can make an integrated (standard) QEMU test framework in the
kselftest common directory and reuse it.
Also, maybe we can reconsider using ktest.pl to run these tests.
Thanks,
---
base-commit: 29a86c5e6361caffa7e75e891169e813f82ff688
Masami Hiramatsu (Google) (4):
selftests/ftrace: Add generic boot tracing test framework
selftests/ftrace: Add boot-time tracing testcases
selftests/ftrace: Add kernel cmdline tracing testcases
selftests/ftrace: Add persistent ring buffer testcases
tools/testing/selftests/ftrace/Makefile | 4
tools/testing/selftests/ftrace/boottime-ktap | 6
tools/testing/selftests/ftrace/boottime/Makefile | 10 +
tools/testing/selftests/ftrace/boottime/README | 72 ++++
.../ftrace/boottime/bootconfigs/01-kprobe.bconf | 4
.../ftrace/boottime/bootconfigs/02-synth.bconf | 4
.../ftrace/boottime/bootconfigs/03-eprobe.bconf | 4
.../ftrace/boottime/bootconfigs/04-fprobe.bconf | 4
.../ftrace/boottime/bootconfigs/05-tprobe.bconf | 4
.../ftrace/boottime/bootconfigs/06-instance.bconf | 5
.../boottime/cmdlines/cmdline-01-ftrace.cmdline | 1
.../cmdlines/cmdline-02-trace-event.cmdline | 1
.../cmdlines/cmdline-03-trace-buf-size.cmdline | 1
.../cmdlines/cmdline-04-trace-options.cmdline | 1
.../cmdlines/cmdline-05-trace-clock.cmdline | 1
.../cmdlines/cmdline-06-trace-instance.cmdline | 1
.../cmdlines/persistent-01-reserve-mem.cmdline | 1
.../cmdlines/persistent-02-backup-instance.cmdline | 1
.../selftests/ftrace/boottime/run_boottime_test.sh | 384 ++++++++++++++++++++
.../selftests/ftrace/boottime/tests/01-kprobe.sh | 25 +
.../selftests/ftrace/boottime/tests/02-synth.sh | 25 +
.../selftests/ftrace/boottime/tests/03-eprobe.sh | 25 +
.../selftests/ftrace/boottime/tests/04-fprobe.sh | 25 +
.../selftests/ftrace/boottime/tests/05-tprobe.sh | 25 +
.../selftests/ftrace/boottime/tests/06-instance.sh | 30 ++
.../ftrace/boottime/tests/cmdline-01-ftrace.sh | 19 +
.../boottime/tests/cmdline-02-trace-event.sh | 26 +
.../boottime/tests/cmdline-03-trace-buf-size.sh | 28 +
.../boottime/tests/cmdline-04-trace-options.sh | 23 +
.../boottime/tests/cmdline-05-trace-clock.sh | 19 +
.../boottime/tests/cmdline-06-trace-instance.sh | 24 +
.../boottime/tests/persistent-01-reserve-mem.sh | 28 +
.../tests/persistent-02-backup-instance.sh | 40 ++
tools/testing/selftests/ftrace/config | 6
34 files changed, 875 insertions(+), 2 deletions(-)
create mode 100755 tools/testing/selftests/ftrace/boottime-ktap
create mode 100644 tools/testing/selftests/ftrace/boottime/Makefile
create mode 100644 tools/testing/selftests/ftrace/boottime/README
create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/01-kprobe.bconf
create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/02-synth.bconf
create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/03-eprobe.bconf
create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/04-fprobe.bconf
create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/05-tprobe.bconf
create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/06-instance.bconf
create mode 100644 tools/testing/selftests/ftrace/boottime/cmdlines/cmdline-01-ftrace.cmdline
create mode 100644 tools/testing/selftests/ftrace/boottime/cmdlines/cmdline-02-trace-event.cmdline
create mode 100644 tools/testing/selftests/ftrace/boottime/cmdlines/cmdline-03-trace-buf-size.cmdline
create mode 100644 tools/testing/selftests/ftrace/boottime/cmdlines/cmdline-04-trace-options.cmdline
create mode 100644 tools/testing/selftests/ftrace/boottime/cmdlines/cmdline-05-trace-clock.cmdline
create mode 100644 tools/testing/selftests/ftrace/boottime/cmdlines/cmdline-06-trace-instance.cmdline
create mode 100644 tools/testing/selftests/ftrace/boottime/cmdlines/persistent-01-reserve-mem.cmdline
create mode 100644 tools/testing/selftests/ftrace/boottime/cmdlines/persistent-02-backup-instance.cmdline
create mode 100755 tools/testing/selftests/ftrace/boottime/run_boottime_test.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/01-kprobe.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/02-synth.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/03-eprobe.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/04-fprobe.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/05-tprobe.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/06-instance.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/cmdline-01-ftrace.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/cmdline-02-trace-event.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/cmdline-03-trace-buf-size.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/cmdline-04-trace-options.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/cmdline-05-trace-clock.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/cmdline-06-trace-instance.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/persistent-01-reserve-mem.sh
create mode 100644 tools/testing/selftests/ftrace/boottime/tests/persistent-02-backup-instance.sh
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
next reply other threads:[~2026-08-11 15:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-11 15:34 Masami Hiramatsu (Google) [this message]
2026-08-11 15:34 ` [PATCH v2 1/4] selftests/ftrace: Add generic boot tracing test framework Masami Hiramatsu (Google)
2026-08-11 15:34 ` [PATCH v2 2/4] selftests/ftrace: Add boot-time tracing testcases Masami Hiramatsu (Google)
2026-08-11 15:34 ` [PATCH v2 3/4] selftests/ftrace: Add kernel cmdline " Masami Hiramatsu (Google)
2026-08-11 15:34 ` [PATCH v2 4/4] selftests/ftrace: Add persistent ring buffer testcases Masami Hiramatsu (Google)
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=178646245730.428104.4400499381224001727.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=rostedt@goodmis.org \
--cc=skhan@linuxfoundation.org \
/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