2
2
3
3
case " $1 " in
4
4
--help)
5
- echo " usage: $0 [other_git_tree...] [--] [test_scripts]"
5
+ echo " usage: $0 [--config file] [ other_git_tree...] [--] [test_scripts]"
6
6
exit 0
7
7
;;
8
+ --config)
9
+ shift
10
+ GIT_PERF_CONFIG_FILE=$( cd " $( dirname " $1 " ) " ; pwd) /$( basename " $1 " )
11
+ export GIT_PERF_CONFIG_FILE
12
+ shift ;;
8
13
esac
9
14
10
15
die () {
@@ -29,16 +34,18 @@ unpack_git_rev () {
29
34
(cd " $( git rev-parse --show-cdup) " && git archive --format=tar $rev ) |
30
35
(cd build/$rev && tar x)
31
36
}
37
+
32
38
build_git_rev () {
33
39
rev=$1
40
+ name=" $2 "
34
41
for config in config.mak config.mak.autogen config.status
35
42
do
36
43
if test -e " ../../$config "
37
44
then
38
45
cp " ../../$config " " build/$rev /"
39
46
fi
40
47
done
41
- echo " === Building $rev ==="
48
+ echo " === Building $rev ( $name ) ==="
42
49
(
43
50
cd build/$rev &&
44
51
if test -n " $GIT_PERF_MAKE_COMMAND "
@@ -65,7 +72,7 @@ run_dirs_helper () {
65
72
if [ ! -d build/$rev ]; then
66
73
unpack_git_rev $rev
67
74
fi
68
- build_git_rev $rev
75
+ build_git_rev $rev " $mydir "
69
76
mydir=build/$rev
70
77
fi
71
78
if test " $mydir " = . ; then
@@ -87,14 +94,78 @@ run_dirs () {
87
94
done
88
95
}
89
96
90
- GIT_PERF_AGGREGATING_LATER=t
91
- export GIT_PERF_AGGREGATING_LATER
97
+ get_subsections () {
98
+ section=" $1 "
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
102
+ }
103
+
104
+ get_var_from_env_or_config () {
105
+ env_var=" $1 "
106
+ conf_sec=" $2 "
107
+ conf_var=" $3 "
108
+ # $4 can be set to a default value
109
+
110
+ # Do nothing if the env variable is already set
111
+ eval " test -z \"\$ {$env_var +x}\" " || return
112
+
113
+ test -z " $GIT_PERF_CONFIG_FILE " && return
114
+
115
+ # Check if the variable is in the config file
116
+ if test -n " $GIT_PERF_SUBSECTION "
117
+ then
118
+ var=" $conf_sec .$GIT_PERF_SUBSECTION .$conf_var "
119
+ conf_value=$( git config -f " $GIT_PERF_CONFIG_FILE " " $var " ) &&
120
+ eval " $env_var =\" $conf_value \" " && return
121
+ fi
122
+ var=" $conf_sec .$conf_var "
123
+ conf_value=$( git config -f " $GIT_PERF_CONFIG_FILE " " $var " ) &&
124
+ eval " $env_var =\" $conf_value \" " && return
125
+
126
+ test -n " ${4+x} " && eval " $env_var =\" $4 \" "
127
+ }
128
+
129
+ run_subsection () {
130
+ get_var_from_env_or_config " GIT_PERF_REPEAT_COUNT" " perf" " repeatCount" 3
131
+ export GIT_PERF_REPEAT_COUNT
132
+
133
+ get_var_from_env_or_config " GIT_PERF_DIRS_OR_REVS" " perf" " dirsOrRevs"
134
+ set -- $GIT_PERF_DIRS_OR_REVS " $@ "
135
+
136
+ get_var_from_env_or_config " GIT_PERF_MAKE_COMMAND" " perf" " makeCommand"
137
+ get_var_from_env_or_config " GIT_PERF_MAKE_OPTS" " perf" " makeOpts"
138
+
139
+ GIT_PERF_AGGREGATING_LATER=t
140
+ export GIT_PERF_AGGREGATING_LATER
141
+
142
+ if test $# = 0 -o " $1 " = -- -o -f " $1 " ; then
143
+ set -- . " $@ "
144
+ fi
145
+
146
+ run_dirs " $@ "
147
+ ./aggregate.perl " $@ "
148
+ }
92
149
93
150
cd " $( dirname $0 ) "
94
151
. ../../GIT-BUILD-OPTIONS
95
152
96
- if test $# = 0 -o " $1 " = -- -o -f " $1 " ; then
97
- set -- . " $@ "
153
+ mkdir -p test-results
154
+ get_subsections " perf" > test-results/run_subsections.names
155
+
156
+ if test $( wc -l < test-results/run_subsections.names) -eq 0
157
+ then
158
+ (
159
+ run_subsection " $@ "
160
+ )
161
+ else
162
+ while read -r subsec
163
+ do
164
+ (
165
+ GIT_PERF_SUBSECTION=" $subsec "
166
+ export GIT_PERF_SUBSECTION
167
+ echo " ======== Run for subsection '$GIT_PERF_SUBSECTION ' ========"
168
+ run_subsection " $@ "
169
+ )
170
+ done < test-results/run_subsections.names
98
171
fi
99
- run_dirs " $@ "
100
- ./aggregate.perl " $@ "
0 commit comments