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

Side by Side Diff: slave/skia_slave_scripts/flavor_utils/default_build_step_utils.py

Issue 295753002: upload SKP renderings that did not match expectations (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: update comment about Google Storage ACLs Created 6 years, 7 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
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 """ Utilities for generic build steps. """ 5 """ Utilities for generic build steps. """
6 6
7 import errno 7 import errno
8 import os 8 import os
9 import shutil 9 import shutil
10 import sys 10 import sys
11 11
12 from utils import file_utils 12 from utils import file_utils
13 from utils import shell_utils 13 from utils import shell_utils
14 14
15 15
16 class DeviceDirs(object): 16 class DeviceDirs(object):
17 def __init__(self, perf_data_dir, gm_actual_dir, gm_expected_dir, 17 def __init__(self, perf_data_dir, gm_actual_dir, gm_expected_dir,
18 resource_dir, skimage_in_dir, skimage_expected_dir, 18 resource_dir, skimage_in_dir, skimage_expected_dir,
19 skimage_out_dir, skp_dir, skp_perf_dir, skp_out_dir, tmp_dir): 19 skimage_out_dir, skp_dir, skp_perf_dir,
20 playback_actual_images_dir, playback_actual_summaries_dir,
21 playback_expected_summaries_dir, tmp_dir):
20 self._perf_data_dir = perf_data_dir 22 self._perf_data_dir = perf_data_dir
21 self._gm_actual_dir = gm_actual_dir 23 self._gm_actual_dir = gm_actual_dir
22 self._gm_expected_dir = gm_expected_dir 24 self._gm_expected_dir = gm_expected_dir
23 self._resource_dir = resource_dir 25 self._resource_dir = resource_dir
24 self._skimage_in_dir = skimage_in_dir 26 self._skimage_in_dir = skimage_in_dir
25 self._skimage_expected_dir = skimage_expected_dir 27 self._skimage_expected_dir = skimage_expected_dir
26 self._skimage_out_dir = skimage_out_dir 28 self._skimage_out_dir = skimage_out_dir
27 self._skp_dir = skp_dir 29 self._skp_dir = skp_dir
28 self._skp_perf_dir = skp_perf_dir 30 self._skp_perf_dir = skp_perf_dir
29 self._skp_out_dir = skp_out_dir 31 self._playback_actual_images_dir = playback_actual_images_dir
32 self._playback_actual_summaries_dir = playback_actual_summaries_dir
33 self._playback_expected_summaries_dir = playback_expected_summaries_dir
30 self._tmp_dir = tmp_dir 34 self._tmp_dir = tmp_dir
31 35
32 def GMActualDir(self): 36 def GMActualDir(self):
33 return self._gm_actual_dir 37 return self._gm_actual_dir
34 38
35 def GMExpectedDir(self): 39 def GMExpectedDir(self):
36 return self._gm_expected_dir 40 return self._gm_expected_dir
37 41
38 def PerfDir(self): 42 def PerfDir(self):
39 return self._perf_data_dir 43 return self._perf_data_dir
40 44
45 def PlaybackActualImagesDir(self):
46 return self._playback_actual_images_dir
47
48 def PlaybackActualSummariesDir(self):
49 return self._playback_actual_summaries_dir
50
51 def PlaybackExpectedSummariesDir(self):
52 return self._playback_expected_summaries_dir
53
41 def ResourceDir(self): 54 def ResourceDir(self):
42 return self._resource_dir 55 return self._resource_dir
43 56
44 def SKImageInDir(self): 57 def SKImageInDir(self):
45 return self._skimage_in_dir 58 return self._skimage_in_dir
46 59
47 def SKImageExpectedDir(self): 60 def SKImageExpectedDir(self):
48 return self._skimage_expected_dir 61 return self._skimage_expected_dir
49 62
50 def SKImageOutDir(self): 63 def SKImageOutDir(self):
51 return self._skimage_out_dir 64 return self._skimage_out_dir
52 65
53 def SKPDir(self): 66 def SKPDir(self):
67 """Holds SKP files that are consumed by RenderSKPs and BenchPictures."""
borenet 2014/05/20 17:52:20 Why document this one but no others?
epoger 2014/05/20 19:02:48 Documented the ones that I know well.
54 return self._skp_dir 68 return self._skp_dir
55 69
56 def SKPPerfDir(self): 70 def SKPPerfDir(self):
57 return self._skp_perf_dir 71 return self._skp_perf_dir
58 72
59 def SKPOutDir(self):
60 return self._skp_out_dir
61
62 def TmpDir(self): 73 def TmpDir(self):
63 return self._tmp_dir 74 return self._tmp_dir
64 75
65 76
66 class DefaultBuildStepUtils: 77 class DefaultBuildStepUtils:
67 """ Utilities to be used by subclasses of BuildStep. 78 """ Utilities to be used by subclasses of BuildStep.
68 79
69 The methods in this class define how certain high-level functions should work. 80 The methods in this class define how certain high-level functions should work.
70 Each build step flavor should correspond to a subclass of BuildStepUtils which 81 Each build step flavor should correspond to a subclass of BuildStepUtils which
71 may override any of these functions as appropriate for that flavor. 82 may override any of these functions as appropriate for that flavor.
(...skipping 27 matching lines...) Expand all
99 """ Read the contents of a file on the associated device. Subclasses should 110 """ Read the contents of a file on the associated device. Subclasses should
100 override this method with one appropriate for reading the contents of a file 111 override this method with one appropriate for reading the contents of a file
101 on the device side. """ 112 on the device side. """
102 with open(filepath) as f: 113 with open(filepath) as f:
103 return f.read() 114 return f.read()
104 115
105 def CopyDirectoryContentsToDevice(self, host_dir, device_dir): 116 def CopyDirectoryContentsToDevice(self, host_dir, device_dir):
106 """ Copy the contents of a host-side directory to a clean directory on the 117 """ Copy the contents of a host-side directory to a clean directory on the
107 device side. Subclasses should override this method with one appropriate for 118 device side. Subclasses should override this method with one appropriate for
108 copying the contents of a host-side directory to a clean device-side 119 copying the contents of a host-side directory to a clean device-side
109 directory.""" 120 directory.
121
122 TODO(epoger): Clarify the description a bit: this method does not expect
123 device_dir to be an empty directory before it is called. Implementations
124 of this method for other device types create an empty directory at
125 device_dir as the first step.
126 """
110 # For "normal" builders who don't have an attached device, we expect 127 # For "normal" builders who don't have an attached device, we expect
111 # host_dir and device_dir to be the same. 128 # host_dir and device_dir to be the same.
112 if host_dir != device_dir: 129 if host_dir != device_dir:
113 raise ValueError('For builders who do not have attached devices, copying ' 130 raise ValueError('For builders who do not have attached devices, copying '
114 'from host to device is undefined and only allowed if ' 131 'from host to device is undefined and only allowed if '
115 'host_dir and device_dir are the same.') 132 'host_dir and device_dir are the same.')
116 133
117 def CopyDirectoryContentsToHost(self, device_dir, host_dir): 134 def CopyDirectoryContentsToHost(self, device_dir, host_dir):
118 """ Copy the contents of a device-side directory to a clean directory on the 135 """ Copy the contents of a device-side directory to a clean directory on the
119 host side. Subclasses should override this method with one appropriate for 136 host side. Subclasses should override this method with one appropriate for
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 make_cmd = 'make' 220 make_cmd = 'make'
204 if os.name == 'nt': 221 if os.name == 'nt':
205 make_cmd = 'make.bat' 222 make_cmd = 'make.bat'
206 shell_utils.run([make_cmd, 'clean']) 223 shell_utils.run([make_cmd, 'clean'])
207 224
208 def PreRun(self): 225 def PreRun(self):
209 """ Preprocessing step to run before the BuildStep itself. """ 226 """ Preprocessing step to run before the BuildStep itself. """
210 pass 227 pass
211 228
212 def GetDeviceDirs(self): 229 def GetDeviceDirs(self):
213 """ Set the directories which will be used by the BuildStep. """ 230 """ Set the directories which will be used by the BuildStep.
231
232 In this case, host_dirs and device_dirs are the same, which is why
borenet 2014/05/20 17:52:20 "In the case of DefaultBuildStepUtils, ..."
epoger 2014/05/20 19:02:48 Done.
233 CopyDirectoryContentsToDevice() is a no-op.
234 """
214 return DeviceDirs( 235 return DeviceDirs(
215 perf_data_dir=self._step.perf_data_dir, 236 perf_data_dir=self._step.perf_data_dir,
216 # TODO(epoger): Instead, set gm_actual_dir to self._step._gm_actual_dir 237 # TODO(epoger): Instead, set gm_actual_dir to self._step._gm_actual_dir
217 # and remove os.path.join() with self._builder_name in postrender.py ? 238 # and remove os.path.join() with self._builder_name in postrender.py ?
218 # (CopyDirectoryContentsToHost fails if the paths are different when 239 # (CopyDirectoryContentsToHost fails if the paths are different when
219 # host==device, so why not just make them inherently equal?) 240 # host==device, so why not just make them inherently equal?)
220 gm_actual_dir=os.path.join(os.pardir, os.pardir, 'gm', 'actual'), 241 gm_actual_dir=os.path.join(os.pardir, os.pardir, 'gm', 'actual'),
221 gm_expected_dir=os.path.join(os.pardir, os.pardir, 'gm', 'expected'), 242 gm_expected_dir=os.path.join(os.pardir, os.pardir, 'gm', 'expected'),
222 resource_dir=self._step.resource_dir, 243 resource_dir=self._step.resource_dir,
223 skimage_in_dir=self._step.skimage_in_dir, 244 skimage_in_dir=self._step.skimage_in_dir,
224 skimage_expected_dir=self._step.skimage_expected_dir, 245 skimage_expected_dir=self._step.skimage_expected_dir,
225 skimage_out_dir=self._step.skimage_out_dir, 246 skimage_out_dir=self._step.skimage_out_dir,
226 skp_dir=self._step.skp_dir, 247 skp_dir=self._step.skp_dir,
227 skp_perf_dir=self._step.perf_data_dir, 248 skp_perf_dir=self._step.perf_data_dir,
228 skp_out_dir=self._step.skp_out_dir, 249 playback_actual_images_dir=self._step.playback_actual_images_dir,
250 playback_actual_summaries_dir=self._step.playback_actual_summaries_dir,
251 playback_expected_summaries_dir=(
252 self._step.playback_expected_summaries_dir),
229 tmp_dir=os.path.join(os.pardir, 'tmp')) 253 tmp_dir=os.path.join(os.pardir, 'tmp'))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698