Skip to content

Commit

Permalink
tests default_vmlinux_btf: Cover the no args segfault too
Browse files Browse the repository at this point in the history
  root@x1:/home/acme/git/pahole# pahole --running_kernel_vmlinux
  pahole: couldn't find a vmlinux that matches the running kernel
  HINT: Maybe you're inside a container or missing a debuginfo package?
  root@x1:/home/acme/git/pahole# tests/default_vmlinux_btf.sh
  Default BTF on a system without BTF: FAILED
  root@x1:/home/acme/git/pahole# pahole
  Segmentation fault (core dumped)
  root@x1:/home/acme/git/pahole#

Reported-by: Matthias Schwarzott <[email protected]>
Reviewed-by: Alan Maguire <[email protected]>
Tested-by: Alan Maguire <[email protected]>
Acked-by: Eduard Zingerman <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Song Liu <[email protected]>
Cc: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/all/ZzzQEdPoMDoGjI5z@x1
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Nov 19, 2024
1 parent 031495f commit 98d1f01
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/default_vmlinux_btf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,16 @@ if [ $nr_lines -eq 0 ] ; then
exit 1
fi

# There is also the case where no debugging info is available, be it DWARF of
# BTF and it segfaults when calling just 'pahole', with no args, so check for
# that as well
#
nr_lines=$(PAHOLE_VMLINUX_BTF_FILENAME=foobar pahole 2>&1 | wc -l)

if [ $nr_lines -eq 0 ] ; then
echo "FAILED"
exit 1
fi

echo "Ok"
exit 0

0 comments on commit 98d1f01

Please sign in to comment.