Chromium Code Reviews| 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 |
| 11 import shutil | 11 import shutil |
| 12 import signal | 12 import signal |
| 13 import subprocess | 13 import subprocess |
| 14 import sys | 14 import sys |
| 15 import time | 15 import time |
| 16 import traceback | 16 import traceback |
| 17 | 17 |
| 18 from get_subdir import GetSubDirFromBuilderName | |
| 18 from playback_dirs import LocalSkpPlaybackDirs | 19 from playback_dirs import LocalSkpPlaybackDirs |
| 19 from playback_dirs import StorageSkpPlaybackDirs | 20 from playback_dirs import StorageSkpPlaybackDirs |
| 20 from utils import file_utils | 21 from utils import file_utils |
| 21 from utils import misc | 22 from utils import misc |
| 22 from utils import shell_utils | 23 from utils import shell_utils |
| 23 | 24 |
| 24 | 25 |
| 25 # Add important directories to the PYTHONPATH | 26 # Add important directories to the PYTHONPATH |
| 26 buildbot_root = os.path.join(os.path.dirname(os.path.abspath(__file__)), | 27 buildbot_root = os.path.join(os.path.dirname(os.path.abspath(__file__)), |
| 27 os.pardir, os.pardir) | 28 os.pardir, os.pardir) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 def write(self, data): | 78 def write(self, data): |
| 78 build_step_stdout_has_written.value = INT_TRUE | 79 build_step_stdout_has_written.value = INT_TRUE |
| 79 self.stdout.write(data) | 80 self.stdout.write(data) |
| 80 | 81 |
| 81 def flush(self): | 82 def flush(self): |
| 82 self.stdout.flush() | 83 self.stdout.flush() |
| 83 | 84 |
| 84 | 85 |
| 85 class DeviceDirs(object): | 86 class DeviceDirs(object): |
| 86 def __init__(self, perf_data_dir, gm_actual_dir, gm_expected_dir, | 87 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): | 88 resource_dir, skimage_in_dir, skimage_expected_dir, |
| 89 skimage_out_dir, skp_dir, skp_perf_dir, skp_out_dir, tmp_dir): | |
| 88 self._perf_data_dir = perf_data_dir | 90 self._perf_data_dir = perf_data_dir |
| 89 self._gm_actual_dir = gm_actual_dir | 91 self._gm_actual_dir = gm_actual_dir |
| 90 self._gm_expected_dir = gm_expected_dir | 92 self._gm_expected_dir = gm_expected_dir |
| 91 self._resource_dir = resource_dir | 93 self._resource_dir = resource_dir |
| 94 self._skimage_in_dir = skimage_in_dir | |
| 95 self._skimage_expected_dir = skimage_expected_dir | |
| 96 self._skimage_out_dir = skimage_out_dir | |
| 92 self._skp_dir = skp_dir | 97 self._skp_dir = skp_dir |
| 93 self._skp_perf_dir = skp_perf_dir | 98 self._skp_perf_dir = skp_perf_dir |
| 94 self._skp_out_dir = skp_out_dir | 99 self._skp_out_dir = skp_out_dir |
| 95 self._tmp_dir = tmp_dir | 100 self._tmp_dir = tmp_dir |
| 96 | 101 |
| 97 def GMActualDir(self): | 102 def GMActualDir(self): |
| 98 return self._gm_actual_dir | 103 return self._gm_actual_dir |
| 99 | 104 |
| 100 def GMExpectedDir(self): | 105 def GMExpectedDir(self): |
| 101 return self._gm_expected_dir | 106 return self._gm_expected_dir |
| 102 | 107 |
| 103 def PerfDir(self): | 108 def PerfDir(self): |
| 104 return self._perf_data_dir | 109 return self._perf_data_dir |
| 105 | 110 |
| 106 def ResourceDir(self): | 111 def ResourceDir(self): |
| 107 return self._resource_dir | 112 return self._resource_dir |
| 108 | 113 |
| 114 def SKImageInDir(self): | |
| 115 return self._skimage_in_dir | |
| 116 | |
| 117 def SKImageExpectedDir(self): | |
| 118 return self._skimage_expected_dir | |
| 119 | |
| 120 def SKImageOutDir(self): | |
| 121 return self._skimage_out_dir | |
| 122 | |
| 109 def SKPDir(self): | 123 def SKPDir(self): |
| 110 return self._skp_dir | 124 return self._skp_dir |
| 111 | 125 |
| 112 def SKPPerfDir(self): | 126 def SKPPerfDir(self): |
| 113 return self._skp_perf_dir | 127 return self._skp_perf_dir |
| 114 | 128 |
| 115 def SKPOutDir(self): | 129 def SKPOutDir(self): |
| 116 return self._skp_out_dir | 130 return self._skp_out_dir |
| 117 | 131 |
| 118 def TmpDir(self): | 132 def TmpDir(self): |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 # Figure out where we are going to store performance output. | 239 # Figure out where we are going to store performance output. |
| 226 if args['perf_output_basedir'] != 'None': | 240 if args['perf_output_basedir'] != 'None': |
| 227 self._perf_data_dir = os.path.join(args['perf_output_basedir'], | 241 self._perf_data_dir = os.path.join(args['perf_output_basedir'], |
| 228 self._builder_name, 'data') | 242 self._builder_name, 'data') |
| 229 self._perf_graphs_dir = os.path.join(args['perf_output_basedir'], | 243 self._perf_graphs_dir = os.path.join(args['perf_output_basedir'], |
| 230 self._builder_name, 'graphs') | 244 self._builder_name, 'graphs') |
| 231 else: | 245 else: |
| 232 self._perf_data_dir = None | 246 self._perf_data_dir = None |
| 233 self._perf_graphs_dir = None | 247 self._perf_graphs_dir = None |
| 234 | 248 |
| 249 skimage_subdir = GetSubDirFromBuilderName(self._builder_name) | |
|
borenet
2013/06/25 18:19:12
Would it be equivalent to use self._gm_image_subdi
scroggo
2013/06/25 19:28:56
Yes. Thanks!
| |
| 250 if None == skimage_subdir: | |
| 251 raise BuildStepFailure("Could not find subdir for " + self._builder_name) | |
| 252 | |
| 253 self._skimage_in_dir = os.path.join(os.pardir, 'skimage_in') | |
| 254 | |
| 255 self._skimage_expected_dir = os.path.join(os.pardir, 'expectations', | |
| 256 'skimage', skimage_subdir) | |
| 257 self._skimage_out_dir = os.path.join('out', self._configuration, | |
| 258 'skimage_out') | |
| 259 | |
| 235 # Note that DeviceDirs.GMExpectedDir() is being set up to point at a | 260 # Note that DeviceDirs.GMExpectedDir() is being set up to point at a |
| 236 # DIFFERENT directory than self._gm_expected. | 261 # DIFFERENT directory than self._gm_expected. |
| 237 # self._gm_expected : The SVN-managed directory on the buildbot host | 262 # self._gm_expected : The SVN-managed directory on the buildbot host |
| 238 # where canonical expectations are stored. | 263 # where canonical expectations are stored. |
| 239 # Currently, they are stored there as | 264 # Currently, they are stored there as |
| 240 # individual image files. | 265 # individual image files. |
| 241 # DeviceDirs.GMExpectedDir(): A temporary directory on the device we are | 266 # DeviceDirs.GMExpectedDir(): A temporary directory on the device we are |
| 242 # testing, where the PreRender step will put | 267 # testing, where the PreRender step will put |
| 243 # an expected-results.json file that describes | 268 # an expected-results.json file that describes |
| 244 # all GM results expectations. | 269 # all GM results expectations. |
| 245 # TODO(epoger): Update the above description as we move through the steps in | 270 # TODO(epoger): Update the above description as we move through the steps in |
| 246 # https://goto.google.com/ChecksumTransitionDetail | 271 # https://goto.google.com/ChecksumTransitionDetail |
| 247 self._device_dirs = DeviceDirs( | 272 self._device_dirs = DeviceDirs( |
| 248 perf_data_dir=self._perf_data_dir, | 273 perf_data_dir=self._perf_data_dir, |
| 249 gm_actual_dir=os.path.join(os.pardir, os.pardir, 'gm', 'actual'), | 274 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'), | 275 gm_expected_dir=os.path.join(os.pardir, os.pardir, 'gm', 'expected'), |
| 251 resource_dir=self._resource_dir, | 276 resource_dir=self._resource_dir, |
| 277 skimage_in_dir=self._skimage_in_dir, | |
| 278 skimage_expected_dir=self._skimage_expected_dir, | |
| 279 skimage_out_dir=self._skimage_out_dir, | |
| 252 skp_dir=self._local_playback_dirs.PlaybackSkpDir(), | 280 skp_dir=self._local_playback_dirs.PlaybackSkpDir(), |
| 253 skp_perf_dir=self._perf_data_dir, | 281 skp_perf_dir=self._perf_data_dir, |
| 254 skp_out_dir=self._local_playback_dirs.PlaybackGmActualDir(), | 282 skp_out_dir=self._local_playback_dirs.PlaybackGmActualDir(), |
| 255 tmp_dir=os.path.join(os.pardir, 'tmp')) | 283 tmp_dir=os.path.join(os.pardir, 'tmp')) |
| 256 | 284 |
| 257 def RunFlavoredCmd(self, app, args): | 285 def RunFlavoredCmd(self, app, args): |
| 258 """ Override this in new BuildStep flavors. """ | 286 """ Override this in new BuildStep flavors. """ |
| 259 shell_utils.Bash([self._PathToBinary(app)] + args) | 287 shell_utils.Bash([self._PathToBinary(app)] + args) |
| 260 | 288 |
| 261 def _PreRun(self): | 289 def _PreRun(self): |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 365 else: | 393 else: |
| 366 raise BuildStepFailure('Build step failed.') | 394 raise BuildStepFailure('Build step failed.') |
| 367 except Exception: | 395 except Exception: |
| 368 print traceback.format_exc() | 396 print traceback.format_exc() |
| 369 if attempt + 1 >= step.attempts: | 397 if attempt + 1 >= step.attempts: |
| 370 raise | 398 raise |
| 371 # pylint: disable=W0212 | 399 # pylint: disable=W0212 |
| 372 step._WaitFunc(attempt) | 400 step._WaitFunc(attempt) |
| 373 attempt += 1 | 401 attempt += 1 |
| 374 print '**** %s, attempt %d ****' % (StepType.__name__, attempt + 1) | 402 print '**** %s, attempt %d ****' % (StepType.__name__, attempt + 1) |
| OLD | NEW |