14 echo "usage: $0 [--config file] [--subsection subsec] [other_git_tree...] [--] [test_scripts]"
18 GIT_PERF_CONFIG_FILE
=$
(cd "$(dirname "$1")"; pwd)/$
(basename "$1")
19 export GIT_PERF_CONFIG_FILE
23 GIT_PERF_SUBSECTION
="$1"
24 export GIT_PERF_SUBSECTION
27 die
"unrecognised option: '$arg'" ;;
34 if test $# -eq 0; then
37 echo "=== Running $# tests in ${GIT_TEST_INSTALLED:-this tree} ==="
45 echo "=== Unpacking $rev in build/$rev ==="
47 (cd "$(git rev-parse --show-cdup)" && git archive
--format=tar $rev) |
48 (cd build
/$rev && tar x
)
54 for config
in config.mak config.mak.autogen config.status
56 if test -e "../../$config"
58 cp "../../$config" "build/$rev/"
61 echo "=== Building $rev ($name) ==="
64 if test -n "$GIT_PERF_MAKE_COMMAND"
66 sh
-c "$GIT_PERF_MAKE_COMMAND"
68 make $GIT_PERF_MAKE_OPTS
70 ) || die
"failed to build revision '$mydir'"
76 while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
79 if test $# -gt 0 -a "$1" = --; then
82 if [ ! -d "$mydir" ]; then
83 rev=$
(git rev-parse
--verify "$mydir" 2>/dev
/null
) ||
84 die
"'$mydir' is neither a directory nor a valid revision"
85 if [ ! -d build
/$rev ]; then
88 build_git_rev
$rev "$mydir"
91 if test "$mydir" = .
; then
92 unset GIT_TEST_INSTALLED
94 GIT_TEST_INSTALLED
="$mydir/bin-wrappers"
95 # Older versions of git lacked bin-wrappers; fallback to the
97 test -d "$GIT_TEST_INSTALLED" || GIT_TEST_INSTALLED
=$mydir
98 export GIT_TEST_INSTALLED
104 while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
112 test -z "$GIT_PERF_CONFIG_FILE" && return
113 git config
-f "$GIT_PERF_CONFIG_FILE" --name-only --get-regex "$section\..*\.[^.]+" |
114 sed -e "s/$section\.\(.*\)\..*/\1/" |
sort |
uniq
117 get_var_from_env_or_config
() {
121 conf_opts
="$4" # optional
123 # Do nothing if the env variable is already set
124 eval "test -z \"\${$env_var+x}\"" ||
return
126 test -z "$GIT_PERF_CONFIG_FILE" && return
128 # Check if the variable is in the config file
129 if test -n "$GIT_PERF_SUBSECTION"
131 var
="$conf_sec.$GIT_PERF_SUBSECTION.$conf_var"
132 conf_value
=$
(git config
$conf_opts -f "$GIT_PERF_CONFIG_FILE" "$var") &&
133 eval "$env_var=\"$conf_value\"" && return
135 var
="$conf_sec.$conf_var"
136 conf_value
=$
(git config
$conf_opts -f "$GIT_PERF_CONFIG_FILE" "$var") &&
137 eval "$env_var=\"$conf_value\""
141 get_var_from_env_or_config
"GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" "--int"
142 : ${GIT_PERF_REPEAT_COUNT:=3}
143 export GIT_PERF_REPEAT_COUNT
145 get_var_from_env_or_config
"GIT_PERF_DIRS_OR_REVS" "perf" "dirsOrRevs"
146 set -- $GIT_PERF_DIRS_OR_REVS "$@"
148 get_var_from_env_or_config
"GIT_PERF_MAKE_COMMAND" "perf" "makeCommand"
149 get_var_from_env_or_config
"GIT_PERF_MAKE_OPTS" "perf" "makeOpts"
151 get_var_from_env_or_config
"GIT_PERF_REPO_NAME" "perf" "repoName"
152 export GIT_PERF_REPO_NAME
154 GIT_PERF_AGGREGATING_LATER
=t
155 export GIT_PERF_AGGREGATING_LATER
157 if test $# = 0 -o "$1" = -- -o -f "$1"; then
162 test "$GIT_PERF_CODESPEED_OUTPUT" = "true" && codespeed_opt
="--codespeed"
166 if test -z "$GIT_PERF_SEND_TO_CODESPEED"
168 .
/aggregate.perl
$codespeed_opt "$@"
170 json_res_file
="test-results/$GIT_PERF_SUBSECTION/aggregate.json"
171 .
/aggregate.perl
--codespeed "$@" |
tee "$json_res_file"
172 send_data_url
="$GIT_PERF_SEND_TO_CODESPEED/result/add/json/"
173 curl
-v --request POST
--data-urlencode "json=$(cat "$json_res_file")" "$send_data_url"
177 get_var_from_env_or_config
"GIT_PERF_CODESPEED_OUTPUT" "perf" "codespeedOutput" "--bool"
178 get_var_from_env_or_config
"GIT_PERF_SEND_TO_CODESPEED" "perf" "sendToCodespeed"
181 . ..
/..
/GIT-BUILD-OPTIONS
183 mkdir
-p test-results
184 get_subsections
"perf" >test-results
/run_subsections.names
186 if test $
(wc -l <test-results
/run_subsections.names
) -eq 0
188 if test -n "$GIT_PERF_SUBSECTION"
190 if test -n "$GIT_PERF_CONFIG_FILE"
192 die
"no subsections are defined in config file '$GIT_PERF_CONFIG_FILE'"
194 die
"subsection '$GIT_PERF_SUBSECTION' defined without a config file"
200 elif test -n "$GIT_PERF_SUBSECTION"
202 egrep "^$GIT_PERF_SUBSECTION\$" test-results
/run_subsections.names
>/dev
/null ||
203 die
"subsection '$GIT_PERF_SUBSECTION' not found in '$GIT_PERF_CONFIG_FILE'"
205 egrep "^$GIT_PERF_SUBSECTION\$" test-results
/run_subsections.names |
while read -r subsec
208 GIT_PERF_SUBSECTION
="$subsec"
209 export GIT_PERF_SUBSECTION
210 echo "======== Run for subsection '$GIT_PERF_SUBSECTION' ========"
218 GIT_PERF_SUBSECTION
="$subsec"
219 export GIT_PERF_SUBSECTION
220 echo "======== Run for subsection '$GIT_PERF_SUBSECTION' ========"
223 done <test-results
/run_subsections.names