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