[PATCH 2/5] perf stat: Add stat record+report test

From: Ian Rogers
Date: Wed May 18 2022 - 23:20:40 EST


This would have caught:
https://lore.kernel.org/linux-perf-users/CAP-5=fWQR=sCuiSMktvUtcbOLidEpUJLCybVF6=BRvORcDOq+g@xxxxxxxxxxxxxx/

Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/tests/shell/stat.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/tools/perf/tests/shell/stat.sh b/tools/perf/tests/shell/stat.sh
index c7894764d4a6..9313ef2739e0 100755
--- a/tools/perf/tests/shell/stat.sh
+++ b/tools/perf/tests/shell/stat.sh
@@ -16,6 +16,18 @@ test_default_stat() {
echo "Basic stat command test [Success]"
}

+test_stat_record_report() {
+ echo "stat record and report test"
+ if ! perf stat record -o - true | perf stat report -i - 2>&1 | \
+ egrep -q "Performance counter stats for 'pipe':"
+ then
+ echo "stat record and report test [Failed]"
+ err=1
+ return
+ fi
+ echo "stat record and report test [Success]"
+}
+
test_topdown_groups() {
# Topdown events must be grouped with the slots event first. Test that
# parse-events reorders this.
@@ -62,6 +74,7 @@ test_topdown_weak_groups() {
}

test_default_stat
+test_stat_record_report
test_topdown_groups
test_topdown_weak_groups
exit $err
--
2.36.1.124.g0e6072fb45-goog