Mike Frysinger | c7f1593 | 2013-03-20 13:43:35 -0400 | [diff] [blame] | 1 | #!/usr/bin/python |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 2 | # |
| 3 | # Copyright 2010 Google Inc. All Rights Reserved. |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 4 | """Script to build ChromeOS benchmarks |
| 5 | |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 6 | Inputs: |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 7 | chromeos_root |
| 8 | toolchain_root |
| 9 | board |
| 10 | [chromeos/cpu/<benchname>|chromeos/browser/[pagecycler|sunspider]|chromeos/startup] |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 11 | |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 12 | This script assumes toolchain has already been built in toolchain_root. |
| 13 | |
| 14 | chromeos/cpu/<benchname> |
| 15 | - Execute bench.py script within chroot to build benchmark |
| 16 | - Copy build results to perflab-bin |
| 17 | |
| 18 | chromeos/startup |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 19 | - Call build_chromeos to build image. |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 20 | - Copy image to perflab-bin |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 21 | |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 22 | chromeos/browser/* |
| 23 | - Call build_chromebrowser to build image with new browser |
| 24 | - Copy image to perflab-bin |
| 25 | |
| 26 | """ |
| 27 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 28 | __author__ = 'bjanakiraman@google.com (Bhaskar Janakiraman)' |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 29 | |
| 30 | import optparse |
| 31 | import os |
| 32 | import sys |
| 33 | import re |
kbaclawski | 20082a0 | 2013-02-16 02:12:57 +0000 | [diff] [blame] | 34 | |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 35 | import build_chromeos |
kbaclawski | 20082a0 | 2013-02-16 02:12:57 +0000 | [diff] [blame] | 36 | import tc_enter_chroot |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 37 | from utils import command_executer |
| 38 | from utils import logger |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 39 | |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 40 | KNOWN_BENCHMARKS = [ |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 41 | 'chromeos/startup', 'chromeos/browser/pagecycler', |
| 42 | 'chromeos/browser/sunspider', 'chromeos/browser/v8bench', |
| 43 | 'chromeos/cpu/bikjmp' |
| 44 | ] |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 45 | |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 46 | # Commands to build CPU benchmarks. |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 47 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 48 | CPU_BUILDCMD_CLEAN = 'cd /usr/local/toolchain_root/third_party/android_bench/v2_0/CLOSED_SOURCE/%s;\ |
| 49 | python ../../scripts/bench.py --toolchain=/usr/bin --action=clean;' |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 50 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 51 | CPU_BUILDCMD_BUILD = 'cd /usr/local/toolchain_root/third_party/android_bench/v2_0/CLOSED_SOURCE/%s;\ |
| 52 | python ../../scripts/bench.py --toolchain=/usr/bin --add_cflags=%s --add_ldflags=%s --makeopts=%s --action=build' |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 53 | |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 54 | # Common initializations |
| 55 | cmd_executer = command_executer.GetCommandExecuter() |
| 56 | |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 57 | |
| 58 | def Usage(parser, message): |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 59 | print 'ERROR: ' + message |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 60 | parser.print_help() |
| 61 | sys.exit(0) |
| 62 | |
| 63 | |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 64 | def CreateRunsh(destdir, benchmark): |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 65 | """Create run.sh script to run benchmark. |
| 66 | |
| 67 | Perflab needs a run.sh that runs the benchmark. |
| 68 | """ |
| 69 | run_cmd = os.path.dirname(os.path.abspath(__file__)) + '/run_benchmarks.py' |
| 70 | contents = '#!/bin/sh\n%s $@ %s\n' % (run_cmd, benchmark) |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 71 | runshfile = destdir + '/run.sh' |
| 72 | f = open(runshfile, 'w') |
| 73 | f.write(contents) |
| 74 | f.close() |
asharif | ef75f39 | 2013-02-15 10:22:49 +0000 | [diff] [blame] | 75 | retval = cmd_executer.RunCommand('chmod +x %s' % runshfile) |
| 76 | return retval |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 77 | |
| 78 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 79 | def CreateBinaryCopy(sourcedir, destdir, copy=None): |
shenhan | 12089d4 | 2013-02-15 20:32:18 +0000 | [diff] [blame] | 80 | """Create links in perflab-bin/destdir/* to sourcedir/* for now, instead of copies |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 81 | |
shenhan | 12089d4 | 2013-02-15 20:32:18 +0000 | [diff] [blame] | 82 | Args: |
| 83 | copy: when none, make soft links to everything under sourcedir, otherwise |
| 84 | copy all to destdir. |
| 85 | TODO: remove this parameter if it's determined that CopyFiles can use |
| 86 | rsync -L. |
| 87 | """ |
bjanakiraman | e7a379a | 2013-02-15 10:24:30 +0000 | [diff] [blame] | 88 | retval = 0 |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 89 | # check if sourcedir exists |
| 90 | if not os.path.exists(sourcedir): |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 91 | logger.GetLogger().LogError('benchmark results %s does not exist.' % |
kbaclawski | 6999ada | 2013-02-15 19:57:09 +0000 | [diff] [blame] | 92 | sourcedir) |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 93 | return 1 |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 94 | |
| 95 | # Deal with old copies - save off old ones for now. |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 96 | # Note - if its a link, it doesn't save anything. |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 97 | if os.path.exists(destdir): |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 98 | command = 'rm -rf %s.old' % destdir |
bjanakiraman | e7a379a | 2013-02-15 10:24:30 +0000 | [diff] [blame] | 99 | retval = cmd_executer.RunCommand(command) |
| 100 | if retval != 0: |
| 101 | return retval |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 102 | command = 'mv %s %s.old' % (destdir, destdir) |
bjanakiraman | e7a379a | 2013-02-15 10:24:30 +0000 | [diff] [blame] | 103 | retval = cmd_executer.RunCommand(command) |
| 104 | if retval != 0: |
| 105 | return retval |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 106 | os.makedirs(destdir) |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 107 | sourcedir = os.path.abspath(sourcedir) |
shenhan | 12089d4 | 2013-02-15 20:32:18 +0000 | [diff] [blame] | 108 | if copy is None: |
| 109 | command = 'ln -s %s/* %s' % (sourcedir, destdir) |
| 110 | else: |
| 111 | command = 'cp -fr %s/* %s' % (sourcedir, destdir) |
asharif | ef75f39 | 2013-02-15 10:22:49 +0000 | [diff] [blame] | 112 | retval = cmd_executer.RunCommand(command) |
| 113 | return retval |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 114 | |
| 115 | |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 116 | def Main(argv): |
| 117 | """Build ChromeOS.""" |
| 118 | # Common initializations |
| 119 | |
| 120 | parser = optparse.OptionParser() |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 121 | parser.add_option('-c', |
| 122 | '--chromeos_root', |
| 123 | dest='chromeos_root', |
| 124 | help='Target directory for ChromeOS installation.') |
| 125 | parser.add_option('-t', |
| 126 | '--toolchain_root', |
| 127 | dest='toolchain_root', |
| 128 | help='This is obsolete. Do not use.') |
| 129 | parser.add_option('-r', |
| 130 | '--third_party', |
| 131 | dest='third_party', |
| 132 | help='The third_party dir containing android benchmarks.') |
| 133 | parser.add_option('-C', |
| 134 | '--clean', |
| 135 | dest='clean', |
| 136 | action='store_true', |
| 137 | default=False, |
| 138 | help='Clean up build.'), |
| 139 | parser.add_option('-B', |
| 140 | '--build', |
| 141 | dest='build', |
| 142 | action='store_true', |
| 143 | default=False, |
| 144 | help='Build benchmark.'), |
| 145 | parser.add_option('-O', |
| 146 | '--only_copy', |
| 147 | dest='only_copy', |
| 148 | action='store_true', |
| 149 | default=False, |
| 150 | help='Only copy to perflab-bin - no builds.'), |
| 151 | parser.add_option('--workdir', |
| 152 | dest='workdir', |
| 153 | default='.', |
| 154 | help='Work directory for perflab outputs.') |
| 155 | parser.add_option('--clobber_chroot', |
| 156 | dest='clobber_chroot', |
| 157 | action='store_true', |
| 158 | help='Delete the chroot and start fresh', |
| 159 | default=False) |
| 160 | parser.add_option('--clobber_board', |
| 161 | dest='clobber_board', |
| 162 | action='store_true', |
| 163 | help='Delete the board and start fresh', |
| 164 | default=False) |
| 165 | parser.add_option('--cflags', |
| 166 | dest='cflags', |
| 167 | default='', |
| 168 | help='CFLAGS for the ChromeOS packages') |
| 169 | parser.add_option('--cxxflags', |
| 170 | dest='cxxflags', |
| 171 | default='', |
| 172 | help='CXXFLAGS for the ChromeOS packages') |
| 173 | parser.add_option('--ldflags', |
| 174 | dest='ldflags', |
| 175 | default='', |
| 176 | help='LDFLAGS for the ChromeOS packages') |
| 177 | parser.add_option('--makeopts', |
| 178 | dest='makeopts', |
| 179 | default='', |
| 180 | help='Make options for the ChromeOS packages') |
| 181 | parser.add_option('--board', |
| 182 | dest='board', |
| 183 | help='ChromeOS target board, e.g. x86-generic') |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 184 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 185 | (options, args) = parser.parse_args(argv[1:]) |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 186 | |
| 187 | # validate args |
| 188 | for arg in args: |
| 189 | if arg not in KNOWN_BENCHMARKS: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 190 | logger.GetLogger().LogFatal('Bad benchmark %s specified' % arg) |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 191 | |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 192 | if options.chromeos_root is None: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 193 | Usage(parser, '--chromeos_root must be set') |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 194 | |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 195 | if options.board is None: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 196 | Usage(parser, '--board must be set') |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 197 | |
asharif | 8697d4e | 2013-02-15 09:18:09 +0000 | [diff] [blame] | 198 | if options.toolchain_root: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 199 | logger.GetLogger().LogWarning('--toolchain_root should not be set') |
asharif | 8697d4e | 2013-02-15 09:18:09 +0000 | [diff] [blame] | 200 | |
| 201 | options.chromeos_root = os.path.expanduser(options.chromeos_root) |
| 202 | options.workdir = os.path.expanduser(options.workdir) |
| 203 | |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 204 | retval = 0 |
asharif | 2198c51 | 2013-02-15 09:21:35 +0000 | [diff] [blame] | 205 | if options.third_party: |
| 206 | third_party = options.third_party |
| 207 | else: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 208 | third_party = '%s/../../../third_party' % os.path.dirname(__file__) |
asharif | 2198c51 | 2013-02-15 09:21:35 +0000 | [diff] [blame] | 209 | third_party = os.path.realpath(third_party) |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 210 | for arg in args: |
| 211 | # CPU benchmarks |
| 212 | if re.match('chromeos/cpu', arg): |
| 213 | comps = re.split('/', arg) |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 214 | benchname = comps[2] |
asharif | 8697d4e | 2013-02-15 09:18:09 +0000 | [diff] [blame] | 215 | |
| 216 | tec_options = [] |
asharif | 2198c51 | 2013-02-15 09:21:35 +0000 | [diff] [blame] | 217 | if third_party: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 218 | tec_options.append('--third_party=%s' % third_party) |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 219 | if options.clean: |
asharif | ca3c6c1 | 2013-02-15 23:17:54 +0000 | [diff] [blame] | 220 | retval = cmd_executer.ChrootRunCommand(options.chromeos_root, |
| 221 | CPU_BUILDCMD_CLEAN % benchname, |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 222 | tec_options=tec_options) |
kbaclawski | 6999ada | 2013-02-15 19:57:09 +0000 | [diff] [blame] | 223 | logger.GetLogger().LogErrorIf(retval, |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 224 | 'clean of benchmark %s failed.' % arg) |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 225 | if options.build: |
asharif | ca3c6c1 | 2013-02-15 23:17:54 +0000 | [diff] [blame] | 226 | retval = cmd_executer.ChrootRunCommand( |
| 227 | options.chromeos_root, |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 228 | CPU_BUILDCMD_BUILD % (benchname, options.cflags, options.ldflags, |
| 229 | options.makeopts), |
asharif | ca3c6c1 | 2013-02-15 23:17:54 +0000 | [diff] [blame] | 230 | tec_options=tec_options) |
kbaclawski | 6999ada | 2013-02-15 19:57:09 +0000 | [diff] [blame] | 231 | logger.GetLogger().LogErrorIf(retval, |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 232 | 'Build of benchmark %s failed.' % arg) |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 233 | if retval == 0 and (options.build or options.only_copy): |
asharif | 2198c51 | 2013-02-15 09:21:35 +0000 | [diff] [blame] | 234 | benchdir = ('%s/android_bench/v2_0/CLOSED_SOURCE/%s' % |
| 235 | (third_party, benchname)) |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 236 | linkdir = '%s/perflab-bin/%s' % (options.workdir, arg) |
asharif | 2198c51 | 2013-02-15 09:21:35 +0000 | [diff] [blame] | 237 | |
shenhan | 12089d4 | 2013-02-15 20:32:18 +0000 | [diff] [blame] | 238 | # For cpu/*, we need to copy (not symlinks) of all the contents, |
| 239 | # because they are part of the test fixutre. |
| 240 | retval = CreateBinaryCopy(benchdir, linkdir, True) |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 241 | if retval != 0: |
| 242 | return retval |
asharif | 2198c51 | 2013-02-15 09:21:35 +0000 | [diff] [blame] | 243 | retval = CreateRunsh(linkdir, arg) |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 244 | if retval != 0: |
| 245 | return retval |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 246 | elif re.match('chromeos/startup', arg): |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 247 | if options.build: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 248 | # Clean for chromeos/browser and chromeos/startup is a Nop since builds are always from scratch. |
| 249 | build_args = [ |
| 250 | os.path.dirname(os.path.abspath(__file__)) + '/build_chromeos.py', |
| 251 | '--chromeos_root=' + options.chromeos_root, |
| 252 | '--board=' + options.board, '--cflags=' + options.cflags, |
| 253 | '--cxxflags=' + options.cxxflags, '--ldflags=' + options.ldflags, |
| 254 | '--clobber_board' |
| 255 | ] |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 256 | retval = build_chromeos.Main(build_args) |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 257 | logger.GetLogger().LogErrorIf(retval, 'Build of ChromeOS failed.') |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 258 | if retval == 0 and (options.build or options.only_copy): |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 259 | benchdir = '%s/src/build/images/%s/latest' % (options.chromeos_root, |
| 260 | options.board) |
bjanakiraman | 4e8bdf2 | 2013-02-15 04:57:09 +0000 | [diff] [blame] | 261 | linkdir = '%s/perflab-bin/%s' % (options.workdir, arg) |
asharif | 2198c51 | 2013-02-15 09:21:35 +0000 | [diff] [blame] | 262 | retval = CreateBinaryCopy(benchdir, linkdir) |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 263 | if retval != 0: |
| 264 | return retval |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 265 | CreateRunsh(linkdir, arg) |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 266 | if retval != 0: |
| 267 | return retval |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 268 | elif re.match('chromeos/browser', arg): |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 269 | if options.build: |
bjanakiraman | 229d626 | 2013-02-15 04:56:46 +0000 | [diff] [blame] | 270 | # For now, re-build os. TBD: Change to call build_browser |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 271 | build_args = [os.path.dirname(os.path.abspath(__file__)) + |
| 272 | '/build_chrome_browser.py', |
| 273 | '--chromeos_root=' + options.chromeos_root, |
| 274 | '--board=' + options.board, '--cflags=' + options.cflags, |
| 275 | '--cxxflags=' + options.cxxflags, |
| 276 | '--ldflags=' + options.ldflags] |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 277 | retval = build_chromeos.Main(build_args) |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 278 | logger.GetLogger().LogErrorIf(retval, 'Build of ChromeOS failed.') |
bjanakiraman | aabd2d1 | 2013-02-15 04:55:30 +0000 | [diff] [blame] | 279 | if retval == 0 and (options.build or options.only_copy): |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 280 | benchdir = '%s/src/build/images/%s/latest' % (options.chromeos_root, |
| 281 | options.board) |
bjanakiraman | 4e8bdf2 | 2013-02-15 04:57:09 +0000 | [diff] [blame] | 282 | linkdir = '%s/perflab-bin/%s' % (options.workdir, arg) |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 283 | retval = CreateBinaryCopy(benchdir, linkdir) |
| 284 | if retval != 0: |
| 285 | return retval |
asharif | 2198c51 | 2013-02-15 09:21:35 +0000 | [diff] [blame] | 286 | retval = CreateRunsh(linkdir, arg) |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 287 | if retval != 0: |
| 288 | return retval |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 289 | |
asharif | 2198c51 | 2013-02-15 09:21:35 +0000 | [diff] [blame] | 290 | return 0 |
bjanakiraman | 6496e5f | 2013-02-15 04:50:58 +0000 | [diff] [blame] | 291 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 292 | |
| 293 | if __name__ == '__main__': |
kbaclawski | 5fec550 | 2013-02-15 19:55:56 +0000 | [diff] [blame] | 294 | sys.exit(Main(sys.argv)) |