[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250813-james-brbe-test-v1-1-76a0144b73fb@linaro.org>
Date: Wed, 13 Aug 2025 14:38:49 +0100
From: James Clark <james.clark@...aro.org>
To: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Anshuman Khandual <anshuman.khandual@....com>,
Mark Rutland <mark.rutland@....com>, "Rob Herring (Arm)" <robh@...nel.org>,
Adam Young <admiyo@...amperecomputing.com>, Will Deacon <will@...nel.org>,
German Gomez <german.gomez@....com>
Cc: linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
James Clark <james.clark@...aro.org>
Subject: [PATCH 1/3] perf test: Refactor brstack test
check_branches() will be used by other tests in a later commit so make
it a function. And the any_call filters are duplicated and will also
be extended in a later commit, so move them to a variable.
No functional changes intended.
Signed-off-by: James Clark <james.clark@...aro.org>
---
tools/perf/tests/shell/test_brstack.sh | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/tools/perf/tests/shell/test_brstack.sh b/tools/perf/tests/shell/test_brstack.sh
index 9138fa83bf36..46e5aa9ce8ee 100755
--- a/tools/perf/tests/shell/test_brstack.sh
+++ b/tools/perf/tests/shell/test_brstack.sh
@@ -34,6 +34,13 @@ trap_cleanup() {
}
trap trap_cleanup EXIT TERM INT
+check_branches() {
+ if ! tr -s ' ' '\n' < "$TMPDIR/perf.script" | grep -E -m1 -q "$1"; then
+ echo "Branches missing $1"
+ err=1
+ fi
+}
+
test_user_branches() {
echo "Testing user branch stack sampling"
@@ -55,11 +62,7 @@ test_user_branches() {
)
for x in "${expected[@]}"
do
- if ! tr -s ' ' '\n' < "$TMPDIR/perf.script" | grep -E -m1 -q "$x"
- then
- echo "Branches missing $x"
- err=1
- fi
+ check_branches "$x"
done
# some branch types are still not being tested:
# IND COND_CALL COND_RET SYSCALL SYSRET IRQ SERROR NO_TX
@@ -101,14 +104,16 @@ set -e
test_user_branches
-test_filter "any_call" "CALL|IND_CALL|COND_CALL|SYSCALL|IRQ"
+any_call="CALL|IND_CALL|COND_CALL|SYSCALL|IRQ"
+
+test_filter "any_call" "$any_call"
test_filter "call" "CALL|SYSCALL"
test_filter "cond" "COND"
test_filter "any_ret" "RET|COND_RET|SYSRET|ERET"
test_filter "call,cond" "CALL|SYSCALL|COND"
-test_filter "any_call,cond" "CALL|IND_CALL|COND_CALL|IRQ|SYSCALL|COND"
-test_filter "cond,any_call,any_ret" "COND|CALL|IND_CALL|COND_CALL|SYSCALL|IRQ|RET|COND_RET|SYSRET|ERET"
+test_filter "any_call,cond" "$any_call|COND"
+test_filter "any_call,cond,any_ret" "$any_call|COND|RET|COND_RET"
cleanup
exit $err
--
2.34.1
Powered by blists - more mailing lists