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