Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1#!/bin/bash
2# 'import perf' in python
3# SPDX-License-Identifier: GPL-2.0
4# Just test if we can load the python binding.
5set -e
6
7shelldir=$(dirname "$0")
8# shellcheck source=lib/setup_python.sh
9. "${shelldir}"/lib/setup_python.sh
10
11MODULE_DIR=$(dirname "$(which perf)")/python
12
13if [ -d "$MODULE_DIR" ]
14then
15 CMD=$(cat <<EOF
16import sys
17sys.path.insert(0, '$MODULE_DIR')
18import perf
19print('success!')
20EOF
21 )
22else
23 CMD=$(cat <<EOF
24import perf
25print('success!')
26EOF
27 )
28fi
29
30echo -e "Testing 'import perf' with:\n$CMD"
31
32if ! echo "$CMD" | $PYTHON | grep -q "success!"
33then
34 exit 1
35fi
36exit 0