1#!/bin/sh 2# Check Arm64 callgraphs are complete in fp mode 3# SPDX-License-Identifier: GPL-2.0 4 5lscpu | grep -q "aarch64" || exit 2 6 7PERF_DATA=$(mktemp /tmp/__perf_test.perf.data.XXXXX) 8TEST_PROGRAM="perf test -w leafloop" 9 10cleanup_files() 11{ 12 rm -f "$PERF_DATA" 13} 14 15trap cleanup_files EXIT TERM INT 16 17# shellcheck disable=SC2086 18perf record -o "$PERF_DATA" --call-graph fp -e cycles//u --user-callchains -- $TEST_PROGRAM 19 20# Try opening the file so any immediate errors are visible in the log 21perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4 22 23# expected perf-script output if 'leaf' has been inserted correctly: 24# 25# perf 26# 728 leaf 27# 753 parent 28# 76c leafloop 29# ... remaining stack to main() ... 30 31# Each frame is separated by a tab, some spaces and an address 32SEP="[[:space:]]+ [[:xdigit:]]+" 33perf script -i "$PERF_DATA" -F comm,ip,sym | tr '\n' ' ' | \ 34 grep -E -q "perf $SEP leaf $SEP parent $SEP leafloop" 35