Re: [PATCH] libtraceevent utest: exit test if mmap fails

Sudip Mukherjee <[email protected]> Mon, 15 Jun 2026 20:25:08 +0100
Newsgroups org.kernel.vger.linux-trace-devel
Message-ID <CADVatmMUERxEkbURZuZfTw+UYB2YCMVxK9nvc-z-u5kKNHxM=g@mail.gmail.com>
Hi Steve,

On Fri, 29 May 2026 at 19:41, Steven Rostedt <[email protected]> wrote:
>
> On Tue, 26 May 2026 19:42:19 +0100
> Sudip Mukherjee <[email protected]> wrote:
>
> > CU_TEST() continues execution even if the test fails. It just records
> > that the test has failed and moves on.
> > So, when libtraceevent is built in a chroot, it can open
> > /sys/kernel/btf/vmlinux but fails in mmap stage and since CU_TEST()
> > does not stop so we get a segfault when tep_load_btf() tries to use
> > the mapped buffer.
> >
> > Signed-off-by: Sudip Mukherjee <[email protected]>
>
> Thanks, but the real fix is here and I'm applying that one:
>
>   https://lore.kernel.org/all/[email protected]/

Tried it today, and the test still fails for me.

Suite: traceevent library
  Test: parse dynamic string event ...irq=0 handler=hellopassed
  Test: parse old dynamic string event ...irq=0 handler=hellopassed
  Test: parse full cpumask ...cpumask=0-63passed
  Test: parse empty cpumask ...cpumask=passed
  Test: parse half-filled cpumask
...cpumask=0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62passed
  Test: parse cpumask spanning 2 bytes ...cpumask=0,15passed
  Test: parse cpumask spanning 3 bytes ...cpumask=0,23passed
  Test: parse cpumask spanning all bytes ...cpumask=0,63passed
  Test: parse sizeof() 8byte values ...int=4 unsigned=4 unsigned int=4
long=8 unsigned long=8 long long=8 unsigned long long=8 s4=4 u4=4 s8=8
u8=8passed
  Test: parse sizeof() 4byte values ...int=4 unsigned=4 unsigned int=4
long=4 unsigned long=4 long long=8 unsigned long long=8 s4=4 u4=4 s8=8
u8=8passed
  Test: parse sizeof() no long size defined ...[FAILED TO PARSE] s4=0
u4=0 s8=0 u8=0x0passed
  Test: read BTF ...FAILED
    1. traceevent-utest.c:410  - read(fd, buf, st.st_size) == st.st_size
    2. traceevent-utest.c:412  - tep_load_btf(test_tep, buf, st.st_size) == 0
    3. traceevent-utest.c:429  - strcmp(s->buffer,
"getname_flags(filename=0x7ffe7d33f3d0, flags=0)\n") == 0

Run Summary:    Type  Total    Ran Passed Failed Inactive
              suites      1      1    n/a      0        0
               tests     12     12     11      1        0
             asserts     46     46     43      3      n/a



-- 
Regards
Sudip