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 - 13:12:42 EST


Em Thu, Oct 06, 2022 at 11:07:19PM +0800, Leo Yan escreveu:
> On Thu, Oct 06, 2022 at 11:22:13AM -0300, Arnaldo Carvalho de Melo wrote:
>
> [...]
>
> > > @@ -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 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/shell/coresight'
> > > + $(Q)$(MAKE) -C tests/shell/coresight install-tests
> > >
> > > It's deliberately to not add '-m 644' when install coresight test
> > > shell scripts under the folder tests/shell/coresight/ so that we can
> > > keep the executable permission for these scripts. On the other flip,
> > > we set 644 mode for the scripts under tests/shell/lib/ so these
> > > scripts will not be executed directly by perf test framework.
> > >
> > > @Carsten, if have chance could you confirm for above change?
> >
> > If you need for some .sh, coresight test's to have x set while all of
> > the others don't have, and you have a good reason for that, ok, we just
> > add a comment.
>
> Simply to say, all lib scripts are not needed for execute permission.
> Yes, it's good to add a comment for the installation steps.
>
> > > > DESCEND plugins
> > > > GEN /tmp/build/perf/python/perf.so
> > > > INSTALL trace_plugins
> > > > INSTALL binaries
> > > > INSTALL tests
> > > > install: cannot stat 'tests/shell/coresight/*.sh': No such file or directory
> > > > make[2]: *** [Makefile.perf:1007: install-tests] Error 1
> > > > make[2]: *** Waiting for unfinished jobs....
> > > >
> > > > I'll add it back when the first .sh gets added to tests/shell/coresight/
> > >
> > > Sorry for introducing extra efforts for you and thanks!
> >
> > This also has to go, I'll check and fix this loop that doesn't follow
> > the existing output style, happens with ´make install', etc too:
> >
> > ⬢[acme@toolbox perf]$ make -C tools/perf clean
> > make: Entering directory '/var/home/acme/git/perf/tools/perf'
> > CLEAN x86
> > CLEAN libtraceevent
> > CLEAN libapi
> > CLEAN libbpf
> > CLEAN libsubcmd
> > CLEAN libperf
> > CLEAN fixdep
> > CLEAN feature-detect
> > CLEAN python
> > CLEAN bpf-skel
> > make -C asm_pure_loop clean >/dev/null <-------------------
> > make -C memcpy_thread clean >/dev/null <-------------------
> > make -C thread_loop clean >/dev/null <-------------------
> > make -C unroll_loop_thread clean >/dev/null <-------------------
>
> Ouch, if we can update the file tests/shell/coresight/Makefile as below:
>
> $(CLEANDIRS):
> $(call QUIET_CLEAN, test-$(@:clean-%=%)) $(Q)$(MAKE) -C $(@:clean-%=%) clean >/dev/null

I had to do it, so far, at the time that the above line is first added
as:

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index a20b4adb5e3451f1..194e582e70c2c766 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -635,7 +635,8 @@ tests-coresight-targets: FORCE
$(Q)$(MAKE) -C $(TESTS_CORESIGHT_DIR)

tests-coresight-targets-clean:
- $(Q)$(MAKE) -C $(TESTS_CORESIGHT_DIR) clean
+ $(call QUIET_CLEAN, coresight)
+ $(Q)$(MAKE) -C $(TESTS_CORESIGHT_DIR) O=$(OUTPUT) clean >/dev/null

all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) tests-coresight-targets

diff --git a/tools/perf/tests/shell/coresight/Makefile b/tools/perf/tests/shell/coresight/Makefile
index 3fee05cfcb0e73f6..6baab5cbaa9aa3b1 100644
--- a/tools/perf/tests/shell/coresight/Makefile
+++ b/tools/perf/tests/shell/coresight/Makefile
@@ -20,6 +20,6 @@ CLEANDIRS = $(SUBDIRS:%=clean-%)

clean: $(CLEANDIRS)
$(CLEANDIRS):
- $(Q)$(MAKE) -C $(@:clean-%=%) clean >/dev/null
+ $(call QUIET_CLEAN, test-$(@:clean-%=%)) $(Q)$(MAKE) -C $(@:clean-%=%) clean >/dev/null

.PHONY: all clean $(SUBDIRS) $(CLEANDIRS) $(INSTALLDIRS)

> Then we can get output as:
>
> # make clean
> CLEAN arm64
> CLEAN libtraceevent
> CLEAN libapi
> CLEAN libbpf
> CLEAN libsubcmd
> CLEAN libperf
> CLEAN fixdep
> CLEAN feature-detect
> CLEAN python
> CLEAN bpf-skel
> CLEAN test-asm_pure_loop
> CLEAN test-memcpy_thread
> CLEAN test-thread_loop
> CLEAN test-unroll_loop_thread
> CLEAN core-objs
> CLEAN core-progs
> CLEAN core-gen
> CLEAN Documentation
>
> Sorry for inconvenience.
>
> Thanks,
> Leo

--

- Arnaldo