Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test: Set PERF_EXEC_PATH for script execution

The task-analyzer.py script (actually every other scripts too) requires
PERF_EXEC_PATH env to find dependent libraries and scripts. For scripts
test to run correctly, it needs to set PERF_EXEC_PATH to the perf tool
source directory.

Instead of blindly update the env, let's check the directory structure
to make sure it points to the correct location.

Fixes: e8478b84d6ba ("perf test: add new task-analyzer tests")
Cc: Petar Gligoric <petar.gligoric@rohde-schwarz.com>
Cc: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: Aditya Gupta <adityag@linux.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

+6
+6
tools/perf/tests/shell/test_task_analyzer.sh
··· 5 5 tmpdir=$(mktemp -d /tmp/perf-script-task-analyzer-XXXXX) 6 6 err=0 7 7 8 + # set PERF_EXEC_PATH to find scripts in the source directory 9 + perfdir=$(dirname "$0")/../.. 10 + if [ -e "$perfdir/scripts/python/Perf-Trace-Util" ]; then 11 + export PERF_EXEC_PATH=$perfdir 12 + fi 13 + 8 14 cleanup() { 9 15 rm -f perf.data 10 16 rm -f perf.data.old