Skip to content

Commit fccec20

Browse files
chriscoolgitster
authored andcommitted
perf/run: learn to send output to codespeed server
Let's make it possible to set in a config file the URL of a codespeed server. And then let's make the `run` script send the perf test results to this URL at the end of the tests. This should make is possible to easily automate the process of running perf tests and having their results available in Codespeed. Signed-off-by: Christian Couder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5d6bb93 commit fccec20

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

t/perf/run

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,20 @@ run_subsection () {
148148
test "$GIT_PERF_CODESPEED_OUTPUT" = "true" && codespeed_opt="--codespeed"
149149

150150
run_dirs "$@"
151-
./aggregate.perl $codespeed_opt "$@"
151+
152+
if test -z "$GIT_PERF_SEND_TO_CODESPEED"
153+
then
154+
./aggregate.perl $codespeed_opt "$@"
155+
else
156+
json_res_file="test-results/$GIT_PERF_SUBSECTION/aggregate.json"
157+
./aggregate.perl --codespeed "$@" | tee "$json_res_file"
158+
send_data_url="$GIT_PERF_SEND_TO_CODESPEED/result/add/json/"
159+
curl -v --request POST --data-urlencode "json=$(cat "$json_res_file")" "$send_data_url"
160+
fi
152161
}
153162

154163
get_var_from_env_or_config "GIT_PERF_CODESPEED_OUTPUT" "perf" "codespeedOutput" "--bool"
164+
get_var_from_env_or_config "GIT_PERF_SEND_TO_CODESPEED" "perf" "sendToCodespeed"
155165

156166
cd "$(dirname $0)"
157167
. ../../GIT-BUILD-OPTIONS

0 commit comments

Comments
 (0)