OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 set -o xtrace | |
7 set -o nounset | |
8 set -o errexit | |
9 | |
10 ###################################################################### | |
11 # SCRIPT CONFIG | |
12 ###################################################################### | |
13 | |
14 CLOBBER=${CLOBBER:-yes} | |
15 SCONS_TRUSTED="./scons --mode=opt-host -j8" | |
16 SCONS_NACL="./scons --mode=opt-host,nacl -j8" | |
17 SPEC_HARNESS=${SPEC_HARNESS:-${HOME}/cpu2000-redhat64-ia32}/ | |
18 UTMAN=tools/llvm/utman.sh | |
19 | |
20 # Rough test running time classification for ARM which is our bottleneck | |
21 FAST_ARM="176.gcc 181.mcf 197.parser 254.gap" | |
22 MEDIUM_ARM="164.gzip 175.vpr 179.art 186.crafty 252.eon \ | |
23 256.bzip2 255.vortex 300.twolf" | |
24 SLOW_ARM="177.mesa 183.equake 188.ammp 253.perlbmk" | |
25 | |
26 SPEC_BASE="tests/spec2k" | |
27 | |
28 TestsToBuild() { | |
29 local setup=$1 | |
30 case ${setup} in | |
31 SetupPnaclArmOpt) | |
32 # we expect arm to diverge | |
33 echo ${FAST_ARM} 252.eon 179.art | |
34 ;; | |
35 SetupPnaclTranslator*) | |
36 echo 176.gcc | |
37 ;; | |
38 *) | |
39 echo ${FAST_ARM} 252.eon 179.art | |
40 ;; | |
41 esac | |
42 } | |
43 | |
44 TestsToRun() { | |
45 local setup=$1 | |
46 case ${setup} in | |
47 SetupPnaclArmOpt) | |
48 # we expect arm to diverge | |
49 echo ${FAST_ARM} 252.eon 179.art | |
50 ;; | |
51 SetupPnaclTranslator*) | |
52 echo 176.gcc | |
53 ;; | |
54 *) | |
55 echo ${FAST_ARM} 252.eon 179.art | |
56 ;; | |
57 esac | |
58 } | |
59 | |
60 ###################################################################### | |
61 # SCRIPT ACTION | |
62 ###################################################################### | |
63 | |
64 clobber() { | |
65 echo "@@@BUILD_STEP clobber@@@" | |
66 rm -rf scons-out toolchain | |
67 | |
68 echo "@@@BUILD_STEP gclient_runhooks@@@" | |
69 gclient runhooks --force | |
70 } | |
71 | |
72 basic-setup-nacl() { | |
73 local platforms=$1 | |
74 build-sel_ldr "${platforms}" | |
75 build-libs "${platforms}" | |
76 } | |
77 | |
78 basic-setup-pnacl() { | |
79 local platforms=$1 | |
80 build-sel_ldr "${platforms}" | |
81 build-sel_universal "${platforms}" | |
82 ${UTMAN} sdk | |
83 } | |
84 | |
85 build-sel_ldr() { | |
86 local platforms=$1 | |
87 for platform in ${platforms} ; do | |
88 echo "@@@BUILD_STEP scons sel_ldr [${platform}]@@@" | |
89 ${SCONS_TRUSTED} platform=${platform} sel_ldr | |
90 done | |
91 } | |
92 | |
93 build-sel_universal() { | |
94 local platforms=$1 | |
95 for platform in ${platforms} ; do | |
96 echo "@@@BUILD_STEP scons sel_universal [${platform}]@@@" | |
97 ${SCONS_TRUSTED} platform=${platform} sel_universal | |
98 done | |
99 } | |
100 | |
101 build-libs() { | |
102 local platforms=$1 | |
103 shift 1 | |
104 for platform in ${platforms} ; do | |
105 echo "@@@BUILD_STEP scons build_lib [${platform}] $* @@@" | |
106 ${SCONS_NACL} platform=${platform} build_lib "$@" | |
107 done | |
108 } | |
109 | |
110 build-and-run-some() { | |
111 local harness=$1 | |
112 local setups=$2 | |
113 | |
114 pushd ${SPEC_BASE} | |
115 for setup in ${setups}; do | |
116 echo "@@@BUILD_STEP spec2k build [${setup}] [train-some]@@@" | |
117 ./run_all.sh CleanBenchmarks | |
118 ./run_all.sh PopulateFromSpecHarness ${harness} | |
119 MAKEOPTS=-j8 \ | |
120 ./run_all.sh BuildBenchmarks 0 ${setup} $(TestsToBuild ${setup}) | |
121 | |
122 echo "@@@BUILD_STEP spec2k run [${setup}] [train-some]@@@" | |
123 ./run_all.sh RunBenchmarks ${setup} train $(TestsToRun ${setup}) || \ | |
124 { RETCODE=$? && echo "@@@STEP_FAILURE@@@"; } | |
125 done | |
126 popd | |
127 } | |
128 | |
129 build-and-run-all-timed() { | |
130 local harness=$1 | |
131 local setups=$2 | |
132 | |
133 pushd ${SPEC_BASE} | |
134 for setup in ${setups}; do | |
135 echo "@@@BUILD_STEP spec2k build [${setup}] [train]@@@" | |
136 ./run_all.sh CleanBenchmarks | |
137 ./run_all.sh PopulateFromSpecHarness ${harness} | |
138 MAKEOPTS=-j8 \ | |
139 ./run_all.sh BuildBenchmarks 1 ${setup} train | |
140 | |
141 echo @@@BUILD_STEP spec2k run [${setup}] [train]@@@ | |
142 # NOTE: we intentionally do not parallelize the build because | |
143 # we are measuring build times | |
144 ./run_all.sh RunTimedBenchmarks ${setup} train || \ | |
145 { RETCODE=$? && echo "@@@STEP_FAILURE@@@"; } | |
146 done | |
147 popd | |
148 } | |
149 | |
150 | |
151 ###################################################################### | |
152 # NOTE: trybots only runs a subset of the the spec2k tests | |
153 # TODO: elminate this long running bot in favor per arch sharded bots | |
154 mode-spec-pnacl-trybot() { | |
155 clobber | |
156 basic-setup-pnacl "arm x86-64 x86-32" | |
157 build-and-run-some ${SPEC_HARNESS} "SetupPnaclArmOpt \ | |
158 SetupPnaclX8632Opt \ | |
159 SetupPnaclX8664Opt \ | |
160 SetupPnaclTranslatorX8632Opt \ | |
161 SetupPnaclTranslatorX8664Opt" | |
162 } | |
163 | |
164 mode-spec-pnacl-trybot-arm() { | |
165 clobber | |
166 basic-setup-pnacl "arm" | |
167 build-and-run-some ${SPEC_HARNESS} "SetupPnaclArmOpt" | |
168 } | |
169 | |
170 mode-spec-pnacl-trybot-x8632() { | |
171 clobber | |
172 basic-setup-pnacl "x86-32" | |
173 build-and-run-some ${SPEC_HARNESS} "SetupPnaclX8632Opt \ | |
174 SetupPnaclTranslatorX8632Opt" | |
175 } | |
176 | |
177 mode-spec-pnacl-trybot-x8664() { | |
178 clobber | |
179 basic-setup-pnacl "x86-64" | |
180 build-and-run-some ${SPEC_HARNESS} "SetupPnaclX8664Opt \ | |
181 SetupPnaclTranslatorX8664Opt" | |
182 } | |
183 | |
184 | |
185 mode-spec-pnacl-arm() { | |
186 clobber | |
187 basic-setup-pnacl "arm" | |
188 # arm takes a long time and we do not have sandboxed tests working | |
189 build-and-run-all-timed ${SPEC_HARNESS} "SetupPnaclArmOpt" | |
190 } | |
191 | |
192 mode-spec-pnacl-x8664() { | |
193 clobber | |
194 basic-setup-pnacl "x86-64" | |
195 build-and-run-all-timed ${SPEC_HARNESS} \ | |
196 "SetupPnaclX8664 \ | |
197 SetupPnaclX8664Opt \ | |
198 SetupPnaclTranslatorX8664 \ | |
199 SetupPnaclTranslatorX8664Opt" | |
200 } | |
201 | |
202 mode-spec-pnacl-x8632() { | |
203 clobber | |
204 basic-setup-pnacl "x86-32" | |
205 build-and-run-all-timed ${SPEC_HARNESS} \ | |
206 "SetupPnaclX8632 \ | |
207 SetupPnaclX8632Opt \ | |
208 SetupPnaclTranslatorX8632 \ | |
209 SetupPnaclTranslatorX8632Opt" | |
210 } | |
211 | |
212 # scheduled to be obsolete | |
213 # TODO(robertm): delete this target | |
214 mode-spec-nacl() { | |
215 clobber | |
216 basic-setup-nacl "x86-32 x86-64" | |
217 build-and-run-all-timed ${SPEC_HARNESS} \ | |
218 "SetupNaclX8664 \ | |
219 SetupNaclX8664Opt \ | |
220 SetupNaclX8632 \ | |
221 SetupNaclX8632Opt" | |
222 } | |
223 | |
224 mode-spec-nacl-x8632() { | |
225 clobber | |
226 basic-setup-nacl "x86-32" | |
227 build-and-run-all-timed ${SPEC_HARNESS} \ | |
228 "SetupNaclX8632 \ | |
229 SetupNaclX8632Opt" | |
230 } | |
231 | |
232 mode-spec-nacl-x8664() { | |
233 clobber | |
234 basic-setup-nacl "x86-64" | |
235 build-and-run-all-timed ${SPEC_HARNESS} \ | |
236 "SetupNaclX8664 \ | |
237 SetupNaclX8664Opt" | |
238 | |
239 } | |
240 | |
241 | |
242 ###################################################################### | |
243 # Script assumed to be run in native_client/ | |
244 if [[ $(pwd) != */native_client ]]; then | |
245 echo "ERROR: must be run in native_client!" | |
246 exit 1 | |
247 fi | |
248 | |
249 | |
250 if [[ $# -eq 0 ]] ; then | |
251 echo "you must specify a mode on the commandline:" | |
252 exit 1 | |
253 fi | |
254 | |
255 if [ "$(type -t $1)" != "function" ]; then | |
256 Usage | |
257 echo "ERROR: unknown mode '$1'." >&2 | |
258 exit 1 | |
259 fi | |
260 | |
261 eval "$@" | |
262 | |
OLD | NEW |