linux/tools/perf/tests/shell/python-use.sh
James Clark a9aa5c5e40 perf test: Remove redundant shellcheck source paths
The minimum required shellcheck version treats paths with leading
variables as starting from the script's current directory, so shellcheck
is able to source all of these files without needing the extra
directives:

  v0.7.2 - 2021-04-19

  Changed
   * SC1090: A leading $x/ or $(x)/ is now treated as ./ when locating files

Remove them to avoid future copy pasting and confusion that they are
required. Because the paths weren't actually followed, they didn't have
to be accurate and accepted any string to silence the warning.

Signed-off-by: James Clark <james.clark@linaro.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2026-09-25 00:55:45 +02:00

36 lines
556 B
Bash
Executable File

#!/bin/bash
# 'import perf' in python
# SPDX-License-Identifier: GPL-2.0
# Just test if we can load the python binding.
set -e
shelldir=$(dirname "$0")
. "${shelldir}"/lib/setup_python.sh
MODULE_DIR=$(dirname "$(which perf)")/python
if [ -d "$MODULE_DIR" ]
then
CMD=$(cat <<EOF
import sys
sys.path.insert(0, '$MODULE_DIR')
import perf
print('success!')
EOF
)
else
CMD=$(cat <<EOF
import perf
print('success!')
EOF
)
fi
echo -e "Testing 'import perf' with:\n$CMD"
if ! echo "$CMD" | $PYTHON | grep -q "success!"
then
exit 1
fi
exit 0