perf test: Refactor shell tests allowing subdirs
authorCarsten Haitzler <carsten.haitzler@arm.com>
Fri, 12 Aug 2022 12:16:28 +0000 (13:16 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 13 Aug 2022 18:13:20 +0000 (15:13 -0300)
commit7391db6459388d47d657aad633cb55fc04a8d4fb
tree43025c60999f7178f97f006db43c60414203d078
parentaa0d6e9cc23e996b484725d0a31906809862d678
perf test: Refactor shell tests allowing subdirs

This is a prelude to adding more tests to shell tests and in order to
support putting those tests into subdirectories, I need to change the
test code that scans/finds and runs them.

To support subdirs I have to recurse so it's time to refactor the code
to allow this and centralize the shell script finding into one location
and only one single scan that builds a list of all the found tests in
memory instead of it being duplicated in 3 places.

This code also optimizes things like knowing the max width of desciption
strings (as we can do that while we scan instead of a whole new pass of
opening files).

It also more cleanly filters scripts to see only *.sh files thus
skipping random other files in directories like *~ backup files, other
random junk/data files that may appear and the scripts must be
executable to make the cut (this ensures the script lib dir is not seen
as scripts to run).

This avoids perf test running previous older versions of test scripts
that are editor backup files as well as skipping perf.data files that
may appear and so on.

Reviewed-by: Leo Yan <leo.yan@linaro.org>
Signed-off-by: Carsten Haitzler <carsten.haitzler@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: coresight@lists.linaro.org
Link: https://lore.kernel.org/r/20220812121641.336465-2-carsten.haitzler@foss.arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/Build
tools/perf/tests/builtin-test-list.c [new file with mode: 0644]
tools/perf/tests/builtin-test-list.h [new file with mode: 0644]
tools/perf/tests/builtin-test.c