* [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test
@ 2023-02-01 18:04 Athira Rajeev
2023-02-01 18:04 ` [PATCH 2/2] tests/shell: Fix perf test shell to check for libtracevent support Athira Rajeev
2023-02-02 0:40 ` [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test Arnaldo Carvalho de Melo
0 siblings, 2 replies; 4+ messages in thread
From: Athira Rajeev @ 2023-02-01 18:04 UTC (permalink / raw)
To: acme, jolsa
Cc: ak, namhyung, irogers, james.clark, mpe, linux-perf-users,
linuxppc-dev, maddy, rnsastry, kjain, disgoel
"probe libc's inet_pton & backtrace it with ping" test
installs a uprobe and uses perf record/script to check
the backtrace. Currently even if the "perf record" fails,
the test reports success. Logs below:
# ./perf test -v "probe libc's inet_pton & backtrace it with ping"
81: probe libc's inet_pton & backtrace it with ping :
--- start ---
test child forked, pid 304211
failed to open /tmp/perf.data.Btf: No such file or directory
test child finished with 0
---- end ----
probe libc's inet_pton & backtrace it with ping: Ok
Fix this by adding check for presence of perf.data file
before proceeding with "perf script".
With the patch changes, test reports fail correctly.
# ./perf test -v "probe libc's inet_pton & backtrace it with ping"
81: probe libc's inet_pton & backtrace it with ping :
--- start ---
test child forked, pid 304358
FAIL: perf record failed to create "/tmp/perf.data.Uoi"
test child finished with -1
---- end ----
probe libc's inet_pton & backtrace it with ping: FAILED!
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
index 57e7a6a470c9..08cdd902d0cf 100755
--- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
@@ -58,6 +58,11 @@ trace_libc_inet_pton_backtrace() {
perf_data=`mktemp -u /tmp/perf.data.XXX`
perf_script=`mktemp -u /tmp/perf.script.XXX`
perf record -e $event_name/$eventattr/ -o $perf_data ping -6 -c 1 ::1 > /dev/null 2>&1
+ # check if perf data file got created in above step.
+ if [ ! -e $perf_data ]; then
+ printf "FAIL: perf record failed to create \"%s\" \n" "$perf_data"
+ return 1
+ fi
perf script -i $perf_data | tac | grep -m1 ^ping -B9 | tac > $perf_script
exec 3<$perf_script
--
2.39.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] tests/shell: Fix perf test shell to check for libtracevent support
2023-02-01 18:04 [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test Athira Rajeev
@ 2023-02-01 18:04 ` Athira Rajeev
2023-02-02 0:40 ` [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test Arnaldo Carvalho de Melo
1 sibling, 0 replies; 4+ messages in thread
From: Athira Rajeev @ 2023-02-01 18:04 UTC (permalink / raw)
To: acme, jolsa
Cc: ak, namhyung, irogers, james.clark, mpe, linux-perf-users,
linuxppc-dev, maddy, rnsastry, kjain, disgoel
Test “Use vfs_getname probe to get syscall args filenames”
fails in environment with missing libtraceevent
support as below:
82: Use vfs_getname probe to get syscall args filenames :
--- start ---
test child forked, pid 304726
Recording open file:
event syntax error: 'probe:vfs_getname*'
\___ unsupported tracepoint
libtraceevent is necessary for tracepoint support
Run 'perf list' for a list of valid events
Usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
-e, --event <event> event selector. use 'perf list' to list available events
test child finished with -1
---- end ----
Use vfs_getname probe to get syscall args filenames: FAILED!
The environment has debuginfo but is missing the libtraceevent
devel. Hence perf is compiled without libtraceevent support.
The test tries to add probe “probe:vfs_getname” and then
uses it with “perf record”. This fails at function
“parse_events_add_tracepoint" due to missing libtraceevent.
Similarly "probe libc's inet_pton & backtrace it with ping" test
slso fails with same reason.
Add a function in 'perf test shell' library to check if perf
record with —dry-run reports any error on missing support
for libtraceevent. Update both the tests to use this new
function “skip_no_probe_record_support” before proceeding
With using probe point via perf builtin record.
With the change,
82: Use vfs_getname probe to get syscall args filenames :
--- start ---
test child forked, pid 305014
Recording open file:
libtraceevent is necessary for tracepoint support
test child finished with -2
---- end ----
Use vfs_getname probe to get syscall args filenames: Skip
81: probe libc's inet_pton & backtrace it with ping :
--- start ---
test child forked, pid 305036
libtraceevent is necessary for tracepoint support
test child finished with -2
---- end ----
probe libc's inet_pton & backtrace it with ping: Skip
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
---
tools/perf/tests/shell/lib/probe_vfs_getname.sh | 8 ++++++++
tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 6 ++++++
tools/perf/tests/shell/record+script_probe_vfs_getname.sh | 3 +++
3 files changed, 17 insertions(+)
diff --git a/tools/perf/tests/shell/lib/probe_vfs_getname.sh b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
index ed0a3972c4c8..60c5e34f90c4 100644
--- a/tools/perf/tests/shell/lib/probe_vfs_getname.sh
+++ b/tools/perf/tests/shell/lib/probe_vfs_getname.sh
@@ -22,3 +22,11 @@ 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
return 1
}
+
+# check if perf is compiled with libtraceevent support
+skip_no_probe_record_support() {
+ if [ $had_vfs_getname -eq 1 ] ; then
+ perf record --dry-run -e $1 2>&1 | grep "libtraceevent is necessary for tracepoint support" && return 2
+ return 1
+ fi
+}
diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
index 08cdd902d0cf..b4149b2db4c6 100755
--- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
@@ -11,6 +11,7 @@
# Arnaldo Carvalho de Melo <acme@kernel.org>, 2017
. $(dirname $0)/lib/probe.sh
+. $(dirname $0)/lib/probe_vfs_getname.sh
libc=$(grep -w libc /proc/self/maps | head -1 | sed -r 's/.*[[:space:]](\/.*)/\1/g')
nm -Dg $libc 2>/dev/null | fgrep -q inet_pton || exit 254
@@ -57,6 +58,11 @@ trace_libc_inet_pton_backtrace() {
perf_data=`mktemp -u /tmp/perf.data.XXX`
perf_script=`mktemp -u /tmp/perf.script.XXX`
+
+ # Check presence of libtraceevent support to run perf record
+ skip_no_probe_record_support "$event_name/$eventattr/"
+ [ $? -eq 2 ] && return 2
+
perf record -e $event_name/$eventattr/ -o $perf_data ping -6 -c 1 ::1 > /dev/null 2>&1
# check if perf data file got created in above step.
if [ ! -e $perf_data ]; then
diff --git a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh
index 7f83b2715b9a..1341437e1bd9 100755
--- a/tools/perf/tests/shell/record+script_probe_vfs_getname.sh
+++ b/tools/perf/tests/shell/record+script_probe_vfs_getname.sh
@@ -17,6 +17,9 @@ skip_if_no_perf_probe || exit 2
record_open_file() {
echo "Recording open file:"
+ # Check presence of libtraceevent support to run perf record
+ skip_no_probe_record_support "probe:vfs_getname*"
+ [ $? -eq 2 ] && return 2
perf record -o ${perfdata} -e probe:vfs_getname\* touch $file
}
--
2.39.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test
2023-02-01 18:04 [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test Athira Rajeev
2023-02-01 18:04 ` [PATCH 2/2] tests/shell: Fix perf test shell to check for libtracevent support Athira Rajeev
@ 2023-02-02 0:40 ` Arnaldo Carvalho de Melo
2023-02-02 4:17 ` Athira Rajeev
1 sibling, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2023-02-02 0:40 UTC (permalink / raw)
To: Athira Rajeev
Cc: jolsa, ak, namhyung, irogers, james.clark, mpe, linux-perf-users,
linuxppc-dev, maddy, rnsastry, kjain, disgoel
Em Wed, Feb 01, 2023 at 11:34:20PM +0530, Athira Rajeev escreveu:
> "probe libc's inet_pton & backtrace it with ping" test
> installs a uprobe and uses perf record/script to check
> the backtrace. Currently even if the "perf record" fails,
> the test reports success. Logs below:
>
> # ./perf test -v "probe libc's inet_pton & backtrace it with ping"
> 81: probe libc's inet_pton & backtrace it with ping :
> --- start ---
Please add spaces before --- as this separates the commit log message
from the patch and ends up chopped up when I use git-am.
I'm fixing it now.
- Arnaldo
> test child forked, pid 304211
> failed to open /tmp/perf.data.Btf: No such file or directory
> test child finished with 0
> ---- end ----
> probe libc's inet_pton & backtrace it with ping: Ok
>
> Fix this by adding check for presence of perf.data file
> before proceeding with "perf script".
>
> With the patch changes, test reports fail correctly.
>
> # ./perf test -v "probe libc's inet_pton & backtrace it with ping"
> 81: probe libc's inet_pton & backtrace it with ping :
> --- start ---
> test child forked, pid 304358
> FAIL: perf record failed to create "/tmp/perf.data.Uoi"
> test child finished with -1
> ---- end ----
> probe libc's inet_pton & backtrace it with ping: FAILED!
>
> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
> ---
> tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
> index 57e7a6a470c9..08cdd902d0cf 100755
> --- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
> +++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
> @@ -58,6 +58,11 @@ trace_libc_inet_pton_backtrace() {
> perf_data=`mktemp -u /tmp/perf.data.XXX`
> perf_script=`mktemp -u /tmp/perf.script.XXX`
> perf record -e $event_name/$eventattr/ -o $perf_data ping -6 -c 1 ::1 > /dev/null 2>&1
> + # check if perf data file got created in above step.
> + if [ ! -e $perf_data ]; then
> + printf "FAIL: perf record failed to create \"%s\" \n" "$perf_data"
> + return 1
> + fi
> perf script -i $perf_data | tac | grep -m1 ^ping -B9 | tac > $perf_script
>
> exec 3<$perf_script
> --
> 2.39.0
>
--
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test
2023-02-02 0:40 ` [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test Arnaldo Carvalho de Melo
@ 2023-02-02 4:17 ` Athira Rajeev
0 siblings, 0 replies; 4+ messages in thread
From: Athira Rajeev @ 2023-02-02 4:17 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Jiri Olsa, Andi Kleen, Namhyung Kim, Ian Rogers, James Clark,
Michael Ellerman, linux-perf-users, linuxppc-dev, maddy,
Nageswara Sastry, Kajol Jain, disgoel
> On 02-Feb-2023, at 6:10 AM, Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> Em Wed, Feb 01, 2023 at 11:34:20PM +0530, Athira Rajeev escreveu:
>> "probe libc's inet_pton & backtrace it with ping" test
>> installs a uprobe and uses perf record/script to check
>> the backtrace. Currently even if the "perf record" fails,
>> the test reports success. Logs below:
>>
>> # ./perf test -v "probe libc's inet_pton & backtrace it with ping"
>> 81: probe libc's inet_pton & backtrace it with ping :
>> --- start ---
>
> Please add spaces before --- as this separates the commit log message
> from the patch and ends up chopped up when I use git-am.
>
> I'm fixing it now.
Hi Arnaldo,
Sorry for that, will take care in next patches and thanks for fixing it
Athira
>
> - Arnaldo
>
>> test child forked, pid 304211
>> failed to open /tmp/perf.data.Btf: No such file or directory
>> test child finished with 0
>> ---- end ----
>> probe libc's inet_pton & backtrace it with ping: Ok
>>
>> Fix this by adding check for presence of perf.data file
>> before proceeding with "perf script".
>>
>> With the patch changes, test reports fail correctly.
>>
>> # ./perf test -v "probe libc's inet_pton & backtrace it with ping"
>> 81: probe libc's inet_pton & backtrace it with ping :
>> --- start ---
>> test child forked, pid 304358
>> FAIL: perf record failed to create "/tmp/perf.data.Uoi"
>> test child finished with -1
>> ---- end ----
>> probe libc's inet_pton & backtrace it with ping: FAILED!
>>
>> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
>> ---
>> tools/perf/tests/shell/record+probe_libc_inet_pton.sh | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
>> index 57e7a6a470c9..08cdd902d0cf 100755
>> --- a/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
>> +++ b/tools/perf/tests/shell/record+probe_libc_inet_pton.sh
>> @@ -58,6 +58,11 @@ trace_libc_inet_pton_backtrace() {
>> perf_data=`mktemp -u /tmp/perf.data.XXX`
>> perf_script=`mktemp -u /tmp/perf.script.XXX`
>> perf record -e $event_name/$eventattr/ -o $perf_data ping -6 -c 1 ::1 > /dev/null 2>&1
>> + # check if perf data file got created in above step.
>> + if [ ! -e $perf_data ]; then
>> + printf "FAIL: perf record failed to create \"%s\" \n" "$perf_data"
>> + return 1
>> + fi
>> perf script -i $perf_data | tac | grep -m1 ^ping -B9 | tac > $perf_script
>>
>> exec 3<$perf_script
>> --
>> 2.39.0
>>
>
> --
>
> - Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-02 4:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-01 18:04 [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test Athira Rajeev
2023-02-01 18:04 ` [PATCH 2/2] tests/shell: Fix perf test shell to check for libtracevent support Athira Rajeev
2023-02-02 0:40 ` [PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test Arnaldo Carvalho de Melo
2023-02-02 4:17 ` Athira Rajeev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).