5 echo "usage: $0 [--config file] [other_git_tree...] [--] [test_scripts]"
10 GIT_PERF_CONFIG_FILE=$(cd "$(dirname "$1")"; pwd)/$(basename "$1")
11 export GIT_PERF_CONFIG_FILE
21 if test $# -eq 0; then
24 echo "=== Running $# tests in ${GIT_TEST_INSTALLED:-this tree} ==="
32 echo "=== Unpacking $rev in build/$rev ==="
34 (cd "$(git rev-parse --show-cdup)" && git archive --format=tar $rev) |
35 (cd build/$rev && tar x)
41 for config in config.mak config.mak.autogen config.status
43 if test -e "../../$config"
45 cp "../../$config" "build/$rev/"
48 echo "=== Building $rev ($name) ==="
51 if test -n "$GIT_PERF_MAKE_COMMAND"
53 sh -c "$GIT_PERF_MAKE_COMMAND"
55 make $GIT_PERF_MAKE_OPTS
57 ) || die "failed to build revision '$mydir'"
63 while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
66 if test $# -gt 0 -a "$1" = --; then
69 if [ ! -d "$mydir" ]; then
70 rev=$(git rev-parse --verify "$mydir" 2>/dev/null) ||
71 die "'$mydir' is neither a directory nor a valid revision"
72 if [ ! -d build/$rev ]; then
75 build_git_rev $rev "$mydir"
78 if test "$mydir" = .; then
79 unset GIT_TEST_INSTALLED
81 GIT_TEST_INSTALLED="$mydir/bin-wrappers"
82 # Older versions of git lacked bin-wrappers; fallback to the
84 test -d "$GIT_TEST_INSTALLED" || GIT_TEST_INSTALLED=$mydir
85 export GIT_TEST_INSTALLED
91 while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
99 test -z "$GIT_PERF_CONFIG_FILE" && return
100 git config -f "$GIT_PERF_CONFIG_FILE" --name-only --get-regex "$section\..*\.[^.]+" |
101 sed -e "s/$section\.\(.*\)\..*/\1/" | sort | uniq
104 get_var_from_env_or_config () {
108 conf_opts="$4" # optional
110 # Do nothing if the env variable is already set
111 eval "test -z \"\${$env_var+x}\"" || return
113 test -z "$GIT_PERF_CONFIG_FILE" && return
115 # Check if the variable is in the config file
116 if test -n "$GIT_PERF_SUBSECTION"
118 var="$conf_sec.$GIT_PERF_SUBSECTION.$conf_var"
119 conf_value=$(git config $conf_opts -f "$GIT_PERF_CONFIG_FILE" "$var") &&
120 eval "$env_var=\"$conf_value\"" && return
122 var="$conf_sec.$conf_var"
123 conf_value=$(git config $conf_opts -f "$GIT_PERF_CONFIG_FILE" "$var") &&
124 eval "$env_var=\"$conf_value\""
128 get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" "--int"
129 : ${GIT_PERF_REPEAT_COUNT:=3}
130 export GIT_PERF_REPEAT_COUNT
132 get_var_from_env_or_config "GIT_PERF_DIRS_OR_REVS" "perf" "dirsOrRevs"
133 set -- $GIT_PERF_DIRS_OR_REVS "$@"
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"
138 get_var_from_env_or_config "GIT_PERF_REPO_NAME" "perf" "repoName"
139 export GIT_PERF_REPO_NAME
141 GIT_PERF_AGGREGATING_LATER=t
142 export GIT_PERF_AGGREGATING_LATER
144 if test $# = 0 -o "$1" = -- -o -f "$1"; then
149 test "$GIT_PERF_CODESPEED_OUTPUT" = "true" && codespeed_opt="--codespeed"
153 if test -z "$GIT_PERF_SEND_TO_CODESPEED"
155 ./aggregate.perl $codespeed_opt "$@"
157 json_res_file="test-results/$GIT_PERF_SUBSECTION/aggregate.json"
158 ./aggregate.perl --codespeed "$@" | tee "$json_res_file"
159 send_data_url="$GIT_PERF_SEND_TO_CODESPEED/result/add/json/"
160 curl -v --request POST --data-urlencode "json=$(cat "$json_res_file")" "$send_data_url"
164 get_var_from_env_or_config "GIT_PERF_CODESPEED_OUTPUT" "perf" "codespeedOutput" "--bool"
165 get_var_from_env_or_config "GIT_PERF_SEND_TO_CODESPEED" "perf" "sendToCodespeed"
168 . ../../GIT-BUILD-OPTIONS
170 mkdir -p test-results
171 get_subsections "perf" >test-results/run_subsections.names
173 if test $(wc -l <test-results/run_subsections.names) -eq 0
182 GIT_PERF_SUBSECTION="$subsec"
183 export GIT_PERF_SUBSECTION
184 echo "======== Run for subsection '$GIT_PERF_SUBSECTION' ========"
187 done <test-results/run_subsections.names