Re: [PATCH V3] tools/perf/tests: Update test_adding_kernel.sh to handle proper debuginfo check
From: Athira Rajeev <hidden>
Date: 2026-06-09 14:25:42
Also in:
linux-perf-users
On 21 May 2026, at 2:01 PM, Athira Rajeev [off-list ref] wrote:quoted
On 29 Apr 2026, at 7:01 PM, Venkat [off-list ref] wrote:quoted
On 24 Apr 2026, at 10:54 PM, Athira Rajeev [off-list ref] wrote: Perf test perftool-testsuite_probe fails as below: Regexp not found: "\s*probe:inode_permission(?:_\d+)?\s+\(on inode_permission(?:[:\+][0-9A-Fa-f]+)?@.+\)" -- [ FAIL ] -- perf_probe :: test_adding_kernel :: listing added probe :: perf probe -l (output regexp parsing) -- [ PASS ] -- perf_probe :: test_adding_kernel :: removing multiple probes Regexp not found: "probe:vfs_mknod" Regexp not found: "probe:vfs_create" Regexp not found: "probe:vfs_rmdir" Regexp not found: "probe:vfs_link" Regexp not found: "probe:vfs_write" -- [ FAIL ] -- perf_probe :: test_adding_kernel :: wildcard adding support (command exitcode + output regexp parsing) Regexp not found: "somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64" Regexp not found: "in this function|at this address" -- [ FAIL ] -- perf_probe :: test_adding_kernel :: non-existing variable (output regexp parsing) ## [ FAIL ] ## perf_probe :: test_adding_kernel SUMMARY :: 3 failures found Further analysing, the failed testcase is for "test_adding_kernel". If the kernel debuginfo is missing, perf probe fails as below: perf probe -nf --max-probes=512 -a 'vfs_* $params' Failed to find the path for the kernel: No such file or directory Error: Failed to add events. skip_if_no_debuginfo has check to handle whether debuginfo is present and the testcase checks for debuginfo since this : commit 90d32e92011e ("tools/perf: Handle perftool-testsuite_probe testcases fail when kernel debuginfo is not present") Recently a change got added in "tests/shell/lib/probe_vfs_getname.sh" via this another fix: commit 92b664dcefab ("perf test probe_vfs_getname: Skip if no suitable line detected") Since this commit, first add_probe_vfs_getname is used to prevent false failures. And based on return code of add_probe_vfs_getname, skip_if_no_debuginfo is used to skip testcase if debuginfo is present. And this modified other testcases to call add_probe_vfs_getname first and invoke skip_if_no_debuginfo based on return value. The tests in test_adding_kernel.sh which depends on presence of debuginfo are: 1. probe add for inode_permission 2. probe max-probes option using 'vfs_* $params' 3. non-existing variable probing For these tests, probe check for specific line is not required. So call skip_if_no_debuginfo with argument to say if line check is needed. This is to convey to skip_if_no_debuginfo() function that test only needs to check for debuginfo, and not specifically line number. Update skip_if_no_debuginfo to use simple "perf probe" check if test only needs to check for debuginfo. And for other tests which rely on line number, use add_probe_vfs_getname() Update other places which uses skip_if_no_debuginfo to use argument as zero. With the change, verified that only three which required debuginfo only is skipped and others ran successfully. Also tested with debuginfo to make sure tests are not skipped. Reported-by: Tejas Manhas <redacted> Reviewed-by: Ian Rogers <irogers@google.com> Signed-off-by: Athira Rajeev <redacted> ---Tested this patch, by applying on top of mainline, and it fixes the reported issue. Without this patch: # ./perf test -v perftool-testsuite_probe--- start ---test child forked, pid 15772 Probing start_text -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: adding blacklisted function start_text -- [ PASS ] -- perf_probe :: test_adding_blacklisted :: listing blacklisted probe (should NOT be listed) ## [ PASS ] ## perf_probe :: test_adding_blacklisted SUMMARY -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: -a -- [ PASS ] -- perf_probe :: test_adding_kernel :: adding probe inode_permission :: --add -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing added probe :: perf list Regexp not found: "\s*probe:inode_permission(?:_\d+)?\s+\(on inode_permission(?:[:\+][0-9A-Fa-f]+)?@.+\)" -- [ FAIL ] -- perf_probe :: test_adding_kernel :: listing added probe :: perf probe -l (output regexp parsing) -- [ PASS ] -- perf_probe :: test_adding_kernel :: using added probe -- [ PASS ] -- perf_probe :: test_adding_kernel :: deleting added probe -- [ PASS ] -- perf_probe :: test_adding_kernel :: listing removed probe (should NOT be listed) -- [ PASS ] -- perf_probe :: test_adding_kernel :: dry run :: adding probe -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: first probe adding -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: second probe adding (without force) -- [ PASS ] -- perf_probe :: test_adding_kernel :: force-adding probes :: second probe adding (with force) -- [ PASS ] -- perf_probe :: test_adding_kernel :: using doubled probe -- [ PASS ] -- perf_probe :: test_adding_kernel :: removing multiple probes Regexp not found: "probe:vfs_mknod" Regexp not found: "probe:vfs_create" Regexp not found: "probe:vfs_rmdir" Regexp not found: "probe:vfs_link" Regexp not found: "probe:vfs_write" -- [ FAIL ] -- perf_probe :: test_adding_kernel :: wildcard adding support (command exitcode + output regexp parsing) Regexp not found: "Failed to find" Regexp not found: "somenonexistingrandomstuffwhichisalsoprettylongorevenlongertoexceed64" Regexp not found: "in this function|at this address" Line did not match any pattern: "The /lib/modules/7.1.0-rc1+/build/vmlinux file has no debug information." Line did not match any pattern: "Rebuild with CONFIG_DEBUG_INFO=y, or install an appropriate debuginfo package." -- [ FAIL ] -- perf_probe :: test_adding_kernel :: non-existing variable (output regexp parsing) -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with retval :: add -- [ PASS ] -- perf_probe :: test_adding_kernel :: function with retval :: record -- [ PASS ] -- perf_probe :: test_adding_kernel :: function argument probing :: script ## [ FAIL ] ## perf_probe :: test_adding_kernel SUMMARY :: 3 failures found -- [ SKIP ] -- perf_probe :: test_basic :: help message :: testcase skipped -- [ PASS ] -- perf_probe :: test_basic :: usage message -- [ PASS ] -- perf_probe :: test_basic :: quiet switch ## [ PASS ] ## perf_probe :: test_basic SUMMARY -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -a -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -d -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -L -- [ PASS ] -- perf_probe :: test_invalid_options :: missing argument for -V -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary argument for -F -- [ PASS ] -- perf_probe :: test_invalid_options :: unnecessary argument for -l -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -d xxx -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -L foo -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -V foo -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -l -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -a xxx -F -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -L foo -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -V foo -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -l -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -d xxx -F -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -V bar -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -l -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -L foo -F -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -V foo -l -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -V foo -F -- [ PASS ] -- perf_probe :: test_invalid_options :: mutually exclusive options :: -l -F ## [ PASS ] ## perf_probe :: test_invalid_options SUMMARY -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:10 -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:0-10 -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func:2+10 -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func@source.c -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: func@source.c:1 -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1 -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1+1 -- [ PASS ] -- perf_probe :: test_line_semantics :: acceptable descriptions :: source.c:1-10 -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:foo -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:1-foo -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func:1+foo -- [ PASS ] -- perf_probe :: test_line_semantics :: unacceptable descriptions :: func;lazy\*pattern ## [ PASS ] ## perf_probe :: test_line_semantics SUMMARY ---- end(-1) ---- 137: perftool-testsuite_probe : FAILED! With This patch: # ./perf test -v perftool-testsuite_probe 137: perftool-testsuite_probe : Ok Please add below tag. Tested-by: Venkat Rao Bagalkote <redacted> Regards, Venkat.Hi, Can we please have this pulled in, if the patches looks fine ? Thanks Athira
Hi, Looking for any further review comments on this patch. Please suggest if any changes needs to be addressed. Thanks Athira
quoted
quoted
Changelog: v2 -> v3: - Update other callsites to use "skip_if_no_debuginfo 0" - Use "perf probe -vn --add inode_permission $params" v1 -> v2: - First version used "perf probe -v -L getname_flags" for debuginfo check. This will not catch fail string "Debuginfo-analysis is not supported" which is used in cases when perf is built without dwarf. So use "perf probe -vn add inode_permission" to capture cases when tools built with NO_LIBDWARF=1. This will capture debuginfo missing as well as tool built without dwarf case. .../tests/shell/base_probe/test_adding_kernel.sh | 15 ++++++++++++++- tools/perf/tests/shell/lib/probe_vfs_getname.sh | 13 ++++++++++++- tools/perf/tests/shell/probe_vfs_getname.sh | 7 ++++++- .../shell/record+script_probe_vfs_getname.sh | 7 ++++++- tools/perf/tests/shell/trace+probe_vfs_getname.sh | 7 ++++++- 5 files changed, 44 insertions(+), 5 deletions(-)diff --git a/tools/perf/tests/shell/base_probe/test_adding_kernel.sh b/tools/perf/tests/shell/base_probe/test_adding_kernel.sh index 555a825d55f2..f3db125c8669 100755 --- a/tools/perf/tests/shell/base_probe/test_adding_kernel.sh +++ b/tools/perf/tests/shell/base_probe/test_adding_kernel.sh@@ -23,10 +23,23 @@ TEST_RESULT=0. "$DIR_PATH/../lib/probe_vfs_getname.sh" TEST_PROBE=${TEST_PROBE:-"inode_permission"} +PROBE_NO_LINE_CHECK=1 # set NO_DEBUGINFO to skip testcase if debuginfo is not present # skip_if_no_debuginfo returns 2 if debuginfo is not present -skip_if_no_debuginfo +# +# The perf probe checks which depends on presence of debuginfo and +# used in this testcase are: +# 1. probe add for inode_permission +# 2. probe max-probes option using 'vfs_* $params' +# 3. non-existing variable probing +# +# For these tests, probe check for specific line is not +# required ( add_probe_vfs_getname does that ). So call +# skip_if_no_debuginfo with argument as 1. This is to convey +# that test only needs to check for debuginfo, and not specifically +# line number +skip_if_no_debuginfo $PROBE_NO_LINE_CHECK if [ $? -eq 2 ]; then NO_DEBUGINFO=1 fidiff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh index 88cd0e26d5f6..2c5252a38ea1 100644 --- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh +++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh@@ -39,7 +39,18 @@ add_probe_vfs_getname() {} skip_if_no_debuginfo() { - add_probe_vfs_getname -v 2>&1 | grep -E -q "^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" && return 2 + no_line_check=$1 + debug_str="^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)" + + # search for debug_str using simple perf probe if the + # test only needs to check for debuginfo, and not specifically + # line number. + if [ $no_line_check -eq 1 ]; then + perf probe -vn --add 'inode_permission $params' 2>&1 | grep -E -q "$debug_str" && return 2 + else + add_probe_vfs_getname -v 2>&1 | grep -E -q "$debug_str" && return 2 + fi + return 1 }diff --git a/tools/perf/tests/shell/probe_vfs_getname.sh b/tools/perf/tests/shell/probe_vfs_getname.sh index 5fe5682c28ce..b0878f571449 100755 --- a/tools/perf/tests/shell/probe_vfs_getname.sh +++ b/tools/perf/tests/shell/probe_vfs_getname.sh@@ -16,8 +16,13 @@ skip_if_no_perf_probe || exit 2add_probe_vfs_getname err=$? +# Invoke skip_if_no_debuginfo with argument as 0, +# since the test needs suitable line number for getname +# along with debuginfo check. +# Argument "1" is used when to convey that test only needs to +# check for debuginfo, and not specifically line number. if [ $err -eq 1 ] ; then - skip_if_no_debuginfo + skip_if_no_debuginfo 0 err=$? fidiff --git a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh index 002f7037f182..48063fc2b221 100755 --- a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh +++ b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh@@ -38,8 +38,13 @@ perf_script_filenames() {add_probe_vfs_getname err=$? +# Invoke skip_if_no_debuginfo with argument as 0, +# since the test needs suitable line number for getname +# along with debuginfo check. +# Argument "1" is used when to convey that test only needs to +# check for debuginfo, and not specifically line number. if [ $err -eq 1 ] ; then - skip_if_no_debuginfo + skip_if_no_debuginfo 0 err=$? fidiff --git a/tools/perf/tests/shell/trace+probe_vfs_getname.sh b/tools/perf/tests/shell/trace+probe_vfs_getname.sh index 7a0b1145d0cd..6833fba12086 100755 --- a/tools/perf/tests/shell/trace+probe_vfs_getname.sh +++ b/tools/perf/tests/shell/trace+probe_vfs_getname.sh@@ -28,8 +28,13 @@ trace_open_vfs_getname() {add_probe_vfs_getname err=$? +# Invoke skip_if_no_debuginfo with argument as 0, +# since the test needs suitable line number for getname +# along with debuginfo check. +# Argument "1" is used when to convey that test only needs to +# check for debuginfo, and not specifically line number. if [ $err -eq 1 ] ; then - skip_if_no_debuginfo + skip_if_no_debuginfo 0 err=$? fi -- 2.47.3