Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2157)

Side by Side Diff: slave/skia_slave_scripts/build_step.py

Issue 16226005: Run skimage on the bots. (Closed) Base URL: https://skia.googlecode.com/svn/buildbot
Patch Set: Respond to comments. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 DeviceListDir(self, directory):
164 """ List the contents of a directory on the connected device. """
165 return os.listdir(directory)
166
167 def DevicePathExists(self, path):
168 """ Like os.path.exists(), but for a path on the connected device. """
169 return os.path.exists(path)
170
150 def DevicePathJoin(self, *args): 171 def DevicePathJoin(self, *args):
151 """ Like os.path.join(), but for paths that will target the connected 172 """ Like os.path.join(), but for paths that will target the connected
152 device. """ 173 device. """
153 return os.sep.join(args) 174 return os.sep.join(args)
154 175
155 def CreateCleanDirectory(self, directory): 176 def CreateCleanDirectory(self, directory):
156 file_utils.CreateCleanLocalDir(directory) 177 file_utils.CreateCleanLocalDir(directory)
157 178
158 def __init__(self, args, attempts=1, timeout=DEFAULT_TIMEOUT, 179 def __init__(self, args, attempts=1, timeout=DEFAULT_TIMEOUT,
159 no_output_timeout=DEFAULT_NO_OUTPUT_TIMEOUT): 180 no_output_timeout=DEFAULT_NO_OUTPUT_TIMEOUT):
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 # Figure out where we are going to store performance output. 246 # Figure out where we are going to store performance output.
226 if args['perf_output_basedir'] != 'None': 247 if args['perf_output_basedir'] != 'None':
227 self._perf_data_dir = os.path.join(args['perf_output_basedir'], 248 self._perf_data_dir = os.path.join(args['perf_output_basedir'],
228 self._builder_name, 'data') 249 self._builder_name, 'data')
229 self._perf_graphs_dir = os.path.join(args['perf_output_basedir'], 250 self._perf_graphs_dir = os.path.join(args['perf_output_basedir'],
230 self._builder_name, 'graphs') 251 self._builder_name, 'graphs')
231 else: 252 else:
232 self._perf_data_dir = None 253 self._perf_data_dir = None
233 self._perf_graphs_dir = None 254 self._perf_graphs_dir = None
234 255
256 self._skimage_in_dir = os.path.join(os.pardir, 'skimage_in')
257
258 self._skimage_expected_dir = os.path.join('expectations', 'skimage')
259
260 self._skimage_out_dir = os.path.join('out', self._configuration,
261 'skimage_out')
262
235 # Note that DeviceDirs.GMExpectedDir() is being set up to point at a 263 # Note that DeviceDirs.GMExpectedDir() is being set up to point at a
236 # DIFFERENT directory than self._gm_expected. 264 # DIFFERENT directory than self._gm_expected.
237 # self._gm_expected : The SVN-managed directory on the buildbot host 265 # self._gm_expected : The SVN-managed directory on the buildbot host
238 # where canonical expectations are stored. 266 # where canonical expectations are stored.
239 # Currently, they are stored there as 267 # Currently, they are stored there as
240 # individual image files. 268 # individual image files.
241 # DeviceDirs.GMExpectedDir(): A temporary directory on the device we are 269 # DeviceDirs.GMExpectedDir(): A temporary directory on the device we are
242 # testing, where the PreRender step will put 270 # testing, where the PreRender step will put
243 # an expected-results.json file that describes 271 # an expected-results.json file that describes
244 # all GM results expectations. 272 # all GM results expectations.
245 # TODO(epoger): Update the above description as we move through the steps in 273 # TODO(epoger): Update the above description as we move through the steps in
246 # https://goto.google.com/ChecksumTransitionDetail 274 # https://goto.google.com/ChecksumTransitionDetail
247 self._device_dirs = DeviceDirs( 275 self._device_dirs = DeviceDirs(
248 perf_data_dir=self._perf_data_dir, 276 perf_data_dir=self._perf_data_dir,
249 gm_actual_dir=os.path.join(os.pardir, os.pardir, 'gm', 'actual'), 277 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'), 278 gm_expected_dir=os.path.join(os.pardir, os.pardir, 'gm', 'expected'),
251 resource_dir=self._resource_dir, 279 resource_dir=self._resource_dir,
280 skimage_in_dir=self._skimage_in_dir,
281 skimage_expected_dir=self._skimage_expected_dir,
282 skimage_out_dir=self._skimage_out_dir,
252 skp_dir=self._local_playback_dirs.PlaybackSkpDir(), 283 skp_dir=self._local_playback_dirs.PlaybackSkpDir(),
253 skp_perf_dir=self._perf_data_dir, 284 skp_perf_dir=self._perf_data_dir,
254 skp_out_dir=self._local_playback_dirs.PlaybackGmActualDir(), 285 skp_out_dir=self._local_playback_dirs.PlaybackGmActualDir(),
255 tmp_dir=os.path.join(os.pardir, 'tmp')) 286 tmp_dir=os.path.join(os.pardir, 'tmp'))
256 287
257 def RunFlavoredCmd(self, app, args): 288 def RunFlavoredCmd(self, app, args):
258 """ Override this in new BuildStep flavors. """ 289 """ Override this in new BuildStep flavors. """
259 shell_utils.Bash([self._PathToBinary(app)] + args) 290 shell_utils.Bash([self._PathToBinary(app)] + args)
260 291
261 def _PreRun(self): 292 def _PreRun(self):
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 else: 396 else:
366 raise BuildStepFailure('Build step failed.') 397 raise BuildStepFailure('Build step failed.')
367 except Exception: 398 except Exception:
368 print traceback.format_exc() 399 print traceback.format_exc()
369 if attempt + 1 >= step.attempts: 400 if attempt + 1 >= step.attempts:
370 raise 401 raise
371 # pylint: disable=W0212 402 # pylint: disable=W0212
372 step._WaitFunc(attempt) 403 step._WaitFunc(attempt)
373 attempt += 1 404 attempt += 1
374 print '**** %s, attempt %d ****' % (StepType.__name__, attempt + 1) 405 print '**** %s, attempt %d ****' % (StepType.__name__, attempt + 1)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698