diff options
author | Li Zhijian <lizhijian@cn.fujitsu.com> | 2017-10-18 04:34:09 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-10-18 08:14:18 -0400 |
commit | 74f8e22c153f4464060a0c2e4cfd1d6e51af2109 (patch) | |
tree | a55d3fa56f186b22b40fb319c5b63493a6f409ef | |
parent | 3d8bba9535ac6e79453c769dd0c8ea852a51ad60 (diff) |
perf test shell trace+probe_libc_inet_pton.sh: Be compatible with Debian/Ubuntu
In debian/ubuntu, libc.so is located at a different place,
/lib/x86_64-linux-gnu/libc-2.23.so, so it outputs like this when testing:
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.040 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.040/0.040/0.040/0.000 ms
0.000 probe_libc:inet_pton:(7f0e2db741c0))
__GI___inet_pton (/lib/x86_64-linux-gnu/libc-2.23.so)
getaddrinfo (/lib/x86_64-linux-gnu/libc-2.23.so)
[0xffffa9d40f34ff4d] (/bin/ping)
Fix up the libc path to make sure this test works in more OSes.
Committer testing:
When this test fails one can use 'perf test -v', i.e. in verbose mode, where
it'll show the expected backtrace, so, after applying this test:
On Fedora 26:
# perf test -v ping
62: probe libc's inet_pton & backtrace it with ping :
--- start ---
test child forked, pid 23322
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.058 ms
--- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.058/0.058/0.058/0.000 ms
0.000 probe_libc:inet_pton:(7fe344310d80))
__GI___inet_pton (/usr/lib64/libc-2.25.so)
getaddrinfo (/usr/lib64/libc-2.25.so)
_init (/usr/bin/ping)
test child finished with 0
---- end ----
probe libc's inet_pton & backtrace it with ping: Ok
#
Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Kim Phillips <kim.phillips@arm.com>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Philip Li <philip.li@intel.com>
Link: http://lkml.kernel.org/r/1508315649-18836-1-git-send-email-lizhijian@cn.fujitsu.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-x | tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh index 462fc755092e..7a84d73324e3 100755 --- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh +++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | |||
@@ -10,6 +10,9 @@ | |||
10 | 10 | ||
11 | . $(dirname $0)/lib/probe.sh | 11 | . $(dirname $0)/lib/probe.sh |
12 | 12 | ||
13 | ld=$(realpath /lib64/ld*.so.* | uniq) | ||
14 | libc=$(echo $ld | sed 's/ld/libc/g') | ||
15 | |||
13 | trace_libc_inet_pton_backtrace() { | 16 | trace_libc_inet_pton_backtrace() { |
14 | idx=0 | 17 | idx=0 |
15 | expected[0]="PING.*bytes" | 18 | expected[0]="PING.*bytes" |
@@ -18,8 +21,8 @@ trace_libc_inet_pton_backtrace() { | |||
18 | expected[3]=".*packets transmitted.*" | 21 | expected[3]=".*packets transmitted.*" |
19 | expected[4]="rtt min.*" | 22 | expected[4]="rtt min.*" |
20 | expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)" | 23 | expected[5]="[0-9]+\.[0-9]+[[:space:]]+probe_libc:inet_pton:\([[:xdigit:]]+\)" |
21 | expected[6]=".*inet_pton[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" | 24 | expected[6]=".*inet_pton[[:space:]]\($libc\)$" |
22 | expected[7]="getaddrinfo[[:space:]]\(/usr/lib.*/libc-[0-9]+\.[0-9]+\.so\)$" | 25 | expected[7]="getaddrinfo[[:space:]]\($libc\)$" |
23 | expected[8]=".*\(.*/bin/ping.*\)$" | 26 | expected[8]=".*\(.*/bin/ping.*\)$" |
24 | 27 | ||
25 | perf trace --no-syscalls -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do | 28 | perf trace --no-syscalls -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1 2>&1 | grep -v ^$ | while read line ; do |
@@ -35,7 +38,7 @@ trace_libc_inet_pton_backtrace() { | |||
35 | } | 38 | } |
36 | 39 | ||
37 | skip_if_no_perf_probe && \ | 40 | skip_if_no_perf_probe && \ |
38 | perf probe -q /lib64/libc-*.so inet_pton && \ | 41 | perf probe -q $libc inet_pton && \ |
39 | trace_libc_inet_pton_backtrace | 42 | trace_libc_inet_pton_backtrace |
40 | err=$? | 43 | err=$? |
41 | rm -f ${file} | 44 | rm -f ${file} |