forked from friendlyarm/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf test shell: Check if 'perf probe' is available, skip tests if not
Add a library function that checks if 'perf probe' is built into the tool being tested, skipping tests that need it. Testing it on a system after removing the library needed to build 'probe' as a perf subcommand: # perf test ping vfs_getname 59: Use vfs_getname probe to get syscall args filenames : Skip 60: probe libc's inet_pton & backtrace it with ping : Skip 61: Check open filename arg using perf trace + vfs_getname: Skip 62: Add vfs_getname probe to get syscall args filenames : Skip # perf probe perf: 'probe' is not a perf-command. See 'perf --help'. # Now reinstalling elfutils-libelf-devel on this Fedora 26 system to rebuild perf and then retest this: # perf test ping vfs_getname 60: Use vfs_getname probe to get syscall args filenames : Ok 61: probe libc's inet_pton & backtrace it with ping : Ok 62: Check open filename arg using perf trace + vfs_getname: Ok 63: Add vfs_getname probe to get syscall args filenames : Ok # Reported-by: Kim Phillips <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Michael Petlan <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Thomas Richter <[email protected]> Cc: Wang Nan <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
- Loading branch information
Showing
6 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Arnaldo Carvalho de Melo <[email protected]>, 2017 | ||
|
||
skip_if_no_perf_probe() { | ||
perf probe |& grep -q 'is not a perf-command' && return 2 | ||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Arnaldo Carvalho de Melo <[email protected]>, 2017 | ||
|
||
perf probe -l | grep -q probe:vfs_getname | ||
perf probe -l |& grep -q probe:vfs_getname | ||
had_vfs_getname=$? | ||
|
||
cleanup_probe_vfs_getname() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,10 @@ | |
# | ||
# Arnaldo Carvalho de Melo <[email protected]>, 2017 | ||
|
||
. $(dirname $0)/lib/probe.sh | ||
|
||
skip_if_no_perf_probe || exit 2 | ||
|
||
. $(dirname $0)/lib/probe_vfs_getname.sh | ||
|
||
add_probe_vfs_getname || skip_if_no_debuginfo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ | |
|
||
# Arnaldo Carvalho de Melo <[email protected]>, 2017 | ||
|
||
. $(dirname $0)/lib/probe.sh | ||
|
||
skip_if_no_perf_probe || exit 2 | ||
|
||
. $(dirname $0)/lib/probe_vfs_getname.sh | ||
|
||
perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
|
||
# Arnaldo Carvalho de Melo <[email protected]>, 2017 | ||
|
||
. $(dirname $0)/lib/probe.sh | ||
|
||
trace_libc_inet_pton_backtrace() { | ||
idx=0 | ||
expected[0]="PING.*bytes" | ||
|
@@ -32,6 +34,7 @@ trace_libc_inet_pton_backtrace() { | |
done | ||
} | ||
|
||
skip_if_no_perf_probe && \ | ||
perf probe -q /lib64/libc-*.so inet_pton && \ | ||
trace_libc_inet_pton_backtrace | ||
err=$? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,10 @@ | |
|
||
# Arnaldo Carvalho de Melo <[email protected]>, 2017 | ||
|
||
. $(dirname $0)/lib/probe.sh | ||
|
||
skip_if_no_perf_probe || exit 2 | ||
|
||
. $(dirname $0)/lib/probe_vfs_getname.sh | ||
|
||
file=$(mktemp /tmp/temporary_file.XXXXX) | ||
|