From 7391db6459388d47d657aad633cb55fc04a8d4fb Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 12 Aug 2022 13:16:28 +0100 Subject: 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 Signed-off-by: Carsten Haitzler Tested-by: Leo Yan Cc: Mathieu Poirier Cc: Mike Leach Cc: Suzuki Poulouse 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 --- tools/perf/tests/builtin-test-list.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tools/perf/tests/builtin-test-list.h (limited to 'tools/perf/tests/builtin-test-list.h') diff --git a/tools/perf/tests/builtin-test-list.h b/tools/perf/tests/builtin-test-list.h new file mode 100644 index 000000000000..eb81f3aa6683 --- /dev/null +++ b/tools/perf/tests/builtin-test-list.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +struct script_file { + char *dir; + char *file; + char *desc; +}; + +/* List available script tests to run - singleton - never freed */ +const struct script_file *list_script_files(void); +/* Get maximum width of description string */ +int list_script_max_width(void); -- cgit v1.2.3