blob: 34e7c2b7d8c0703e2464f080d08639b834405cf9 [file] [log] [blame]
Yunlian Jiang14cf5962015-12-11 15:50:14 -08001#!/usr/bin/python2
2"""Script for running nightly compiler tests on ChromeOS.
cmtice46093e52014-12-09 14:59:16 -08003
4This script launches a buildbot to build ChromeOS with the latest compiler on
5a particular board; then it finds and downloads the trybot image and the
6corresponding official image, and runs crosperf performance tests comparing
7the two. It then generates a report, emails it to the c-compiler-chrome, as
8well as copying the images into the seven-day reports directory.
9"""
10
11# Script to test different toolchains against ChromeOS benchmarks.
Yunlian Jiang14cf5962015-12-11 15:50:14 -080012
13from __future__ import print_function
14
Caroline Ticeeddb0632016-04-14 09:19:02 -070015import argparse
cmticece5ffa42015-02-12 15:18:43 -080016import datetime
cmtice46093e52014-12-09 14:59:16 -080017import os
Luis Lozanoc75fd052016-02-19 17:37:01 -080018import re
cmtice46093e52014-12-09 14:59:16 -080019import sys
20import time
cmtice46093e52014-12-09 14:59:16 -080021
Caroline Ticea8af9a72016-07-20 12:52:59 -070022from cros_utils import command_executer
23from cros_utils import logger
cmtice46093e52014-12-09 14:59:16 -080024
Caroline Ticea8af9a72016-07-20 12:52:59 -070025from cros_utils import buildbot_utils
cmtice46093e52014-12-09 14:59:16 -080026
27# CL that updated GCC ebuilds to use 'next_gcc'.
Luis Lozanof2a3ef42015-12-15 13:49:30 -080028USE_NEXT_GCC_PATCH = '230260'
Yunlian Jiang3c6e4672015-08-24 15:58:22 -070029
Yunlian Jiang2f563562015-08-28 13:54:04 -070030# CL that uses LLVM to build the peppy image.
Luis Lozanof2a3ef42015-12-15 13:49:30 -080031USE_LLVM_PATCH = '295217'
Yunlian Jiang2f563562015-08-28 13:54:04 -070032
Yunlian Jiang3c6e4672015-08-24 15:58:22 -070033# The boards on which we run weekly reports
Luis Lozanof2a3ef42015-12-15 13:49:30 -080034WEEKLY_REPORT_BOARDS = ['lumpy']
cmtice46093e52014-12-09 14:59:16 -080035
Luis Lozanof2a3ef42015-12-15 13:49:30 -080036CROSTC_ROOT = '/usr/local/google/crostc'
37ROLE_ACCOUNT = 'mobiletc-prebuild'
cmtice46093e52014-12-09 14:59:16 -080038TOOLCHAIN_DIR = os.path.dirname(os.path.realpath(__file__))
Luis Lozanof2a3ef42015-12-15 13:49:30 -080039MAIL_PROGRAM = '~/var/bin/mail-sheriff'
40WEEKLY_REPORTS_ROOT = os.path.join(CROSTC_ROOT, 'weekly_test_data')
41PENDING_ARCHIVES_DIR = os.path.join(CROSTC_ROOT, 'pending_archives')
42NIGHTLY_TESTS_DIR = os.path.join(CROSTC_ROOT, 'nightly_test_reports')
43
Luis Lozanoc75fd052016-02-19 17:37:01 -080044IMAGE_FS = (r'{board}-{image_type}/{chrome_version}-{tip}\.' +
45 r'{branch}\.{branch_branch}')
46TRYBOT_IMAGE_FS = 'trybot-' + IMAGE_FS + '-{build_id}'
47PFQ_IMAGE_FS = IMAGE_FS + '-rc1'
Manoj Guptaaee96b72016-10-24 13:43:28 -070048IMAGE_RE_GROUPS = {
49 'board': r'(?P<board>\S+)',
50 'image_type': r'(?P<image_type>\S+)',
51 'chrome_version': r'(?P<chrome_version>R\d+)',
52 'tip': r'(?P<tip>\d+)',
53 'branch': r'(?P<branch>\d+)',
54 'branch_branch': r'(?P<branch_branch>\d+)',
55 'build_id': r'(?P<build_id>b\d+)'
56}
Luis Lozanoc75fd052016-02-19 17:37:01 -080057TRYBOT_IMAGE_RE = TRYBOT_IMAGE_FS.format(**IMAGE_RE_GROUPS)
58
cmtice46093e52014-12-09 14:59:16 -080059
Yunlian Jiang14cf5962015-12-11 15:50:14 -080060class ToolchainComparator(object):
61 """Class for doing the nightly tests work."""
cmtice46093e52014-12-09 14:59:16 -080062
Luis Lozanof2a3ef42015-12-15 13:49:30 -080063 def __init__(self,
64 board,
65 remotes,
66 chromeos_root,
67 weekday,
68 patches,
69 noschedv2=False):
cmtice46093e52014-12-09 14:59:16 -080070 self._board = board
71 self._remotes = remotes
72 self._chromeos_root = chromeos_root
73 self._base_dir = os.getcwd()
74 self._ce = command_executer.GetCommandExecuter()
75 self._l = logger.GetLogger()
Luis Lozanof2a3ef42015-12-15 13:49:30 -080076 self._build = '%s-release' % board
Yunlian Jiang3c6e4672015-08-24 15:58:22 -070077 self._patches = patches.split(',')
78 self._patches_string = '_'.join(str(p) for p in self._patches)
Han Shen43494292015-09-14 10:26:40 -070079 self._noschedv2 = noschedv2
Yunlian Jiang3c6e4672015-08-24 15:58:22 -070080
cmtice46093e52014-12-09 14:59:16 -080081 if not weekday:
Luis Lozanof2a3ef42015-12-15 13:49:30 -080082 self._weekday = time.strftime('%a')
cmtice46093e52014-12-09 14:59:16 -080083 else:
84 self._weekday = weekday
cmtice7f3190b2015-05-22 14:14:51 -070085 timestamp = datetime.datetime.strftime(datetime.datetime.now(),
Luis Lozanof2a3ef42015-12-15 13:49:30 -080086 '%Y-%m-%d_%H:%M:%S')
Manoj Guptaaee96b72016-10-24 13:43:28 -070087 self._reports_dir = os.path.join(
88 NIGHTLY_TESTS_DIR,
89 '%s.%s' % (timestamp, board),)
cmtice46093e52014-12-09 14:59:16 -080090
Luis Lozanoc75fd052016-02-19 17:37:01 -080091 def _GetVanillaImageName(self, trybot_image):
92 """Given a trybot artifact name, get corresponding vanilla image name.
cmtice46093e52014-12-09 14:59:16 -080093
Luis Lozano783954f2015-12-21 18:06:29 -080094 Args:
95 trybot_image: artifact name such as
96 'trybot-daisy-release/R40-6394.0.0-b1389'
97
98 Returns:
99 Corresponding official image name, e.g. 'daisy-release/R40-6394.0.0'.
cmtice46093e52014-12-09 14:59:16 -0800100 """
Luis Lozanoc75fd052016-02-19 17:37:01 -0800101 mo = re.search(TRYBOT_IMAGE_RE, trybot_image)
102 assert mo
103 return IMAGE_FS.replace('\\', '').format(**mo.groupdict())
cmtice46093e52014-12-09 14:59:16 -0800104
Luis Lozanoc75fd052016-02-19 17:37:01 -0800105 def _GetNonAFDOImageName(self, trybot_image):
106 """Given a trybot artifact name, get corresponding non-AFDO image name.
107
108 We get the non-AFDO image from the PFQ builders. This image
109 is not generated for all the boards and, the closest PFQ image
110 was the one build for the previous ChromeOS version (the chrome
111 used in the current version is the one validated in the previous
112 version).
113 The previous ChromeOS does not always exist either. So, we try
114 a couple of versions before.
Luis Lozano783954f2015-12-21 18:06:29 -0800115
116 Args:
117 trybot_image: artifact name such as
118 'trybot-daisy-release/R40-6394.0.0-b1389'
119
120 Returns:
121 Corresponding chrome PFQ image name, e.g.
Luis Lozanoc75fd052016-02-19 17:37:01 -0800122 'daisy-chrome-pfq/R40-6393.0.0-rc1'.
Luis Lozano783954f2015-12-21 18:06:29 -0800123 """
Luis Lozanoc75fd052016-02-19 17:37:01 -0800124 mo = re.search(TRYBOT_IMAGE_RE, trybot_image)
125 assert mo
126 image_dict = mo.groupdict()
127 image_dict['image_type'] = 'chrome-pfq'
128 for _ in xrange(2):
129 image_dict['tip'] = str(int(image_dict['tip']) - 1)
130 nonafdo_image = PFQ_IMAGE_FS.replace('\\', '').format(**image_dict)
131 if buildbot_utils.DoesImageExist(self._chromeos_root, nonafdo_image):
132 return nonafdo_image
133 return ''
Luis Lozano783954f2015-12-21 18:06:29 -0800134
cmtice46093e52014-12-09 14:59:16 -0800135 def _FinishSetup(self):
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800136 """Make sure testing_rsa file is properly set up."""
cmtice46093e52014-12-09 14:59:16 -0800137 # Fix protections on ssh key
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800138 command = ('chmod 600 /var/cache/chromeos-cache/distfiles/target'
139 '/chrome-src-internal/src/third_party/chromite/ssh_keys'
140 '/testing_rsa')
cmtice46093e52014-12-09 14:59:16 -0800141 ret_val = self._ce.ChrootRunCommand(self._chromeos_root, command)
cmtice7f3190b2015-05-22 14:14:51 -0700142 if ret_val != 0:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800143 raise RuntimeError('chmod for testing_rsa failed')
cmtice46093e52014-12-09 14:59:16 -0800144
Luis Lozano783954f2015-12-21 18:06:29 -0800145 def _TestImages(self, trybot_image, vanilla_image, nonafdo_image):
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800146 """Create crosperf experiment file.
cmtice46093e52014-12-09 14:59:16 -0800147
Luis Lozano783954f2015-12-21 18:06:29 -0800148 Given the names of the trybot, vanilla and non-AFDO images, create the
cmtice46093e52014-12-09 14:59:16 -0800149 appropriate crosperf experiment file and launch crosperf on it.
150 """
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800151 experiment_file_dir = os.path.join(self._chromeos_root, '..', self._weekday)
152 experiment_file_name = '%s_toolchain_experiment.txt' % self._board
Yunlian Jiang2f563562015-08-28 13:54:04 -0700153
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800154 compiler_string = 'gcc'
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800155 if USE_LLVM_PATCH in self._patches_string:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800156 experiment_file_name = '%s_llvm_experiment.txt' % self._board
157 compiler_string = 'llvm'
Yunlian Jiang2f563562015-08-28 13:54:04 -0700158
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800159 experiment_file = os.path.join(experiment_file_dir, experiment_file_name)
cmtice46093e52014-12-09 14:59:16 -0800160 experiment_header = """
161 board: %s
162 remote: %s
Luis Lozanoe1efeb82015-06-16 16:35:44 -0700163 retries: 1
cmtice46093e52014-12-09 14:59:16 -0800164 """ % (self._board, self._remotes)
165 experiment_tests = """
Luis Lozano1489d642015-12-08 10:08:19 -0800166 benchmark: all_toolchain_perf {
cmtice46093e52014-12-09 14:59:16 -0800167 suite: telemetry_Crosperf
168 iterations: 3
169 }
Caroline Ticee82513b2016-10-27 12:45:15 -0700170
171 benchmark: page_cycler_v2.typical_25 {
172 suite: telemetry_Crosperf
173 iterations: 2
174 run_local: False
175 retries: 0
176 }
cmtice46093e52014-12-09 14:59:16 -0800177 """
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800178
179 with open(experiment_file, 'w') as f:
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800180 f.write(experiment_header)
181 f.write(experiment_tests)
cmtice46093e52014-12-09 14:59:16 -0800182
183 # Now add vanilla to test file.
184 official_image = """
185 vanilla_image {
186 chromeos_root: %s
187 build: %s
Caroline Ticeddde5052015-09-23 09:43:35 -0700188 compiler: gcc
cmtice46093e52014-12-09 14:59:16 -0800189 }
190 """ % (self._chromeos_root, vanilla_image)
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800191 f.write(official_image)
cmtice46093e52014-12-09 14:59:16 -0800192
Luis Lozano783954f2015-12-21 18:06:29 -0800193 # Now add non-AFDO image to test file.
Luis Lozano439f2b72016-01-08 11:56:02 -0800194 if nonafdo_image:
195 official_nonafdo_image = """
Luis Lozano783954f2015-12-21 18:06:29 -0800196 nonafdo_image {
197 chromeos_root: %s
198 build: %s
199 compiler: gcc
200 }
201 """ % (self._chromeos_root, nonafdo_image)
Luis Lozano439f2b72016-01-08 11:56:02 -0800202 f.write(official_nonafdo_image)
Luis Lozano783954f2015-12-21 18:06:29 -0800203
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800204 label_string = '%s_trybot_image' % compiler_string
Caroline Tice80eab982015-11-04 14:03:14 -0800205 if USE_NEXT_GCC_PATCH in self._patches:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800206 label_string = 'gcc_next_trybot_image'
Caroline Tice80eab982015-11-04 14:03:14 -0800207
cmtice46093e52014-12-09 14:59:16 -0800208 experiment_image = """
Caroline Tice80eab982015-11-04 14:03:14 -0800209 %s {
cmtice46093e52014-12-09 14:59:16 -0800210 chromeos_root: %s
211 build: %s
Caroline Ticeddde5052015-09-23 09:43:35 -0700212 compiler: %s
cmtice46093e52014-12-09 14:59:16 -0800213 }
Caroline Tice80eab982015-11-04 14:03:14 -0800214 """ % (label_string, self._chromeos_root, trybot_image,
215 compiler_string)
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800216 f.write(experiment_image)
cmtice46093e52014-12-09 14:59:16 -0800217
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800218 crosperf = os.path.join(TOOLCHAIN_DIR, 'crosperf', 'crosperf')
Han Shen43494292015-09-14 10:26:40 -0700219 noschedv2_opts = '--noschedv2' if self._noschedv2 else ''
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800220 command = ('{crosperf} --no_email=True --results_dir={r_dir} '
221 '--json_report=True {noschedv2_opts} {exp_file}').format(
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800222 crosperf=crosperf,
223 r_dir=self._reports_dir,
224 noschedv2_opts=noschedv2_opts,
225 exp_file=experiment_file)
cmticeaa700b02015-06-12 13:26:47 -0700226
cmtice46093e52014-12-09 14:59:16 -0800227 ret = self._ce.RunCommand(command)
cmtice7f3190b2015-05-22 14:14:51 -0700228 if ret != 0:
Manoj Guptaaee96b72016-10-24 13:43:28 -0700229 raise RuntimeError('Crosperf execution error!')
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700230 else:
231 # Copy json report to pending archives directory.
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800232 command = 'cp %s/*.json %s/.' % (self._reports_dir, PENDING_ARCHIVES_DIR)
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700233 ret = self._ce.RunCommand(command)
cmtice7f3190b2015-05-22 14:14:51 -0700234 return
cmtice46093e52014-12-09 14:59:16 -0800235
Luis Lozano783954f2015-12-21 18:06:29 -0800236 def _CopyWeeklyReportFiles(self, trybot_image, vanilla_image, nonafdo_image):
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800237 """Put files in place for running seven-day reports.
cmtice46093e52014-12-09 14:59:16 -0800238
239 Create tar files of the custom and official images and copy them
240 to the weekly reports directory, so they exist when the weekly report
241 gets generated. IMPORTANT NOTE: This function must run *after*
242 crosperf has been run; otherwise the vanilla images will not be there.
243 """
244
245 dry_run = False
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800246 if os.getlogin() != ROLE_ACCOUNT:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800247 self._l.LogOutput('Running this from non-role account; not copying '
248 'tar files for weekly reports.')
cmtice46093e52014-12-09 14:59:16 -0800249 dry_run = True
250
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800251 images_path = os.path.join(
252 os.path.realpath(self._chromeos_root), 'chroot/tmp')
cmtice46093e52014-12-09 14:59:16 -0800253
254 data_dir = os.path.join(WEEKLY_REPORTS_ROOT, self._board)
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800255 dest_dir = os.path.join(data_dir, self._weekday)
cmtice46093e52014-12-09 14:59:16 -0800256 if not os.path.exists(dest_dir):
257 os.makedirs(dest_dir)
258
259 # Make sure dest_dir is empty (clean out last week's data).
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800260 cmd = 'cd %s; rm -Rf %s_*_image*' % (dest_dir, self._weekday)
cmtice46093e52014-12-09 14:59:16 -0800261 if dry_run:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800262 print('CMD: %s' % cmd)
cmtice46093e52014-12-09 14:59:16 -0800263 else:
264 self._ce.RunCommand(cmd)
265
266 # Now create new tar files and copy them over.
Luis Lozano439f2b72016-01-08 11:56:02 -0800267 labels = {'test': trybot_image, 'vanilla': vanilla_image}
268 if nonafdo_image:
269 labels['nonafdo'] = nonafdo_image
270 for label_name, test_path in labels.iteritems():
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800271 tar_file_name = '%s_%s_image.tar' % (self._weekday, label_name)
272 cmd = ('cd %s; tar -cvf %s %s/chromiumos_test_image.bin; '
273 'cp %s %s/.') % (images_path, tar_file_name, test_path,
274 tar_file_name, dest_dir)
cmtice46093e52014-12-09 14:59:16 -0800275 if dry_run:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800276 print('CMD: %s' % cmd)
cmtice46093e52014-12-09 14:59:16 -0800277 tar_ret = 0
278 else:
279 tar_ret = self._ce.RunCommand(cmd)
280 if tar_ret:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800281 self._l.LogOutput('Error while creating/copying test tar file(%s).' %
282 tar_file_name)
cmtice46093e52014-12-09 14:59:16 -0800283
cmtice7f3190b2015-05-22 14:14:51 -0700284 def _SendEmail(self):
285 """Find email message generated by crosperf and send it."""
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800286 filename = os.path.join(self._reports_dir, 'msg_body.html')
cmtice7f3190b2015-05-22 14:14:51 -0700287 if (os.path.exists(filename) and
288 os.path.exists(os.path.expanduser(MAIL_PROGRAM))):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800289 email_title = 'buildbot test results'
Yunlian Jiang2f563562015-08-28 13:54:04 -0700290 if self._patches_string == USE_LLVM_PATCH:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800291 email_title = 'buildbot llvm test results'
292 command = ('cat %s | %s -s "%s, %s" -team -html' %
293 (filename, MAIL_PROGRAM, email_title, self._board))
cmtice7f3190b2015-05-22 14:14:51 -0700294 self._ce.RunCommand(command)
cmtice46093e52014-12-09 14:59:16 -0800295
296 def DoAll(self):
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800297 """Main function inside ToolchainComparator class.
cmtice46093e52014-12-09 14:59:16 -0800298
299 Launch trybot, get image names, create crosperf experiment file, run
300 crosperf, and copy images into seven-day report directories.
301 """
cmticece5ffa42015-02-12 15:18:43 -0800302 date_str = datetime.date.today()
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800303 description = 'master_%s_%s_%s' % (self._patches_string, self._build,
Han Shenfe054f12015-02-18 15:00:13 -0800304 date_str)
Manoj Guptaaee96b72016-10-24 13:43:28 -0700305 trybot_image = buildbot_utils.GetTrybotImage(
306 self._chromeos_root,
307 self._build,
308 self._patches,
309 description,
310 other_flags=['--notests'],
311 build_toolchain=True)
cmtice46093e52014-12-09 14:59:16 -0800312
cmticed54f9802015-02-05 11:04:11 -0800313 if len(trybot_image) == 0:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800314 self._l.LogError('Unable to find trybot_image for %s!' % description)
Luis Lozano7f20acb2015-11-04 17:15:08 -0800315 return 1
Luis Lozano783954f2015-12-21 18:06:29 -0800316
Luis Lozanoc75fd052016-02-19 17:37:01 -0800317 vanilla_image = self._GetVanillaImageName(trybot_image)
318 nonafdo_image = self._GetNonAFDOImageName(trybot_image)
Luis Lozano783954f2015-12-21 18:06:29 -0800319
Yunlian Jiang56f13762016-01-06 12:56:24 -0800320 # The trybot image is ready here, in some cases, the vanilla image
321 # is not ready, so we need to make sure vanilla image is available.
322 buildbot_utils.WaitForImage(self._chromeos_root, vanilla_image)
Luis Lozano783954f2015-12-21 18:06:29 -0800323 print('trybot_image: %s' % trybot_image)
324 print('vanilla_image: %s' % vanilla_image)
325 print('nonafdo_image: %s' % nonafdo_image)
Luis Lozanoc75fd052016-02-19 17:37:01 -0800326
cmtice46093e52014-12-09 14:59:16 -0800327 if os.getlogin() == ROLE_ACCOUNT:
328 self._FinishSetup()
329
Luis Lozano783954f2015-12-21 18:06:29 -0800330 self._TestImages(trybot_image, vanilla_image, nonafdo_image)
cmtice7f3190b2015-05-22 14:14:51 -0700331 self._SendEmail()
Yunlian Jiang3c6e4672015-08-24 15:58:22 -0700332 if (self._patches_string == USE_NEXT_GCC_PATCH and
333 self._board in WEEKLY_REPORT_BOARDS):
Luis Lozano7f20acb2015-11-04 17:15:08 -0800334 # Only try to copy the image files if the test runs ran successfully.
Luis Lozano783954f2015-12-21 18:06:29 -0800335 self._CopyWeeklyReportFiles(trybot_image, vanilla_image, nonafdo_image)
cmtice46093e52014-12-09 14:59:16 -0800336 return 0
337
338
339def Main(argv):
340 """The main function."""
341
342 # Common initializations
343 command_executer.InitCommandExecuter()
Caroline Ticeeddb0632016-04-14 09:19:02 -0700344 parser = argparse.ArgumentParser()
Manoj Guptaaee96b72016-10-24 13:43:28 -0700345 parser.add_argument(
346 '--remote', dest='remote', help='Remote machines to run tests on.')
347 parser.add_argument(
348 '--board', dest='board', default='x86-zgb', help='The target board.')
349 parser.add_argument(
350 '--chromeos_root',
351 dest='chromeos_root',
352 help='The chromeos root from which to run tests.')
353 parser.add_argument(
354 '--weekday',
355 default='',
356 dest='weekday',
357 help='The day of the week for which to run tests.')
358 parser.add_argument(
359 '--patch',
360 dest='patches',
361 help='The patches to use for the testing, '
362 "seprate the patch numbers with ',' "
363 'for more than one patches.')
364 parser.add_argument(
365 '--noschedv2',
366 dest='noschedv2',
367 action='store_true',
368 default=False,
369 help='Pass --noschedv2 to crosperf.')
Han Shen36413122015-08-28 11:05:40 -0700370
Caroline Ticeeddb0632016-04-14 09:19:02 -0700371 options = parser.parse_args(argv[1:])
cmtice46093e52014-12-09 14:59:16 -0800372 if not options.board:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800373 print('Please give a board.')
cmtice46093e52014-12-09 14:59:16 -0800374 return 1
375 if not options.remote:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800376 print('Please give at least one remote machine.')
cmtice46093e52014-12-09 14:59:16 -0800377 return 1
378 if not options.chromeos_root:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800379 print('Please specify the ChromeOS root directory.')
cmtice46093e52014-12-09 14:59:16 -0800380 return 1
Yunlian Jiang76259e62015-08-21 08:44:31 -0700381 if options.patches:
Yunlian Jiang3c6e4672015-08-24 15:58:22 -0700382 patches = options.patches
383 else:
384 patches = USE_NEXT_GCC_PATCH
Yunlian Jiange52838c2015-08-20 14:32:37 -0700385
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800386 fc = ToolchainComparator(options.board, options.remote, options.chromeos_root,
387 options.weekday, patches, options.noschedv2)
cmtice46093e52014-12-09 14:59:16 -0800388 return fc.DoAll()
389
390
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800391if __name__ == '__main__':
cmtice46093e52014-12-09 14:59:16 -0800392 retval = Main(sys.argv)
393 sys.exit(retval)