Commit 86698623 authored by Sandipan Das's avatar Sandipan Das Committed by Arnaldo Carvalho de Melo

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
8b76a318 ("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: default avatarSandipan Das <sandipan.das@amd.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ananth Narayan <ananth.narayan@amd.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Nick Terrell <terrelln@fb.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Link: https://lore.kernel.org/r/6a5429879764e3dac984cbb11ee2d95cc1604161.1683280603.git.sandipan.das@amd.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 2fe65759
...@@ -28,6 +28,18 @@ test_stat_record_report() { ...@@ -28,6 +28,18 @@ test_stat_record_report() {
echo "stat record and report test [Success]" echo "stat record and report test [Success]"
} }
test_stat_record_script() {
echo "stat record and script test"
if ! perf stat record -o - true | perf script -i - 2>&1 | \
grep -E -q "CPU[[:space:]]+THREAD[[:space:]]+VAL[[:space:]]+ENA[[:space:]]+RUN[[:space:]]+TIME[[:space:]]+EVENT"
then
echo "stat record and script test [Failed]"
err=1
return
fi
echo "stat record and script test [Success]"
}
test_stat_repeat_weak_groups() { test_stat_repeat_weak_groups() {
echo "stat repeat weak groups test" echo "stat repeat weak groups test"
if ! perf stat -e '{cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles}' \ if ! perf stat -e '{cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles,cycles}' \
...@@ -93,6 +105,7 @@ test_topdown_weak_groups() { ...@@ -93,6 +105,7 @@ test_topdown_weak_groups() {
test_default_stat test_default_stat
test_stat_record_report test_stat_record_report
test_stat_record_script
test_stat_repeat_weak_groups test_stat_repeat_weak_groups
test_topdown_groups test_topdown_groups
test_topdown_weak_groups test_topdown_weak_groups
......
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