linux/tools/perf/tests/shell/test_arm_callgraph_fp.sh

49 lines
1.2 KiB
Bash
Raw Permalink Normal View History

#!/bin/bash
2022-03-16 17:20:15 +00:00
# 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
2022-03-16 17:20:15 +00:00
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
2022-03-16 17:20:15 +00:00
PERF_DATA=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
TEST_PROGRAM="perf test -w leafloop"
2022-03-16 17:20:15 +00:00
cleanup_files()
{
perf tests arm_callgraph_fp: Address shellcheck warnings about signal names and adding double quotes for expression Running shellcheck -S on test_arm_calligraph_fp throws warnings SC2086 and SC3049,       $shellcheck -S warning tests/shell/test_arm_callgraph_fp.sh          rm -f $PERF_DATA             : Double quote to prevent globbing and word splitting.          trap cleanup_files exit term int       : In POSIX sh, using lower/mixed case for signal names is undefined. After fixing the warnings,       $shellcheck tests/shell/test_arm_callgraph_fp.sh       $ echo $?       0 To address the POSIX shell warnings added changes to convert Lowercase signal names to uppercase in the script and double quoted the command substitutions($fix to "$fix") to solve Globbing warnings. Signed-off-by: Spoorthy S<spoorts2@in.ibm.com> Cc: Disha Goel <disgoel@linux.vnet.ibm.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: linuxppc-dev@lists.ozlabs.org Link: https://lore.kernel.org/r/20230613164145.50488-4-atrajeev@linux.vnet.ibm.com Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Signed-off-by: Kajol Jain <kjain@linux.ibm.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2023-06-13 22:11:31 +05:30
rm -f "$PERF_DATA"
2022-03-16 17:20:15 +00:00
}
perf tests arm_callgraph_fp: Address shellcheck warnings about signal names and adding double quotes for expression Running shellcheck -S on test_arm_calligraph_fp throws warnings SC2086 and SC3049,       $shellcheck -S warning tests/shell/test_arm_callgraph_fp.sh          rm -f $PERF_DATA             : Double quote to prevent globbing and word splitting.          trap cleanup_files exit term int       : In POSIX sh, using lower/mixed case for signal names is undefined. After fixing the warnings,       $shellcheck tests/shell/test_arm_callgraph_fp.sh       $ echo $?       0 To address the POSIX shell warnings added changes to convert Lowercase signal names to uppercase in the script and double quoted the command substitutions($fix to "$fix") to solve Globbing warnings. Signed-off-by: Spoorthy S<spoorts2@in.ibm.com> Cc: Disha Goel <disgoel@linux.vnet.ibm.com> Cc: Ian Rogers <irogers@google.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: linuxppc-dev@lists.ozlabs.org Link: https://lore.kernel.org/r/20230613164145.50488-4-atrajeev@linux.vnet.ibm.com Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Signed-off-by: Kajol Jain <kjain@linux.ibm.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2023-06-13 22:11:31 +05:30
trap cleanup_files EXIT TERM INT
2022-03-16 17:20:15 +00:00
# shellcheck disable=SC2086
perf record -o "$PERF_DATA" --call-graph fp -e cycles//u --user-callchains -- $TEST_PROGRAM
2022-03-16 17:20:15 +00:00
# Try opening the file so any immediate errors are visible in the log
perf script -i "$PERF_DATA" -F comm,ip,sym | head -n4
2022-03-16 17:20:15 +00:00
# expected perf-script output if 'leaf' has been inserted correctly:
2022-03-16 17:20:15 +00:00
#
# perf
2022-03-16 17:20:15 +00:00
# 728 leaf
# 753 parent
# 76c leafloop
# ... remaining stack to main() ...
2022-03-16 17:20:15 +00:00
# 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"