perf test java symbol: Additional libperf-jvmti.so path check

If perf is built into an output directory then so is
libperf-jvmti.so.

If `perf test` is run from that directory then PWD needn't also be that
directory meaning libperf-jvmti.so won't be found and the test skipped.

Add an additional check for libperf-jvmti.so in the same directory as
the perf binary for this case, this avoids the test skipping.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Ian Rogers
2025-12-05 11:01:35 -08:00
committed by Arnaldo Carvalho de Melo
parent b04d2b9199
commit 1ec205e366

View File

@@ -22,10 +22,13 @@ cleanup_files()
trap cleanup_files exit term int
PERF_DIR=$(dirname "$(which perf)")
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 "$PERF_DIR/libperf-jvmti.so" ]; then
LIBJVMTI=$PERF_DIR/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
@@ -34,6 +37,7 @@ elif [ -e "/usr/lib/linux-tools-$(uname -a | awk '{ print $3 }' | sed -r 's/-gen
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