summaryrefslogtreecommitdiff
path: root/t/perf/run
diff options
context:
space:
mode:
authorLibravatar Christian Couder <chriscool@tuxfamily.org>2017-09-23 19:55:56 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-09-24 16:58:34 +0900
commit9ba95ed23cec1787d1fc2d42ef48137987807ca8 (patch)
tree1c942ce53ce414ef18e8aaf0d896935bb96ce6c2 /t/perf/run
parentperf/run: add get_subsections() (diff)
downloadtgif-9ba95ed23cec1787d1fc2d42ef48137987807ca8.tar.xz
perf/run: update get_var_from_env_or_config() for subsections
As we will set some config options in subsections, let's teach get_var_from_env_or_config() to get the config options from the subsections if they are set there. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/perf/run')
-rwxr-xr-xt/perf/run32
1 files changed, 20 insertions, 12 deletions
diff --git a/t/perf/run b/t/perf/run
index 4c966c0ae4..bd39398b9c 100755
--- a/t/perf/run
+++ b/t/perf/run
@@ -102,29 +102,37 @@ get_subsections () {
get_var_from_env_or_config () {
env_var="$1"
- conf_var="$2"
- # $3 can be set to a default value
+ conf_sec="$2"
+ conf_var="$3"
+ # $4 can be set to a default value
# Do nothing if the env variable is already set
eval "test -z \"\${$env_var+x}\"" || return
+ test -z "$GIT_PERF_CONFIG_FILE" && return
+
# Check if the variable is in the config file
- test -n "$GIT_PERF_CONFIG_FILE" &&
- conf_value=$(git config -f "$GIT_PERF_CONFIG_FILE" "$conf_var") &&
- eval "$env_var=\"$conf_value\"" || {
- test -n "${3+x}" &&
- eval "$env_var=\"$3\""
- }
+ if test -n "$GIT_PERF_SUBSECTION"
+ then
+ var="$conf_sec.$GIT_PERF_SUBSECTION.$conf_var"
+ conf_value=$(git config -f "$GIT_PERF_CONFIG_FILE" "$var") &&
+ eval "$env_var=\"$conf_value\"" && return
+ fi
+ var="$conf_sec.$conf_var"
+ conf_value=$(git config -f "$GIT_PERF_CONFIG_FILE" "$var") &&
+ eval "$env_var=\"$conf_value\"" && return
+
+ test -n "${4+x}" && eval "$env_var=\"$4\""
}
-get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf.repeatCount" 3
+get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" 3
export GIT_PERF_REPEAT_COUNT
-get_var_from_env_or_config "GIT_PERF_DIRS_OR_REVS" "perf.dirsOrRevs"
+get_var_from_env_or_config "GIT_PERF_DIRS_OR_REVS" "perf" "dirsOrRevs"
set -- $GIT_PERF_DIRS_OR_REVS "$@"
-get_var_from_env_or_config "GIT_PERF_MAKE_COMMAND" "perf.makeCommand"
-get_var_from_env_or_config "GIT_PERF_MAKE_OPTS" "perf.makeOpts"
+get_var_from_env_or_config "GIT_PERF_MAKE_COMMAND" "perf" "makeCommand"
+get_var_from_env_or_config "GIT_PERF_MAKE_OPTS" "perf" "makeOpts"
GIT_PERF_AGGREGATING_LATER=t
export GIT_PERF_AGGREGATING_LATER