diff options
| author | Ian Rogers <irogers@google.com> | 2026-09-25 23:20:13 -0700 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-09-26 20:54:54 +0200 |
| commit | 0d0f9e540d940a48b91cbea1657794d44b25aedf (patch) | |
| tree | c278c28d2ce50a88dfaaae897161d0ad385aa01e /tools/perf/tests/shell | |
| parent | 5084b5f91a70e0aa2811c7c894ac19424bfc4194 (diff) | |
perf: Remove libpython support and legacy Python scripts
Remove embedded Python interpreter support (libpython) from perf, as
all Python scripts have been migrated to standalone scripts using the
perf Python extension module.
Changes include:
- Remove libpython detection and build flags from Makefile.config.
- Remove legacy Python script installation rules from Makefile.perf.
- Delete tools/perf/util/scripting-engines/trace-event-python.c and
tools/perf/scripts/python/Perf-Trace-Util/Context.c.
- Remove Python scripting engine registration from
trace-event-scripting.c.
- Remove libpython from the supported features list in builtin-check.c
and Documentation/perf-check.txt.
- Delete the legacy Python scripts and bin wrappers in
tools/perf/scripts/python/ and update shell tests.
Assisted-by: Antigravity:gemini-3.1-pro
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/shell')
| -rwxr-xr-x | tools/perf/tests/shell/script.sh | 42 | ||||
| -rwxr-xr-x | tools/perf/tests/shell/script_python.sh | 113 |
2 files changed, 0 insertions, 155 deletions
diff --git a/tools/perf/tests/shell/script.sh b/tools/perf/tests/shell/script.sh index 254fc3ae94e7..af687c7cfe44 100755 --- a/tools/perf/tests/shell/script.sh +++ b/tools/perf/tests/shell/script.sh @@ -6,9 +6,6 @@ set -e temp_dir=$(mktemp -d /tmp/perf-test-script.XXXXXXXXXX) -perfdatafile="${temp_dir}/perf.data" -db_test="${temp_dir}/db_test.py" - err=0 cleanup() @@ -30,44 +27,6 @@ trap_cleanup() trap trap_cleanup EXIT TERM INT - -test_db() -{ - echo "DB test" - - # Check if python script is supported - if perf version --build-options | grep python | grep -q OFF ; then - echo "SKIP: python scripting is not supported" - err=2 - return - fi - - cat << "_end_of_file_" > "${db_test}" -perf_db_export_mode = True -perf_db_export_calls = False -perf_db_export_callchains = True - -def sample_table(*args): - print(f'sample_table({args})') - -def call_path_table(*args): - print(f'call_path_table({args}') -_end_of_file_ - case $(uname -m) - in s390x) - cmd_flags="--call-graph dwarf -e cpu-clock";; - *) - cmd_flags="-g";; - esac - - perf record $cmd_flags -o "${perfdatafile}" true - # Disable lsan to avoid warnings about python memory leaks. - export ASAN_OPTIONS=detect_leaks=0 - perf script -i "${perfdatafile}" -s "${db_test}" - export ASAN_OPTIONS= - echo "DB test [Success]" -} - test_parallel_perf() { echo "parallel-perf test" @@ -91,7 +50,6 @@ test_parallel_perf() echo "parallel-perf test [Success]" } -test_db test_parallel_perf cleanup diff --git a/tools/perf/tests/shell/script_python.sh b/tools/perf/tests/shell/script_python.sh deleted file mode 100755 index 6bc66074a31f..000000000000 --- a/tools/perf/tests/shell/script_python.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash -# perf script python tests -# SPDX-License-Identifier: GPL-2.0 - -set -e - -# set PERF_EXEC_PATH to find scripts in the source directory -perfdir=$(dirname "$0")/../.. -if [ -e "$perfdir/scripts/python/Perf-Trace-Util" ]; then - export PERF_EXEC_PATH=$perfdir -fi - - -perfdata=$(mktemp /tmp/__perf_test_script_python.perf.data.XXXXX) -generated_script=$(mktemp /tmp/__perf_test_script.XXXXX.py) - -cleanup() { - rm -f "${perfdata}" - rm -f "${generated_script}" - trap - EXIT TERM INT -} - -trap_cleanup() { - echo "Unexpected signal in ${FUNCNAME[1]}" - cleanup - exit 1 -} -trap trap_cleanup TERM INT -trap cleanup EXIT - -check_python_support() { - if perf check feature -q libpython; then - return 0 - fi - echo "perf script python test [Skipped: no libpython support]" - return 2 -} - -test_script() { - local event_name=$1 - local expected_output=$2 - local record_opts=$3 - - echo "Testing event: $event_name" - - # Try to record. If this fails, it might be permissions or lack of - # support. Return 2 to indicate "skip this event" rather than "fail - # test". - if ! perf record -o "${perfdata}" -e "$event_name" $record_opts -- perf test -w thloop > /dev/null 2>&1; then - echo "perf script python test [Skipped: failed to record $event_name]" - return 2 - fi - - echo "Generating python script..." - if ! perf script -i "${perfdata}" -g "${generated_script}"; then - echo "perf script python test [Failed: script generation for $event_name]" - return 1 - fi - - if [ ! -f "${generated_script}" ]; then - echo "perf script python test [Failed: script not generated for $event_name]" - return 1 - fi - - # Perf script -g python doesn't generate process_event for generic - # events so append it manually to test that the callback works. - if ! grep -q "def process_event" "${generated_script}"; then - cat <<EOF >> "${generated_script}" - -def process_event(param_dict): - print("param_dict: %s" % param_dict) -EOF - fi - - echo "Executing python script..." - output=$(perf script -i "${perfdata}" -s "${generated_script}" 2>&1) - - if echo "$output" | grep -q "$expected_output"; then - echo "perf script python test [Success: $event_name triggered $expected_output]" - return 0 - else - echo "perf script python test [Failed: $event_name did not trigger $expected_output]" - echo "Output was:" - echo "$output" | head -n 20 - return 1 - fi -} - -check_python_support || exit 2 - -# Try tracepoint first -test_script "sched:sched_switch" "sched__sched_switch" "-c 1" && res=0 || res=$? - -if [ $res -eq 0 ]; then - exit 0 -elif [ $res -eq 1 ]; then - exit 1 -fi - -# If tracepoint skipped (res=2), try task-clock -# For generic events like task-clock, the generated script uses process_event() -# which prints the param_dict. -test_script "task-clock" "param_dict" "-c 100" && res=0 || res=$? - -if [ $res -eq 0 ]; then - exit 0 -elif [ $res -eq 1 ]; then - exit 1 -fi - -# If both skipped -echo "perf script python test [Skipped: Could not record tracepoint or task-clock]" -exit 2 |
