blob: 4c03d456b373e1cfa2ab0195beea65174a6735a8 [file] [log] [blame]
Caroline Tice88272d42016-01-13 09:48:29 -08001#!/usr/bin/python2
asharif96f59692013-02-16 03:13:36 +00002
3# Script to test different toolchains against ChromeOS benchmarks.
Caroline Tice88272d42016-01-13 09:48:29 -08004"""Toolchain team nightly performance test script (local builds)."""
5
6from __future__ import print_function
7
8import argparse
cmtice7cdb11a2015-05-28 10:24:41 -07009import datetime
asharif96f59692013-02-16 03:13:36 +000010import os
11import sys
12import build_chromeos
13import setup_chromeos
cmtice94bc4702014-05-29 16:29:04 -070014import time
Caroline Tice88272d42016-01-13 09:48:29 -080015from cros_utils import command_executer
16from cros_utils import misc
17from cros_utils import logger
asharif96f59692013-02-16 03:13:36 +000018
Luis Lozanof2a3ef42015-12-15 13:49:30 -080019CROSTC_ROOT = '/usr/local/google/crostc'
20MAIL_PROGRAM = '~/var/bin/mail-sheriff'
21WEEKLY_REPORTS_ROOT = os.path.join(CROSTC_ROOT, 'weekly_test_data')
22PENDING_ARCHIVES_DIR = os.path.join(CROSTC_ROOT, 'pending_archives')
23NIGHTLY_TESTS_DIR = os.path.join(CROSTC_ROOT, 'nightly_test_reports')
asharif96f59692013-02-16 03:13:36 +000024
cmtice94bc4702014-05-29 16:29:04 -070025
asharif96f59692013-02-16 03:13:36 +000026class GCCConfig(object):
Caroline Tice88272d42016-01-13 09:48:29 -080027 """GCC configuration class."""
Luis Lozanof2a3ef42015-12-15 13:49:30 -080028
asharif96f59692013-02-16 03:13:36 +000029 def __init__(self, githash):
30 self.githash = githash
31
32
Caroline Tice88272d42016-01-13 09:48:29 -080033class ToolchainConfig(object):
34 """Toolchain configuration class."""
Luis Lozanof2a3ef42015-12-15 13:49:30 -080035
Caroline Tice88272d42016-01-13 09:48:29 -080036 def __init__(self, gcc_config=None):
asharif96f59692013-02-16 03:13:36 +000037 self.gcc_config = gcc_config
38
39
40class ChromeOSCheckout(object):
Caroline Tice88272d42016-01-13 09:48:29 -080041 """Main class for checking out, building and testing ChromeOS."""
Luis Lozanof2a3ef42015-12-15 13:49:30 -080042
asharif96f59692013-02-16 03:13:36 +000043 def __init__(self, board, chromeos_root):
44 self._board = board
45 self._chromeos_root = chromeos_root
46 self._ce = command_executer.GetCommandExecuter()
47 self._l = logger.GetLogger()
cmtice56fb7162014-06-18 11:32:15 -070048 self._build_num = None
asharif96f59692013-02-16 03:13:36 +000049
asharif3e38de02013-02-19 19:34:59 +000050 def _DeleteChroot(self):
Luis Lozanof2a3ef42015-12-15 13:49:30 -080051 command = 'cd %s; cros_sdk --delete' % self._chromeos_root
asharif3e38de02013-02-19 19:34:59 +000052 return self._ce.RunCommand(command)
53
asharif67973582013-02-19 20:19:40 +000054 def _DeleteCcahe(self):
55 # crosbug.com/34956
Luis Lozanof2a3ef42015-12-15 13:49:30 -080056 command = 'sudo rm -rf %s' % os.path.join(self._chromeos_root, '.cache')
asharif67973582013-02-19 20:19:40 +000057 return self._ce.RunCommand(command)
58
cmtice56fb7162014-06-18 11:32:15 -070059 def _GetBuildNumber(self):
Caroline Tice88272d42016-01-13 09:48:29 -080060 """Get the build number of the ChromeOS image from the chroot.
61
62 This function assumes a ChromeOS image has been built in the chroot.
cmtice56fb7162014-06-18 11:32:15 -070063 It translates the 'latest' symlink in the
64 <chroot>/src/build/images/<board> directory, to find the actual
65 ChromeOS build number for the image that was built. For example, if
66 src/build/image/lumpy/latest -> R37-5982.0.2014_06_23_0454-a1, then
67 This function would parse it out and assign 'R37-5982' to self._build_num.
68 This is used to determine the official, vanilla build to use for
69 comparison tests.
70 """
71 # Get the path to 'latest'
Luis Lozanof2a3ef42015-12-15 13:49:30 -080072 sym_path = os.path.join(
73 misc.GetImageDir(self._chromeos_root, self._board), 'latest')
cmtice56fb7162014-06-18 11:32:15 -070074 # Translate the symlink to its 'real' path.
75 real_path = os.path.realpath(sym_path)
76 # Break up the path and get the last piece
77 # (e.g. 'R37-5982.0.2014_06_23_0454-a1"
Luis Lozanof2a3ef42015-12-15 13:49:30 -080078 path_pieces = real_path.split('/')
cmtice56fb7162014-06-18 11:32:15 -070079 last_piece = path_pieces[-1]
80 # Break this piece into the image number + other pieces, and get the
81 # image number [ 'R37-5982', '0', '2014_06_23_0454-a1']
Luis Lozanof2a3ef42015-12-15 13:49:30 -080082 image_parts = last_piece.split('.')
cmtice56fb7162014-06-18 11:32:15 -070083 self._build_num = image_parts[0]
84
Caroline Tice88272d42016-01-13 09:48:29 -080085 def _BuildLabelName(self, config):
Luis Lozanof2a3ef42015-12-15 13:49:30 -080086 pieces = config.split('/')
Caroline Tice80eab982015-11-04 14:03:14 -080087 compiler_version = pieces[-1]
Luis Lozanof2a3ef42015-12-15 13:49:30 -080088 label = compiler_version + '_tot_afdo'
Caroline Tice80eab982015-11-04 14:03:14 -080089 return label
90
Luis Lozanof2a3ef42015-12-15 13:49:30 -080091 def _BuildAndImage(self, label=''):
asharif96f59692013-02-16 03:13:36 +000092 if (not label or
93 not misc.DoesLabelExist(self._chromeos_root, self._board, label)):
94 build_chromeos_args = [build_chromeos.__file__,
Luis Lozanof2a3ef42015-12-15 13:49:30 -080095 '--chromeos_root=%s' % self._chromeos_root,
96 '--board=%s' % self._board, '--rebuild']
asharife6b72fe2013-02-19 19:58:18 +000097 if self._public:
Luis Lozanof2a3ef42015-12-15 13:49:30 -080098 build_chromeos_args.append('--env=USE=-chrome_internal')
cmtice56fb7162014-06-18 11:32:15 -070099
asharif96f59692013-02-16 03:13:36 +0000100 ret = build_chromeos.Main(build_chromeos_args)
cmtice7f3190b2015-05-22 14:14:51 -0700101 if ret != 0:
102 raise RuntimeError("Couldn't build ChromeOS!")
cmtice56fb7162014-06-18 11:32:15 -0700103
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800104 if not self._build_num:
cmtice56fb7162014-06-18 11:32:15 -0700105 self._GetBuildNumber()
106 # Check to see if we need to create the symbolic link for the vanilla
107 # image, and do so if appropriate.
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800108 if not misc.DoesLabelExist(self._chromeos_root, self._board, 'vanilla'):
109 build_name = '%s-release/%s.0.0' % (self._board, self._build_num)
110 full_vanilla_path = os.path.join(os.getcwd(), self._chromeos_root,
111 'chroot/tmp', build_name)
cmtice56fb7162014-06-18 11:32:15 -0700112 misc.LabelLatestImage(self._chromeos_root, self._board, label,
113 full_vanilla_path)
114 else:
asharif96f59692013-02-16 03:13:36 +0000115 misc.LabelLatestImage(self._chromeos_root, self._board, label)
116 return label
117
cmtice56fb7162014-06-18 11:32:15 -0700118 def _SetupBoard(self, env_dict, usepkg_flag, clobber_flag):
asharif96f59692013-02-16 03:13:36 +0000119 env_string = misc.GetEnvStringFromDict(env_dict)
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800120 command = ('%s %s' % (env_string,
121 misc.GetSetupBoardCommand(self._board,
122 usepkg=usepkg_flag,
123 force=clobber_flag)))
124 ret = self._ce.ChrootRunCommand(self._chromeos_root, command)
cmtice56fb7162014-06-18 11:32:15 -0700125 error_str = "Could not setup board: '%s'" % command
126 assert ret == 0, error_str
asharif96f59692013-02-16 03:13:36 +0000127
128 def _UnInstallToolchain(self):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800129 command = ('sudo CLEAN_DELAY=0 emerge -C cross-%s/gcc' %
130 misc.GetCtargetFromBoard(self._board, self._chromeos_root))
131 ret = self._ce.ChrootRunCommand(self._chromeos_root, command)
cmtice7f3190b2015-05-22 14:14:51 -0700132 if ret != 0:
133 raise RuntimeError("Couldn't uninstall the toolchain!")
asharif96f59692013-02-16 03:13:36 +0000134
135 def _CheckoutChromeOS(self):
136 # TODO(asharif): Setup a fixed ChromeOS version (quarterly snapshot).
137 if not os.path.exists(self._chromeos_root):
Rahul Chaudhry4d4565e2016-01-27 10:46:09 -0800138 setup_chromeos_args = ['--dir=%s' % self._chromeos_root]
asharife6b72fe2013-02-19 19:58:18 +0000139 if self._public:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800140 setup_chromeos_args.append('--public')
asharif5fe40e22013-02-19 19:58:50 +0000141 ret = setup_chromeos.Main(setup_chromeos_args)
cmtice7f3190b2015-05-22 14:14:51 -0700142 if ret != 0:
143 raise RuntimeError("Couldn't run setup_chromeos!")
asharif96f59692013-02-16 03:13:36 +0000144
145 def _BuildToolchain(self, config):
cmtice56fb7162014-06-18 11:32:15 -0700146 # Call setup_board for basic, vanilla setup.
147 self._SetupBoard({}, usepkg_flag=True, clobber_flag=False)
148 # Now uninstall the vanilla compiler and setup/build our custom
149 # compiler.
asharif96f59692013-02-16 03:13:36 +0000150 self._UnInstallToolchain()
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800151 envdict = {'USE': 'git_gcc',
152 'GCC_GITHASH': config.gcc_config.githash,
153 'EMERGE_DEFAULT_OPTS': '--exclude=gcc'}
cmtice56fb7162014-06-18 11:32:15 -0700154 self._SetupBoard(envdict, usepkg_flag=False, clobber_flag=False)
asharif96f59692013-02-16 03:13:36 +0000155
156
157class ToolchainComparator(ChromeOSCheckout):
Caroline Tice88272d42016-01-13 09:48:29 -0800158 """Main class for running tests and generating reports."""
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800159
160 def __init__(self,
161 board,
162 remotes,
163 configs,
164 clean,
165 public,
166 force_mismatch,
167 noschedv2=False):
asharif96f59692013-02-16 03:13:36 +0000168 self._board = board
169 self._remotes = remotes
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800170 self._chromeos_root = 'chromeos'
asharif96f59692013-02-16 03:13:36 +0000171 self._configs = configs
asharif3e38de02013-02-19 19:34:59 +0000172 self._clean = clean
asharife6b72fe2013-02-19 19:58:18 +0000173 self._public = public
asharif58a8c9f2013-02-19 20:42:43 +0000174 self._force_mismatch = force_mismatch
asharif96f59692013-02-16 03:13:36 +0000175 self._ce = command_executer.GetCommandExecuter()
176 self._l = logger.GetLogger()
cmtice7f3190b2015-05-22 14:14:51 -0700177 timestamp = datetime.datetime.strftime(datetime.datetime.now(),
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800178 '%Y-%m-%d_%H:%M:%S')
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700179 self._reports_dir = os.path.join(NIGHTLY_TESTS_DIR,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800180 '%s.%s' % (timestamp, board),)
Han Shen43494292015-09-14 10:26:40 -0700181 self._noschedv2 = noschedv2
asharif96f59692013-02-16 03:13:36 +0000182 ChromeOSCheckout.__init__(self, board, self._chromeos_root)
183
cmticea6255d02014-01-10 10:27:22 -0800184 def _FinishSetup(self):
185 # Get correct .boto file
186 current_dir = os.getcwd()
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800187 src = '/usr/local/google/home/mobiletc-prebuild/.boto'
cmticea6255d02014-01-10 10:27:22 -0800188 dest = os.path.join(current_dir, self._chromeos_root,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800189 'src/private-overlays/chromeos-overlay/'
190 'googlestorage_account.boto')
cmticea6255d02014-01-10 10:27:22 -0800191 # Copy the file to the correct place
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800192 copy_cmd = 'cp %s %s' % (src, dest)
Caroline Tice88272d42016-01-13 09:48:29 -0800193 retv = self._ce.RunCommand(copy_cmd)
194 if retv != 0:
cmtice7f3190b2015-05-22 14:14:51 -0700195 raise RuntimeError("Couldn't copy .boto file for google storage.")
cmticea6255d02014-01-10 10:27:22 -0800196
197 # Fix protections on ssh key
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800198 command = ('chmod 600 /var/cache/chromeos-cache/distfiles/target'
199 '/chrome-src-internal/src/third_party/chromite/ssh_keys'
200 '/testing_rsa')
Caroline Tice88272d42016-01-13 09:48:29 -0800201 retv = self._ce.ChrootRunCommand(self._chromeos_root, command)
202 if retv != 0:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800203 raise RuntimeError('chmod for testing_rsa failed')
cmticea6255d02014-01-10 10:27:22 -0800204
asharif96f59692013-02-16 03:13:36 +0000205 def _TestLabels(self, labels):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800206 experiment_file = 'toolchain_experiment.txt'
207 image_args = ''
asharif58a8c9f2013-02-19 20:42:43 +0000208 if self._force_mismatch:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800209 image_args = '--force-mismatch'
asharif96f59692013-02-16 03:13:36 +0000210 experiment_header = """
211 board: %s
212 remote: %s
cmticed1f03b82015-06-30 15:19:23 -0700213 retries: 1
asharif96f59692013-02-16 03:13:36 +0000214 """ % (self._board, self._remotes)
215 experiment_tests = """
cmtice0c84ea72015-06-25 14:22:36 -0700216 benchmark: all_toolchain_perf {
cmtice04403882013-11-04 16:38:37 -0500217 suite: telemetry_Crosperf
cmtice6de7f8f2014-03-14 14:08:21 -0700218 iterations: 3
asharif96f59692013-02-16 03:13:36 +0000219 }
220 """
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800221
222 with open(experiment_file, 'w') as f:
Caroline Tice88272d42016-01-13 09:48:29 -0800223 f.write(experiment_header)
224 f.write(experiment_tests)
asharif96f59692013-02-16 03:13:36 +0000225 for label in labels:
226 # TODO(asharif): Fix crosperf so it accepts labels with symbols
227 crosperf_label = label
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800228 crosperf_label = crosperf_label.replace('-', '_')
229 crosperf_label = crosperf_label.replace('+', '_')
230 crosperf_label = crosperf_label.replace('.', '')
cmtice56fb7162014-06-18 11:32:15 -0700231
232 # Use the official build instead of building vanilla ourselves.
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800233 if label == 'vanilla':
cmtice56fb7162014-06-18 11:32:15 -0700234 build_name = '%s-release/%s.0.0' % (self._board, self._build_num)
235
236 # Now add 'official build' to test file.
237 official_image = """
238 official_image {
239 chromeos_root: %s
240 build: %s
241 }
242 """ % (self._chromeos_root, build_name)
Caroline Tice88272d42016-01-13 09:48:29 -0800243 f.write(official_image)
cmtice56fb7162014-06-18 11:32:15 -0700244
cmtice94bc4702014-05-29 16:29:04 -0700245 else:
cmtice56fb7162014-06-18 11:32:15 -0700246 experiment_image = """
247 %s {
248 chromeos_image: %s
249 image_args: %s
250 }
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800251 """ % (crosperf_label, os.path.join(
252 misc.GetImageDir(self._chromeos_root, self._board), label,
253 'chromiumos_test_image.bin'), image_args)
Caroline Tice88272d42016-01-13 09:48:29 -0800254 f.write(experiment_image)
cmtice56fb7162014-06-18 11:32:15 -0700255
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800256 crosperf = os.path.join(os.path.dirname(__file__), 'crosperf', 'crosperf')
Han Shen43494292015-09-14 10:26:40 -0700257 noschedv2_opts = '--noschedv2' if self._noschedv2 else ''
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800258 command = ('{crosperf} --no_email=True --results_dir={r_dir} '
259 '--json_report=True {noschedv2_opts} {exp_file}').format(
260 crosperf=crosperf,
261 r_dir=self._reports_dir,
262 noschedv2_opts=noschedv2_opts,
263 exp_file=experiment_file)
cmticeaa700b02015-06-12 13:26:47 -0700264
asharif96f59692013-02-16 03:13:36 +0000265 ret = self._ce.RunCommand(command)
cmtice7f3190b2015-05-22 14:14:51 -0700266 if ret != 0:
267 raise RuntimeError("Couldn't run crosperf!")
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700268 else:
269 # Copy json report to pending archives directory.
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800270 command = 'cp %s/*.json %s/.' % (self._reports_dir, PENDING_ARCHIVES_DIR)
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700271 ret = self._ce.RunCommand(command)
cmtice7f3190b2015-05-22 14:14:51 -0700272 return
cmtice56fb7162014-06-18 11:32:15 -0700273
cmtice56fb7162014-06-18 11:32:15 -0700274 def _CopyWeeklyReportFiles(self, labels):
Caroline Tice88272d42016-01-13 09:48:29 -0800275 """Move files into place for creating 7-day reports.
276
277 Create tar files of the custom and official images and copy them
cmtice56fb7162014-06-18 11:32:15 -0700278 to the weekly reports directory, so they exist when the weekly report
279 gets generated. IMPORTANT NOTE: This function must run *after*
280 crosperf has been run; otherwise the vanilla images will not be there.
281 """
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800282 images_path = os.path.join(
283 os.path.realpath(self._chromeos_root), 'src/build/images', self._board)
284 weekday = time.strftime('%a')
cmtice56fb7162014-06-18 11:32:15 -0700285 data_dir = os.path.join(WEEKLY_REPORTS_ROOT, self._board)
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800286 dest_dir = os.path.join(data_dir, weekday)
cmtice56fb7162014-06-18 11:32:15 -0700287 if not os.path.exists(dest_dir):
288 os.makedirs(dest_dir)
cmtice4536ef62014-07-08 11:17:21 -0700289 # Make sure dest_dir is empty (clean out last week's data).
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800290 cmd = 'cd %s; rm -Rf %s_*_image*' % (dest_dir, weekday)
cmtice4536ef62014-07-08 11:17:21 -0700291 self._ce.RunCommand(cmd)
292 # Now create new tar files and copy them over.
cmtice56fb7162014-06-18 11:32:15 -0700293 for l in labels:
294 test_path = os.path.join(images_path, l)
295 if os.path.exists(test_path):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800296 if l != 'vanilla':
297 label_name = 'test'
cmtice56fb7162014-06-18 11:32:15 -0700298 else:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800299 label_name = 'vanilla'
300 tar_file_name = '%s_%s_image.tar' % (weekday, label_name)
301 cmd = ('cd %s; tar -cvf %s %s/chromiumos_test_image.bin; '
302 'cp %s %s/.') % (images_path, tar_file_name, l, tar_file_name,
Han Shenfe054f12015-02-18 15:00:13 -0800303 dest_dir)
cmtice56fb7162014-06-18 11:32:15 -0700304 tar_ret = self._ce.RunCommand(cmd)
cmtice7f3190b2015-05-22 14:14:51 -0700305 if tar_ret != 0:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800306 self._l.LogOutput('Error while creating/copying test tar file(%s).' %
307 tar_file_name)
cmtice56fb7162014-06-18 11:32:15 -0700308
cmtice7f3190b2015-05-22 14:14:51 -0700309 def _SendEmail(self):
310 """Find email msesage generated by crosperf and send it."""
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800311 filename = os.path.join(self._reports_dir, 'msg_body.html')
cmtice7f3190b2015-05-22 14:14:51 -0700312 if (os.path.exists(filename) and
313 os.path.exists(os.path.expanduser(MAIL_PROGRAM))):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800314 command = ('cat %s | %s -s "Nightly test results, %s" -team -html' %
315 (filename, MAIL_PROGRAM, self._board))
cmtice7f3190b2015-05-22 14:14:51 -0700316 self._ce.RunCommand(command)
asharif96f59692013-02-16 03:13:36 +0000317
318 def DoAll(self):
319 self._CheckoutChromeOS()
asharif96f59692013-02-16 03:13:36 +0000320 labels = []
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800321 labels.append('vanilla')
asharif96f59692013-02-16 03:13:36 +0000322 for config in self._configs:
Caroline Tice88272d42016-01-13 09:48:29 -0800323 label = self._BuildLabelName(config.gcc_config.githash)
324 if not misc.DoesLabelExist(self._chromeos_root, self._board, label):
asharif96f59692013-02-16 03:13:36 +0000325 self._BuildToolchain(config)
326 label = self._BuildAndImage(label)
327 labels.append(label)
cmticea6255d02014-01-10 10:27:22 -0800328 self._FinishSetup()
cmticeb4588092015-05-27 08:07:50 -0700329 self._TestLabels(labels)
cmtice7f3190b2015-05-22 14:14:51 -0700330 self._SendEmail()
331 # Only try to copy the image files if the test runs ran successfully.
332 self._CopyWeeklyReportFiles(labels)
asharif3e38de02013-02-19 19:34:59 +0000333 if self._clean:
334 ret = self._DeleteChroot()
cmtice7f3190b2015-05-22 14:14:51 -0700335 if ret != 0:
336 return ret
asharif67973582013-02-19 20:19:40 +0000337 ret = self._DeleteCcahe()
cmtice7f3190b2015-05-22 14:14:51 -0700338 if ret != 0:
339 return ret
asharif96f59692013-02-16 03:13:36 +0000340 return 0
341
342
343def Main(argv):
344 """The main function."""
345 # Common initializations
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800346 ### command_executer.InitCommandExecuter(True)
asharif96f59692013-02-16 03:13:36 +0000347 command_executer.InitCommandExecuter()
Caroline Tice88272d42016-01-13 09:48:29 -0800348 parser = argparse.ArgumentParser()
349 parser.add_argument('--remote',
350 dest='remote',
351 help='Remote machines to run tests on.')
352 parser.add_argument('--board',
353 dest='board',
354 default='x86-alex',
355 help='The target board.')
356 parser.add_argument('--githashes',
357 dest='githashes',
358 default='master',
359 help='The gcc githashes to test.')
360 parser.add_argument('--clean',
361 dest='clean',
362 default=False,
363 action='store_true',
364 help='Clean the chroot after testing.')
365 parser.add_argument('--public',
366 dest='public',
367 default=False,
368 action='store_true',
369 help='Use the public checkout/build.')
370 parser.add_argument('--force-mismatch',
371 dest='force_mismatch',
372 default='',
373 help='Force the image regardless of board mismatch')
374 parser.add_argument('--noschedv2',
375 dest='noschedv2',
376 action='store_true',
377 default=False,
378 help='Pass --noschedv2 to crosperf.')
379 options = parser.parse_args(argv)
asharif96f59692013-02-16 03:13:36 +0000380 if not options.board:
Caroline Tice88272d42016-01-13 09:48:29 -0800381 print('Please give a board.')
asharif96f59692013-02-16 03:13:36 +0000382 return 1
383 if not options.remote:
Caroline Tice88272d42016-01-13 09:48:29 -0800384 print('Please give at least one remote machine.')
asharif96f59692013-02-16 03:13:36 +0000385 return 1
386 toolchain_configs = []
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800387 for githash in options.githashes.split(','):
asharif96f59692013-02-16 03:13:36 +0000388 gcc_config = GCCConfig(githash=githash)
389 toolchain_config = ToolchainConfig(gcc_config=gcc_config)
390 toolchain_configs.append(toolchain_config)
asharif3e38de02013-02-19 19:34:59 +0000391 fc = ToolchainComparator(options.board, options.remote, toolchain_configs,
asharif58a8c9f2013-02-19 20:42:43 +0000392 options.clean, options.public,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800393 options.force_mismatch, options.noschedv2)
asharif96f59692013-02-16 03:13:36 +0000394 return fc.DoAll()
395
396
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800397if __name__ == '__main__':
Rahul Chaudhry748254e2016-01-25 16:49:21 -0800398 retval = Main(sys.argv[1:])
asharif96f59692013-02-16 03:13:36 +0000399 sys.exit(retval)