1#!/bin/sh 2# Check Arm64 callgraphs are complete in fp mode 3# SPDX-License-Identifier: GPL-2.0 4 5shelldir=$(dirname "$0") 6# shellcheck source=lib/perf_has_symbol.sh 7. "${shelldir}"/lib/perf_has_symbol.sh 8 9lscpu | grep -q "aarch64" || exit 2 10 11if perf version --build-options | grep HAVE_DWARF_UNWIND_SUPPORT | grep -q OFF 12then 13 echo "Skipping, no dwarf unwind support" 14 exit 2 15fi 16 17skip_test_missing_symbol leafloop 18 19PERF_DATA=$(mktemp /tmp/__perf_test.perf.data.XXXXX) 20TEST_PROGRAM="perf test -w leafloop" 21 22cleanup_files() 23{ 24 rm -f "$PERF_DATA" 25} 26 27trap cleanup_files EXIT TERM INT 28 29# Add a 1 second delay to skip samples that are not in the leaf() function 30# shellcheck disable=SC2086 31perf record -o "$PERF_DATA" --call-graph fp -e cycles//u -D 1000 --user-callchains -- $TEST_PROGRAM 2> /dev/null & 32PID=$! 33 34echo " + Recording (PID=$PID)..." 35sleep 2 36echo " + Stopping perf-record..." 37 38kill $PID 39wait $PID 40 41# expected perf-script output: 42# 43# program 44# 728 leaf 45# 753 parent 46# 76c leafloop 47# ... 48 49perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4 50perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4 | \ 51 awk '{ if ($2 != "") sym[i++] = $2 } END { if (sym[0] != "leaf" || 52 sym[1] != "parent" || 53 sym[2] != "leafloop") exit 1 }' 54