From: Thomas Perale via buildroot <buildroot@buildroot.org>
To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Thomas Perale <thomas.perale@mind.be>, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 3/3] support/testing: add bpftrace test
Date: Fri, 4 Sep 2026 14:19:06 +0200 [thread overview]
Message-ID: <20260904121906.406574-1-thomas.perale@mind.be> (raw)
In-Reply-To: <20260827095520.1049186-3-thomas.petazzoni@bootlin.com>
In reply of:
> This commit adds a simple bpftrace test that ensures that not only it
> builds fine, but it also runs properly on a minimal test scenario.
>
> Assisted-by: GPT-5.6
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Applied to 2025.02.x & 2026.05.x. Thanks
> ---
> DEVELOPERS | 2 +
> .../testing/tests/package/test_bpftrace.py | 66 +++++++++++++++++++
> .../test_bpftrace/linux-bpftrace.fragment | 4 ++
> 3 files changed, 72 insertions(+)
> create mode 100644 support/testing/tests/package/test_bpftrace.py
> create mode 100644 support/testing/tests/package/test_bpftrace/linux-bpftrace.fragment
>
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 5eb438906f..080aaac5e0 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -3297,6 +3297,8 @@ F: support/testing/tests/package/sample_python_flask_expects_json.py
> F: support/testing/tests/package/sample_python_git.py
> F: support/testing/tests/package/sample_python_pyudev.py
> F: support/testing/tests/package/sample_python_unittest_xml_reporting.py
> +F: support/testing/tests/package/test_bpftrace.py
> +F: support/testing/tests/package/test_bpftrace/linux-bpftrace.fragment
> F: support/testing/tests/package/test_nodejs.py
> F: support/testing/tests/package/test_python_augeas.py
> F: support/testing/tests/package/test_python_crccheck.py
> diff --git a/support/testing/tests/package/test_bpftrace.py b/support/testing/tests/package/test_bpftrace.py
> new file mode 100644
> index 0000000000..70ccfe8b20
> --- /dev/null
> +++ b/support/testing/tests/package/test_bpftrace.py
> @@ -0,0 +1,66 @@
> +import os
> +
> +import infra.basetest
> +
> +
> +# gitlab-runner: 2xlarge
> +class TestBpftrace(infra.basetest.BRTest):
> + kern_fragment = infra.filepath(
> + "tests/package/test_bpftrace/linux-bpftrace.fragment"
> + )
> + config = f"""
> + BR2_aarch64=y
> + BR2_TOOLCHAIN_EXTERNAL=y
> + BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
> + BR2_LINUX_KERNEL=y
> + BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> + BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.32"
> + BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
> + BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
> + BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{kern_fragment}"
> + BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> + BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
> + BR2_PACKAGE_BPFTRACE=y
> + BR2_PACKAGE_TAR=y
> + BR2_TARGET_ROOTFS_EXT2=y
> + BR2_TARGET_ROOTFS_EXT2_4=y
> + BR2_TARGET_ROOTFS_EXT2_SIZE="256M"
> + # BR2_TARGET_ROOTFS_TAR is not set
> + """
> +
> + def test_run(self):
> + drive = os.path.join(self.builddir, "images", "rootfs.ext4")
> + kern = os.path.join(self.builddir, "images", "Image")
> + self.emulator.boot(
> + arch="aarch64",
> + kernel=kern,
> + kernel_cmdline=["root=/dev/vda console=ttyAMA0"],
> + options=[
> + "-M",
> + "virt",
> + "-cpu",
> + "cortex-a57",
> + "-m",
> + "256M",
> + "-drive",
> + f"file={drive},if=virtio,format=raw",
> + ],
> + )
> + self.emulator.login()
> +
> + self.assertRunOk("mount -t debugfs none /sys/kernel/debug/")
> +
> + # Check that bpftrace can find a syscall tracepoint.
> + self.assertRunOk("bpftrace -l 'tracepoint:syscalls:sys_enter_execve'")
> +
> + # Compile and attach a tracepoint program, then trigger it with the
> + # command executed by bpftrace. The marker avoids matching volatile
> + # fields such as PIDs or command names.
> + cmd = (
> + "bpftrace -e 'tracepoint:syscalls:sys_enter_execve "
> + '{ printf("buildroot-bpftrace-test\\n"); exit(); }\' '
> + "-c /bin/true"
> + )
> + output, ret = self.emulator.run(cmd)
> + self.assertEqual(ret, 0)
> + self.assertIn("buildroot-bpftrace-test", "\n".join(output))
> diff --git a/support/testing/tests/package/test_bpftrace/linux-bpftrace.fragment b/support/testing/tests/package/test_bpftrace/linux-bpftrace.fragment
> new file mode 100644
> index 0000000000..35359b08f6
> --- /dev/null
> +++ b/support/testing/tests/package/test_bpftrace/linux-bpftrace.fragment
> @@ -0,0 +1,4 @@
> +CONFIG_FTRACE=y
> +CONFIG_FTRACE_SYSCALLS=y
> +CONFIG_FUNCTION_TRACER=y
> +CONFIG_KPROBES=y
> --
> 2.55.0
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2026-09-04 12:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 9:55 [Buildroot] [PATCH 1/3] package/libbpf: update UAPI header installation work-around Thomas Petazzoni via buildroot
2026-08-27 9:55 ` [Buildroot] [PATCH 2/3] package/bpftrace: bump to version 0.26.1 to fix build with LLVM 22 Thomas Petazzoni via buildroot
2026-09-04 12:17 ` Thomas Perale via buildroot
2026-08-27 9:55 ` [Buildroot] [PATCH 3/3] support/testing: add bpftrace test Thomas Petazzoni via buildroot
2026-08-29 14:19 ` Peter Korsgaard
2026-08-29 16:52 ` Julien Olivain via buildroot
2026-08-29 17:49 ` Peter Korsgaard
2026-08-29 18:45 ` Thomas Petazzoni via buildroot
2026-08-29 19:24 ` Julien Olivain via buildroot
2026-09-04 12:19 ` Thomas Perale via buildroot [this message]
2026-08-28 10:58 ` [Buildroot] [PATCH 1/3] package/libbpf: update UAPI header installation work-around Julien Olivain via buildroot
2026-09-04 12:17 ` Thomas Perale via buildroot
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=20260904121906.406574-1-thomas.perale@mind.be \
--to=buildroot@buildroot.org \
--cc=thomas.perale@mind.be \
--cc=thomas.petazzoni@bootlin.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