2 # Check Arm64 callgraphs are complete in fp mode
3 # SPDX-License-Identifier: GPL-2.0
5 lscpu | grep -q "aarch64" || exit 2
7 if ! [ -x "$(command -v cc)" ]; then
8 echo "failed: no compiler, install gcc"
12 PERF_DATA=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
13 TEST_PROGRAM_SOURCE=$(mktemp /tmp/test_program.XXXXX.c)
14 TEST_PROGRAM=$(mktemp /tmp/test_program.XXXXX)
19 rm -f $TEST_PROGRAM_SOURCE
23 trap cleanup_files exit term int
25 cat << EOF > $TEST_PROGRAM_SOURCE
40 echo " + Compiling test program ($TEST_PROGRAM)..."
42 CFLAGS="-g -O0 -fno-inline -fno-omit-frame-pointer"
43 cc $CFLAGS $TEST_PROGRAM_SOURCE -o $TEST_PROGRAM || exit 1
45 # Add a 1 second delay to skip samples that are not in the leaf() function
46 perf record -o $PERF_DATA --call-graph fp -e cycles//u -D 1000 --user-callchains -- $TEST_PROGRAM 2> /dev/null &
49 echo " + Recording (PID=$PID)..."
51 echo " + Stopping perf-record..."
56 # expected perf-script output:
64 perf script -i $PERF_DATA -F comm,ip,sym | head -n4
65 perf script -i $PERF_DATA -F comm,ip,sym | head -n4 | \
66 awk '{ if ($2 != "") sym[i++] = $2 } END { if (sym[0] != "leaf" ||
68 sym[2] != "main") exit 1 }'