| 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 """Encapsulations all required directories for skp playback BuildSteps.""" | 5 """Encapsulations all required directories for skp playback BuildSteps.""" |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import posixpath | 8 import posixpath |
| 9 | 9 |
| 10 | 10 |
| 11 # The playback root directory name will be used both locally and on Google | 11 # The playback root directory name will be used both locally and on Google |
| 12 # Storage. | 12 # Storage. |
| 13 ROOT_PLAYBACK_DIR_NAME = 'playback' | 13 ROOT_PLAYBACK_DIR_NAME = 'playback' |
| 14 # The skpictures directory name will be used both locally and on Google Storage. | 14 # The skpictures directory name will be used both locally and on Google Storage. |
| 15 SKPICTURES_DIR_NAME = 'skps' | 15 SKPICTURES_DIR_NAME = 'skps' |
| 16 | 16 |
| 17 | 17 |
| 18 class SkpPlaybackDirs(object): | 18 class SkpPlaybackDirs(object): |
| 19 """Interface for required directories for skp playback BuildSteps.""" | 19 """Interface for required directories for skp playback BuildSteps.""" |
| 20 | 20 |
| 21 def __init__(self, builder_name, gm_image_subdir, perf_output_basedir): | 21 def __init__(self, builder_name, perf_output_basedir): |
| 22 """Create an instance of SkpPlaybackDirs.""" | 22 """Create an instance of SkpPlaybackDirs.""" |
| 23 self._builder_name = builder_name | 23 self._builder_name = builder_name |
| 24 self._gm_image_subdir = gm_image_subdir | |
| 25 self._perf_output_basedir = perf_output_basedir | 24 self._perf_output_basedir = perf_output_basedir |
| 26 | 25 |
| 27 def PlaybackRootDir(self): | 26 def PlaybackRootDir(self): |
| 28 raise NotImplementedError("PlaybackRootDir is unimplemented!") | 27 raise NotImplementedError("PlaybackRootDir is unimplemented!") |
| 29 | 28 |
| 30 def PlaybackSkpDir(self): | 29 def PlaybackSkpDir(self): |
| 31 raise NotImplementedError("PlaybackSkpDir is unimplemented!") | 30 raise NotImplementedError("PlaybackSkpDir is unimplemented!") |
| 32 | 31 |
| 33 def PlaybackGmActualDir(self): | 32 def PlaybackGmActualDir(self): |
| 34 raise NotImplementedError("PlaybackGmActualDir is unimplemented") | 33 raise NotImplementedError("PlaybackGmActualDir is unimplemented") |
| 35 | 34 |
| 36 def PlaybackGmExpectedDir(self): | 35 def PlaybackGmExpectedDir(self): |
| 37 raise NotImplementedError("PlaybackGmExpectedDir is unimplemented") | 36 raise NotImplementedError("PlaybackGmExpectedDir is unimplemented") |
| 38 | 37 |
| 39 def PlaybackPerfDataDir(self): | 38 def PlaybackPerfDataDir(self): |
| 40 raise NotImplementedError("PlaybackPerfDataDir is unimplemented") | 39 raise NotImplementedError("PlaybackPerfDataDir is unimplemented") |
| 41 | 40 |
| 42 def PlaybackPerfGraphsDir(self): | 41 def PlaybackPerfGraphsDir(self): |
| 43 raise NotImplementedError("PlaybackPerfGraphsDir is unimplemented") | 42 raise NotImplementedError("PlaybackPerfGraphsDir is unimplemented") |
| 44 | 43 |
| 45 | 44 |
| 46 class LocalSkpPlaybackDirs(SkpPlaybackDirs): | 45 class LocalSkpPlaybackDirs(SkpPlaybackDirs): |
| 47 """Encapsulates all required local dirs for skp playback BuildSteps.""" | 46 """Encapsulates all required local dirs for skp playback BuildSteps.""" |
| 48 | 47 |
| 49 def __init__(self, builder_name, gm_image_subdir, perf_output_basedir): | 48 def __init__(self, builder_name, perf_output_basedir): |
| 50 """Create an instance of LocalSkpPlaybackDirs.""" | 49 """Create an instance of LocalSkpPlaybackDirs.""" |
| 51 SkpPlaybackDirs.__init__(self, builder_name, gm_image_subdir, | 50 SkpPlaybackDirs.__init__(self, builder_name, perf_output_basedir) |
| 52 perf_output_basedir) | |
| 53 | 51 |
| 54 self._local_playback_root_dir = os.path.abspath( | 52 self._local_playback_root_dir = os.path.abspath( |
| 55 os.path.join(os.pardir, ROOT_PLAYBACK_DIR_NAME)) | 53 os.path.join(os.pardir, ROOT_PLAYBACK_DIR_NAME)) |
| 56 | 54 |
| 57 def PlaybackRootDir(self): | 55 def PlaybackRootDir(self): |
| 58 """Returns the local playback root directory.""" | 56 """Returns the local playback root directory.""" |
| 59 return self._local_playback_root_dir | 57 return self._local_playback_root_dir |
| 60 | 58 |
| 61 def PlaybackSkpDir(self): | 59 def PlaybackSkpDir(self): |
| 62 """Returns the local playback skp directory.""" | 60 """Returns the local playback skp directory.""" |
| 63 return os.path.join( | 61 return os.path.join( |
| 64 self._local_playback_root_dir, SKPICTURES_DIR_NAME) | 62 self._local_playback_root_dir, SKPICTURES_DIR_NAME) |
| 65 | 63 |
| 66 def PlaybackGmActualDir(self): | 64 def PlaybackGmActualDir(self): |
| 67 """Returns the local playback gm-actual directory.""" | 65 """Returns the local playback gm-actual directory.""" |
| 68 return os.path.join( | 66 return os.path.join( |
| 69 self._local_playback_root_dir, 'gm-actual', | 67 self._local_playback_root_dir, 'gm-actual', |
| 70 self._builder_name) | 68 self._builder_name) |
| 71 | 69 |
| 72 def PlaybackGmExpectedDir(self): | 70 def PlaybackGmExpectedDir(self): |
| 73 """Returns the local playback gm-expected directory.""" | 71 """Returns the local playback gm-expected directory.""" |
| 74 return os.path.join( | 72 return os.path.join( |
| 75 self._local_playback_root_dir, 'gm-expected', self._gm_image_subdir) | 73 self._local_playback_root_dir, 'gm-expected', self._builder_name) |
| 76 | 74 |
| 77 def PlaybackPerfDataDir(self): | 75 def PlaybackPerfDataDir(self): |
| 78 """Returns the local playback perf data directory.""" | 76 """Returns the local playback perf data directory.""" |
| 79 return os.path.abspath(os.path.join( | 77 return os.path.abspath(os.path.join( |
| 80 self._perf_output_basedir, ROOT_PLAYBACK_DIR_NAME, | 78 self._perf_output_basedir, ROOT_PLAYBACK_DIR_NAME, |
| 81 self._builder_name, 'data')) if self._perf_output_basedir else None | 79 self._builder_name, 'data')) if self._perf_output_basedir else None |
| 82 | 80 |
| 83 def PlaybackPerfGraphsDir(self): | 81 def PlaybackPerfGraphsDir(self): |
| 84 """Returns the local playback perf graphs directory.""" | 82 """Returns the local playback perf graphs directory.""" |
| 85 return os.path.abspath(os.path.join( | 83 return os.path.abspath(os.path.join( |
| 86 self._perf_output_basedir, ROOT_PLAYBACK_DIR_NAME, | 84 self._perf_output_basedir, ROOT_PLAYBACK_DIR_NAME, |
| 87 self._builder_name, 'graphs')) if self._perf_output_basedir else None | 85 self._builder_name, 'graphs')) if self._perf_output_basedir else None |
| 88 | 86 |
| 89 | 87 |
| 90 class StorageSkpPlaybackDirs(SkpPlaybackDirs): | 88 class StorageSkpPlaybackDirs(SkpPlaybackDirs): |
| 91 """Encapsulates all required storage dirs for skp playback BuildSteps.""" | 89 """Encapsulates all required storage dirs for skp playback BuildSteps.""" |
| 92 | 90 |
| 93 def __init__(self, builder_name, gm_image_subdir, perf_output_basedir): | 91 def __init__(self, builder_name, perf_output_basedir): |
| 94 """Create an instance of StorageSkpPlaybackDirs.""" | 92 """Create an instance of StorageSkpPlaybackDirs.""" |
| 95 SkpPlaybackDirs.__init__(self, builder_name, gm_image_subdir, | 93 SkpPlaybackDirs.__init__(self, builder_name, perf_output_basedir) |
| 96 perf_output_basedir) | |
| 97 | 94 |
| 98 def PlaybackRootDir(self): | 95 def PlaybackRootDir(self): |
| 99 """Returns the relative storage playback root directory.""" | 96 """Returns the relative storage playback root directory.""" |
| 100 return ROOT_PLAYBACK_DIR_NAME | 97 return ROOT_PLAYBACK_DIR_NAME |
| 101 | 98 |
| 102 def PlaybackSkpDir(self): | 99 def PlaybackSkpDir(self): |
| 103 """Returns the relative storage playback skp directory.""" | 100 """Returns the relative storage playback skp directory.""" |
| 104 return posixpath.join(ROOT_PLAYBACK_DIR_NAME, SKPICTURES_DIR_NAME) | 101 return posixpath.join(ROOT_PLAYBACK_DIR_NAME, SKPICTURES_DIR_NAME) |
| 105 | 102 |
| 106 def PlaybackGmActualDir(self): | 103 def PlaybackGmActualDir(self): |
| 107 """Returns the relative storage playback gm-actual directory.""" | 104 """Returns the relative storage playback gm-actual directory.""" |
| 108 return posixpath.join( | 105 return posixpath.join( |
| 109 ROOT_PLAYBACK_DIR_NAME, 'gm-actual', self._gm_image_subdir, | 106 ROOT_PLAYBACK_DIR_NAME, 'gm-actual', self._builder_name) |
| 110 self._builder_name, self._gm_image_subdir) | |
| 111 | 107 |
| 112 def PlaybackGmExpectedDir(self): | 108 def PlaybackGmExpectedDir(self): |
| 113 """Returns the relative storage playback gm-expected directory.""" | 109 """Returns the relative storage playback gm-expected directory.""" |
| 114 return posixpath.join( | 110 return posixpath.join( |
| 115 ROOT_PLAYBACK_DIR_NAME, 'gm-expected', self._gm_image_subdir) | 111 ROOT_PLAYBACK_DIR_NAME, 'gm-expected', self._builder_name) |
| 116 | 112 |
| 117 def PlaybackPerfDataDir(self): | 113 def PlaybackPerfDataDir(self): |
| 118 """Returns the relative playback perf data directory.""" | 114 """Returns the relative playback perf data directory.""" |
| 119 return posixpath.join( | 115 return posixpath.join( |
| 120 ROOT_PLAYBACK_DIR_NAME, 'perfdata', self._builder_name, 'data') | 116 ROOT_PLAYBACK_DIR_NAME, 'perfdata', self._builder_name, 'data') |
| 121 | 117 |
| 122 def PlaybackPerfGraphsDir(self): | 118 def PlaybackPerfGraphsDir(self): |
| 123 """Returns the relative playback perf graphs directory.""" | 119 """Returns the relative playback perf graphs directory.""" |
| 124 return posixpath.join( | 120 return posixpath.join( |
| 125 ROOT_PLAYBACK_DIR_NAME, 'perfdata', self._builder_name, 'graphs') | 121 ROOT_PLAYBACK_DIR_NAME, 'perfdata', self._builder_name, 'graphs') |
| 126 | |
| OLD | NEW |