All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH 3/5] perf test java symbol: Extract LIBJVMTI detection
Date: Wed,  5 Nov 2025 20:10:26 +0100	[thread overview]
Message-ID: <20251105191626.34998-4-iii@linux.ibm.com> (raw)
In-Reply-To: <20251105191626.34998-1-iii@linux.ibm.com>

Extract LIBJVMTI into lib/setup_libjvmti.sh for reuse by future tests.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tools/perf/tests/shell/lib/setup_libjvmti.sh | 18 ++++++++++++++++++
 tools/perf/tests/shell/test_java_symbol.sh   | 17 ++---------------
 2 files changed, 20 insertions(+), 15 deletions(-)
 create mode 100644 tools/perf/tests/shell/lib/setup_libjvmti.sh

diff --git a/tools/perf/tests/shell/lib/setup_libjvmti.sh b/tools/perf/tests/shell/lib/setup_libjvmti.sh
new file mode 100644
index 0000000000000..fab4a44f8ecb2
--- /dev/null
+++ b/tools/perf/tests/shell/lib/setup_libjvmti.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+if [ -e "$PWD/tools/perf/libperf-jvmti.so" ]; then
+	LIBJVMTI=$PWD/tools/perf/libperf-jvmti.so
+elif [ -e "$PWD/libperf-jvmti.so" ]; then
+	LIBJVMTI=$PWD/libperf-jvmti.so
+elif [ -e "$PREFIX/lib64/libperf-jvmti.so" ]; then
+	LIBJVMTI=$PREFIX/lib64/libperf-jvmti.so
+elif [ -e "$PREFIX/lib/libperf-jvmti.so" ]; then
+	LIBJVMTI=$PREFIX/lib/libperf-jvmti.so
+elif [ -e "/usr/lib/linux-tools-$(uname -a | awk '{ print $3 }' | sed -r 's/-generic//')/libperf-jvmti.so" ]; then
+	LIBJVMTI=/usr/lib/linux-tools-$(uname -a | awk '{ print $3 }' | sed -r 's/-generic//')/libperf-jvmti.so
+else
+	echo "Fail to find libperf-jvmti.so"
+	# JVMTI is a build option, skip the test if fail to find lib
+	exit 2
+fi
diff --git a/tools/perf/tests/shell/test_java_symbol.sh b/tools/perf/tests/shell/test_java_symbol.sh
index b1d7cd43af01a..f36c9321568c5 100755
--- a/tools/perf/tests/shell/test_java_symbol.sh
+++ b/tools/perf/tests/shell/test_java_symbol.sh
@@ -26,21 +26,8 @@ cleanup_files() {
 
 trap cleanup_files exit term int
 
-if [ -e "$PWD/tools/perf/libperf-jvmti.so" ]; then
-	LIBJVMTI=$PWD/tools/perf/libperf-jvmti.so
-elif [ -e "$PWD/libperf-jvmti.so" ]; then
-	LIBJVMTI=$PWD/libperf-jvmti.so
-elif [ -e "$PREFIX/lib64/libperf-jvmti.so" ]; then
-	LIBJVMTI=$PREFIX/lib64/libperf-jvmti.so
-elif [ -e "$PREFIX/lib/libperf-jvmti.so" ]; then
-	LIBJVMTI=$PREFIX/lib/libperf-jvmti.so
-elif [ -e "/usr/lib/linux-tools-$(uname -a | awk '{ print $3 }' | sed -r 's/-generic//')/libperf-jvmti.so" ]; then
-	LIBJVMTI=/usr/lib/linux-tools-$(uname -a | awk '{ print $3 }' | sed -r 's/-generic//')/libperf-jvmti.so
-else
-	echo "Fail to find libperf-jvmti.so"
-	# JVMTI is a build option, skip the test if fail to find lib
-	exit 2
-fi
+# shellcheck source=lib/setup_libjvmti.sh
+. "$(dirname "$0")/lib/setup_libjvmti.sh"
 
 cat <<EOF | perf record -k 1 -o "$PERF_DATA" jshell -s -J"-agentpath:$LIBJVMTI"
 int fib(int x) {
-- 
2.51.1


  parent reply	other threads:[~2025-11-05 19:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05 19:10 [PATCH 0/5] perf jitdump: Fix PID namespace detection Ilya Leoshkevich
2025-11-05 19:10 ` [PATCH 1/5] " Ilya Leoshkevich
2025-11-07  2:16   ` Namhyung Kim
2025-11-07  8:19     ` Ilya Leoshkevich
2025-11-14  8:07       ` Namhyung Kim
2025-11-14 12:44         ` Ilya Leoshkevich
2025-11-14 18:44           ` Namhyung Kim
2025-11-05 19:10 ` [PATCH 2/5] perf test java symbol: Get rid of shellcheck warnings Ilya Leoshkevich
2025-11-07  2:07   ` Namhyung Kim
2025-11-07  7:57     ` Ilya Leoshkevich
2025-11-05 19:10 ` Ilya Leoshkevich [this message]
2025-11-05 19:10 ` [PATCH 4/5] perf test java symbol: Fix a false negative in symbol regex Ilya Leoshkevich
2025-11-07  2:08   ` Namhyung Kim
2025-11-07  7:59     ` Ilya Leoshkevich
2025-11-05 19:10 ` [PATCH 5/5] perf test java symbol: Add PID namespace variant Ilya Leoshkevich

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=20251105191626.34998-4-iii@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.