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

perf test: Add CSV summary test

The patch "perf stat: Align CSV output for summary mode" aligned CSV
output and added "summary" to the first column of summary lines.

Now we check if the "summary" string is added to the CSV output.

If we set '--no-csv-summary' option, the "summary" string would not be
added, also check with this case.

Committer testing:

$ perf test csv
84: perf stat csv summary test : Ok
$

Signed-off-by: Jin Yao <yao.jin@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20210319070156.20394-2-yao.jin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jin Yao and committed by
Arnaldo Carvalho de Melo
0f7ff383 0bdad978

+31
+31
tools/perf/tests/shell/stat+csv_summary.sh
··· 1 + #!/bin/sh 2 + # perf stat csv summary test 3 + # SPDX-License-Identifier: GPL-2.0 4 + 5 + set -e 6 + 7 + # 8 + # 1.001364330 9224197 cycles 8012885033 100.00 9 + # summary 9224197 cycles 8012885033 100.00 10 + # 11 + perf stat -e cycles -x' ' -I1000 --interval-count 1 --summary 2>&1 | \ 12 + grep -e summary | \ 13 + while read summary num event run pct 14 + do 15 + if [ $summary != "summary" ]; then 16 + exit 1 17 + fi 18 + done 19 + 20 + # 21 + # 1.001360298 9148534 cycles 8012853854 100.00 22 + #9148534 cycles 8012853854 100.00 23 + # 24 + perf stat -e cycles -x' ' -I1000 --interval-count 1 --summary --no-csv-summary 2>&1 | \ 25 + grep -e summary | \ 26 + while read num event run pct 27 + do 28 + exit 1 29 + done 30 + 31 + exit 0