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