Commit 658a8805 authored by Thomas Richter's avatar Thomas Richter Committed by Namhyung Kim

perf test: Speed up test case 70 annotate basic tests

On some s390 linux machine (mostly older models) and with debug
packages installed, the test case 'perf annotate basic tests' runs
for some longer time.
Speed up the test and save the output of command perf annotate
in a temporary file. This is used to perform pattern matching via
grep command. This saves on invocation of perf annotate which
runs for some time.

Output before:
 # time bash -x tests/shell/annotate.sh >/dev/null 2>&1; echo EXIT CODE $?

 real   4m35.543s
 user   3m19.442s
 sys    1m14.322s
 EXIT CODE 0
 #
Output after:
 # time bash -x tests/shell/annotate.sh >/dev/null 2>&1; echo EXIT CODE $?

 real   2m2.881s
 user   1m30.980s
 sys    0m30.684s
 EXIT CODE 0
 #
Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: gor@linux.ibm.com
Cc: hca@linux.ibm.com
Cc: sumanthk@linux.ibm.com
Cc: svens@linux.ibm.com
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240607054352.2774936-1-tmricht@linux.ibm.com
parent f5803651
...@@ -15,12 +15,13 @@ skip_test_missing_symbol ${testsym} ...@@ -15,12 +15,13 @@ skip_test_missing_symbol ${testsym}
err=0 err=0
perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX) perfdata=$(mktemp /tmp/__perf_test.perf.data.XXXXX)
perfout=$(mktemp /tmp/__perf_test.perf.out.XXXXX)
testprog="perf test -w noploop" testprog="perf test -w noploop"
# disassembly format: "percent : offset: instruction (operands ...)" # disassembly format: "percent : offset: instruction (operands ...)"
disasm_regex="[0-9]*\.[0-9]* *: *\w*: *\w*" disasm_regex="[0-9]*\.[0-9]* *: *\w*: *\w*"
cleanup() { cleanup() {
rm -rf "${perfdata}" rm -rf "${perfdata}" "${perfout}"
rm -rf "${perfdata}".old rm -rf "${perfdata}".old
trap - EXIT TERM INT trap - EXIT TERM INT
...@@ -41,8 +42,11 @@ test_basic() { ...@@ -41,8 +42,11 @@ test_basic() {
return return
fi fi
# Generate the annotated output file
perf annotate -i "${perfdata}" --stdio 2> /dev/null > "${perfout}"
# check if it has the target symbol # check if it has the target symbol
if ! perf annotate -i "${perfdata}" 2> /dev/null | grep "${testsym}" if ! grep "${testsym}" "${perfout}"
then then
echo "Basic annotate [Failed: missing target symbol]" echo "Basic annotate [Failed: missing target symbol]"
err=1 err=1
...@@ -50,7 +54,7 @@ test_basic() { ...@@ -50,7 +54,7 @@ test_basic() {
fi fi
# check if it has the disassembly lines # check if it has the disassembly lines
if ! perf annotate -i "${perfdata}" 2> /dev/null | grep "${disasm_regex}" if ! grep "${disasm_regex}" "${perfout}"
then then
echo "Basic annotate [Failed: missing disasm output from default disassembler]" echo "Basic annotate [Failed: missing disasm output from default disassembler]"
err=1 err=1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment