OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Encapsulates all required directories for skp playback (RenderPictures) | 5 """Encapsulates all required directories for skp playback (RenderPictures) |
6 BuildSteps.""" | 6 BuildSteps.""" |
7 | 7 |
8 import os | 8 import os |
9 import posixpath | 9 import posixpath |
10 | 10 |
11 | 11 |
12 # The playback root directory name will be used both locally and on Google | 12 # The playback root directory name will be used both locally and on Google |
13 # Storage. | 13 # Storage. |
14 ROOT_PLAYBACK_DIR_NAME = 'playback' | 14 ROOT_PLAYBACK_DIR_NAME = 'playback' |
15 | |
16 # These subdirectory names will be used both locally and on Google Storage. | 15 # These subdirectory names will be used both locally and on Google Storage. |
17 ACTUAL_IMAGES_DIR_NAME = 'actualImages' | |
18 ACTUAL_SUMMARIES_DIR_NAME = 'actualSummaries' | |
19 EXPECTED_SUMMARIES_DIR_NAME = 'expectedSummaries' | |
20 SKPICTURES_DIR_NAME = 'skps' | 16 SKPICTURES_DIR_NAME = 'skps' |
| 17 IMAGERESULTS_DIR_NAME = 'imageResults' |
21 | 18 |
22 | 19 |
23 class SkpPlaybackDirs(object): | 20 class SkpPlaybackDirs(object): |
24 """Interface for required directories for skp playback BuildSteps.""" | 21 """Interface for required directories for skp playback BuildSteps.""" |
25 | 22 |
26 def __init__(self, builder_name, perf_output_basedir): | 23 def __init__(self, builder_name, perf_output_basedir): |
27 """Create an instance of SkpPlaybackDirs.""" | 24 """Create an instance of SkpPlaybackDirs.""" |
28 self._builder_name = builder_name | 25 self._builder_name = builder_name |
29 self._perf_output_basedir = perf_output_basedir | 26 self._perf_output_basedir = perf_output_basedir |
30 | 27 |
31 def PlaybackActualImagesDir(self): | 28 def PlaybackRootDir(self): |
32 raise NotImplementedError("PlaybackActualImagesDir is unimplemented") | 29 raise NotImplementedError("PlaybackRootDir is unimplemented!") |
33 | 30 |
34 def PlaybackActualSummariesDir(self): | 31 def PlaybackSkpDir(self): |
35 raise NotImplementedError("PlaybackActualSummariesDir is unimplemented") | 32 raise NotImplementedError("PlaybackSkpDir is unimplemented!") |
36 | 33 |
37 def PlaybackExpectedSummariesDir(self): | 34 def PlaybackImageResultsDir(self): |
38 raise NotImplementedError("PlaybackExpectedSummariesDir is unimplemented") | 35 raise NotImplementedError("PlaybackImageResultsDir is unimplemented") |
39 | 36 |
40 def PlaybackPerfDataDir(self): | 37 def PlaybackPerfDataDir(self): |
41 raise NotImplementedError("PlaybackPerfDataDir is unimplemented") | 38 raise NotImplementedError("PlaybackPerfDataDir is unimplemented") |
42 | 39 |
43 def PlaybackPerfGraphsDir(self): | 40 def PlaybackPerfGraphsDir(self): |
44 raise NotImplementedError("PlaybackPerfGraphsDir is unimplemented") | 41 raise NotImplementedError("PlaybackPerfGraphsDir is unimplemented") |
45 | 42 |
46 def PlaybackRootDir(self): | |
47 raise NotImplementedError("PlaybackRootDir is unimplemented!") | |
48 | |
49 def PlaybackSkpDir(self): | |
50 raise NotImplementedError("PlaybackSkpDir is unimplemented!") | |
51 | |
52 | 43 |
53 class LocalSkpPlaybackDirs(SkpPlaybackDirs): | 44 class LocalSkpPlaybackDirs(SkpPlaybackDirs): |
54 """Encapsulates all required local dirs for skp playback BuildSteps.""" | 45 """Encapsulates all required local dirs for skp playback BuildSteps.""" |
55 | 46 |
56 def __init__(self, builder_name, perf_output_basedir): | 47 def __init__(self, builder_name, perf_output_basedir): |
57 """Create an instance of LocalSkpPlaybackDirs.""" | 48 """Create an instance of LocalSkpPlaybackDirs.""" |
58 SkpPlaybackDirs.__init__(self, builder_name, perf_output_basedir) | 49 SkpPlaybackDirs.__init__(self, builder_name, perf_output_basedir) |
59 | 50 |
60 self._local_playback_root_dir = os.path.abspath( | 51 self._local_playback_root_dir = os.path.abspath( |
61 os.path.join(os.pardir, ROOT_PLAYBACK_DIR_NAME)) | 52 os.path.join(os.pardir, ROOT_PLAYBACK_DIR_NAME)) |
62 | 53 |
63 def PlaybackRootDir(self): | 54 def PlaybackRootDir(self): |
64 """Returns the local playback root directory.""" | 55 """Returns the local playback root directory.""" |
65 return self._local_playback_root_dir | 56 return self._local_playback_root_dir |
66 | 57 |
67 def PlaybackSkpDir(self): | 58 def PlaybackSkpDir(self): |
68 """Returns the local playback skp directory.""" | 59 """Returns the local playback skp directory.""" |
69 return os.path.join( | 60 return os.path.join( |
70 self._local_playback_root_dir, SKPICTURES_DIR_NAME) | 61 self._local_playback_root_dir, SKPICTURES_DIR_NAME) |
71 | 62 |
72 def PlaybackActualImagesDir(self): | 63 def PlaybackImageResultsDir(self): |
73 """Returns the local playback image output directory.""" | 64 """Returns the local playback image output directory.""" |
74 return os.path.join( | 65 return os.path.join( |
75 self._local_playback_root_dir, ACTUAL_IMAGES_DIR_NAME, | 66 self._local_playback_root_dir, IMAGERESULTS_DIR_NAME, |
76 self._builder_name) | 67 self._builder_name) |
77 | 68 |
78 def PlaybackActualSummariesDir(self): | |
79 """Returns the local playback JSON-summary output directory.""" | |
80 return os.path.join( | |
81 self._local_playback_root_dir, ACTUAL_SUMMARIES_DIR_NAME, | |
82 self._builder_name) | |
83 | |
84 def PlaybackExpectedSummariesDir(self): | |
85 """Returns the local playback JSON-summary input directory.""" | |
86 return os.path.abspath(os.path.join( | |
87 'expectations', 'skp', self._builder_name)) | |
88 | |
89 def PlaybackPerfDataDir(self): | 69 def PlaybackPerfDataDir(self): |
90 """Returns the local playback perf data directory.""" | 70 """Returns the local playback perf data directory.""" |
91 return os.path.abspath(os.path.join( | 71 return os.path.abspath(os.path.join( |
92 self._perf_output_basedir, ROOT_PLAYBACK_DIR_NAME, | 72 self._perf_output_basedir, ROOT_PLAYBACK_DIR_NAME, |
93 self._builder_name, 'data')) if self._perf_output_basedir else None | 73 self._builder_name, 'data')) if self._perf_output_basedir else None |
94 | 74 |
95 def PlaybackPerfGraphsDir(self): | 75 def PlaybackPerfGraphsDir(self): |
96 """Returns the local playback perf graphs directory.""" | 76 """Returns the local playback perf graphs directory.""" |
97 return os.path.abspath(os.path.join( | 77 return os.path.abspath(os.path.join( |
98 self._perf_output_basedir, ROOT_PLAYBACK_DIR_NAME, | 78 self._perf_output_basedir, ROOT_PLAYBACK_DIR_NAME, |
99 self._builder_name, 'graphs')) if self._perf_output_basedir else None | 79 self._builder_name, 'graphs')) if self._perf_output_basedir else None |
100 | 80 |
101 | 81 |
102 class StorageSkpPlaybackDirs(SkpPlaybackDirs): | 82 class StorageSkpPlaybackDirs(SkpPlaybackDirs): |
103 """Encapsulates all required storage dirs for skp playback BuildSteps.""" | 83 """Encapsulates all required storage dirs for skp playback BuildSteps.""" |
104 | 84 |
105 def __init__(self, builder_name, perf_output_basedir): | 85 def __init__(self, builder_name, perf_output_basedir): |
106 """Create an instance of StorageSkpPlaybackDirs.""" | 86 """Create an instance of StorageSkpPlaybackDirs.""" |
107 SkpPlaybackDirs.__init__(self, builder_name, perf_output_basedir) | 87 SkpPlaybackDirs.__init__(self, builder_name, perf_output_basedir) |
108 | 88 |
109 def PlaybackRootDir(self): | 89 def PlaybackRootDir(self): |
110 """Returns the relative storage playback root directory.""" | 90 """Returns the relative storage playback root directory.""" |
111 return ROOT_PLAYBACK_DIR_NAME | 91 return ROOT_PLAYBACK_DIR_NAME |
112 | 92 |
113 def PlaybackSkpDir(self): | 93 def PlaybackSkpDir(self): |
114 """Returns the relative storage playback skp directory.""" | 94 """Returns the relative storage playback skp directory.""" |
115 return posixpath.join(ROOT_PLAYBACK_DIR_NAME, SKPICTURES_DIR_NAME) | 95 return posixpath.join(ROOT_PLAYBACK_DIR_NAME, SKPICTURES_DIR_NAME) |
116 | 96 |
117 def PlaybackActualImagesDir(self): | 97 def PlaybackImageResultsDir(self): |
118 """Returns the relative storage playback image output directory.""" | 98 """Returns the relative storage playback image output directory.""" |
119 return posixpath.join( | 99 return posixpath.join( |
120 ROOT_PLAYBACK_DIR_NAME, ACTUAL_IMAGES_DIR_NAME, self._builder_name) | 100 ROOT_PLAYBACK_DIR_NAME, IMAGERESULTS_DIR_NAME, self._builder_name) |
121 | |
122 def PlaybackActualSummariesDir(self): | |
123 """Returns the relative storage playback JSON-summary output directory.""" | |
124 return posixpath.join( | |
125 ROOT_PLAYBACK_DIR_NAME, ACTUAL_SUMMARIES_DIR_NAME, self._builder_name) | |
126 | |
127 def PlaybackExpectedSummariesDir(self): | |
128 """Returns the relative storage playback JSON-summary input directory.""" | |
129 return posixpath.join( | |
130 ROOT_PLAYBACK_DIR_NAME, EXPECTED_SUMMARIES_DIR_NAME, self._builder_name) | |
131 | 101 |
132 def PlaybackPerfDataDir(self): | 102 def PlaybackPerfDataDir(self): |
133 """Returns the relative playback perf data directory.""" | 103 """Returns the relative playback perf data directory.""" |
134 return posixpath.join( | 104 return posixpath.join( |
135 ROOT_PLAYBACK_DIR_NAME, 'perfdata', self._builder_name, 'data') | 105 ROOT_PLAYBACK_DIR_NAME, 'perfdata', self._builder_name, 'data') |
136 | 106 |
137 def PlaybackPerfGraphsDir(self): | 107 def PlaybackPerfGraphsDir(self): |
138 """Returns the relative playback perf graphs directory.""" | 108 """Returns the relative playback perf graphs directory.""" |
139 return posixpath.join( | 109 return posixpath.join( |
140 ROOT_PLAYBACK_DIR_NAME, 'perfdata', self._builder_name, 'graphs') | 110 ROOT_PLAYBACK_DIR_NAME, 'perfdata', self._builder_name, 'graphs') |
OLD | NEW |