From 8519e4f44c2af72214dc029f0334be068466e71f Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Mon, 14 Oct 2024 17:01:56 -0700 Subject: [PATCH] perf test: Add a shell wrapper for "Setup struct perf_event_attr" The "Setup struct perf_event_attr" test in attr.c does a bunch of directory finding to set up running a python test that in general is more brittle than similar logic we have in shell tests. Add a shell test that invokes and runs the tests in the python attr.py script. Signed-off-by: Ian Rogers Tested-by: Athira Rajeev Cc: Stephen Rothwell Cc: zhaimingbing Cc: Howard Chu Cc: Ze Gao Cc: Weilin Wang Cc: James Clark Cc: Leo Yan Cc: Thomas Richter Cc: Veronika Molnarova Link: https://lore.kernel.org/r/20241015000158.871828-2-irogers@google.com Signed-off-by: Namhyung Kim --- tools/perf/tests/shell/attr.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 tools/perf/tests/shell/attr.sh diff --git a/tools/perf/tests/shell/attr.sh b/tools/perf/tests/shell/attr.sh new file mode 100755 index 000000000000..e094f3baffb7 --- /dev/null +++ b/tools/perf/tests/shell/attr.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Perf attribute expectations test +# SPDX-License-Identifier: GPL-2.0 + +err=0 + +cleanup() { + trap - EXIT TERM INT +} + +trap_cleanup() { + echo "Unexpected signal in ${FUNCNAME[1]}" + cleanup + exit 1 +} +trap trap_cleanup EXIT TERM INT + +shelldir=$(dirname "$0") +perf_path=$(which perf) +python "${shelldir}"/../attr.py -d "${shelldir}"/../attr -v -p "$perf_path" +cleanup +exit $err -- 2.50.1