diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2023-11-23 09:58:46 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-11-27 15:40:22 -0300 |
commit | fcfb5a6189f55669c931dce9fec85280655c515f (patch) | |
tree | 93a756019665a93b43f33ce165da139f00312130 | |
parent | fc1de29a8b8ad46b590b2d389b53b4ecf9758273 (diff) | |
download | linux-stable-fcfb5a6189f55669c931dce9fec85280655c515f.tar.gz linux-stable-fcfb5a6189f55669c931dce9fec85280655c515f.tar.bz2 linux-stable-fcfb5a6189f55669c931dce9fec85280655c515f.zip |
perf tests: Skip branch stack sampling test if brstack_bench symbol is missing
The test "Check branch stack sampling" depends on finding symbol
brstack_bench (and several others) in perf, and fails if perf has been
stripped and no debug object is available. In that case, skip the test
instead.
Example:
Before:
$ strip tools/perf/perf
$ tools/perf/perf buildid-cache -p `realpath tools/perf/perf`
$ tools/perf/perf test -v 'branch stack sampling'
112: Check branch stack sampling :
--- start ---
test child forked, pid 123741
Testing user branch stack sampling
+ grep -E -m1 ^brstack_bench\+[^ ]*/brstack_foo\+[^ ]*/IND_CALL/.*$ /tmp/__perf_test.program.5Dz1U/perf.script
+ cleanup
+ rm -rf /tmp/__perf_test.program.5Dz1U
test child finished with -1
---- end ----
Check branch stack sampling: FAILED!
After:
$ tools/perf/perf test -v 'branch stack sampling'
112: Check branch stack sampling :
--- start ---
test child forked, pid 125157
perf does not have symbol 'brstack_bench'
perf is missing symbols - skipping test
test child finished with -2
---- end ----
Check branch stack sampling: Skip
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20231123075848.9652-7-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rwxr-xr-x | tools/perf/tests/shell/test_brstack.sh | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/perf/tests/shell/test_brstack.sh b/tools/perf/tests/shell/test_brstack.sh index 09908d71c994..5f14d0cb013f 100755 --- a/tools/perf/tests/shell/test_brstack.sh +++ b/tools/perf/tests/shell/test_brstack.sh @@ -4,6 +4,10 @@ # SPDX-License-Identifier: GPL-2.0 # German Gomez <german.gomez@arm.com>, 2022 +shelldir=$(dirname "$0") +# shellcheck source=lib/perf_has_symbol.sh +. "${shelldir}"/lib/perf_has_symbol.sh + # skip the test if the hardware doesn't support branch stack sampling # and if the architecture doesn't support filter types: any,save_type,u if ! perf record -o- --no-buildid --branch-filter any,save_type,u -- true > /dev/null 2>&1 ; then @@ -11,6 +15,8 @@ if ! perf record -o- --no-buildid --branch-filter any,save_type,u -- true > /dev exit 2 fi +skip_test_missing_symbol brstack_bench + TMPDIR=$(mktemp -d /tmp/__perf_test.program.XXXXX) TESTPROG="perf test -w brstack" |