Re: [PATCH v7 2/2] perf test: Json format checking

From: Arnaldo Carvalho de Melo
Date: Tue Aug 09 2022 - 11:39:10 EST


Em Fri, Aug 05, 2022 at 01:01:05PM -0700, Ian Rogers escreveu:
> From: Claire Jensen <cjense@xxxxxxxxxx>
>
> Add field checking tests for perf stat JSON output.
> Sanity checks the expected number of fields are present, that the
> expected keys are present and they have the correct values.
>
> Signed-off-by: Claire Jensen <cjense@xxxxxxxxxx>
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
> ---
> tools/perf/Makefile.perf | 3 +-
> .../tests/shell/lib/perf_json_output_lint.py | 96 ++++++++++++
> tools/perf/tests/shell/stat+json_output.sh | 147 ++++++++++++++++++
> 3 files changed, 245 insertions(+), 1 deletion(-)
> create mode 100644 tools/perf/tests/shell/lib/perf_json_output_lint.py
> create mode 100755 tools/perf/tests/shell/stat+json_output.sh
>
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index 5053b563bf9c..b4c5160d3e85 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -1005,7 +1005,8 @@ install-tests: all install-gtk
> $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
> $(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
> $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
> - $(INSTALL) tests/shell/lib/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'
> + $(INSTALL) tests/shell/lib/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib' \
> + $(INSTALL) tests/shell/lib/*.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'


Next time please test installing it, since this is adding a new file:

INSTALL tests
install: omitting directory '/home/acme/libexec/perf-core/tests/shell/lib'
install: cannot stat 'install': No such file or directory
make[2]: *** [Makefile.perf:999: install-tests] Error 1
make[2]: *** Waiting for unfinished jobs....


Fixed with:

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index b4c5160d3e85a161..e5921b3471535d45 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -1005,7 +1005,7 @@ install-tests: all install-gtk
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
$(INSTALL) tests/shell/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell'; \
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
- $(INSTALL) tests/shell/lib/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib' \
+ $(INSTALL) tests/shell/lib/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
$(INSTALL) tests/shell/lib/*.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'

install-bin: install-tools install-tests install-traceevent-plugins