Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test: Add basic callgraph test to record testing

Give some basic perf record callgraph coverage.

Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
Link: https://lore.kernel.org/r/20250628015553.1270748-1-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>

authored by

Ian Rogers and committed by
Namhyung Kim
5ceedc09 bb986e47

+30
+30
tools/perf/tests/shell/record.sh
··· 12 12 . "${shelldir}"/lib/perf_has_symbol.sh 13 13 14 14 testsym="test_loop" 15 + testsym2="brstack" 15 16 16 17 skip_test_missing_symbol ${testsym} 18 + skip_test_missing_symbol ${testsym2} 17 19 18 20 err=0 19 21 perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) ··· 361 359 fi 362 360 } 363 361 362 + test_callgraph() { 363 + echo "Callgraph test" 364 + 365 + case $(uname -m) 366 + in s390x) 367 + cmd_flags="--call-graph dwarf -e cpu-clock";; 368 + *) 369 + cmd_flags="-g";; 370 + esac 371 + 372 + if ! perf record -o "${perfdata}" $cmd_flags perf test -w brstack 373 + then 374 + echo "Callgraph test [Failed missing output]" 375 + err=1 376 + return 377 + fi 378 + 379 + if ! perf report -i "${perfdata}" 2>&1 | grep "${testsym2}" 380 + then 381 + echo "Callgraph test [Failed missing symbol]" 382 + err=1 383 + return 384 + fi 385 + 386 + echo "Callgraph test [Success]" 387 + } 388 + 364 389 # raise the limit of file descriptors to minimum 365 390 if [[ $default_fd_limit -lt $min_fd_limit ]]; then 366 391 ulimit -Sn $min_fd_limit ··· 403 374 test_leader_sampling 404 375 test_topdown_leader_sampling 405 376 test_precise_max 377 + test_callgraph 406 378 407 379 # restore the default value 408 380 ulimit -Sn $default_fd_limit