Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 1 | #!/usr/bin/python2 |
| 2 | """Script for running nightly compiler tests on ChromeOS. |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 3 | |
| 4 | This script launches a buildbot to build ChromeOS with the latest compiler on |
| 5 | a particular board; then it finds and downloads the trybot image and the |
| 6 | corresponding official image, and runs crosperf performance tests comparing |
| 7 | the two. It then generates a report, emails it to the c-compiler-chrome, as |
| 8 | well as copying the images into the seven-day reports directory. |
| 9 | """ |
| 10 | |
| 11 | # Script to test different toolchains against ChromeOS benchmarks. |
Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 12 | |
| 13 | from __future__ import print_function |
| 14 | |
Caroline Tice | eddb063 | 2016-04-14 09:19:02 -0700 | [diff] [blame] | 15 | import argparse |
cmtice | ce5ffa4 | 2015-02-12 15:18:43 -0800 | [diff] [blame] | 16 | import datetime |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 17 | import os |
Luis Lozano | c75fd05 | 2016-02-19 17:37:01 -0800 | [diff] [blame] | 18 | import re |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 19 | import sys |
| 20 | import time |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 21 | |
Caroline Tice | a8af9a7 | 2016-07-20 12:52:59 -0700 | [diff] [blame] | 22 | from cros_utils import command_executer |
| 23 | from cros_utils import logger |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 24 | |
Caroline Tice | a8af9a7 | 2016-07-20 12:52:59 -0700 | [diff] [blame] | 25 | from cros_utils import buildbot_utils |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 26 | |
| 27 | # CL that updated GCC ebuilds to use 'next_gcc'. |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 28 | USE_NEXT_GCC_PATCH = '230260' |
Yunlian Jiang | 3c6e467 | 2015-08-24 15:58:22 -0700 | [diff] [blame] | 29 | |
Yunlian Jiang | 2f56356 | 2015-08-28 13:54:04 -0700 | [diff] [blame] | 30 | # CL that uses LLVM to build the peppy image. |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 31 | USE_LLVM_PATCH = '295217' |
Yunlian Jiang | 2f56356 | 2015-08-28 13:54:04 -0700 | [diff] [blame] | 32 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 33 | CROSTC_ROOT = '/usr/local/google/crostc' |
| 34 | ROLE_ACCOUNT = 'mobiletc-prebuild' |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 35 | TOOLCHAIN_DIR = os.path.dirname(os.path.realpath(__file__)) |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 36 | MAIL_PROGRAM = '~/var/bin/mail-sheriff' |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 37 | PENDING_ARCHIVES_DIR = os.path.join(CROSTC_ROOT, 'pending_archives') |
| 38 | NIGHTLY_TESTS_DIR = os.path.join(CROSTC_ROOT, 'nightly_test_reports') |
| 39 | |
Luis Lozano | c75fd05 | 2016-02-19 17:37:01 -0800 | [diff] [blame] | 40 | IMAGE_FS = (r'{board}-{image_type}/{chrome_version}-{tip}\.' + |
| 41 | r'{branch}\.{branch_branch}') |
| 42 | TRYBOT_IMAGE_FS = 'trybot-' + IMAGE_FS + '-{build_id}' |
| 43 | PFQ_IMAGE_FS = IMAGE_FS + '-rc1' |
Manoj Gupta | aee96b7 | 2016-10-24 13:43:28 -0700 | [diff] [blame] | 44 | IMAGE_RE_GROUPS = { |
| 45 | 'board': r'(?P<board>\S+)', |
| 46 | 'image_type': r'(?P<image_type>\S+)', |
| 47 | 'chrome_version': r'(?P<chrome_version>R\d+)', |
| 48 | 'tip': r'(?P<tip>\d+)', |
| 49 | 'branch': r'(?P<branch>\d+)', |
| 50 | 'branch_branch': r'(?P<branch_branch>\d+)', |
| 51 | 'build_id': r'(?P<build_id>b\d+)' |
| 52 | } |
Luis Lozano | c75fd05 | 2016-02-19 17:37:01 -0800 | [diff] [blame] | 53 | TRYBOT_IMAGE_RE = TRYBOT_IMAGE_FS.format(**IMAGE_RE_GROUPS) |
| 54 | |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 55 | |
Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 56 | class ToolchainComparator(object): |
| 57 | """Class for doing the nightly tests work.""" |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 58 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 59 | def __init__(self, |
| 60 | board, |
| 61 | remotes, |
| 62 | chromeos_root, |
| 63 | weekday, |
| 64 | patches, |
| 65 | noschedv2=False): |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 66 | self._board = board |
| 67 | self._remotes = remotes |
| 68 | self._chromeos_root = chromeos_root |
| 69 | self._base_dir = os.getcwd() |
| 70 | self._ce = command_executer.GetCommandExecuter() |
| 71 | self._l = logger.GetLogger() |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 72 | self._build = '%s-release' % board |
Yunlian Jiang | 3c6e467 | 2015-08-24 15:58:22 -0700 | [diff] [blame] | 73 | self._patches = patches.split(',') |
| 74 | self._patches_string = '_'.join(str(p) for p in self._patches) |
Han Shen | 4349429 | 2015-09-14 10:26:40 -0700 | [diff] [blame] | 75 | self._noschedv2 = noschedv2 |
Yunlian Jiang | 3c6e467 | 2015-08-24 15:58:22 -0700 | [diff] [blame] | 76 | |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 77 | if not weekday: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 78 | self._weekday = time.strftime('%a') |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 79 | else: |
| 80 | self._weekday = weekday |
cmtice | 7f3190b | 2015-05-22 14:14:51 -0700 | [diff] [blame] | 81 | timestamp = datetime.datetime.strftime(datetime.datetime.now(), |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 82 | '%Y-%m-%d_%H:%M:%S') |
Manoj Gupta | aee96b7 | 2016-10-24 13:43:28 -0700 | [diff] [blame] | 83 | self._reports_dir = os.path.join( |
| 84 | NIGHTLY_TESTS_DIR, |
| 85 | '%s.%s' % (timestamp, board),) |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 86 | |
Luis Lozano | c75fd05 | 2016-02-19 17:37:01 -0800 | [diff] [blame] | 87 | def _GetVanillaImageName(self, trybot_image): |
| 88 | """Given a trybot artifact name, get corresponding vanilla image name. |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 89 | |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 90 | Args: |
| 91 | trybot_image: artifact name such as |
| 92 | 'trybot-daisy-release/R40-6394.0.0-b1389' |
| 93 | |
| 94 | Returns: |
| 95 | Corresponding official image name, e.g. 'daisy-release/R40-6394.0.0'. |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 96 | """ |
Luis Lozano | c75fd05 | 2016-02-19 17:37:01 -0800 | [diff] [blame] | 97 | mo = re.search(TRYBOT_IMAGE_RE, trybot_image) |
| 98 | assert mo |
| 99 | return IMAGE_FS.replace('\\', '').format(**mo.groupdict()) |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 100 | |
Luis Lozano | c75fd05 | 2016-02-19 17:37:01 -0800 | [diff] [blame] | 101 | def _GetNonAFDOImageName(self, trybot_image): |
| 102 | """Given a trybot artifact name, get corresponding non-AFDO image name. |
| 103 | |
| 104 | We get the non-AFDO image from the PFQ builders. This image |
| 105 | is not generated for all the boards and, the closest PFQ image |
| 106 | was the one build for the previous ChromeOS version (the chrome |
| 107 | used in the current version is the one validated in the previous |
| 108 | version). |
| 109 | The previous ChromeOS does not always exist either. So, we try |
| 110 | a couple of versions before. |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 111 | |
| 112 | Args: |
| 113 | trybot_image: artifact name such as |
| 114 | 'trybot-daisy-release/R40-6394.0.0-b1389' |
| 115 | |
| 116 | Returns: |
| 117 | Corresponding chrome PFQ image name, e.g. |
Luis Lozano | c75fd05 | 2016-02-19 17:37:01 -0800 | [diff] [blame] | 118 | 'daisy-chrome-pfq/R40-6393.0.0-rc1'. |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 119 | """ |
Luis Lozano | c75fd05 | 2016-02-19 17:37:01 -0800 | [diff] [blame] | 120 | mo = re.search(TRYBOT_IMAGE_RE, trybot_image) |
| 121 | assert mo |
| 122 | image_dict = mo.groupdict() |
| 123 | image_dict['image_type'] = 'chrome-pfq' |
| 124 | for _ in xrange(2): |
| 125 | image_dict['tip'] = str(int(image_dict['tip']) - 1) |
| 126 | nonafdo_image = PFQ_IMAGE_FS.replace('\\', '').format(**image_dict) |
| 127 | if buildbot_utils.DoesImageExist(self._chromeos_root, nonafdo_image): |
| 128 | return nonafdo_image |
| 129 | return '' |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 130 | |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 131 | def _FinishSetup(self): |
Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 132 | """Make sure testing_rsa file is properly set up.""" |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 133 | # Fix protections on ssh key |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 134 | command = ('chmod 600 /var/cache/chromeos-cache/distfiles/target' |
| 135 | '/chrome-src-internal/src/third_party/chromite/ssh_keys' |
| 136 | '/testing_rsa') |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 137 | ret_val = self._ce.ChrootRunCommand(self._chromeos_root, command) |
cmtice | 7f3190b | 2015-05-22 14:14:51 -0700 | [diff] [blame] | 138 | if ret_val != 0: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 139 | raise RuntimeError('chmod for testing_rsa failed') |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 140 | |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 141 | def _TestImages(self, trybot_image, vanilla_image, nonafdo_image): |
Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 142 | """Create crosperf experiment file. |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 143 | |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 144 | Given the names of the trybot, vanilla and non-AFDO images, create the |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 145 | appropriate crosperf experiment file and launch crosperf on it. |
| 146 | """ |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 147 | experiment_file_dir = os.path.join(self._chromeos_root, '..', self._weekday) |
| 148 | experiment_file_name = '%s_toolchain_experiment.txt' % self._board |
Yunlian Jiang | 2f56356 | 2015-08-28 13:54:04 -0700 | [diff] [blame] | 149 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 150 | compiler_string = 'gcc' |
Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 151 | if USE_LLVM_PATCH in self._patches_string: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 152 | experiment_file_name = '%s_llvm_experiment.txt' % self._board |
| 153 | compiler_string = 'llvm' |
Yunlian Jiang | 2f56356 | 2015-08-28 13:54:04 -0700 | [diff] [blame] | 154 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 155 | experiment_file = os.path.join(experiment_file_dir, experiment_file_name) |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 156 | experiment_header = """ |
| 157 | board: %s |
| 158 | remote: %s |
Luis Lozano | e1efeb8 | 2015-06-16 16:35:44 -0700 | [diff] [blame] | 159 | retries: 1 |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 160 | """ % (self._board, self._remotes) |
| 161 | experiment_tests = """ |
Luis Lozano | 1489d64 | 2015-12-08 10:08:19 -0800 | [diff] [blame] | 162 | benchmark: all_toolchain_perf { |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 163 | suite: telemetry_Crosperf |
| 164 | iterations: 3 |
| 165 | } |
Caroline Tice | e82513b | 2016-10-27 12:45:15 -0700 | [diff] [blame] | 166 | |
| 167 | benchmark: page_cycler_v2.typical_25 { |
| 168 | suite: telemetry_Crosperf |
| 169 | iterations: 2 |
| 170 | run_local: False |
| 171 | retries: 0 |
| 172 | } |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 173 | """ |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 174 | |
| 175 | with open(experiment_file, 'w') as f: |
Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 176 | f.write(experiment_header) |
| 177 | f.write(experiment_tests) |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 178 | |
| 179 | # Now add vanilla to test file. |
| 180 | official_image = """ |
| 181 | vanilla_image { |
| 182 | chromeos_root: %s |
| 183 | build: %s |
Caroline Tice | ddde505 | 2015-09-23 09:43:35 -0700 | [diff] [blame] | 184 | compiler: gcc |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 185 | } |
| 186 | """ % (self._chromeos_root, vanilla_image) |
Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 187 | f.write(official_image) |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 188 | |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 189 | # Now add non-AFDO image to test file. |
Luis Lozano | 439f2b7 | 2016-01-08 11:56:02 -0800 | [diff] [blame] | 190 | if nonafdo_image: |
| 191 | official_nonafdo_image = """ |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 192 | nonafdo_image { |
| 193 | chromeos_root: %s |
| 194 | build: %s |
| 195 | compiler: gcc |
| 196 | } |
| 197 | """ % (self._chromeos_root, nonafdo_image) |
Luis Lozano | 439f2b7 | 2016-01-08 11:56:02 -0800 | [diff] [blame] | 198 | f.write(official_nonafdo_image) |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 199 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 200 | label_string = '%s_trybot_image' % compiler_string |
Caroline Tice | 80eab98 | 2015-11-04 14:03:14 -0800 | [diff] [blame] | 201 | if USE_NEXT_GCC_PATCH in self._patches: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 202 | label_string = 'gcc_next_trybot_image' |
Caroline Tice | 80eab98 | 2015-11-04 14:03:14 -0800 | [diff] [blame] | 203 | |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 204 | experiment_image = """ |
Caroline Tice | 80eab98 | 2015-11-04 14:03:14 -0800 | [diff] [blame] | 205 | %s { |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 206 | chromeos_root: %s |
| 207 | build: %s |
Caroline Tice | ddde505 | 2015-09-23 09:43:35 -0700 | [diff] [blame] | 208 | compiler: %s |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 209 | } |
Caroline Tice | 80eab98 | 2015-11-04 14:03:14 -0800 | [diff] [blame] | 210 | """ % (label_string, self._chromeos_root, trybot_image, |
| 211 | compiler_string) |
Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 212 | f.write(experiment_image) |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 213 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 214 | crosperf = os.path.join(TOOLCHAIN_DIR, 'crosperf', 'crosperf') |
Han Shen | 4349429 | 2015-09-14 10:26:40 -0700 | [diff] [blame] | 215 | noschedv2_opts = '--noschedv2' if self._noschedv2 else '' |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 216 | command = ('{crosperf} --no_email=True --results_dir={r_dir} ' |
| 217 | '--json_report=True {noschedv2_opts} {exp_file}').format( |
Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 218 | crosperf=crosperf, |
| 219 | r_dir=self._reports_dir, |
| 220 | noschedv2_opts=noschedv2_opts, |
| 221 | exp_file=experiment_file) |
cmtice | aa700b0 | 2015-06-12 13:26:47 -0700 | [diff] [blame] | 222 | |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 223 | ret = self._ce.RunCommand(command) |
cmtice | 7f3190b | 2015-05-22 14:14:51 -0700 | [diff] [blame] | 224 | if ret != 0: |
Manoj Gupta | aee96b7 | 2016-10-24 13:43:28 -0700 | [diff] [blame] | 225 | raise RuntimeError('Crosperf execution error!') |
Caroline Tice | ebbc3da | 2015-09-03 10:27:20 -0700 | [diff] [blame] | 226 | else: |
| 227 | # Copy json report to pending archives directory. |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 228 | command = 'cp %s/*.json %s/.' % (self._reports_dir, PENDING_ARCHIVES_DIR) |
Caroline Tice | ebbc3da | 2015-09-03 10:27:20 -0700 | [diff] [blame] | 229 | ret = self._ce.RunCommand(command) |
cmtice | 7f3190b | 2015-05-22 14:14:51 -0700 | [diff] [blame] | 230 | return |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 231 | |
cmtice | 7f3190b | 2015-05-22 14:14:51 -0700 | [diff] [blame] | 232 | def _SendEmail(self): |
| 233 | """Find email message generated by crosperf and send it.""" |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 234 | filename = os.path.join(self._reports_dir, 'msg_body.html') |
cmtice | 7f3190b | 2015-05-22 14:14:51 -0700 | [diff] [blame] | 235 | if (os.path.exists(filename) and |
| 236 | os.path.exists(os.path.expanduser(MAIL_PROGRAM))): |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 237 | email_title = 'buildbot test results' |
Yunlian Jiang | 2f56356 | 2015-08-28 13:54:04 -0700 | [diff] [blame] | 238 | if self._patches_string == USE_LLVM_PATCH: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 239 | email_title = 'buildbot llvm test results' |
| 240 | command = ('cat %s | %s -s "%s, %s" -team -html' % |
| 241 | (filename, MAIL_PROGRAM, email_title, self._board)) |
cmtice | 7f3190b | 2015-05-22 14:14:51 -0700 | [diff] [blame] | 242 | self._ce.RunCommand(command) |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 243 | |
| 244 | def DoAll(self): |
Yunlian Jiang | 14cf596 | 2015-12-11 15:50:14 -0800 | [diff] [blame] | 245 | """Main function inside ToolchainComparator class. |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 246 | |
| 247 | Launch trybot, get image names, create crosperf experiment file, run |
| 248 | crosperf, and copy images into seven-day report directories. |
| 249 | """ |
cmtice | ce5ffa4 | 2015-02-12 15:18:43 -0800 | [diff] [blame] | 250 | date_str = datetime.date.today() |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 251 | description = 'master_%s_%s_%s' % (self._patches_string, self._build, |
Han Shen | fe054f1 | 2015-02-18 15:00:13 -0800 | [diff] [blame] | 252 | date_str) |
Manoj Gupta | aee96b7 | 2016-10-24 13:43:28 -0700 | [diff] [blame] | 253 | trybot_image = buildbot_utils.GetTrybotImage( |
| 254 | self._chromeos_root, |
| 255 | self._build, |
| 256 | self._patches, |
| 257 | description, |
| 258 | other_flags=['--notests'], |
| 259 | build_toolchain=True) |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 260 | |
cmtice | d54f980 | 2015-02-05 11:04:11 -0800 | [diff] [blame] | 261 | if len(trybot_image) == 0: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 262 | self._l.LogError('Unable to find trybot_image for %s!' % description) |
Luis Lozano | 7f20acb | 2015-11-04 17:15:08 -0800 | [diff] [blame] | 263 | return 1 |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 264 | |
Luis Lozano | c75fd05 | 2016-02-19 17:37:01 -0800 | [diff] [blame] | 265 | vanilla_image = self._GetVanillaImageName(trybot_image) |
| 266 | nonafdo_image = self._GetNonAFDOImageName(trybot_image) |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 267 | |
Yunlian Jiang | 56f1376 | 2016-01-06 12:56:24 -0800 | [diff] [blame] | 268 | # The trybot image is ready here, in some cases, the vanilla image |
| 269 | # is not ready, so we need to make sure vanilla image is available. |
| 270 | buildbot_utils.WaitForImage(self._chromeos_root, vanilla_image) |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 271 | print('trybot_image: %s' % trybot_image) |
| 272 | print('vanilla_image: %s' % vanilla_image) |
| 273 | print('nonafdo_image: %s' % nonafdo_image) |
Luis Lozano | c75fd05 | 2016-02-19 17:37:01 -0800 | [diff] [blame] | 274 | |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 275 | if os.getlogin() == ROLE_ACCOUNT: |
| 276 | self._FinishSetup() |
| 277 | |
Luis Lozano | 783954f | 2015-12-21 18:06:29 -0800 | [diff] [blame] | 278 | self._TestImages(trybot_image, vanilla_image, nonafdo_image) |
cmtice | 7f3190b | 2015-05-22 14:14:51 -0700 | [diff] [blame] | 279 | self._SendEmail() |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 280 | return 0 |
| 281 | |
| 282 | |
| 283 | def Main(argv): |
| 284 | """The main function.""" |
| 285 | |
| 286 | # Common initializations |
| 287 | command_executer.InitCommandExecuter() |
Caroline Tice | eddb063 | 2016-04-14 09:19:02 -0700 | [diff] [blame] | 288 | parser = argparse.ArgumentParser() |
Manoj Gupta | aee96b7 | 2016-10-24 13:43:28 -0700 | [diff] [blame] | 289 | parser.add_argument( |
| 290 | '--remote', dest='remote', help='Remote machines to run tests on.') |
| 291 | parser.add_argument( |
| 292 | '--board', dest='board', default='x86-zgb', help='The target board.') |
| 293 | parser.add_argument( |
| 294 | '--chromeos_root', |
| 295 | dest='chromeos_root', |
| 296 | help='The chromeos root from which to run tests.') |
| 297 | parser.add_argument( |
| 298 | '--weekday', |
| 299 | default='', |
| 300 | dest='weekday', |
| 301 | help='The day of the week for which to run tests.') |
| 302 | parser.add_argument( |
| 303 | '--patch', |
| 304 | dest='patches', |
| 305 | help='The patches to use for the testing, ' |
| 306 | "seprate the patch numbers with ',' " |
| 307 | 'for more than one patches.') |
| 308 | parser.add_argument( |
| 309 | '--noschedv2', |
| 310 | dest='noschedv2', |
| 311 | action='store_true', |
| 312 | default=False, |
| 313 | help='Pass --noschedv2 to crosperf.') |
Han Shen | 3641312 | 2015-08-28 11:05:40 -0700 | [diff] [blame] | 314 | |
Caroline Tice | eddb063 | 2016-04-14 09:19:02 -0700 | [diff] [blame] | 315 | options = parser.parse_args(argv[1:]) |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 316 | if not options.board: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 317 | print('Please give a board.') |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 318 | return 1 |
| 319 | if not options.remote: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 320 | print('Please give at least one remote machine.') |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 321 | return 1 |
| 322 | if not options.chromeos_root: |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 323 | print('Please specify the ChromeOS root directory.') |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 324 | return 1 |
Yunlian Jiang | 76259e6 | 2015-08-21 08:44:31 -0700 | [diff] [blame] | 325 | if options.patches: |
Yunlian Jiang | 3c6e467 | 2015-08-24 15:58:22 -0700 | [diff] [blame] | 326 | patches = options.patches |
| 327 | else: |
| 328 | patches = USE_NEXT_GCC_PATCH |
Yunlian Jiang | e52838c | 2015-08-20 14:32:37 -0700 | [diff] [blame] | 329 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 330 | fc = ToolchainComparator(options.board, options.remote, options.chromeos_root, |
| 331 | options.weekday, patches, options.noschedv2) |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 332 | return fc.DoAll() |
| 333 | |
| 334 | |
Luis Lozano | f2a3ef4 | 2015-12-15 13:49:30 -0800 | [diff] [blame] | 335 | if __name__ == '__main__': |
cmtice | 46093e5 | 2014-12-09 14:59:16 -0800 | [diff] [blame] | 336 | retval = Main(sys.argv) |
| 337 | sys.exit(retval) |