blob: 6a793dedcd47aa1e8e4cb747d73799d13cf9260f [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):
138 setup_chromeos_args = [setup_chromeos.__file__,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800139 '--dir=%s' % self._chromeos_root]
asharife6b72fe2013-02-19 19:58:18 +0000140 if self._public:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800141 setup_chromeos_args.append('--public')
asharif5fe40e22013-02-19 19:58:50 +0000142 ret = setup_chromeos.Main(setup_chromeos_args)
cmtice7f3190b2015-05-22 14:14:51 -0700143 if ret != 0:
144 raise RuntimeError("Couldn't run setup_chromeos!")
asharif96f59692013-02-16 03:13:36 +0000145
146 def _BuildToolchain(self, config):
cmtice56fb7162014-06-18 11:32:15 -0700147 # Call setup_board for basic, vanilla setup.
148 self._SetupBoard({}, usepkg_flag=True, clobber_flag=False)
149 # Now uninstall the vanilla compiler and setup/build our custom
150 # compiler.
asharif96f59692013-02-16 03:13:36 +0000151 self._UnInstallToolchain()
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800152 envdict = {'USE': 'git_gcc',
153 'GCC_GITHASH': config.gcc_config.githash,
154 'EMERGE_DEFAULT_OPTS': '--exclude=gcc'}
cmtice56fb7162014-06-18 11:32:15 -0700155 self._SetupBoard(envdict, usepkg_flag=False, clobber_flag=False)
asharif96f59692013-02-16 03:13:36 +0000156
157
158class ToolchainComparator(ChromeOSCheckout):
Caroline Tice88272d42016-01-13 09:48:29 -0800159 """Main class for running tests and generating reports."""
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800160
161 def __init__(self,
162 board,
163 remotes,
164 configs,
165 clean,
166 public,
167 force_mismatch,
168 noschedv2=False):
asharif96f59692013-02-16 03:13:36 +0000169 self._board = board
170 self._remotes = remotes
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800171 self._chromeos_root = 'chromeos'
asharif96f59692013-02-16 03:13:36 +0000172 self._configs = configs
asharif3e38de02013-02-19 19:34:59 +0000173 self._clean = clean
asharife6b72fe2013-02-19 19:58:18 +0000174 self._public = public
asharif58a8c9f2013-02-19 20:42:43 +0000175 self._force_mismatch = force_mismatch
asharif96f59692013-02-16 03:13:36 +0000176 self._ce = command_executer.GetCommandExecuter()
177 self._l = logger.GetLogger()
cmtice7f3190b2015-05-22 14:14:51 -0700178 timestamp = datetime.datetime.strftime(datetime.datetime.now(),
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800179 '%Y-%m-%d_%H:%M:%S')
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700180 self._reports_dir = os.path.join(NIGHTLY_TESTS_DIR,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800181 '%s.%s' % (timestamp, board),)
Han Shen43494292015-09-14 10:26:40 -0700182 self._noschedv2 = noschedv2
asharif96f59692013-02-16 03:13:36 +0000183 ChromeOSCheckout.__init__(self, board, self._chromeos_root)
184
cmticea6255d02014-01-10 10:27:22 -0800185 def _FinishSetup(self):
186 # Get correct .boto file
187 current_dir = os.getcwd()
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800188 src = '/usr/local/google/home/mobiletc-prebuild/.boto'
cmticea6255d02014-01-10 10:27:22 -0800189 dest = os.path.join(current_dir, self._chromeos_root,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800190 'src/private-overlays/chromeos-overlay/'
191 'googlestorage_account.boto')
cmticea6255d02014-01-10 10:27:22 -0800192 # Copy the file to the correct place
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800193 copy_cmd = 'cp %s %s' % (src, dest)
Caroline Tice88272d42016-01-13 09:48:29 -0800194 retv = self._ce.RunCommand(copy_cmd)
195 if retv != 0:
cmtice7f3190b2015-05-22 14:14:51 -0700196 raise RuntimeError("Couldn't copy .boto file for google storage.")
cmticea6255d02014-01-10 10:27:22 -0800197
198 # Fix protections on ssh key
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800199 command = ('chmod 600 /var/cache/chromeos-cache/distfiles/target'
200 '/chrome-src-internal/src/third_party/chromite/ssh_keys'
201 '/testing_rsa')
Caroline Tice88272d42016-01-13 09:48:29 -0800202 retv = self._ce.ChrootRunCommand(self._chromeos_root, command)
203 if retv != 0:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800204 raise RuntimeError('chmod for testing_rsa failed')
cmticea6255d02014-01-10 10:27:22 -0800205
asharif96f59692013-02-16 03:13:36 +0000206 def _TestLabels(self, labels):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800207 experiment_file = 'toolchain_experiment.txt'
208 image_args = ''
asharif58a8c9f2013-02-19 20:42:43 +0000209 if self._force_mismatch:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800210 image_args = '--force-mismatch'
asharif96f59692013-02-16 03:13:36 +0000211 experiment_header = """
212 board: %s
213 remote: %s
cmticed1f03b82015-06-30 15:19:23 -0700214 retries: 1
asharif96f59692013-02-16 03:13:36 +0000215 """ % (self._board, self._remotes)
216 experiment_tests = """
cmtice0c84ea72015-06-25 14:22:36 -0700217 benchmark: all_toolchain_perf {
cmtice04403882013-11-04 16:38:37 -0500218 suite: telemetry_Crosperf
cmtice6de7f8f2014-03-14 14:08:21 -0700219 iterations: 3
asharif96f59692013-02-16 03:13:36 +0000220 }
221 """
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800222
223 with open(experiment_file, 'w') as f:
Caroline Tice88272d42016-01-13 09:48:29 -0800224 f.write(experiment_header)
225 f.write(experiment_tests)
asharif96f59692013-02-16 03:13:36 +0000226 for label in labels:
227 # TODO(asharif): Fix crosperf so it accepts labels with symbols
228 crosperf_label = label
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800229 crosperf_label = crosperf_label.replace('-', '_')
230 crosperf_label = crosperf_label.replace('+', '_')
231 crosperf_label = crosperf_label.replace('.', '')
cmtice56fb7162014-06-18 11:32:15 -0700232
233 # Use the official build instead of building vanilla ourselves.
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800234 if label == 'vanilla':
cmtice56fb7162014-06-18 11:32:15 -0700235 build_name = '%s-release/%s.0.0' % (self._board, self._build_num)
236
237 # Now add 'official build' to test file.
238 official_image = """
239 official_image {
240 chromeos_root: %s
241 build: %s
242 }
243 """ % (self._chromeos_root, build_name)
Caroline Tice88272d42016-01-13 09:48:29 -0800244 f.write(official_image)
cmtice56fb7162014-06-18 11:32:15 -0700245
cmtice94bc4702014-05-29 16:29:04 -0700246 else:
cmtice56fb7162014-06-18 11:32:15 -0700247 experiment_image = """
248 %s {
249 chromeos_image: %s
250 image_args: %s
251 }
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800252 """ % (crosperf_label, os.path.join(
253 misc.GetImageDir(self._chromeos_root, self._board), label,
254 'chromiumos_test_image.bin'), image_args)
Caroline Tice88272d42016-01-13 09:48:29 -0800255 f.write(experiment_image)
cmtice56fb7162014-06-18 11:32:15 -0700256
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800257 crosperf = os.path.join(os.path.dirname(__file__), 'crosperf', 'crosperf')
Han Shen43494292015-09-14 10:26:40 -0700258 noschedv2_opts = '--noschedv2' if self._noschedv2 else ''
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800259 command = ('{crosperf} --no_email=True --results_dir={r_dir} '
260 '--json_report=True {noschedv2_opts} {exp_file}').format(
261 crosperf=crosperf,
262 r_dir=self._reports_dir,
263 noschedv2_opts=noschedv2_opts,
264 exp_file=experiment_file)
cmticeaa700b02015-06-12 13:26:47 -0700265
asharif96f59692013-02-16 03:13:36 +0000266 ret = self._ce.RunCommand(command)
cmtice7f3190b2015-05-22 14:14:51 -0700267 if ret != 0:
268 raise RuntimeError("Couldn't run crosperf!")
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700269 else:
270 # Copy json report to pending archives directory.
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800271 command = 'cp %s/*.json %s/.' % (self._reports_dir, PENDING_ARCHIVES_DIR)
Caroline Ticeebbc3da2015-09-03 10:27:20 -0700272 ret = self._ce.RunCommand(command)
cmtice7f3190b2015-05-22 14:14:51 -0700273 return
cmtice56fb7162014-06-18 11:32:15 -0700274
cmtice56fb7162014-06-18 11:32:15 -0700275 def _CopyWeeklyReportFiles(self, labels):
Caroline Tice88272d42016-01-13 09:48:29 -0800276 """Move files into place for creating 7-day reports.
277
278 Create tar files of the custom and official images and copy them
cmtice56fb7162014-06-18 11:32:15 -0700279 to the weekly reports directory, so they exist when the weekly report
280 gets generated. IMPORTANT NOTE: This function must run *after*
281 crosperf has been run; otherwise the vanilla images will not be there.
282 """
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800283 images_path = os.path.join(
284 os.path.realpath(self._chromeos_root), 'src/build/images', self._board)
285 weekday = time.strftime('%a')
cmtice56fb7162014-06-18 11:32:15 -0700286 data_dir = os.path.join(WEEKLY_REPORTS_ROOT, self._board)
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800287 dest_dir = os.path.join(data_dir, weekday)
cmtice56fb7162014-06-18 11:32:15 -0700288 if not os.path.exists(dest_dir):
289 os.makedirs(dest_dir)
cmtice4536ef62014-07-08 11:17:21 -0700290 # Make sure dest_dir is empty (clean out last week's data).
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800291 cmd = 'cd %s; rm -Rf %s_*_image*' % (dest_dir, weekday)
cmtice4536ef62014-07-08 11:17:21 -0700292 self._ce.RunCommand(cmd)
293 # Now create new tar files and copy them over.
cmtice56fb7162014-06-18 11:32:15 -0700294 for l in labels:
295 test_path = os.path.join(images_path, l)
296 if os.path.exists(test_path):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800297 if l != 'vanilla':
298 label_name = 'test'
cmtice56fb7162014-06-18 11:32:15 -0700299 else:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800300 label_name = 'vanilla'
301 tar_file_name = '%s_%s_image.tar' % (weekday, label_name)
302 cmd = ('cd %s; tar -cvf %s %s/chromiumos_test_image.bin; '
303 'cp %s %s/.') % (images_path, tar_file_name, l, tar_file_name,
Han Shenfe054f12015-02-18 15:00:13 -0800304 dest_dir)
cmtice56fb7162014-06-18 11:32:15 -0700305 tar_ret = self._ce.RunCommand(cmd)
cmtice7f3190b2015-05-22 14:14:51 -0700306 if tar_ret != 0:
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800307 self._l.LogOutput('Error while creating/copying test tar file(%s).' %
308 tar_file_name)
cmtice56fb7162014-06-18 11:32:15 -0700309
cmtice7f3190b2015-05-22 14:14:51 -0700310 def _SendEmail(self):
311 """Find email msesage generated by crosperf and send it."""
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800312 filename = os.path.join(self._reports_dir, 'msg_body.html')
cmtice7f3190b2015-05-22 14:14:51 -0700313 if (os.path.exists(filename) and
314 os.path.exists(os.path.expanduser(MAIL_PROGRAM))):
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800315 command = ('cat %s | %s -s "Nightly test results, %s" -team -html' %
316 (filename, MAIL_PROGRAM, self._board))
cmtice7f3190b2015-05-22 14:14:51 -0700317 self._ce.RunCommand(command)
asharif96f59692013-02-16 03:13:36 +0000318
319 def DoAll(self):
320 self._CheckoutChromeOS()
asharif96f59692013-02-16 03:13:36 +0000321 labels = []
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800322 labels.append('vanilla')
asharif96f59692013-02-16 03:13:36 +0000323 for config in self._configs:
Caroline Tice88272d42016-01-13 09:48:29 -0800324 label = self._BuildLabelName(config.gcc_config.githash)
325 if not misc.DoesLabelExist(self._chromeos_root, self._board, label):
asharif96f59692013-02-16 03:13:36 +0000326 self._BuildToolchain(config)
327 label = self._BuildAndImage(label)
328 labels.append(label)
cmticea6255d02014-01-10 10:27:22 -0800329 self._FinishSetup()
cmticeb4588092015-05-27 08:07:50 -0700330 self._TestLabels(labels)
cmtice7f3190b2015-05-22 14:14:51 -0700331 self._SendEmail()
332 # Only try to copy the image files if the test runs ran successfully.
333 self._CopyWeeklyReportFiles(labels)
asharif3e38de02013-02-19 19:34:59 +0000334 if self._clean:
335 ret = self._DeleteChroot()
cmtice7f3190b2015-05-22 14:14:51 -0700336 if ret != 0:
337 return ret
asharif67973582013-02-19 20:19:40 +0000338 ret = self._DeleteCcahe()
cmtice7f3190b2015-05-22 14:14:51 -0700339 if ret != 0:
340 return ret
asharif96f59692013-02-16 03:13:36 +0000341 return 0
342
343
344def Main(argv):
345 """The main function."""
346 # Common initializations
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800347 ### command_executer.InitCommandExecuter(True)
asharif96f59692013-02-16 03:13:36 +0000348 command_executer.InitCommandExecuter()
Caroline Tice88272d42016-01-13 09:48:29 -0800349 parser = argparse.ArgumentParser()
350 parser.add_argument('--remote',
351 dest='remote',
352 help='Remote machines to run tests on.')
353 parser.add_argument('--board',
354 dest='board',
355 default='x86-alex',
356 help='The target board.')
357 parser.add_argument('--githashes',
358 dest='githashes',
359 default='master',
360 help='The gcc githashes to test.')
361 parser.add_argument('--clean',
362 dest='clean',
363 default=False,
364 action='store_true',
365 help='Clean the chroot after testing.')
366 parser.add_argument('--public',
367 dest='public',
368 default=False,
369 action='store_true',
370 help='Use the public checkout/build.')
371 parser.add_argument('--force-mismatch',
372 dest='force_mismatch',
373 default='',
374 help='Force the image regardless of board mismatch')
375 parser.add_argument('--noschedv2',
376 dest='noschedv2',
377 action='store_true',
378 default=False,
379 help='Pass --noschedv2 to crosperf.')
380 options = parser.parse_args(argv)
asharif96f59692013-02-16 03:13:36 +0000381 if not options.board:
Caroline Tice88272d42016-01-13 09:48:29 -0800382 print('Please give a board.')
asharif96f59692013-02-16 03:13:36 +0000383 return 1
384 if not options.remote:
Caroline Tice88272d42016-01-13 09:48:29 -0800385 print('Please give at least one remote machine.')
asharif96f59692013-02-16 03:13:36 +0000386 return 1
387 toolchain_configs = []
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800388 for githash in options.githashes.split(','):
asharif96f59692013-02-16 03:13:36 +0000389 gcc_config = GCCConfig(githash=githash)
390 toolchain_config = ToolchainConfig(gcc_config=gcc_config)
391 toolchain_configs.append(toolchain_config)
asharif3e38de02013-02-19 19:34:59 +0000392 fc = ToolchainComparator(options.board, options.remote, toolchain_configs,
asharif58a8c9f2013-02-19 20:42:43 +0000393 options.clean, options.public,
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800394 options.force_mismatch, options.noschedv2)
asharif96f59692013-02-16 03:13:36 +0000395 return fc.DoAll()
396
397
Luis Lozanof2a3ef42015-12-15 13:49:30 -0800398if __name__ == '__main__':
Rahul Chaudhry748254e2016-01-25 16:49:21 -0800399 retval = Main(sys.argv[1:])
asharif96f59692013-02-16 03:13:36 +0000400 sys.exit(retval)