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)
40 for config in config.mak config.mak.autogen config.status
42 if test -e "../../$config"
44 cp "../../$config" "build/$rev/"
47 echo "=== Building $rev ==="
50 if test -n "$GIT_PERF_MAKE_COMMAND"
52 sh -c "$GIT_PERF_MAKE_COMMAND"
54 make $GIT_PERF_MAKE_OPTS
56 ) || die "failed to build revision '$mydir'"
62 while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
65 if test $# -gt 0 -a "$1" = --; then
68 if [ ! -d "$mydir" ]; then
69 rev=$(git rev-parse --verify "$mydir" 2>/dev/null) ||
70 die "'$mydir' is neither a directory nor a valid revision"
71 if [ ! -d build/$rev ]; then
77 if test "$mydir" = .; then
78 unset GIT_TEST_INSTALLED
80 GIT_TEST_INSTALLED="$mydir/bin-wrappers"
81 # Older versions of git lacked bin-wrappers; fallback to the
83 test -d "$GIT_TEST_INSTALLED" || GIT_TEST_INSTALLED=$mydir
84 export GIT_TEST_INSTALLED
90 while test $# -gt 0 -a "$1" != -- -a ! -f "$1"; do
98 test -z "$GIT_PERF_CONFIG_FILE" && return
99 git config -f "$GIT_PERF_CONFIG_FILE" --name-only --get-regex "$section\..*\.[^.]+" |
100 sed -e "s/$section\.\(.*\)\..*/\1/" | sort | uniq
103 get_var_from_env_or_config () {
107 # $4 can be set to a default value
109 # Do nothing if the env variable is already set
110 eval "test -z \"\${$env_var+x}\"" || return
112 test -z "$GIT_PERF_CONFIG_FILE" && return
114 # Check if the variable is in the config file
115 if test -n "$GIT_PERF_SUBSECTION"
117 var="$conf_sec.$GIT_PERF_SUBSECTION.$conf_var"
118 conf_value=$(git config -f "$GIT_PERF_CONFIG_FILE" "$var") &&
119 eval "$env_var=\"$conf_value\"" && return
121 var="$conf_sec.$conf_var"
122 conf_value=$(git config -f "$GIT_PERF_CONFIG_FILE" "$var") &&
123 eval "$env_var=\"$conf_value\"" && return
125 test -n "${4+x}" && eval "$env_var=\"$4\""
128 get_var_from_env_or_config "GIT_PERF_REPEAT_COUNT" "perf" "repeatCount" 3
129 export GIT_PERF_REPEAT_COUNT
131 get_var_from_env_or_config "GIT_PERF_DIRS_OR_REVS" "perf" "dirsOrRevs"
132 set -- $GIT_PERF_DIRS_OR_REVS "$@"
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"
137 GIT_PERF_AGGREGATING_LATER=t
138 export GIT_PERF_AGGREGATING_LATER
141 . ../../GIT-BUILD-OPTIONS
143 if test $# = 0 -o "$1" = -- -o -f "$1"; then
147 ./aggregate.perl "$@"