Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ Prepare runtime resources that are needed by Test builders but not | 6 """ Prepare runtime resources that are needed by Test builders but not |
| 7 Bench builders. """ | 7 Bench builders. """ |
| 8 | 8 |
| 9 from build_step import BuildStep | 9 from build_step import BuildStep |
| 10 import build_step | 10 import build_step |
| 11 # builder_name_schema must be imported after build_step so the PYTHONPATH will | 11 # builder_name_schema must be imported after build_step so the PYTHONPATH will |
| 12 # be set properly to import it. | 12 # be set properly to import it. |
| 13 import builder_name_schema | 13 import builder_name_schema |
| 14 import os | 14 import os |
| 15 import sys | 15 import sys |
| 16 | 16 |
| 17 | 17 |
| 18 class PreRender(BuildStep): | 18 class PreRender(BuildStep): |
| 19 | 19 |
| 20 def _Run(self): | 20 def _RunBeforeGenerateGMs(self): |
| 21 # Prepare directory to hold GM expectations. | 21 # Prepare directory to hold GM expectations. |
| 22 self._flavor_utils.CreateCleanDeviceDirectory( | 22 self._flavor_utils.CreateCleanDeviceDirectory( |
| 23 self._device_dirs.GMExpectedDir()) | 23 self._device_dirs.GMExpectedDir()) |
| 24 | 24 |
| 25 # Push the GM expectations JSON file to the device. | 25 # Push the GM expectations JSON file to the device. |
| 26 device_gm_expectations_path = self._flavor_utils.DevicePathJoin( | 26 device_gm_expectations_path = self._flavor_utils.DevicePathJoin( |
| 27 self._device_dirs.GMExpectedDir(), build_step.GM_EXPECTATIONS_FILENAME) | 27 self._device_dirs.GMExpectedDir(), build_step.GM_EXPECTATIONS_FILENAME) |
| 28 repo_gm_expectations_path = os.path.join( | 28 repo_gm_expectations_path = os.path.join( |
| 29 self._gm_expected_dir, build_step.GM_EXPECTATIONS_FILENAME) | 29 self._gm_expected_dir, build_step.GM_EXPECTATIONS_FILENAME) |
| 30 if os.path.exists(repo_gm_expectations_path): | 30 if os.path.exists(repo_gm_expectations_path): |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 46 self._flavor_utils.PushFileToDevice(repo_ignore_failures_path, | 46 self._flavor_utils.PushFileToDevice(repo_ignore_failures_path, |
| 47 device_ignore_failures_path) | 47 device_ignore_failures_path) |
| 48 else: | 48 else: |
| 49 print('Missing ignore_failures_file %s' % repo_ignore_failures_path) | 49 print('Missing ignore_failures_file %s' % repo_ignore_failures_path) |
| 50 | 50 |
| 51 # Prepare directory to hold GM actuals. | 51 # Prepare directory to hold GM actuals. |
| 52 self._flavor_utils.CreateCleanHostDirectory(self._gm_actual_dir) | 52 self._flavor_utils.CreateCleanHostDirectory(self._gm_actual_dir) |
| 53 self._flavor_utils.CreateCleanDeviceDirectory( | 53 self._flavor_utils.CreateCleanDeviceDirectory( |
| 54 self._flavor_utils.DevicePathJoin(self._device_dirs.GMActualDir(), | 54 self._flavor_utils.DevicePathJoin(self._device_dirs.GMActualDir(), |
| 55 self._builder_name)) | 55 self._builder_name)) |
| 56 self._flavor_utils.CreateCleanHostDirectory(self.skp_out_dir) | |
| 57 self._flavor_utils.CreateCleanDeviceDirectory(self._device_dirs.SKPOutDir()) | |
| 58 | 56 |
| 57 def _RunBeforeRunDecodingTests(self): | |
| 59 # Copy expectations file and images to decode in skimage to device. | 58 # Copy expectations file and images to decode in skimage to device. |
| 60 self._flavor_utils.CreateCleanDeviceDirectory( | 59 self._flavor_utils.CreateCleanDeviceDirectory( |
| 61 self._device_dirs.SKImageExpectedDir()) | 60 self._device_dirs.SKImageExpectedDir()) |
| 62 skimage_subdir = builder_name_schema.GetWaterfallBot(self._builder_name) | 61 skimage_subdir = builder_name_schema.GetWaterfallBot(self._builder_name) |
| 63 skimage_expected_filename = build_step.GM_EXPECTATIONS_FILENAME | 62 skimage_expected_filename = build_step.GM_EXPECTATIONS_FILENAME |
| 64 | 63 |
| 65 skimage_host_expectations = os.path.join(self._skimage_expected_dir, | 64 skimage_host_expectations = os.path.join(self._skimage_expected_dir, |
| 66 skimage_subdir, | 65 skimage_subdir, |
| 67 skimage_expected_filename) | 66 skimage_expected_filename) |
| 68 | 67 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 81 # check can go away. | 80 # check can go away. |
| 82 if skimage_device_expectations != skimage_host_expectations: | 81 if skimage_device_expectations != skimage_host_expectations: |
| 83 # Create the subdir on the device. | 82 # Create the subdir on the device. |
| 84 self._flavor_utils.CreateCleanDeviceDirectory(skimage_device_subdir) | 83 self._flavor_utils.CreateCleanDeviceDirectory(skimage_device_subdir) |
| 85 self._flavor_utils.PushFileToDevice(skimage_host_expectations, | 84 self._flavor_utils.PushFileToDevice(skimage_host_expectations, |
| 86 skimage_device_expectations) | 85 skimage_device_expectations) |
| 87 | 86 |
| 88 self._flavor_utils.CopyDirectoryContentsToDevice( | 87 self._flavor_utils.CopyDirectoryContentsToDevice( |
| 89 self._skimage_in_dir, self._device_dirs.SKImageInDir()) | 88 self._skimage_in_dir, self._device_dirs.SKImageInDir()) |
| 90 | 89 |
| 91 | |
| 92 # Create a directory for the output of skimage | 90 # Create a directory for the output of skimage |
| 93 self._flavor_utils.CreateCleanHostDirectory(self._skimage_out_dir) | 91 self._flavor_utils.CreateCleanHostDirectory(self._skimage_out_dir) |
| 94 self._flavor_utils.CreateCleanDeviceDirectory( | 92 self._flavor_utils.CreateCleanDeviceDirectory( |
| 95 self._device_dirs.SKImageOutDir()) | 93 self._device_dirs.SKImageOutDir()) |
| 96 | 94 |
| 95 def _RunBeforeRenderSKPs(self): | |
| 96 # SKP files have already been installed by DownloadSKPs, so we don't need | |
| 97 # to do that here. | |
| 98 | |
| 99 # Install JSON summaries of image expectations. | |
| 100 if not os.path.isdir(self.playback_expected_summaries_dir): | |
|
epoger
2014/05/21 17:10:42
I think patchset 2 will fix the error seen in http
| |
| 101 os.makedirs(self.playback_expected_summaries_dir) | |
| 102 self._flavor_utils.CopyDirectoryContentsToDevice( | |
| 103 self.playback_expected_summaries_dir, | |
| 104 self._device_dirs.PlaybackExpectedSummariesDir()) | |
| 105 | |
| 106 # Prepare directory to hold actually-generated images. | |
| 107 self._flavor_utils.CreateCleanHostDirectory( | |
| 108 self.playback_actual_images_dir) | |
| 109 self._flavor_utils.CreateCleanDeviceDirectory( | |
| 110 self._device_dirs.PlaybackActualImagesDir()) | |
| 111 | |
| 112 # Prepare directory to hold JSON summaries of actually-generated images. | |
| 113 self._flavor_utils.CreateCleanHostDirectory( | |
| 114 self.playback_actual_summaries_dir) | |
| 115 self._flavor_utils.CreateCleanDeviceDirectory( | |
| 116 self._device_dirs.PlaybackActualSummariesDir()) | |
| 117 | |
| 118 def _Run(self): | |
| 119 self._RunBeforeGenerateGMs() | |
| 120 self._RunBeforeRunDecodingTests() | |
| 121 self._RunBeforeRenderSKPs() | |
| 122 | |
| 97 | 123 |
| 98 if '__main__' == __name__: | 124 if '__main__' == __name__: |
| 99 sys.exit(BuildStep.RunBuildStep(PreRender)) | 125 sys.exit(BuildStep.RunBuildStep(PreRender)) |
| OLD | NEW |