[PATCH 1/2] tests/shell: Add check for perf data file in record+probe_libc_inet_pton test
Arnaldo Carvalho de Melo
acme at kernel.org
Thu Feb 2 11:40:54 AEDT 2023
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 at 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
More information about the Linuxppc-dev
mailing list