[PATCH v2 0/2] libtraceevent: Fix BTF utest host dependencies

Cao Ruichuang <[email protected]> Tue, 2 Jun 2026 00:52:55 +0800
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <[email protected]>
Fix two independent host-dependent failures in the BTF utest.

The first patch handles short reads from /sys/kernel/btf/vmlinux after
mmap() fails. On a Rocky Linux 9.7 system, mmap() fails with ENODEV and a
single read() returns 4096 bytes from a 5150407-byte BTF file, while a read
loop returns the full file.

The second patch avoids failing the exact getname_flags() output check when
the host kernel BTF has extra arguments appended after the expected
arguments. On the same system, getname_flags() has a third parameter named
"empty", so tep_btf_print_args() correctly prints:

  getname_flags(filename=0x7ffe7d33f3d0, flags=0, empty=0x0)

Validation was done on x86_64 Rocky Linux 9.7, kernel
5.14.0-570.42.2.el9_6.x86_64:

  make -j$(nproc)
  make test
  ./utest/trace-utest -r traceevent

All commands completed successfully after this series.

Changes since v1:
- In patch 1, fold the read_full() call into CU_TEST() so that
  future CUnit failure output reports the actual failing expression
  instead of only "ret == 0", as suggested by Steven.
- No code changes in patch 2.

Cao Ruichuang (2):
  libtraceevent utest: Handle short reads when reading BTF
  libtraceevent utest: Avoid host-specific getname_flags output

 utest/traceevent-utest.c | 52 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 2 deletions(-)

-- 
2.39.5 (Apple Git-154)