linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Richter <tmricht@linux.vnet.ibm.com>
To: acme@kernel.org, linux-perf-users@vger.kernel.org
Cc: brueckner@linux.vnet.ibm.com,
	Thomas Richter <tmricht@linux.vnet.ibm.com>
Subject: [PATCH] perf test: fix test case probe libc's inet_pton on s390x
Date: Tue, 14 Nov 2017 08:18:47 +0100	[thread overview]
Message-ID: <20171114071847.2381-2-tmricht@linux.vnet.ibm.com> (raw)
In-Reply-To: <20171114071847.2381-1-tmricht@linux.vnet.ibm.com>

Perf test case probe libc's inet_pton & backtrace it with ping
fails on s390x. The reason is the 'realpath /lib64/ld*.so.* | uniq'
line which returns 2 libraries:

        root@s35lp76 shell]# realpath /lib64/ld*.so.* | uniq
        /usr/lib64/ld-2.26.so
        /usr/lib64/ld_pre_smc.so.1.0.1
        [root@s35lp76 shell]

This output makes the perf probe command lines invalid.

Use tool ldd to find out the libraries required by the bash and
check if symbol inet_pton is part of the libc library.
Some distros do not have a /lib64 directory.

I have also added a check for the existence of an IPv6
network interface before it is being used.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Suggested-by: Hendrik Brückner <brueckner@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brückner <brueckner@linux.vnet.ibm.com>
---
 tools/perf/tests/shell/trace+probe_libc_inet_pton.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 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 7a84d73324e3..b9c913f1a360 100755
--- a/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
+++ b/tools/perf/tests/shell/trace+probe_libc_inet_pton.sh
@@ -10,8 +10,8 @@
 
 . $(dirname $0)/lib/probe.sh
 
-ld=$(realpath /lib64/ld*.so.* | uniq)
-libc=$(echo $ld | sed 's/ld/libc/g')
+libc=$(ldd $(which bash) 2>/dev/null | fgrep libc | awk '{ print $3 }')
+nm -g $libc 2>/dev/null | fgrep -q inet_pton || exit 254
 
 trace_libc_inet_pton_backtrace() {
 	idx=0
@@ -37,6 +37,9 @@ trace_libc_inet_pton_backtrace() {
 	done
 }
 
+# Check for IPv6 interface existence
+ip a sh lo | fgrep -q inet6 || exit 2
+
 skip_if_no_perf_probe && \
 perf probe -q $libc inet_pton && \
 trace_libc_inet_pton_backtrace
-- 
2.13.4

  reply	other threads:[~2017-11-14  7:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14  7:18 [PATCH] perf test fix check open filename arg using perf trace on s390x Thomas Richter
2017-11-14  7:18 ` Thomas Richter [this message]
2017-11-14 13:26   ` [PATCH] perf test: fix test case probe libc's inet_pton " Arnaldo Carvalho de Melo
2017-11-14 13:34     ` Arnaldo Carvalho de Melo
2017-11-14 13:47       ` Arnaldo Carvalho de Melo
2017-11-14 13:55         ` Thomas-Mich Richter
2017-11-14 14:58           ` Arnaldo Carvalho de Melo
2017-11-14 13:13 ` [PATCH] perf test fix check open filename arg using perf trace " Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171114071847.2381-2-tmricht@linux.vnet.ibm.com \
    --to=tmricht@linux.vnet.ibm.com \
    --cc=acme@kernel.org \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=linux-perf-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).