Skip to content

Commit afda85c

Browse files
chriscoolgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9ba95ed commit afda85c

File tree

1 file changed

+35
-12
lines changed

1 file changed

+35
-12
lines changed

t/perf/run

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,46 @@ get_var_from_env_or_config () {
125125
test -n "${4+x}" && eval "$env_var=\"$4\""
126126
}
127127

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
130131

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 "$@"
133134

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"
136137

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+
}
139148

140149
cd "$(dirname $0)"
141150
. ../../GIT-BUILD-OPTIONS
142151

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
145170
fi
146-
run_dirs "$@"
147-
./aggregate.perl "$@"

0 commit comments

Comments
 (0)