perf/run: add run_subsection()
Let's actually use the subsections we find in the config file to run the perf tests separately for each subsection. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christian Couder committed
Sep 23, 2017 at 19:55 UTC
afda85c25d097e04d6c054817964cc8bba3ff0fa
1 file changed
+35
-12
t/perf/run
+35
-12
@@ -125,23 +125,46 @@ get_var_from_env_or_config () {
125
test -n "${4+x}" && eval "$env_var=\"$4\""
126
}
127
128
-get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" 3
129
-export GIT_PERF_REPEAT_COUNT
128
+run_subsection () {
129
+ get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" 3
130
+ export GIT_PERF_REPEAT_COUNT
131
131
-get_var_from_env_or_config "GIT_PERF_DIRS_OR_REVS" "perf" "dirsOrRevs"
132
-set -- $GIT_PERF_DIRS_OR_REVS "$@"
132
+ get_var_from_env_or_config "GIT_PERF_DIRS_OR_REVS" "perf" "dirsOrRevs"
133
+ set -- $GIT_PERF_DIRS_OR_REVS "$@"
134
134
-get_var_from_env_or_config "GIT_PERF_MAKE_COMMAND" "perf" "makeCommand"
135
-get_var_from_env_or_config "GIT_PERF_MAKE_OPTS" "perf" "makeOpts"
135
+ get_var_from_env_or_config "GIT_PERF_MAKE_COMMAND" "perf" "makeCommand"
136
+ get_var_from_env_or_config "GIT_PERF_MAKE_OPTS" "perf" "makeOpts"
137
137
-GIT_PERF_AGGREGATING_LATER=t
138
-export GIT_PERF_AGGREGATING_LATER
138
+ GIT_PERF_AGGREGATING_LATER=t
139
+ export GIT_PERF_AGGREGATING_LATER
140
+
141
+ if test $# = 0 -o "$1" = -- -o -f "$1"; then
142
+ set -- . "$@"
143
+ fi
144
+
145
+ run_dirs "$@"
146
+ ./aggregate.perl "$@"
147
+}
148
149
cd "$(dirname $0)"
150
. ../../GIT-BUILD-OPTIONS
151
143
-if test $# = 0 -o "$1" = -- -o -f "$1"; then
144
- set -- . "$@"
152
+mkdir -p test-results
153
+get_subsections "perf" >test-results/run_subsections.names
154
+
155
+if test $(wc -l <test-results/run_subsections.names) -eq 0
156
+then
157
+ (
158
+ run_subsection "$@"
159
+ )
160
+else
161
+ while read -r subsec
162
+ do
163
+ (
164
+ GIT_PERF_SUBSECTION="$subsec"
165
+ export GIT_PERF_SUBSECTION
166
+ echo "======== Run for subsection '$GIT_PERF_SUBSECTION' ========"
167
+ run_subsection "$@"
168
+ )
169
+ done <test-results/run_subsections.names
170
fi
146
-run_dirs "$@"
147
-./aggregate.perl "$@"