Re: [PATCH v2] perf: test: Add support for testing JSON generated by perf data command

Arnaldo Carvalho de Melo
2023-05-22T18:31:14Z

Em Mon, May 22, 2023 at 03:28:20PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Mon, May 22, 2023 at 11:10:43AM -0700, Ian Rogers escreveu:
> > On Fri, May 19, 2023 at 12:41 AM Anup Sharma <anupnewsmail@gmail.com> wrote:
> > >
> > > This commit adds support for testing the JSON output generated
> > > by the perf data command's conversion to JSON functionality.
> > > The test script now includes a validation step to ensure that
> > > the resulting JSON file is contain valid data.
> > >
> > > Signed-off-by: Anup Sharma <anupnewsmail@gmail.com>
> >
> > Acked-by: Ian Rogers <irogers@google.com>
>
> I'm fixing these and some other identation minor issues:

The ones below, using 'set list' on vim, look at the mix of tabs with
spaces:

+validate_json_format()$
+{$
+ echo "Validating Perf Data Converted JSON file"$
+ if [ -f "$result" ]$
+ then$
+ if $PYTHON -c "import json; json.load(open('$result'))" >/dev/null 2>&1$
+^Ithen$
+ echo "The file contains valid JSON format [SUCCESS]"$
+ else$
+ echo "The file does not contain valid JSON format [FAILED]"$
+ err=1$
+^I exit$
+ fi$
+ else$
+ echo "File not found [FAILED]"$
+ err=2$
+ exit$
+ fi$
+}$
+$
+test_json_converter_command$

> [acme@quaco perf-tools-next]$ b4 am -ctsl --cc-trailers CAP-5=fXyqWYgR0M0rqG8a2j0sL1WThNX8r49T7EfvkOG32-UqA@mail.gmail.com
> Grabbing thread from lore.kernel.org/all/CAP-5%3DfXyqWYgR0M0rqG8a2j0sL1WThNX8r49T7EfvkOG32-UqA%40mail.gmail.com/t.mbox.gz
> Checking for newer revisions
> Grabbing search results from lore.kernel.org
> Analyzing 2 messages in the thread
> Checking attestation on all messages, may take a moment...
> ---
> [PATCH v2] perf: test: Add support for testing JSON generated by perf data command
> + Acked-by: Ian Rogers <irogers@google.com>
> + Link: https://lore.kernel.org/r/ZGcoJBAGlknjsA/n@yoga
> + Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
> NOTE: install dkimpy for DKIM signature verification
> ---
> Total patches: 1
> ---
> Link: https://lore.kernel.org/r/ZGcoJBAGlknjsA/n@yoga
> Base: not specified
> git am ./v2_20230519_anupnewsmail_perf_test_add_support_for_testing_json_generated_by_perf_data_command.mbx
> [acme@quaco perf-tools-next]$ git am ./v2_20230519_anupnewsmail_perf_test_add_support_for_testing_json_generated_by_perf_data_command.mbx
> Applying: perf: test: Add support for testing JSON generated by perf data command
> .git/rebase-apply/patch:59: trailing whitespace.
> else
> warning: 1 line adds whitespace errors.
> tools/perf/tests/shell/test_perf_data_converter_json.sh:48: trailing whitespace.
> + else
> [acme@quaco perf-tools-next]$
>

--

- Arnaldo