blob: 48987966629ae6c7a6b86a9d56ef759b169b1514 [file] [log] [blame]
Zhizhou Yang81d651f2020-02-10 16:51:20 -08001#!/usr/bin/env python3
Tiancong Wangd0348132019-03-07 11:22:48 -08002# -*- coding: utf-8 -*-
Ting-Yuan Huange5819872016-12-15 14:22:26 -08003#
4# Copyright 2016 The Chromium OS Authors. All rights reserved.
5# Use of this source code is governed by a BSD-style license that can be
6# found in the LICENSE file.
Denis Nikitin265c2962019-08-01 19:52:49 -07007
Yunlian Jiang14cf5962015-12-11 15:50:14 -08008"""Script for running nightly compiler tests on ChromeOS.
cmtice46093e52014-12-09 14:59:16 -08009
10This script launches a buildbot to build ChromeOS with the latest compiler on
11a particular board; then it finds and downloads the trybot image and the
12corresponding official image, and runs crosperf performance tests comparing
13the two. It then generates a report, emails it to the c-compiler-chrome, as
14well as copying the images into the seven-day reports directory.
15"""
16
17# Script to test different toolchains against ChromeOS benchmarks.
Yunlian Jiang14cf5962015-12-11 15:50:14 -080018
19from __future__ import print_function
20
Caroline Ticeeddb0632016-04-14 09:19:02 -070021import argparse
cmticece5ffa42015-02-12 15:18:43 -080022import datetime
cmtice46093e52014-12-09 14:59:16 -080023import os
Luis Lozanoc75fd052016-02-19 17:37:01 -080024import re
zhizhouy9258b052020-04-15 17:33:46 -070025import shutil
cmtice46093e52014-12-09 14:59:16 -080026import sys
27import time
cmtice46093e52014-12-09 14:59:16 -080028
Caroline Ticea8af9a72016-07-20 12:52:59 -070029from cros_utils import command_executer
30from cros_utils import logger
cmtice46093e52014-12-09 14:59:16 -080031
Caroline Ticea8af9a72016-07-20 12:52:59 -070032from cros_utils import buildbot_utils
cmtice46093e52014-12-09 14:59:16 -080033
Manoj Guptac4110352016-12-28 13:47:12 -080034# CL that uses LLVM-Next to build the images (includes chrome).
Manoj Gupta66682c72017-05-24 12:19:57 -070035USE_LLVM_NEXT_PATCH = '513590'
Manoj Guptac4110352016-12-28 13:47:12 -080036
Luis Lozanof2a3ef42015-12-15 13:49:30 -080037CROSTC_ROOT = '/usr/local/google/crostc'
Luis Lozanobe756e02020-02-07 10:54:08 -080038NIGHTLY_TESTS_DIR = os.path.join(CROSTC_ROOT, 'nightly-tests')
Luis Lozanof2a3ef42015-12-15 13:49:30 -080039ROLE_ACCOUNT = 'mobiletc-prebuild'
cmtice46093e52014-12-09 14:59:16 -080040TOOLCHAIN_DIR = os.path.dirname(os.path.realpath(__file__))
zhizhouy9258b052020-04-15 17:33:46 -070041TMP_TOOLCHAIN_TEST = '/tmp/toolchain-tests'
Luis Lozanof2a3ef42015-12-15 13:49:30 -080042MAIL_PROGRAM = '~/var/bin/mail-sheriff'
Luis Lozanof2a3ef42015-12-15 13:49:30 -080043PENDING_ARCHIVES_DIR = os.path.join(CROSTC_ROOT, 'pending_archives')
Luis Lozanob02958e2020-02-10 02:12:18 -080044NIGHTLY_TESTS_RESULTS = os.path.join(CROSTC_ROOT, 'nightly_test_reports')
Luis Lozanof2a3ef42015-12-15 13:49:30 -080045
Ting-Yuan Huange5819872016-12-15 14:22:26 -080046IMAGE_DIR = '{board}-{image_type}'
47IMAGE_VERSION_STR = r'{chrome_version}-{tip}\.{branch}\.{branch_branch}'
48IMAGE_FS = IMAGE_DIR + '/' + IMAGE_VERSION_STR
Ting-Yuan Huang112d5622018-03-26 13:49:42 -070049TRYBOT_IMAGE_FS = IMAGE_FS + '-{build_id}'
Manoj Guptaaee96b72016-10-24 13:43:28 -070050IMAGE_RE_GROUPS = {
51 'board': r'(?P<board>\S+)',
52 'image_type': r'(?P<image_type>\S+)',
53 'chrome_version': r'(?P<chrome_version>R\d+)',
54 'tip': r'(?P<tip>\d+)',
55 'branch': r'(?P<branch>\d+)',
56 'branch_branch': r'(?P<branch_branch>\d+)',
57 'build_id': r'(?P<build_id>b\d+)'
58}
Luis Lozanoc75fd052016-02-19 17:37:01 -080059TRYBOT_IMAGE_RE = TRYBOT_IMAGE_FS.format(**IMAGE_RE_GROUPS)
60
zhizhouy9258b052020-04-15 17:33:46 -070061RECIPE_IMAGE_FS = IMAGE_FS + '-{build_id}-{buildbucket_id}'
62RECIPE_IMAGE_RE_GROUPS = {
63 'board': r'(?P<board>\S+)',
64 'image_type': r'(?P<image_type>\S+)',
65 'chrome_version': r'(?P<chrome_version>R\d+)',
66 'tip': r'(?P<tip>\d+)',
67 'branch': r'(?P<branch>\d+)',
68 'branch_branch': r'(?P<branch_branch>\d+)',
69 'build_id': r'(?P<build_id>\d+)',
70 'buildbucket_id': r'(?P<buildbucket_id>\d+)'
71}
72RECIPE_IMAGE_RE = RECIPE_IMAGE_FS.format(**RECIPE_IMAGE_RE_GROUPS)
73
Tiancong Wang03234662019-10-30 10:16:38 -070074TELEMETRY_AQUARIUM_UNSUPPORTED = ['bob', 'elm', 'veyron_minnie']
75
cmtice46093e52014-12-09 14:59:16 -080076
Yunlian Jiang14cf5962015-12-11 15:50:14 -080077class ToolchainComparator(object):
78 """Class for doing the nightly tests work."""
cmtice46093e52014-12-09 14:59:16 -080079
Luis Lozanof2a3ef42015-12-15 13:49:30 -080080 def __init__(self,
81 board,
82 remotes,
83 chromeos_root,
84 weekday,
85 patches,
zhizhouy9258b052020-04-15 17:33:46 -070086 recipe=False,
87 test=False,
Luis Lozanof2a3ef42015-12-15 13:49:30 -080088 noschedv2=False):
cmtice46093e52014-12-09 14:59:16 -080089 self._board = board
90 self._remotes = remotes
91 self._chromeos_root = chromeos_root
92 self._base_dir = os.getcwd()
93 self._ce = command_executer.GetCommandExecuter()
94 self._l = logger.GetLogger()
Yunlian Jiang73580dd2017-11-21 04:48:40 -080095 self._build = '%s-release-tryjob' % board
Manoj Guptad575b8a2017-03-08 10:51:28 -080096 self._patches = patches.split(',') if patches else []
Yunlian Jiang3c6e4672015-08-24 15:58:22 -070097 self._patches_string = '_'.join(str(p) for p in self._patches)
zhizhouy9258b052020-04-15 17:33:46 -070098 self._recipe = recipe
99 self._test = test
Han Shen43494292015-09-14 10:26:40 -0700100 self._noschedv2 = noschedv2
Yunlian Jiang3c6e4672015-08-24 15:58:22 -0700101
cmtice46093e52014-12-09 14:59:16 -0800102 if not weekday:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800103 self._weekday = time.strftime('%a')
cmtice46093e52014-12-09 14:59:16 -0800104 else:
105 self._weekday = weekday
zhizhouyd8fcbf52020-04-06 16:47:20 -0700106 self._date = datetime.date.today().strftime('%Y/%m/%d')
107 timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
Manoj Guptaaee96b72016-10-24 13:43:28 -0700108 self._reports_dir = os.path.join(
zhizhouy9258b052020-04-15 17:33:46 -0700109 TMP_TOOLCHAIN_TEST if self._test else NIGHTLY_TESTS_RESULTS,
Caroline Tice9c4003a2017-11-07 16:37:33 -0800110 '%s.%s' % (timestamp, board),
111 )
cmtice46093e52014-12-09 14:59:16 -0800112
Luis Lozanoc75fd052016-02-19 17:37:01 -0800113 def _GetVanillaImageName(self, trybot_image):
Ting-Yuan Huange5819872016-12-15 14:22:26 -0800114 """Given a trybot artifact name, get latest vanilla image name.
cmtice46093e52014-12-09 14:59:16 -0800115
Luis Lozano783954f2015-12-21 18:06:29 -0800116 Args:
117 trybot_image: artifact name such as
Caroline Tice219e3b72018-12-18 15:54:49 -0800118 'daisy-release-tryjob/R40-6394.0.0-b1389'
zhizhouy9258b052020-04-15 17:33:46 -0700119 for recipe images, name is in this format:
120 'lulu-llvm-next-nightly/R84-13037.0.0-31011-8883172717979984032/'
Luis Lozano783954f2015-12-21 18:06:29 -0800121
122 Returns:
Ting-Yuan Huange5819872016-12-15 14:22:26 -0800123 Latest official image name, e.g. 'daisy-release/R57-9089.0.0'.
cmtice46093e52014-12-09 14:59:16 -0800124 """
Caroline Tice97ef4d02020-05-03 14:30:23 -0700125 # For board names with underscores, we need to fix the trybot image name
126 # to replace the hyphen (for the recipe builder) with the underscore.
127 # Currently the only such board we use is 'veyron_minnie'.
128 if trybot_image.find('veyron-minnie') != -1:
129 trybot_image = trybot_image.replace('veyron-minnie', 'veyron_minnie')
Yunlian Jiang2e0ad052017-11-22 14:06:45 -0800130 # We need to filter out -tryjob in the trybot_image.
zhizhouy9258b052020-04-15 17:33:46 -0700131 if self._recipe:
132 trybot = re.sub('-llvm-next-nightly', '-release', trybot_image)
133 mo = re.search(RECIPE_IMAGE_RE, trybot)
134 else:
135 trybot = re.sub('-tryjob', '', trybot_image)
136 mo = re.search(TRYBOT_IMAGE_RE, trybot)
Luis Lozanoc75fd052016-02-19 17:37:01 -0800137 assert mo
Ting-Yuan Huange5819872016-12-15 14:22:26 -0800138 dirname = IMAGE_DIR.replace('\\', '').format(**mo.groupdict())
Ting-Yuan Huang99d32c42017-04-24 20:34:43 -0700139 return buildbot_utils.GetLatestImage(self._chromeos_root, dirname)
cmtice46093e52014-12-09 14:59:16 -0800140
zhizhouy9258b052020-04-15 17:33:46 -0700141 def _TestImages(self, trybot_image, vanilla_image):
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800142 """Create crosperf experiment file.
cmtice46093e52014-12-09 14:59:16 -0800143
Luis Lozano783954f2015-12-21 18:06:29 -0800144 Given the names of the trybot, vanilla and non-AFDO images, create the
cmtice46093e52014-12-09 14:59:16 -0800145 appropriate crosperf experiment file and launch crosperf on it.
146 """
zhizhouy9258b052020-04-15 17:33:46 -0700147 if self._test:
148 experiment_file_dir = TMP_TOOLCHAIN_TEST
149 else:
150 experiment_file_dir = os.path.join(NIGHTLY_TESTS_DIR, self._weekday)
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800151 experiment_file_name = '%s_toolchain_experiment.txt' % self._board
Yunlian Jiang2f563562015-08-28 13:54:04 -0700152
Manoj Guptad575b8a2017-03-08 10:51:28 -0800153 compiler_string = 'llvm'
Manoj Guptac4110352016-12-28 13:47:12 -0800154 if USE_LLVM_NEXT_PATCH in self._patches_string:
155 experiment_file_name = '%s_llvm_next_experiment.txt' % self._board
156 compiler_string = 'llvm_next'
Yunlian Jiang2f563562015-08-28 13:54:04 -0700157
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800158 experiment_file = os.path.join(experiment_file_dir, experiment_file_name)
cmtice46093e52014-12-09 14:59:16 -0800159 experiment_header = """
160 board: %s
161 remote: %s
Luis Lozanoe1efeb82015-06-16 16:35:44 -0700162 retries: 1
cmtice46093e52014-12-09 14:59:16 -0800163 """ % (self._board, self._remotes)
164 experiment_tests = """
Luis Lozano1489d642015-12-08 10:08:19 -0800165 benchmark: all_toolchain_perf {
cmtice46093e52014-12-09 14:59:16 -0800166 suite: telemetry_Crosperf
Tiancong Wangd0348132019-03-07 11:22:48 -0800167 iterations: 5
Manoj Gupta5a516382017-08-23 12:27:54 -0700168 run_local: False
cmtice46093e52014-12-09 14:59:16 -0800169 }
Caroline Ticee82513b2016-10-27 12:45:15 -0700170
Caroline Tice219e3b72018-12-18 15:54:49 -0800171 benchmark: loading.desktop {
Caroline Ticee82513b2016-10-27 12:45:15 -0700172 suite: telemetry_Crosperf
Caroline Tice219e3b72018-12-18 15:54:49 -0800173 test_args: --story-tag-filter=typical
174 iterations: 3
Caroline Ticee82513b2016-10-27 12:45:15 -0700175 run_local: False
176 retries: 0
177 }
Tiancong Wang03234662019-10-30 10:16:38 -0700178 """
179 telemetry_aquarium_tests = """
Tiancong Wangd8bf2812019-08-30 11:34:05 -0700180 benchmark: rendering.desktop {
181 run_local: False
182 suite: telemetry_Crosperf
183 test_args: --story-filter=aquarium$
184 iterations: 5
185 }
186
187 benchmark: rendering.desktop {
188 run_local: False
189 suite: telemetry_Crosperf
190 test_args: --story-filter=aquarium_20k$
191 iterations: 3
192 }
cmtice46093e52014-12-09 14:59:16 -0800193 """
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800194
Zhizhou Yang81d651f2020-02-10 16:51:20 -0800195 with open(experiment_file, 'w', encoding='utf-8') as f:
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800196 f.write(experiment_header)
197 f.write(experiment_tests)
cmtice46093e52014-12-09 14:59:16 -0800198
Tiancong Wang011c5712019-11-01 10:33:34 -0700199 if self._board not in TELEMETRY_AQUARIUM_UNSUPPORTED:
Tiancong Wang03234662019-10-30 10:16:38 -0700200 f.write(telemetry_aquarium_tests)
201
cmtice46093e52014-12-09 14:59:16 -0800202 # Now add vanilla to test file.
Yunlian Jiangfceaba32018-06-06 09:08:44 -0700203 official_image = """
Zhizhou Yangcbc6a9d2020-02-13 15:51:36 -0800204 vanilla_image {
205 chromeos_root: %s
206 build: %s
207 compiler: llvm
208 }
209 """ % (self._chromeos_root, vanilla_image)
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800210 f.write(official_image)
cmtice46093e52014-12-09 14:59:16 -0800211
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800212 label_string = '%s_trybot_image' % compiler_string
Caroline Tice80eab982015-11-04 14:03:14 -0800213
Manoj Gupta3594db82017-01-31 11:48:57 -0800214 # Reuse autotest files from vanilla image for trybot images
215 autotest_files = os.path.join('/tmp', vanilla_image, 'autotest_files')
Yunlian Jiangfceaba32018-06-06 09:08:44 -0700216 experiment_image = """
Zhizhou Yangcbc6a9d2020-02-13 15:51:36 -0800217 %s {
218 chromeos_root: %s
219 build: %s
220 autotest_path: %s
221 compiler: %s
222 }
223 """ % (label_string, self._chromeos_root, trybot_image, autotest_files,
224 compiler_string)
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800225 f.write(experiment_image)
cmtice46093e52014-12-09 14:59:16 -0800226
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800227 crosperf = os.path.join(TOOLCHAIN_DIR, 'crosperf', 'crosperf')
Han Shen43494292015-09-14 10:26:40 -0700228 noschedv2_opts = '--noschedv2' if self._noschedv2 else ''
zhizhouy9258b052020-04-15 17:33:46 -0700229 command = ('{crosperf} --no_email={no_email} --results_dir={r_dir} '
Denis Nikitin21477692020-05-12 19:39:47 -0700230 '--logging_level=verbose --json_report=True {noschedv2_opts} '
231 '{exp_file}').format(
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800232 crosperf=crosperf,
zhizhouy9258b052020-04-15 17:33:46 -0700233 no_email=not self._test,
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800234 r_dir=self._reports_dir,
235 noschedv2_opts=noschedv2_opts,
236 exp_file=experiment_file)
cmticeaa700b02015-06-12 13:26:47 -0700237
zhizhouyd8fcbf52020-04-06 16:47:20 -0700238 return self._ce.RunCommand(command)
cmtice46093e52014-12-09 14:59:16 -0800239
cmtice7f3190b2015-05-22 14:14:51 -0700240 def _SendEmail(self):
241 """Find email message generated by crosperf and send it."""
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800242 filename = os.path.join(self._reports_dir, 'msg_body.html')
cmtice7f3190b2015-05-22 14:14:51 -0700243 if (os.path.exists(filename) and
244 os.path.exists(os.path.expanduser(MAIL_PROGRAM))):
Manoj Guptad575b8a2017-03-08 10:51:28 -0800245 email_title = 'buildbot llvm test results'
Manoj Guptac4110352016-12-28 13:47:12 -0800246 if USE_LLVM_NEXT_PATCH in self._patches_string:
247 email_title = 'buildbot llvm_next test results'
zhizhouyd8fcbf52020-04-06 16:47:20 -0700248 command = ('cat %s | %s -s "%s, %s %s" -team -html' %
249 (filename, MAIL_PROGRAM, email_title, self._board, self._date))
cmtice7f3190b2015-05-22 14:14:51 -0700250 self._ce.RunCommand(command)
cmtice46093e52014-12-09 14:59:16 -0800251
zhizhouyd8fcbf52020-04-06 16:47:20 -0700252 def _CopyJson(self):
Denis Nikitin92d70052020-10-06 11:31:25 -0700253 # Make sure a destination directory exists.
254 os.makedirs(PENDING_ARCHIVES_DIR, exist_ok=True)
zhizhouyd8fcbf52020-04-06 16:47:20 -0700255 # Copy json report to pending archives directory.
256 command = 'cp %s/*.json %s/.' % (self._reports_dir, PENDING_ARCHIVES_DIR)
257 ret = self._ce.RunCommand(command)
258 # Failing to access json report means that crosperf terminated or all tests
259 # failed, raise an error.
260 if ret != 0:
261 raise RuntimeError(
262 'Crosperf failed to run tests, cannot copy json report!')
263
Ting-Yuan Huang6a9a98a2018-03-07 17:35:13 -0800264 def DoAll(self):
Yunlian Jiang14cf5962015-12-11 15:50:14 -0800265 """Main function inside ToolchainComparator class.
cmtice46093e52014-12-09 14:59:16 -0800266
267 Launch trybot, get image names, create crosperf experiment file, run
268 crosperf, and copy images into seven-day report directories.
269 """
zhizhouy9258b052020-04-15 17:33:46 -0700270 if self._recipe:
271 print('Using recipe buckets to get latest image.')
Bob Haarman42e215f2020-05-01 14:15:28 -0700272 # crbug.com/1077313: Some boards are not consistently
273 # spelled, having underscores in some places and dashes in others.
274 # The image directories consistenly use dashes, so convert underscores
275 # to dashes to work around this.
zhizhouy9258b052020-04-15 17:33:46 -0700276 trybot_image = buildbot_utils.GetLatestRecipeImage(
Caroline Tice97ef4d02020-05-03 14:30:23 -0700277 self._chromeos_root,
278 '%s-llvm-next-nightly' % self._board.replace('_', '-'))
zhizhouy9258b052020-04-15 17:33:46 -0700279 else:
280 # Launch tryjob and wait to get image location.
281 buildbucket_id, trybot_image = buildbot_utils.GetTrybotImage(
282 self._chromeos_root,
283 self._build,
284 self._patches,
285 tryjob_flags=['--notests'],
286 build_toolchain=True)
287 print('trybot_url: \
288 http://cros-goldeneye/chromeos/healthmonitoring/buildDetails?buildbucketId=%s'
289 % buildbucket_id)
cmtice46093e52014-12-09 14:59:16 -0800290
Tiancong Wang03234662019-10-30 10:16:38 -0700291 if not trybot_image:
Caroline Ticeefb79902018-04-18 11:23:01 -0700292 self._l.LogError('Unable to find trybot_image!')
Yunlian Jiangcdd19072017-09-29 10:15:56 -0700293 return 2
Luis Lozano783954f2015-12-21 18:06:29 -0800294
Luis Lozanoc75fd052016-02-19 17:37:01 -0800295 vanilla_image = self._GetVanillaImageName(trybot_image)
Luis Lozano783954f2015-12-21 18:06:29 -0800296
297 print('trybot_image: %s' % trybot_image)
298 print('vanilla_image: %s' % vanilla_image)
Luis Lozanoc75fd052016-02-19 17:37:01 -0800299
zhizhouy9258b052020-04-15 17:33:46 -0700300 ret = self._TestImages(trybot_image, vanilla_image)
zhizhouyd8fcbf52020-04-06 16:47:20 -0700301 # Always try to send report email as crosperf will generate report when
302 # tests partially succeeded.
zhizhouy9258b052020-04-15 17:33:46 -0700303 if not self._test:
304 self._SendEmail()
305 self._CopyJson()
zhizhouyd8fcbf52020-04-06 16:47:20 -0700306 # Non-zero ret here means crosperf tests partially failed, raise error here
307 # so that toolchain summary report can catch it.
308 if ret != 0:
309 raise RuntimeError('Crosperf tests partially failed!')
310
cmtice46093e52014-12-09 14:59:16 -0800311 return 0
312
313
314def Main(argv):
315 """The main function."""
316
317 # Common initializations
318 command_executer.InitCommandExecuter()
Caroline Ticeeddb0632016-04-14 09:19:02 -0700319 parser = argparse.ArgumentParser()
Manoj Guptaaee96b72016-10-24 13:43:28 -0700320 parser.add_argument(
321 '--remote', dest='remote', help='Remote machines to run tests on.')
322 parser.add_argument(
323 '--board', dest='board', default='x86-zgb', help='The target board.')
324 parser.add_argument(
325 '--chromeos_root',
326 dest='chromeos_root',
327 help='The chromeos root from which to run tests.')
328 parser.add_argument(
329 '--weekday',
330 default='',
331 dest='weekday',
332 help='The day of the week for which to run tests.')
333 parser.add_argument(
334 '--patch',
335 dest='patches',
336 help='The patches to use for the testing, '
337 "seprate the patch numbers with ',' "
338 'for more than one patches.')
339 parser.add_argument(
340 '--noschedv2',
341 dest='noschedv2',
342 action='store_true',
343 default=False,
344 help='Pass --noschedv2 to crosperf.')
zhizhouy9258b052020-04-15 17:33:46 -0700345 parser.add_argument(
346 '--recipe',
347 dest='recipe',
348 default=True,
349 help='Use images generated from recipe rather than'
350 'launching tryjob to get images.')
351 parser.add_argument(
352 '--test',
353 dest='test',
354 default=False,
355 help='Test this script on local desktop, '
356 'disabling mobiletc checking and email sending.'
357 'Artifacts stored in /tmp/toolchain-tests')
Han Shen36413122015-08-28 11:05:40 -0700358
Caroline Ticeeddb0632016-04-14 09:19:02 -0700359 options = parser.parse_args(argv[1:])
cmtice46093e52014-12-09 14:59:16 -0800360 if not options.board:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800361 print('Please give a board.')
cmtice46093e52014-12-09 14:59:16 -0800362 return 1
363 if not options.remote:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800364 print('Please give at least one remote machine.')
cmtice46093e52014-12-09 14:59:16 -0800365 return 1
366 if not options.chromeos_root:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800367 print('Please specify the ChromeOS root directory.')
cmtice46093e52014-12-09 14:59:16 -0800368 return 1
zhizhouy9258b052020-04-15 17:33:46 -0700369 if options.test:
370 print('Cleaning local test directory for this script.')
371 if os.path.exists(TMP_TOOLCHAIN_TEST):
372 shutil.rmtree(TMP_TOOLCHAIN_TEST)
373 os.mkdir(TMP_TOOLCHAIN_TEST)
Yunlian Jiange52838c2015-08-20 14:32:37 -0700374
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800375 fc = ToolchainComparator(options.board, options.remote, options.chromeos_root,
zhizhouy9258b052020-04-15 17:33:46 -0700376 options.weekday, options.patches, options.recipe,
377 options.test, options.noschedv2)
Ting-Yuan Huang6a9a98a2018-03-07 17:35:13 -0800378 return fc.DoAll()
cmtice46093e52014-12-09 14:59:16 -0800379
380
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800381if __name__ == '__main__':
cmtice46093e52014-12-09 14:59:16 -0800382 retval = Main(sys.argv)
383 sys.exit(retval)