| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Base class for all slave-side build steps. """ | 5 """Base class for all slave-side build steps. """ |
| 6 | 6 |
| 7 import config | 7 import config |
| 8 import multiprocessing | 8 import multiprocessing |
| 9 import os | 9 import os |
| 10 import shlex | 10 import shlex |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 def write(self, data): | 77 def write(self, data): |
| 78 build_step_stdout_has_written.value = INT_TRUE | 78 build_step_stdout_has_written.value = INT_TRUE |
| 79 self.stdout.write(data) | 79 self.stdout.write(data) |
| 80 | 80 |
| 81 def flush(self): | 81 def flush(self): |
| 82 self.stdout.flush() | 82 self.stdout.flush() |
| 83 | 83 |
| 84 | 84 |
| 85 class DeviceDirs(object): | 85 class DeviceDirs(object): |
| 86 def __init__(self, perf_data_dir, gm_actual_dir, gm_expected_dir, | 86 def __init__(self, perf_data_dir, gm_actual_dir, gm_expected_dir, |
| 87 resource_dir, skp_dir, skp_perf_dir, skp_out_dir, tmp_dir): | 87 resource_dir, skimage_in_dir, skimage_expected_dir, |
| 88 skimage_out_dir, skp_dir, skp_perf_dir, skp_out_dir, tmp_dir): |
| 88 self._perf_data_dir = perf_data_dir | 89 self._perf_data_dir = perf_data_dir |
| 89 self._gm_actual_dir = gm_actual_dir | 90 self._gm_actual_dir = gm_actual_dir |
| 90 self._gm_expected_dir = gm_expected_dir | 91 self._gm_expected_dir = gm_expected_dir |
| 91 self._resource_dir = resource_dir | 92 self._resource_dir = resource_dir |
| 93 self._skimage_in_dir = skimage_in_dir |
| 94 self._skimage_expected_dir = skimage_expected_dir |
| 95 self._skimage_out_dir = skimage_out_dir |
| 92 self._skp_dir = skp_dir | 96 self._skp_dir = skp_dir |
| 93 self._skp_perf_dir = skp_perf_dir | 97 self._skp_perf_dir = skp_perf_dir |
| 94 self._skp_out_dir = skp_out_dir | 98 self._skp_out_dir = skp_out_dir |
| 95 self._tmp_dir = tmp_dir | 99 self._tmp_dir = tmp_dir |
| 96 | 100 |
| 97 def GMActualDir(self): | 101 def GMActualDir(self): |
| 98 return self._gm_actual_dir | 102 return self._gm_actual_dir |
| 99 | 103 |
| 100 def GMExpectedDir(self): | 104 def GMExpectedDir(self): |
| 101 return self._gm_expected_dir | 105 return self._gm_expected_dir |
| 102 | 106 |
| 103 def PerfDir(self): | 107 def PerfDir(self): |
| 104 return self._perf_data_dir | 108 return self._perf_data_dir |
| 105 | 109 |
| 106 def ResourceDir(self): | 110 def ResourceDir(self): |
| 107 return self._resource_dir | 111 return self._resource_dir |
| 108 | 112 |
| 113 def SKImageInDir(self): |
| 114 return self._skimage_in_dir |
| 115 |
| 116 def SKImageExpectedDir(self): |
| 117 return self._skimage_expected_dir |
| 118 |
| 119 def SKImageOutDir(self): |
| 120 return self._skimage_out_dir |
| 121 |
| 109 def SKPDir(self): | 122 def SKPDir(self): |
| 110 return self._skp_dir | 123 return self._skp_dir |
| 111 | 124 |
| 112 def SKPPerfDir(self): | 125 def SKPPerfDir(self): |
| 113 return self._skp_perf_dir | 126 return self._skp_perf_dir |
| 114 | 127 |
| 115 def SKPOutDir(self): | 128 def SKPOutDir(self): |
| 116 return self._skp_out_dir | 129 return self._skp_out_dir |
| 117 | 130 |
| 118 def TmpDir(self): | 131 def TmpDir(self): |
| (...skipping 21 matching lines...) Expand all Loading... |
| 140 'from host to device is undefined and only allowed if ' | 153 'from host to device is undefined and only allowed if ' |
| 141 'host_dir and device_dir are the same.') | 154 'host_dir and device_dir are the same.') |
| 142 | 155 |
| 143 def PushFileToDevice(self, src, dst): | 156 def PushFileToDevice(self, src, dst): |
| 144 """ Copy the a single file from path "src" on the host to path "dst" on | 157 """ Copy the a single file from path "src" on the host to path "dst" on |
| 145 the device. If the host IS the device we are testing, it's just a filecopy. | 158 the device. If the host IS the device we are testing, it's just a filecopy. |
| 146 Subclasses should override this method with one appropriate for | 159 Subclasses should override this method with one appropriate for |
| 147 pushing the file to the device. """ | 160 pushing the file to the device. """ |
| 148 shutil.copy(src, dst) | 161 shutil.copy(src, dst) |
| 149 | 162 |
| 163 def DevicePathExists(self, path): |
| 164 """ Like os.path.exists(), but for a path on the connected device. """ |
| 165 return os.path.exists(path) |
| 166 |
| 150 def DevicePathJoin(self, *args): | 167 def DevicePathJoin(self, *args): |
| 151 """ Like os.path.join(), but for paths that will target the connected | 168 """ Like os.path.join(), but for paths that will target the connected |
| 152 device. """ | 169 device. """ |
| 153 return os.sep.join(args) | 170 return os.sep.join(args) |
| 154 | 171 |
| 155 def CreateCleanDirectory(self, directory): | 172 def CreateCleanDirectory(self, directory): |
| 156 file_utils.CreateCleanLocalDir(directory) | 173 file_utils.CreateCleanLocalDir(directory) |
| 157 | 174 |
| 158 def __init__(self, args, attempts=1, timeout=DEFAULT_TIMEOUT, | 175 def __init__(self, args, attempts=1, timeout=DEFAULT_TIMEOUT, |
| 159 no_output_timeout=DEFAULT_NO_OUTPUT_TIMEOUT): | 176 no_output_timeout=DEFAULT_NO_OUTPUT_TIMEOUT): |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 # Figure out where we are going to store performance output. | 242 # Figure out where we are going to store performance output. |
| 226 if args['perf_output_basedir'] != 'None': | 243 if args['perf_output_basedir'] != 'None': |
| 227 self._perf_data_dir = os.path.join(args['perf_output_basedir'], | 244 self._perf_data_dir = os.path.join(args['perf_output_basedir'], |
| 228 self._builder_name, 'data') | 245 self._builder_name, 'data') |
| 229 self._perf_graphs_dir = os.path.join(args['perf_output_basedir'], | 246 self._perf_graphs_dir = os.path.join(args['perf_output_basedir'], |
| 230 self._builder_name, 'graphs') | 247 self._builder_name, 'graphs') |
| 231 else: | 248 else: |
| 232 self._perf_data_dir = None | 249 self._perf_data_dir = None |
| 233 self._perf_graphs_dir = None | 250 self._perf_graphs_dir = None |
| 234 | 251 |
| 252 self._skimage_in_dir = os.path.join(os.pardir, 'skimage_in') |
| 253 |
| 254 self._skimage_expected_dir = os.path.join('expectations', 'skimage') |
| 255 |
| 256 self._skimage_out_dir = os.path.join('out', self._configuration, |
| 257 'skimage_out') |
| 258 |
| 235 # Note that DeviceDirs.GMExpectedDir() is being set up to point at a | 259 # Note that DeviceDirs.GMExpectedDir() is being set up to point at a |
| 236 # DIFFERENT directory than self._gm_expected. | 260 # DIFFERENT directory than self._gm_expected. |
| 237 # self._gm_expected : The SVN-managed directory on the buildbot host | 261 # self._gm_expected : The SVN-managed directory on the buildbot host |
| 238 # where canonical expectations are stored. | 262 # where canonical expectations are stored. |
| 239 # Currently, they are stored there as | 263 # Currently, they are stored there as |
| 240 # individual image files. | 264 # individual image files. |
| 241 # DeviceDirs.GMExpectedDir(): A temporary directory on the device we are | 265 # DeviceDirs.GMExpectedDir(): A temporary directory on the device we are |
| 242 # testing, where the PreRender step will put | 266 # testing, where the PreRender step will put |
| 243 # an expected-results.json file that describes | 267 # an expected-results.json file that describes |
| 244 # all GM results expectations. | 268 # all GM results expectations. |
| 245 # TODO(epoger): Update the above description as we move through the steps in | 269 # TODO(epoger): Update the above description as we move through the steps in |
| 246 # https://goto.google.com/ChecksumTransitionDetail | 270 # https://goto.google.com/ChecksumTransitionDetail |
| 247 self._device_dirs = DeviceDirs( | 271 self._device_dirs = DeviceDirs( |
| 248 perf_data_dir=self._perf_data_dir, | 272 perf_data_dir=self._perf_data_dir, |
| 249 gm_actual_dir=os.path.join(os.pardir, os.pardir, 'gm', 'actual'), | 273 gm_actual_dir=os.path.join(os.pardir, os.pardir, 'gm', 'actual'), |
| 250 gm_expected_dir=os.path.join(os.pardir, os.pardir, 'gm', 'expected'), | 274 gm_expected_dir=os.path.join(os.pardir, os.pardir, 'gm', 'expected'), |
| 251 resource_dir=self._resource_dir, | 275 resource_dir=self._resource_dir, |
| 276 skimage_in_dir=self._skimage_in_dir, |
| 277 skimage_expected_dir=self._skimage_expected_dir, |
| 278 skimage_out_dir=self._skimage_out_dir, |
| 252 skp_dir=self._local_playback_dirs.PlaybackSkpDir(), | 279 skp_dir=self._local_playback_dirs.PlaybackSkpDir(), |
| 253 skp_perf_dir=self._perf_data_dir, | 280 skp_perf_dir=self._perf_data_dir, |
| 254 skp_out_dir=self._local_playback_dirs.PlaybackGmActualDir(), | 281 skp_out_dir=self._local_playback_dirs.PlaybackGmActualDir(), |
| 255 tmp_dir=os.path.join(os.pardir, 'tmp')) | 282 tmp_dir=os.path.join(os.pardir, 'tmp')) |
| 256 | 283 |
| 257 def RunFlavoredCmd(self, app, args): | 284 def RunFlavoredCmd(self, app, args): |
| 258 """ Override this in new BuildStep flavors. """ | 285 """ Override this in new BuildStep flavors. """ |
| 259 shell_utils.Bash([self._PathToBinary(app)] + args) | 286 shell_utils.Bash([self._PathToBinary(app)] + args) |
| 260 | 287 |
| 261 def _PreRun(self): | 288 def _PreRun(self): |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 else: | 392 else: |
| 366 raise BuildStepFailure('Build step failed.') | 393 raise BuildStepFailure('Build step failed.') |
| 367 except Exception: | 394 except Exception: |
| 368 print traceback.format_exc() | 395 print traceback.format_exc() |
| 369 if attempt + 1 >= step.attempts: | 396 if attempt + 1 >= step.attempts: |
| 370 raise | 397 raise |
| 371 # pylint: disable=W0212 | 398 # pylint: disable=W0212 |
| 372 step._WaitFunc(attempt) | 399 step._WaitFunc(attempt) |
| 373 attempt += 1 | 400 attempt += 1 |
| 374 print '**** %s, attempt %d ****' % (StepType.__name__, attempt + 1) | 401 print '**** %s, attempt %d ****' % (StepType.__name__, attempt + 1) |
| OLD | NEW |