blob: fdd13fe5a7d17dce389b01bb81bef39f3e5325b0 [file] [log] [blame]
asharif96f59692013-02-16 03:13:36 +00001#!/usr/bin/python
2
3# Script to test different toolchains against ChromeOS benchmarks.
cmtice7cdb11a2015-05-28 10:24:41 -07004import datetime
asharif96f59692013-02-16 03:13:36 +00005import optparse
6import os
Caroline Tice80eab982015-11-04 14:03:14 -08007import string
asharif96f59692013-02-16 03:13:36 +00008import sys
9import build_chromeos
10import setup_chromeos
cmtice94bc4702014-05-29 16:29:04 -070011import time
asharif96f59692013-02-16 03:13:36 +000012from utils import command_executer
13from utils import misc
14from utils import logger
15
Luis Lozanof2a3ef42015-12-15 13:49:30 -080016CROSTC_ROOT = '/usr/local/google/crostc'
17MAIL_PROGRAM = '~/var/bin/mail-sheriff'
18WEEKLY_REPORTS_ROOT = os.path.join(CROSTC_ROOT, 'weekly_test_data')
19PENDING_ARCHIVES_DIR = os.path.join(CROSTC_ROOT, 'pending_archives')
20NIGHTLY_TESTS_DIR = os.path.join(CROSTC_ROOT, 'nightly_test_reports')
asharif96f59692013-02-16 03:13:36 +000021
cmtice94bc4702014-05-29 16:29:04 -070022
asharif96f59692013-02-16 03:13:36 +000023class GCCConfig(object):
Luis Lozanof2a3ef42015-12-15 13:49:30 -080024
asharif96f59692013-02-16 03:13:36 +000025 def __init__(self, githash):
26 self.githash = githash
27
28
29class ToolchainConfig:
Luis Lozanof2a3ef42015-12-15 13:49:30 -080030
asharif96f59692013-02-16 03:13:36 +000031 def __init__(self, gcc_config=None, binutils_config=None):
32 self.gcc_config = gcc_config
33
34
35class ChromeOSCheckout(object):
Luis Lozanof2a3ef42015-12-15 13:49:30 -080036
asharif96f59692013-02-16 03:13:36 +000037 def __init__(self, board, chromeos_root):
38 self._board = board
39 self._chromeos_root = chromeos_root
40 self._ce = command_executer.GetCommandExecuter()
41 self._l = logger.GetLogger()
cmtice56fb7162014-06-18 11:32:15 -070042 self._build_num = None
asharif96f59692013-02-16 03:13:36 +000043
asharif3e38de02013-02-19 19:34:59 +000044 def _DeleteChroot(self):
Luis Lozanof2a3ef42015-12-15 13:49:30 -080045 command = 'cd %s; cros_sdk --delete' % self._chromeos_root
asharif3e38de02013-02-19 19:34:59 +000046 return self._ce.RunCommand(command)
47
asharif67973582013-02-19 20:19:40 +000048 def _DeleteCcahe(self):
49 # crosbug.com/34956
Luis Lozanof2a3ef42015-12-15 13:49:30 -080050 command = 'sudo rm -rf %s' % os.path.join(self._chromeos_root, '.cache')
asharif67973582013-02-19 20:19:40 +000051 return self._ce.RunCommand(command)
52
cmtice56fb7162014-06-18 11:32:15 -070053 def _GetBuildNumber(self):
54 """ This function assumes a ChromeOS image has been built in the chroot.
55 It translates the 'latest' symlink in the
56 <chroot>/src/build/images/<board> directory, to find the actual
57 ChromeOS build number for the image that was built. For example, if
58 src/build/image/lumpy/latest -> R37-5982.0.2014_06_23_0454-a1, then
59 This function would parse it out and assign 'R37-5982' to self._build_num.
60 This is used to determine the official, vanilla build to use for
61 comparison tests.
62 """
63 # Get the path to 'latest'
Luis Lozanof2a3ef42015-12-15 13:49:30 -080064 sym_path = os.path.join(
65 misc.GetImageDir(self._chromeos_root, self._board), 'latest')
cmtice56fb7162014-06-18 11:32:15 -070066 # Translate the symlink to its 'real' path.
67 real_path = os.path.realpath(sym_path)
68 # Break up the path and get the last piece
69 # (e.g. 'R37-5982.0.2014_06_23_0454-a1"
Luis Lozanof2a3ef42015-12-15 13:49:30 -080070 path_pieces = real_path.split('/')
cmtice56fb7162014-06-18 11:32:15 -070071 last_piece = path_pieces[-1]
72 # Break this piece into the image number + other pieces, and get the
73 # image number [ 'R37-5982', '0', '2014_06_23_0454-a1']
Luis Lozanof2a3ef42015-12-15 13:49:30 -080074 image_parts = last_piece.split('.')
cmtice56fb7162014-06-18 11:32:15 -070075 self._build_num = image_parts[0]
76
Caroline Tice80eab982015-11-04 14:03:14 -080077 def _BuildLabelName(self, config, board):
Luis Lozanof2a3ef42015-12-15 13:49:30 -080078 pieces = config.split('/')
Caroline Tice80eab982015-11-04 14:03:14 -080079 compiler_version = pieces[-1]
Luis Lozanof2a3ef42015-12-15 13:49:30 -080080 label = compiler_version + '_tot_afdo'
Caroline Tice80eab982015-11-04 14:03:14 -080081 return label
82
Luis Lozanof2a3ef42015-12-15 13:49:30 -080083 def _BuildAndImage(self, label=''):
asharif96f59692013-02-16 03:13:36 +000084 if (not label or
85 not misc.DoesLabelExist(self._chromeos_root, self._board, label)):
86 build_chromeos_args = [build_chromeos.__file__,
Luis Lozanof2a3ef42015-12-15 13:49:30 -080087 '--chromeos_root=%s' % self._chromeos_root,
88 '--board=%s' % self._board, '--rebuild']
asharife6b72fe2013-02-19 19:58:18 +000089 if self._public:
Luis Lozanof2a3ef42015-12-15 13:49:30 -080090 build_chromeos_args.append('--env=USE=-chrome_internal')
cmtice56fb7162014-06-18 11:32:15 -070091
asharif96f59692013-02-16 03:13:36 +000092 ret = build_chromeos.Main(build_chromeos_args)
cmtice7f3190b2015-05-22 14:14:51 -070093 if ret != 0:
94 raise RuntimeError("Couldn't build ChromeOS!")
cmtice56fb7162014-06-18 11:32:15 -070095
Luis Lozanof2a3ef42015-12-15 13:49:30 -080096 if not self._build_num:
cmtice56fb7162014-06-18 11:32:15 -070097 self._GetBuildNumber()
98 # Check to see if we need to create the symbolic link for the vanilla
99 # image, and do so if appropriate.
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800100 if not misc.DoesLabelExist(self._chromeos_root, self._board, 'vanilla'):
101 build_name = '%s-release/%s.0.0' % (self._board, self._build_num)
102 full_vanilla_path = os.path.join(os.getcwd(), self._chromeos_root,
103 'chroot/tmp', build_name)
cmtice56fb7162014-06-18 11:32:15 -0700104 misc.LabelLatestImage(self._chromeos_root, self._board, label,
105 full_vanilla_path)
106 else:
asharif96f59692013-02-16 03:13:36 +0000107 misc.LabelLatestImage(self._chromeos_root, self._board, label)
108 return label
109
cmtice56fb7162014-06-18 11:32:15 -0700110 def _SetupBoard(self, env_dict, usepkg_flag, clobber_flag):
asharif96f59692013-02-16 03:13:36 +0000111 env_string = misc.GetEnvStringFromDict(env_dict)
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800112 command = ('%s %s' % (env_string,
113 misc.GetSetupBoardCommand(self._board,
114 usepkg=usepkg_flag,
115 force=clobber_flag)))
116 ret = self._ce.ChrootRunCommand(self._chromeos_root, command)
cmtice56fb7162014-06-18 11:32:15 -0700117 error_str = "Could not setup board: '%s'" % command
118 assert ret == 0, error_str
asharif96f59692013-02-16 03:13:36 +0000119
120 def _UnInstallToolchain(self):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800121 command = ('sudo CLEAN_DELAY=0 emerge -C cross-%s/gcc' %
122 misc.GetCtargetFromBoard(self._board, self._chromeos_root))
123 ret = self._ce.ChrootRunCommand(self._chromeos_root, command)
cmtice7f3190b2015-05-22 14:14:51 -0700124 if ret != 0:
125 raise RuntimeError("Couldn't uninstall the toolchain!")
asharif96f59692013-02-16 03:13:36 +0000126
127 def _CheckoutChromeOS(self):
128 # TODO(asharif): Setup a fixed ChromeOS version (quarterly snapshot).
129 if not os.path.exists(self._chromeos_root):
130 setup_chromeos_args = [setup_chromeos.__file__,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800131 '--dir=%s' % self._chromeos_root]
asharife6b72fe2013-02-19 19:58:18 +0000132 if self._public:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800133 setup_chromeos_args.append('--public')
asharif5fe40e22013-02-19 19:58:50 +0000134 ret = setup_chromeos.Main(setup_chromeos_args)
cmtice7f3190b2015-05-22 14:14:51 -0700135 if ret != 0:
136 raise RuntimeError("Couldn't run setup_chromeos!")
asharif96f59692013-02-16 03:13:36 +0000137
138 def _BuildToolchain(self, config):
cmtice56fb7162014-06-18 11:32:15 -0700139 # Call setup_board for basic, vanilla setup.
140 self._SetupBoard({}, usepkg_flag=True, clobber_flag=False)
141 # Now uninstall the vanilla compiler and setup/build our custom
142 # compiler.
asharif96f59692013-02-16 03:13:36 +0000143 self._UnInstallToolchain()
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800144 envdict = {'USE': 'git_gcc',
145 'GCC_GITHASH': config.gcc_config.githash,
146 'EMERGE_DEFAULT_OPTS': '--exclude=gcc'}
cmtice56fb7162014-06-18 11:32:15 -0700147 self._SetupBoard(envdict, usepkg_flag=False, clobber_flag=False)
asharif96f59692013-02-16 03:13:36 +0000148
149
150class ToolchainComparator(ChromeOSCheckout):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800151
152 def __init__(self,
153 board,
154 remotes,
155 configs,
156 clean,
157 public,
158 force_mismatch,
159 noschedv2=False):
asharif96f59692013-02-16 03:13:36 +0000160 self._board = board
161 self._remotes = remotes
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800162 self._chromeos_root = 'chromeos'
asharif96f59692013-02-16 03:13:36 +0000163 self._configs = configs
asharif3e38de02013-02-19 19:34:59 +0000164 self._clean = clean
asharife6b72fe2013-02-19 19:58:18 +0000165 self._public = public
asharif58a8c9f2013-02-19 20:42:43 +0000166 self._force_mismatch = force_mismatch
asharif96f59692013-02-16 03:13:36 +0000167 self._ce = command_executer.GetCommandExecuter()
168 self._l = logger.GetLogger()
cmtice7f3190b2015-05-22 14:14:51 -0700169 timestamp = datetime.datetime.strftime(datetime.datetime.now(),
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800170 '%Y-%m-%d_%H:%M:%S')
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700171 self._reports_dir = os.path.join(NIGHTLY_TESTS_DIR,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800172 '%s.%s' % (timestamp, board),)
Han Shen43494292015-09-14 10:26:40 -0700173 self._noschedv2 = noschedv2
asharif96f59692013-02-16 03:13:36 +0000174 ChromeOSCheckout.__init__(self, board, self._chromeos_root)
175
cmticea6255d02014-01-10 10:27:22 -0800176 def _FinishSetup(self):
177 # Get correct .boto file
178 current_dir = os.getcwd()
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800179 src = '/usr/local/google/home/mobiletc-prebuild/.boto'
cmticea6255d02014-01-10 10:27:22 -0800180 dest = os.path.join(current_dir, self._chromeos_root,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800181 'src/private-overlays/chromeos-overlay/'
182 'googlestorage_account.boto')
cmticea6255d02014-01-10 10:27:22 -0800183 # Copy the file to the correct place
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800184 copy_cmd = 'cp %s %s' % (src, dest)
cmticea6255d02014-01-10 10:27:22 -0800185 retval = self._ce.RunCommand(copy_cmd)
cmtice7f3190b2015-05-22 14:14:51 -0700186 if retval != 0:
187 raise RuntimeError("Couldn't copy .boto file for google storage.")
cmticea6255d02014-01-10 10:27:22 -0800188
189 # Fix protections on ssh key
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800190 command = ('chmod 600 /var/cache/chromeos-cache/distfiles/target'
191 '/chrome-src-internal/src/third_party/chromite/ssh_keys'
192 '/testing_rsa')
cmticea6255d02014-01-10 10:27:22 -0800193 retval = self._ce.ChrootRunCommand(self._chromeos_root, command)
cmtice7f3190b2015-05-22 14:14:51 -0700194 if retval != 0:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800195 raise RuntimeError('chmod for testing_rsa failed')
cmticea6255d02014-01-10 10:27:22 -0800196
asharif96f59692013-02-16 03:13:36 +0000197 def _TestLabels(self, labels):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800198 experiment_file = 'toolchain_experiment.txt'
199 image_args = ''
asharif58a8c9f2013-02-19 20:42:43 +0000200 if self._force_mismatch:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800201 image_args = '--force-mismatch'
asharif96f59692013-02-16 03:13:36 +0000202 experiment_header = """
203 board: %s
204 remote: %s
cmticed1f03b82015-06-30 15:19:23 -0700205 retries: 1
asharif96f59692013-02-16 03:13:36 +0000206 """ % (self._board, self._remotes)
207 experiment_tests = """
cmtice0c84ea72015-06-25 14:22:36 -0700208 benchmark: all_toolchain_perf {
cmtice04403882013-11-04 16:38:37 -0500209 suite: telemetry_Crosperf
cmtice6de7f8f2014-03-14 14:08:21 -0700210 iterations: 3
asharif96f59692013-02-16 03:13:36 +0000211 }
212 """
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800213
214 with open(experiment_file, 'w') as f:
215 print >> f, experiment_header
216 print >> f, experiment_tests
asharif96f59692013-02-16 03:13:36 +0000217 for label in labels:
218 # TODO(asharif): Fix crosperf so it accepts labels with symbols
219 crosperf_label = label
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800220 crosperf_label = crosperf_label.replace('-', '_')
221 crosperf_label = crosperf_label.replace('+', '_')
222 crosperf_label = crosperf_label.replace('.', '')
cmtice56fb7162014-06-18 11:32:15 -0700223
224 # Use the official build instead of building vanilla ourselves.
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800225 if label == 'vanilla':
cmtice56fb7162014-06-18 11:32:15 -0700226 build_name = '%s-release/%s.0.0' % (self._board, self._build_num)
227
228 # Now add 'official build' to test file.
229 official_image = """
230 official_image {
231 chromeos_root: %s
232 build: %s
233 }
234 """ % (self._chromeos_root, build_name)
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800235 print >> f, official_image
cmtice56fb7162014-06-18 11:32:15 -0700236
cmtice94bc4702014-05-29 16:29:04 -0700237 else:
cmtice56fb7162014-06-18 11:32:15 -0700238 experiment_image = """
239 %s {
240 chromeos_image: %s
241 image_args: %s
242 }
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800243 """ % (crosperf_label, os.path.join(
244 misc.GetImageDir(self._chromeos_root, self._board), label,
245 'chromiumos_test_image.bin'), image_args)
246 print >> f, experiment_image
cmtice56fb7162014-06-18 11:32:15 -0700247
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800248 crosperf = os.path.join(os.path.dirname(__file__), 'crosperf', 'crosperf')
Han Shen43494292015-09-14 10:26:40 -0700249 noschedv2_opts = '--noschedv2' if self._noschedv2 else ''
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800250 command = ('{crosperf} --no_email=True --results_dir={r_dir} '
251 '--json_report=True {noschedv2_opts} {exp_file}').format(
252 crosperf=crosperf,
253 r_dir=self._reports_dir,
254 noschedv2_opts=noschedv2_opts,
255 exp_file=experiment_file)
cmticeaa700b02015-06-12 13:26:47 -0700256
asharif96f59692013-02-16 03:13:36 +0000257 ret = self._ce.RunCommand(command)
cmtice7f3190b2015-05-22 14:14:51 -0700258 if ret != 0:
259 raise RuntimeError("Couldn't run crosperf!")
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700260 else:
261 # Copy json report to pending archives directory.
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800262 command = 'cp %s/*.json %s/.' % (self._reports_dir, PENDING_ARCHIVES_DIR)
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700263 ret = self._ce.RunCommand(command)
cmtice7f3190b2015-05-22 14:14:51 -0700264 return
cmtice56fb7162014-06-18 11:32:15 -0700265
cmtice56fb7162014-06-18 11:32:15 -0700266 def _CopyWeeklyReportFiles(self, labels):
267 """Create tar files of the custom and official images and copy them
268 to the weekly reports directory, so they exist when the weekly report
269 gets generated. IMPORTANT NOTE: This function must run *after*
270 crosperf has been run; otherwise the vanilla images will not be there.
271 """
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800272 images_path = os.path.join(
273 os.path.realpath(self._chromeos_root), 'src/build/images', self._board)
274 weekday = time.strftime('%a')
cmtice56fb7162014-06-18 11:32:15 -0700275 data_dir = os.path.join(WEEKLY_REPORTS_ROOT, self._board)
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800276 dest_dir = os.path.join(data_dir, weekday)
cmtice56fb7162014-06-18 11:32:15 -0700277 if not os.path.exists(dest_dir):
278 os.makedirs(dest_dir)
cmtice4536ef62014-07-08 11:17:21 -0700279 # Make sure dest_dir is empty (clean out last week's data).
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800280 cmd = 'cd %s; rm -Rf %s_*_image*' % (dest_dir, weekday)
cmtice4536ef62014-07-08 11:17:21 -0700281 self._ce.RunCommand(cmd)
282 # Now create new tar files and copy them over.
cmtice56fb7162014-06-18 11:32:15 -0700283 for l in labels:
284 test_path = os.path.join(images_path, l)
285 if os.path.exists(test_path):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800286 if l != 'vanilla':
287 label_name = 'test'
cmtice56fb7162014-06-18 11:32:15 -0700288 else:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800289 label_name = 'vanilla'
290 tar_file_name = '%s_%s_image.tar' % (weekday, label_name)
291 cmd = ('cd %s; tar -cvf %s %s/chromiumos_test_image.bin; '
292 'cp %s %s/.') % (images_path, tar_file_name, l, tar_file_name,
Han Shenfe054f12015-02-18 15:00:13 -0800293 dest_dir)
cmtice56fb7162014-06-18 11:32:15 -0700294 tar_ret = self._ce.RunCommand(cmd)
cmtice7f3190b2015-05-22 14:14:51 -0700295 if tar_ret != 0:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800296 self._l.LogOutput('Error while creating/copying test tar file(%s).' %
297 tar_file_name)
cmtice56fb7162014-06-18 11:32:15 -0700298
cmtice7f3190b2015-05-22 14:14:51 -0700299 def _SendEmail(self):
300 """Find email msesage generated by crosperf and send it."""
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800301 filename = os.path.join(self._reports_dir, 'msg_body.html')
cmtice7f3190b2015-05-22 14:14:51 -0700302 if (os.path.exists(filename) and
303 os.path.exists(os.path.expanduser(MAIL_PROGRAM))):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800304 command = ('cat %s | %s -s "Nightly test results, %s" -team -html' %
305 (filename, MAIL_PROGRAM, self._board))
cmtice7f3190b2015-05-22 14:14:51 -0700306 self._ce.RunCommand(command)
asharif96f59692013-02-16 03:13:36 +0000307
308 def DoAll(self):
309 self._CheckoutChromeOS()
asharif96f59692013-02-16 03:13:36 +0000310 labels = []
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800311 labels.append('vanilla')
asharif96f59692013-02-16 03:13:36 +0000312 for config in self._configs:
Caroline Tice80eab982015-11-04 14:03:14 -0800313 label = self._BuildLabelName(config.gcc_config.githash, self._board)
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800314 if (not misc.DoesLabelExist(self._chromeos_root, self._board, label)):
asharif96f59692013-02-16 03:13:36 +0000315 self._BuildToolchain(config)
316 label = self._BuildAndImage(label)
317 labels.append(label)
cmticea6255d02014-01-10 10:27:22 -0800318 self._FinishSetup()
cmticeb4588092015-05-27 08:07:50 -0700319 self._TestLabels(labels)
cmtice7f3190b2015-05-22 14:14:51 -0700320 self._SendEmail()
321 # Only try to copy the image files if the test runs ran successfully.
322 self._CopyWeeklyReportFiles(labels)
asharif3e38de02013-02-19 19:34:59 +0000323 if self._clean:
324 ret = self._DeleteChroot()
cmtice7f3190b2015-05-22 14:14:51 -0700325 if ret != 0:
326 return ret
asharif67973582013-02-19 20:19:40 +0000327 ret = self._DeleteCcahe()
cmtice7f3190b2015-05-22 14:14:51 -0700328 if ret != 0:
329 return ret
asharif96f59692013-02-16 03:13:36 +0000330 return 0
331
332
333def Main(argv):
334 """The main function."""
335 # Common initializations
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800336 ### command_executer.InitCommandExecuter(True)
asharif96f59692013-02-16 03:13:36 +0000337 command_executer.InitCommandExecuter()
338 parser = optparse.OptionParser()
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800339 parser.add_option('--remote',
340 dest='remote',
341 help='Remote machines to run tests on.')
342 parser.add_option('--board',
343 dest='board',
344 default='x86-zgb',
345 help='The target board.')
346 parser.add_option('--githashes',
347 dest='githashes',
348 default='master',
349 help='The gcc githashes to test.')
350 parser.add_option('--clean',
351 dest='clean',
asharif3e38de02013-02-19 19:34:59 +0000352 default=False,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800353 action='store_true',
354 help='Clean the chroot after testing.')
355 parser.add_option('--public',
356 dest='public',
asharife6b72fe2013-02-19 19:58:18 +0000357 default=False,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800358 action='store_true',
359 help='Use the public checkout/build.')
360 parser.add_option('--force-mismatch',
361 dest='force_mismatch',
362 default='',
363 help='Force the image regardless of board mismatch')
364 parser.add_option('--noschedv2',
365 dest='noschedv2',
366 action='store_true',
Han Shen36413122015-08-28 11:05:40 -0700367 default=False,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800368 help='Pass --noschedv2 to crosperf.')
asharif96f59692013-02-16 03:13:36 +0000369 options, _ = parser.parse_args(argv)
370 if not options.board:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800371 print 'Please give a board.'
asharif96f59692013-02-16 03:13:36 +0000372 return 1
373 if not options.remote:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800374 print 'Please give at least one remote machine.'
asharif96f59692013-02-16 03:13:36 +0000375 return 1
376 toolchain_configs = []
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800377 for githash in options.githashes.split(','):
asharif96f59692013-02-16 03:13:36 +0000378 gcc_config = GCCConfig(githash=githash)
379 toolchain_config = ToolchainConfig(gcc_config=gcc_config)
380 toolchain_configs.append(toolchain_config)
asharif3e38de02013-02-19 19:34:59 +0000381 fc = ToolchainComparator(options.board, options.remote, toolchain_configs,
asharif58a8c9f2013-02-19 20:42:43 +0000382 options.clean, options.public,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800383 options.force_mismatch, options.noschedv2)
asharif96f59692013-02-16 03:13:36 +0000384 return fc.DoAll()
385
386
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800387if __name__ == '__main__':
asharif96f59692013-02-16 03:13:36 +0000388 retval = Main(sys.argv)
389 sys.exit(retval)