Skip to content

Commit 15f0db9

Browse files
author
Fox Snowpatch
committed
1 parent 182544a commit 15f0db9

5 files changed

Lines changed: 44 additions & 5 deletions

File tree

tools/perf/tests/shell/base_probe/test_adding_kernel.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,23 @@ TEST_RESULT=0
2323
. "$DIR_PATH/../lib/probe_vfs_getname.sh"
2424

2525
TEST_PROBE=${TEST_PROBE:-"inode_permission"}
26+
PROBE_NO_LINE_CHECK=1
2627

2728
# set NO_DEBUGINFO to skip testcase if debuginfo is not present
2829
# skip_if_no_debuginfo returns 2 if debuginfo is not present
29-
skip_if_no_debuginfo
30+
#
31+
# The perf probe checks which depends on presence of debuginfo and
32+
# used in this testcase are:
33+
# 1. probe add for inode_permission
34+
# 2. probe max-probes option using 'vfs_* $params'
35+
# 3. non-existing variable probing
36+
#
37+
# For these tests, probe check for specific line is not
38+
# required ( add_probe_vfs_getname does that ). So call
39+
# skip_if_no_debuginfo with argument as 1. This is to convey
40+
# that test only needs to check for debuginfo, and not specifically
41+
# line number
42+
skip_if_no_debuginfo $PROBE_NO_LINE_CHECK
3043
if [ $? -eq 2 ]; then
3144
NO_DEBUGINFO=1
3245
fi

tools/perf/tests/shell/lib/probe_vfs_getname.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,18 @@ add_probe_vfs_getname() {
3939
}
4040

4141
skip_if_no_debuginfo() {
42-
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
42+
no_line_check=$1
43+
debug_str="^(Failed to find the path for the kernel|Debuginfo-analysis is not supported)|(file has no debug information)"
44+
45+
# search for debug_str using simple perf probe if the
46+
# test only needs to check for debuginfo, and not specifically
47+
# line number.
48+
if [ $no_line_check -eq 1 ]; then
49+
perf probe -vn --add 'inode_permission $params' 2>&1 | grep -E -q "$debug_str" && return 2
50+
else
51+
add_probe_vfs_getname -v 2>&1 | grep -E -q "$debug_str" && return 2
52+
fi
53+
4354
return 1
4455
}
4556

tools/perf/tests/shell/probe_vfs_getname.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@ skip_if_no_perf_probe || exit 2
1616
add_probe_vfs_getname
1717
err=$?
1818

19+
# Invoke skip_if_no_debuginfo with argument as 0,
20+
# since the test needs suitable line number for getname
21+
# along with debuginfo check.
22+
# Argument "1" is used when to convey that test only needs to
23+
# check for debuginfo, and not specifically line number.
1924
if [ $err -eq 1 ] ; then
20-
skip_if_no_debuginfo
25+
skip_if_no_debuginfo 0
2126
err=$?
2227
fi
2328

tools/perf/tests/shell/record+script_probe_vfs_getname.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@ perf_script_filenames() {
3838
add_probe_vfs_getname
3939
err=$?
4040

41+
# Invoke skip_if_no_debuginfo with argument as 0,
42+
# since the test needs suitable line number for getname
43+
# along with debuginfo check.
44+
# Argument "1" is used when to convey that test only needs to
45+
# check for debuginfo, and not specifically line number.
4146
if [ $err -eq 1 ] ; then
42-
skip_if_no_debuginfo
47+
skip_if_no_debuginfo 0
4348
err=$?
4449
fi
4550

tools/perf/tests/shell/trace+probe_vfs_getname.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,13 @@ trace_open_vfs_getname() {
2828
add_probe_vfs_getname
2929
err=$?
3030

31+
# Invoke skip_if_no_debuginfo with argument as 0,
32+
# since the test needs suitable line number for getname
33+
# along with debuginfo check.
34+
# Argument "1" is used when to convey that test only needs to
35+
# check for debuginfo, and not specifically line number.
3136
if [ $err -eq 1 ] ; then
32-
skip_if_no_debuginfo
37+
skip_if_no_debuginfo 0
3338
err=$?
3439
fi
3540

0 commit comments

Comments
 (0)