2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/tools/perf/tests/shell/test_arm_callgraph_fp.sh
James Clark ff16aeb9b8 perf test: Make test_arm_callgraph_fp.sh more robust
The 2 second sleep can cause the test to fail on very slow network file
systems because Perf ends up being killed before it finishes starting
up.

Fix it by making the leafloop workload end after a fixed time like the
other workloads so there is no need to kill it after 2 seconds.

Also remove the 1 second start sampling delay because it is similarly
fragile. Instead, search through all samples for a matching one, rather
than just checking the first sample and hoping it's in the right place.

Fixes: cd6382d827 ("perf test arm64: Test unwinding using fame-pointer (fp) mode")
Signed-off-by: James Clark <james.clark@arm.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: German Gomez <german.gomez@arm.com>
Cc: Spoorthy S <spoorts2@in.ibm.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240612140316.3006660-1-james.clark@arm.com
2024-06-24 14:42:59 -07:00

49 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Check Arm64 callgraphs are complete in fp mode
# SPDX-License-Identifier: GPL-2.0
shelldir=$(dirname "$0")
# shellcheck source=lib/perf_has_symbol.sh
. "${shelldir}"/lib/perf_has_symbol.sh
if [ "$(uname -m)" != "aarch64" ]; then
exit 2
fi
if perf version --build-options | grep HAVE_DWARF_UNWIND_SUPPORT | grep -q OFF
then
echo "Skipping, no dwarf unwind support"
exit 2
fi
skip_test_missing_symbol leafloop
PERF_DATA=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
TEST_PROGRAM="perf test -w leafloop"
cleanup_files()
{
rm -f "$PERF_DATA"
}
trap cleanup_files EXIT TERM INT
# shellcheck disable=SC2086
perf record -o "$PERF_DATA" --call-graph fp -e cycles//u --user-callchains -- $TEST_PROGRAM
# Try opening the file so any immediate errors are visible in the log
perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4
# expected perf-script output if 'leaf' has been inserted correctly:
#
# perf
# 728 leaf
# 753 parent
# 76c leafloop
# ... remaining stack to main() ...
# Each frame is separated by a tab, some spaces and an address
SEP="[[:space:]]+ [[:xdigit:]]+"
perf script -i "$PERF_DATA" -F comm,ip,sym | tr '\n' ' ' | \
grep -E -q "perf $SEP leaf $SEP parent $SEP leafloop"