[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251105191626.34998-4-iii@linux.ibm.com>
Date: Wed, 5 Nov 2025 20:10:26 +0100
From: Ilya Leoshkevich <iii@...ux.ibm.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
Heiko Carstens <hca@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Ilya Leoshkevich <iii@...ux.ibm.com>
Subject: [PATCH 3/5] perf test java symbol: Extract LIBJVMTI detection
Extract LIBJVMTI into lib/setup_libjvmti.sh for reuse by future tests.
Signed-off-by: Ilya Leoshkevich <iii@...ux.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
Powered by blists - more mailing lists