Re: [PATCH v3 2/2] perf test: Add CVS summary test

From: Arnaldo Carvalho de Melo
Date: Wed Mar 24 2021 - 09:06:09 EST


Em Fri, Mar 19, 2021 at 03:01:56PM +0800, Jin Yao escreveu:
> The patch "perf stat: Align CSV output for summary mode" aligned
> CVS output and added "summary" to the first column of summary
> lines.
>
> Now we check if the "summary" string is added to the CVS output.
>
> If we set '--no-cvs-summary' option, the "summary" string would
> not be added, also check with this case.

You mixed up cvs with csv in various places, I'm fixing it up...

- Arnaldo

> Signed-off-by: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
> ---
> v3:
> - New in v3.
>
> tools/perf/tests/shell/stat+cvs_summary.sh | 31 ++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
> create mode 100755 tools/perf/tests/shell/stat+cvs_summary.sh
>
> diff --git a/tools/perf/tests/shell/stat+cvs_summary.sh b/tools/perf/tests/shell/stat+cvs_summary.sh
> new file mode 100755
> index 000000000000..dd14f2ce7f6b
> --- /dev/null
> +++ b/tools/perf/tests/shell/stat+cvs_summary.sh
> @@ -0,0 +1,31 @@
> +#!/bin/sh
> +# perf stat cvs summary test
> +# SPDX-License-Identifier: GPL-2.0
> +
> +set -e
> +
> +#
> +# 1.001364330 9224197 cycles 8012885033 100.00
> +# summary 9224197 cycles 8012885033 100.00
> +#
> +perf stat -e cycles -x' ' -I1000 --interval-count 1 --summary 2>&1 | \
> +grep -e summary | \
> +while read summary num event run pct
> +do
> + if [ $summary != "summary" ]; then
> + exit 1
> + fi
> +done
> +
> +#
> +# 1.001360298 9148534 cycles 8012853854 100.00
> +#9148534 cycles 8012853854 100.00
> +#
> +perf stat -e cycles -x' ' -I1000 --interval-count 1 --summary --no-cvs-summary 2>&1 | \
> +grep -e summary | \
> +while read num event run pct
> +do
> + exit 1
> +done
> +
> +exit 0
> --
> 2.17.1
>

--

- Arnaldo