Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/bin/bash | |
| 2 # Copyright (c) 2012 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 #@ This script is used to update the archive of canned nexes | |
| 7 #@ Note, it does not recreate every nexe from scratch but will | |
| 8 #@ update those it can. | |
|
jvoung (off chromium)
2012/11/15 19:10:48
Can you clarify in what cases will it not update?
robertm
2012/11/15 19:33:31
Done.
| |
| 9 set -o nounset | |
| 10 set -o errexit | |
| 11 | |
| 12 readonly UP_DOWN_LOAD_SCRIPT=buildbot/file_up_down_load.sh | |
| 13 | |
| 14 readonly CANNED_DIR=CannedNexes | |
| 15 | |
| 16 readonly SPEC_BASE="tests/spec2k" | |
| 17 readonly SPEC_HARNESS=${SPEC_HARNESS:-${HOME}/cpu2000-redhat64-ia32}/ | |
| 18 | |
| 19 readonly SPEC_SETUPS_ARM=SetupPnaclArmOpt | |
| 20 readonly SPEC_SETUPS_X8632=SetupPnaclX8632Opt | |
| 21 readonly SPEC_SETUPS_X8664=SetupPnaclX8664Opt | |
| 22 | |
| 23 # for ./run_all.sh invocation | |
| 24 readonly MAKEOPTS=-j8 | |
| 25 export MAKEOPTS | |
| 26 | |
| 27 ###################################################################### | |
| 28 # Helpers | |
| 29 ###################################################################### | |
| 30 | |
| 31 Banner() { | |
| 32 echo "######################################################################" | |
| 33 echo $* | |
| 34 echo "######################################################################" | |
| 35 } | |
| 36 | |
| 37 help() { | |
| 38 egrep "^#@" $0 | cut --bytes=3- | |
| 39 } | |
| 40 | |
| 41 DownloadCannedNexes() { | |
| 42 local arch=$1 | |
| 43 local rev=$2 | |
| 44 Banner "Downloading rev: ${rev} arch: ${arch}" | |
| 45 ${UP_DOWN_LOAD_SCRIPT} DownloadArchivedNexes \ | |
| 46 ${rev} "${arch}_giant" giant_nexe.tar.bz2 | |
| 47 # This generates "CannedNexes/" in the current directory | |
|
jvoung (off chromium)
2012/11/15 19:10:48
Maybe clarify that "This generates" means untarrin
robertm
2012/11/15 19:33:31
Done.
robertm
2012/11/15 19:33:31
Done.
| |
| 48 rm -rf ${CANNED_DIR} | |
| 49 tar jxf giant_nexe.tar.bz2 | |
| 50 } | |
| 51 | |
| 52 UploadCannedNexes() { | |
| 53 local arch=$1 | |
| 54 local rev=$2 | |
| 55 Banner "Uploading rev: ${rev} arch: ${arch}" | |
| 56 rm giant_nexe.tar.bz2 | |
| 57 tar jcf giant_nexe.tar.bz2 ${CANNED_DIR} | |
| 58 | |
| 59 ${UP_DOWN_LOAD_SCRIPT} UploadArchivedNexes \ | |
| 60 ${rev} "${arch}_giant" giant_nexe.tar.bz2 | |
| 61 # This generates "CannedNexes/" in the current directory | |
|
jvoung (off chromium)
2012/11/15 19:10:48
Stale comment?
robertm
2012/11/15 19:33:31
Done.
| |
| 62 } | |
| 63 | |
| 64 AddTranslatorNexes() { | |
| 65 local arch=$1 | |
| 66 local sysarch="" | |
| 67 if [[ ${arch} == "arm" ]] ; then | |
| 68 sysarch=armv7 | |
| 69 elif [[ ${arch} == "x86-32" ]] ; then | |
| 70 sysarch=i686 | |
| 71 elif [[ ${arch} == "x86-64" ]] ; then | |
| 72 sysarch=x86_64 | |
| 73 else | |
| 74 echo "Error: unknown arch ${arch}" | |
| 75 fi | |
| 76 | |
| 77 Banner "Updating Translator Nexes arch: ${arch}" | |
| 78 cp toolchain/pnacl_translator/${sysarch}/bin/*.nexe ${CANNED_DIR} | |
| 79 } | |
| 80 | |
| 81 AddSpecNexes() { | |
| 82 local arch=$1 | |
| 83 local setups= | |
| 84 local fext= | |
| 85 | |
| 86 if [[ ${arch} == "arm" ]] ; then | |
| 87 setups="${SPEC_SETUPS_ARM}" | |
| 88 fext=arm | |
| 89 elif [[ ${arch} == "x86-32" ]] ; then | |
| 90 setups="${SPEC_SETUPS_X8632}" | |
| 91 fext=x8632 | |
| 92 elif [[ ${arch} == "x86-64" ]] ; then | |
| 93 setups="${SPEC_SETUPS_X8664}" | |
| 94 fext=x8664 | |
| 95 else | |
| 96 echo "Error: unknown arch ${arch}" | |
| 97 fi | |
| 98 | |
| 99 Banner "Updating Spec Nexes arch: ${arch} setups: ${setups}" | |
| 100 | |
| 101 pushd ${SPEC_BASE} | |
| 102 ./run_all.sh BuildPrerequisites "$@" bitcode | |
| 103 ./run_all.sh CleanBenchmarks | |
| 104 ./run_all.sh PopulateFromSpecHarness "${SPEC_HARNESS}" | |
| 105 | |
| 106 for setup in ${setups}; do | |
| 107 ./run_all.sh BuildBenchmarks 0 ${setup} train | |
|
jvoung (off chromium)
2012/11/15 19:10:48
I don't think you need to specify train vs ref vs
robertm
2012/11/15 19:33:31
Done.
| |
| 108 done | |
| 109 popd | |
| 110 | |
| 111 cp tests/spec2k/*/*.${fext} ${CANNED_DIR} | |
|
jvoung (off chromium)
2012/11/15 19:10:48
extra space
robertm
2012/11/15 19:33:31
Done.
| |
| 112 rename 's/[.](arm|x8664|x8632)$//' ${CANNED_DIR}/*.${fext} | |
|
jvoung (off chromium)
2012/11/15 19:10:48
Is it required to chop off the extension? If so,
robertm
2012/11/15 19:33:31
Done.
| |
| 113 } | |
| 114 | |
| 115 Update() { | |
| 116 local arch=$1 | |
| 117 local rev_in=$2 | |
| 118 local rev_out=$3 | |
| 119 DownloadCannedNexes ${arch} ${rev_in} | |
| 120 AddTranslatorNexes ${arch} | |
| 121 AddSpecNexes ${arch} | |
| 122 UploadCannedNexes ${arch} ${rev_out} | |
| 123 } | |
| 124 | |
| 125 ###################################################################### | |
| 126 # "main" | |
| 127 ###################################################################### | |
| 128 | |
| 129 if [ "$(type -t $1)" != "function" ]; then | |
| 130 echo "ERROR: unknown function '$1'." >&2 | |
| 131 echo "For help, try:" | |
| 132 echo " $0 help" | |
| 133 exit 1 | |
| 134 fi | |
| 135 | |
| 136 "$@" | |
| OLD | NEW |