| OLD | NEW |
| (Empty) |
| 1 #!/bin/bash | |
| 2 | |
| 3 # Copyright 2010 The Native Client Authors. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can | |
| 5 # be found in the LICENSE file. | |
| 6 | |
| 7 set -o nounset | |
| 8 set -o errexit | |
| 9 | |
| 10 # Paths relative to native_client | |
| 11 SPEC_BASE="tests/spec2k" | |
| 12 TC_SCRIPT="./tools/llvm/utman.sh" | |
| 13 | |
| 14 ####################################################################### | |
| 15 # Helpers | |
| 16 ####################################################################### | |
| 17 | |
| 18 StepBanner() { | |
| 19 echo "**********************************************************************" | |
| 20 echo "**********************************************************************" | |
| 21 echo " $@" | |
| 22 echo "**********************************************************************" | |
| 23 echo "**********************************************************************" | |
| 24 } | |
| 25 | |
| 26 NoteBuildStep() { | |
| 27 echo "@@@BUILD_STEP $1@@@" | |
| 28 } | |
| 29 | |
| 30 Annotate() { | |
| 31 local label=$1 | |
| 32 shift | |
| 33 StepBanner "Running: $@" | |
| 34 NoteBuildStep ${label} | |
| 35 } | |
| 36 | |
| 37 AnnotatedRun() { | |
| 38 Annotate "$@" | |
| 39 local label=$1 | |
| 40 shift | |
| 41 "$@" | |
| 42 } | |
| 43 | |
| 44 AnnotatedMayFailRun() { | |
| 45 Annotate "$@" | |
| 46 local label=$1 | |
| 47 shift | |
| 48 | |
| 49 set +o errexit | |
| 50 "$@" | |
| 51 local errcode=$? | |
| 52 if [[ ${errcode} -ne 0 ]]; then | |
| 53 echo "@@@BUILD_FAILED@@@" | |
| 54 fi | |
| 55 set -o errexit | |
| 56 | |
| 57 return ${errcode} | |
| 58 } | |
| 59 | |
| 60 PrepareSpec() { | |
| 61 local spec_dir=$1 | |
| 62 pushd ${SPEC_BASE} | |
| 63 AnnotatedRun "Clean" "./run_all.sh" CleanBenchmarks | |
| 64 AnnotatedRun "Populate" "./run_all.sh" PopulateFromSpecHarness "${spec_dir}" | |
| 65 popd | |
| 66 } | |
| 67 | |
| 68 BuildAndRunSetups() { | |
| 69 local setups=$1 | |
| 70 local did_fail=0 | |
| 71 pushd ${SPEC_BASE} | |
| 72 for setup in ${setups}; do | |
| 73 if ! AnnotatedMayFailRun "${setup}" \ | |
| 74 "./run_all.sh" TimedBuildAndRunBenchmarks ${setup}; then | |
| 75 did_fail=1 | |
| 76 fi | |
| 77 done | |
| 78 popd | |
| 79 return ${did_fail} | |
| 80 } | |
| 81 | |
| 82 PrepareTrusted() { | |
| 83 local arch=$1 | |
| 84 AnnotatedRun "scons-${arch}" \ | |
| 85 "./scons" --mode=opt-linux sdl=none platform=${arch} sel_ldr sel_universal | |
| 86 } | |
| 87 | |
| 88 ####################################################################### | |
| 89 # Steps | |
| 90 ####################################################################### | |
| 91 | |
| 92 #@ | |
| 93 #@ test-spec-bot -- determines what runs on the NaCl spec build bots | |
| 94 #@ must run from native_client | |
| 95 test-spec-bot() { | |
| 96 if [[ $# -lt 2 ]]; then | |
| 97 echo "Usage: $0 <bot_id> <spec_dir>" | |
| 98 echo " vs $@" | |
| 99 exit -1 | |
| 100 fi | |
| 101 | |
| 102 if [[ $(basename $(pwd)) != "native_client" ]] ; then | |
| 103 echo "ERROR: run this script from the native_client/ dir" | |
| 104 exit -1 | |
| 105 fi | |
| 106 | |
| 107 # Delete "scons-out" to handle the small number of cases where | |
| 108 # incremental builds fail. Ideally, though, there would be a build | |
| 109 # step that deletes all non-checked-in files, rather than having to | |
| 110 # list files/directories to delete explicitly. | |
| 111 AnnotatedRun "clean scons-out" rm -rf scons-out | |
| 112 | |
| 113 local bot_id=$1 | |
| 114 local spec_dir=$2 | |
| 115 case ${bot_id} in | |
| 116 1) | |
| 117 # The ARM bot. | |
| 118 PrepareTrusted arm | |
| 119 PrepareSpec ${spec_dir} | |
| 120 BuildAndRunSetups "SetupPnaclArmOpt" | |
| 121 exit $? | |
| 122 ;; | |
| 123 2) | |
| 124 # The X86 bot. | |
| 125 PrepareTrusted x86-32 | |
| 126 PrepareTrusted x86-64 | |
| 127 PrepareSpec ${spec_dir} | |
| 128 BuildAndRunSetups "SetupNaclX8664 SetupNaclX8664Opt | |
| 129 SetupPnaclX8632 SetupPnaclX8632Opt | |
| 130 SetupPnaclX8664 SetupPnaclX8664Opt" | |
| 131 exit $? | |
| 132 ;; | |
| 133 3) | |
| 134 # The sandboxed translator bot. | |
| 135 PrepareTrusted x86-32 | |
| 136 PrepareTrusted x86-64 | |
| 137 PrepareSpec ${spec_dir} | |
| 138 BuildAndRunSetups "SetupPnaclTranslatorX8632 SetupPnaclTranslatorX8632Opt | |
| 139 SetupPnaclTranslatorX8664 SetupPnaclTranslatorX8664Opt" | |
| 140 exit $? | |
| 141 ;; | |
| 142 | |
| 143 BadTest) | |
| 144 # Bad bot ID for testing. See that one failure doesn't prevent others | |
| 145 # from running, and check bad return codes get propagated. | |
| 146 echo "Testing fake bot ID with forced failure" | |
| 147 PrepareTrusted x86-64 | |
| 148 PrepareSpec ${spec_dir} | |
| 149 if ! BuildAndRunSetups "SetupBadBadBad SetupPnaclX8664Opt"; then | |
| 150 echo "SUCCESS: See that build failed!" | |
| 151 exit -1 | |
| 152 else | |
| 153 exit 0 | |
| 154 fi | |
| 155 ;; | |
| 156 *) | |
| 157 echo "$0 Given unknown bot-id -- ${bot_id}!" | |
| 158 exit -1 | |
| 159 esac | |
| 160 } | |
| 161 | |
| 162 ###################################################################### | |
| 163 # Main | |
| 164 ###################################################################### | |
| 165 | |
| 166 test-spec-bot $@ | |
| OLD | NEW |