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