Re: [PATCH v9 02/13] perf test: Add build infra for perf test tools for CoreSight tests

From: Arnaldo Carvalho de Melo
Date: Thu Oct 06 2022 - 07:26:14 EST


Em Fri, Sep 09, 2022 at 04:27:52PM +0100, carsten.haitzler@xxxxxxxxxxxx escreveu:
> From: Carsten Haitzler <carsten.haitzler@xxxxxxx>
>
> This adds the initial build infrastructure (makefiles maintainers
> information) for adding follow-on tests for CoreSight.
>
> Signed-off-by: Carsten Haitzler <carsten.haitzler@xxxxxxx>
> ---
> MAINTAINERS | 1 +
> tools/perf/Makefile.config | 2 ++
> tools/perf/Makefile.perf | 15 +++++++++--
> tools/perf/tests/shell/coresight/Makefile | 25 +++++++++++++++++++
> .../tests/shell/coresight/Makefile.miniconfig | 14 +++++++++++
> 5 files changed, 55 insertions(+), 2 deletions(-)
> create mode 100644 tools/perf/tests/shell/coresight/Makefile
> create mode 100644 tools/perf/tests/shell/coresight/Makefile.miniconfig
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 9d7f64dc0efe..c8ae5a6638b6 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2029,6 +2029,7 @@ F: drivers/hwtracing/coresight/*
> F: include/dt-bindings/arm/coresight-cti-dt.h
> F: include/linux/coresight*
> F: samples/coresight/*
> +F: tools/perf/tests/shell/coresight/*
> F: tools/perf/arch/arm/util/auxtrace.c
> F: tools/perf/arch/arm/util/cs-etm.c
> F: tools/perf/arch/arm/util/cs-etm.h
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index 0661a1cf9855..e3e28b3481f9 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -1291,6 +1291,8 @@ perf_examples_instdir_SQ = $(subst ','\'',$(perf_examples_instdir))
> STRACE_GROUPS_INSTDIR_SQ = $(subst ','\'',$(STRACE_GROUPS_INSTDIR))
> tip_instdir_SQ = $(subst ','\'',$(tip_instdir))
>
> +export perfexec_instdir_SQ
> +
> # If we install to $(HOME) we keep the traceevent default:
> # $(HOME)/.traceevent/plugins
> # Otherwise we install plugins into the global $(libdir).
> diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
> index e5921b347153..cef2a06c8f54 100644
> --- a/tools/perf/Makefile.perf
> +++ b/tools/perf/Makefile.perf
> @@ -629,7 +629,15 @@ sync_file_range_tbls := $(srctree)/tools/perf/trace/beauty/sync_file_range.sh
> $(sync_file_range_arrays): $(linux_uapi_dir)/fs.h $(sync_file_range_tbls)
> $(Q)$(SHELL) '$(sync_file_range_tbls)' $(linux_uapi_dir) > $@
>
> -all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
> +TESTS_CORESIGHT_DIR := $(srctree)/tools/perf/tests/shell/coresight
> +
> +tests-coresight-targets: FORCE
> + $(Q)$(MAKE) -C $(TESTS_CORESIGHT_DIR)
> +
> +tests-coresight-targets-clean:
> + $(Q)$(MAKE) -C $(TESTS_CORESIGHT_DIR) clean
> +
> +all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) tests-coresight-targets
>
> # Create python binding output directory if not already present
> _dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')
> @@ -1007,6 +1015,9 @@ install-tests: all install-gtk
> $(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/*.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'
> + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight'; \
> + $(INSTALL) tests/shell/coresight/*.sh '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight'
> + $(Q)$(MAKE) -C tests/shell/coresight install-tests

Added a missing ;\ on the line installing the *.py and adjusted use -m
644 for the .sh files to follow what was done in:

0a9eaf616f29ca32 ("perf tools: Don't install data files with x permissions")

@@ -1006,7 +1014,10 @@ install-tests: all install-gtk
$(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 -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
- $(INSTALL) tests/shell/lib/*.py -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'
+ $(INSTALL) tests/shell/lib/*.py -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/lib'; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight'; \
+ $(INSTALL) tests/shell/coresight/*.sh -m 644 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight'
+ $(Q)$(MAKE) -C tests/shell/coresight install-tests


> install-bin: install-tools install-tests install-traceevent-plugins
>
> @@ -1077,7 +1088,7 @@ endif # BUILD_BPF_SKEL
> bpf-skel-clean:
> $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS)
>
> -clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean
> +clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresight-targets-clean
> $(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive $(OUTPUT)perf-iostat $(LANG_BINDINGS)
> $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
> $(Q)$(RM) $(OUTPUT).config-detected
> diff --git a/tools/perf/tests/shell/coresight/Makefile b/tools/perf/tests/shell/coresight/Makefile
> new file mode 100644
> index 000000000000..3fee05cfcb0e
> --- /dev/null
> +++ b/tools/perf/tests/shell/coresight/Makefile
> @@ -0,0 +1,25 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +# Carsten Haitzler <carsten.haitzler@xxxxxxx>, 2021
> +include ../../../../../tools/scripts/Makefile.include
> +include ../../../../../tools/scripts/Makefile.arch
> +include ../../../../../tools/scripts/utilities.mak
> +
> +SUBDIRS =
> +
> +all: $(SUBDIRS)
> +$(SUBDIRS):
> + $(Q)$(MAKE) -C $@
> +
> +INSTALLDIRS = $(SUBDIRS:%=install-%)
> +
> +install-tests: $(INSTALLDIRS)
> +$(INSTALLDIRS):
> + $(Q)$(MAKE) -C $(@:install-%=%) install-tests
> +
> +CLEANDIRS = $(SUBDIRS:%=clean-%)
> +
> +clean: $(CLEANDIRS)
> +$(CLEANDIRS):
> + $(Q)$(MAKE) -C $(@:clean-%=%) clean >/dev/null
> +
> +.PHONY: all clean $(SUBDIRS) $(CLEANDIRS) $(INSTALLDIRS)
> diff --git a/tools/perf/tests/shell/coresight/Makefile.miniconfig b/tools/perf/tests/shell/coresight/Makefile.miniconfig
> new file mode 100644
> index 000000000000..5f72a9cb43f3
> --- /dev/null
> +++ b/tools/perf/tests/shell/coresight/Makefile.miniconfig
> @@ -0,0 +1,14 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +# Carsten Haitzler <carsten.haitzler@xxxxxxx>, 2021
> +
> +ifndef DESTDIR
> +prefix ?= $(HOME)
> +endif
> +
> +DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
> +INSTALL = install
> +INSTDIR_SUB = tests/shell/coresight
> +
> +include ../../../../../scripts/Makefile.include
> +include ../../../../../scripts/Makefile.arch
> +include ../../../../../scripts/utilities.mak
> --
> 2.32.0

--

- Arnaldo