perf/run: add get_subsections()
authorChristian Couder <chriscool@tuxfamily.org>
Sat, 23 Sep 2017 19:55:56 +0000 (19:55 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sun, 24 Sep 2017 07:58:34 +0000 (16:58 +0900)
This function makes it possible to find subsections, so that
we will be able to run different tests for different subsections
in a later commit.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/perf/run
index 6bd15e701756b2c8bfb1ddb4e13f7e447a23b374..4c966c0ae420e40cb59ea0aeeb7226c8e295b484 100755 (executable)
@@ -93,6 +93,13 @@ run_dirs () {
        done
 }
 
+get_subsections () {
+       section="$1"
+       test -z "$GIT_PERF_CONFIG_FILE" && return
+       git config -f "$GIT_PERF_CONFIG_FILE" --name-only --get-regex "$section\..*\.[^.]+" |
+       sed -e "s/$section\.\(.*\)\..*/\1/" | sort | uniq
+}
+
 get_var_from_env_or_config () {
        env_var="$1"
        conf_var="$2"