Skip to content

Commit 8669862

Browse files
sandip4nacmel
authored andcommitted
perf test: Add stat test for record and script
When using the global aggregation mode, running perf script after perf stat record can result in a segmentation fault as seen with commit 8b76a31 ("perf stat: Remove unused perf_counts.aggr field"). Add a basic test to the existing suite of stat-related tests for checking if that workflow runs without erroring out. Signed-off-by: Sandipan Das <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ananth Narayan <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Nick Terrell <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Ravi Bangoria <[email protected]> Link: https://lore.kernel.org/r/6a5429879764e3dac984cbb11ee2d95cc1604161.1683280603.git.sandipan.das@amd.com Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 2fe6575 commit 8669862

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tools/perf/tests/shell/stat.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,18 @@ test_stat_record_report() {
2828
echo "stat record and report test [Success]"
2929
}
3030

31+
test_stat_record_script() {
32+
echo "stat record and script test"
33+
if ! perf stat record -o - true | perf script -i - 2>&1 | \
34+
grep -E -q "CPU[[:space:]]+THREAD[[:space:]]+VAL[[:space:]]+ENA[[:space:]]+RUN[[:space:]]+TIME[[:space:]]+EVENT"
35+
then
36+
echo "stat record and script test [Failed]"
37+
err=1
38+
return
39+
fi
40+
echo "stat record and script test [Success]"
41+
}
42+
3143
test_stat_repeat_weak_groups() {
3244
echo "stat repeat weak groups test"
3345
if ! perf stat -e '{cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles}' \
@@ -93,6 +105,7 @@ test_topdown_weak_groups() {
93105

94106
test_default_stat
95107
test_stat_record_report
108+
test_stat_record_script
96109
test_stat_repeat_weak_groups
97110
test_topdown_groups
98111
test_topdown_weak_groups

0 commit comments

Comments
 (0)