| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 """Upload results from running skimage.""" | 6 """Upload results from running skimage.""" |
| 7 | 7 |
| 8 import build_step | 8 import build_step |
| 9 import os | 9 import os |
| 10 import posixpath | 10 import posixpath |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 """ | 37 """ |
| 38 build_step.BuildStep.__init__(self, timeout=timeout, | 38 build_step.BuildStep.__init__(self, timeout=timeout, |
| 39 no_output_timeout=no_output_timeout, | 39 no_output_timeout=no_output_timeout, |
| 40 **kwargs) | 40 **kwargs) |
| 41 | 41 |
| 42 self._dest_gsbase = (self._args.get('dest_gsbase') or | 42 self._dest_gsbase = (self._args.get('dest_gsbase') or |
| 43 sync_bucket_subdir.DEFAULT_PERFDATA_GS_BASE) | 43 sync_bucket_subdir.DEFAULT_PERFDATA_GS_BASE) |
| 44 | 44 |
| 45 def _Run(self): | 45 def _Run(self): |
| 46 if self._do_upload_results: | 46 if self._do_upload_results: |
| 47 # Copy actual-results.json to skimage/output/actuals | 47 # Copy actual-results.json to skimage/actuals |
| 48 print '\n\n====Uploading skimage actual-results to Google Storage====\n\n' | 48 print '\n\n====Uploading skimage actual-results to Google Storage====\n\n' |
| 49 src_dir = os.path.abspath(os.path.join(self._skimage_out_dir, | 49 src_dir = os.path.abspath(os.path.join(self._skimage_out_dir, |
| 50 self._builder_name)) | 50 self._builder_name)) |
| 51 dest_dir = posixpath.join( | 51 dest_dir = posixpath.join( |
| 52 skia_vars.GetGlobalVariable('googlestorage_bucket'), | 52 skia_vars.GetGlobalVariable('googlestorage_bucket'), |
| 53 'skimage', 'actuals') | 53 'skimage', 'actuals') |
| 54 http_header_lines = ['Cache-Control:public,max-age=3600'] | 54 http_header_lines = ['Cache-Control:public,max-age=3600'] |
| 55 gs_utils.CopyStorageDirectory(src_dir=src_dir, | 55 gs_utils.CopyStorageDirectory(src_dir=src_dir, |
| 56 dest_dir=dest_dir, | 56 dest_dir=dest_dir, |
| 57 gs_acl='public-read', | 57 gs_acl='public-read', |
| 58 http_header_lines=http_header_lines) | 58 http_header_lines=http_header_lines) |
| 59 | 59 |
| 60 # Copy actual images and expectations to Google Storage. | 60 # Copy actual images to Google Storage at skimage/output. This will merge |
| 61 # TODO(scroggo): This step uploads both the expectations and the | 61 # with the existing files. |
| 62 # mismatches, even though the expectations files were already uploaded | |
| 63 # in the above step. Once skimage is rewritten to include the hash digest | |
| 64 # in the filename, rewrite this to upload a folder (named <input image>) | |
| 65 # containing the result (named <hash digest>.png), much like | |
| 66 # upload_gm_results. | |
| 67 print '\n\n========Uploading skimage results to Google Storage=======\n\n' | 62 print '\n\n========Uploading skimage results to Google Storage=======\n\n' |
| 68 relative_dir = posixpath.join('skimage', 'output', self._builder_name) | 63 src_dir = os.path.abspath(os.path.join(self._skimage_out_dir, 'images')) |
| 69 gs_utils.UploadDirectoryContentsIfChanged( | 64 dest_dir = posixpath.join( |
| 70 gs_base=self._dest_gsbase, | 65 skia_vars.GetGlobalVariable('googlestorage_bucket'), |
| 71 gs_relative_dir=relative_dir, | 66 'skimage', 'output') |
| 72 gs_acl=PLAYBACK_CANNED_ACL, | 67 gs_utils.CopyStorageDirectory(src_dir=src_dir, |
| 73 force_upload=True, | 68 dest_dir=dest_dir, |
| 74 local_dir=self._skimage_out_dir) | 69 gs_acl=PLAYBACK_CANNED_ACL) |
| 75 | 70 |
| 76 if '__main__' == __name__: | 71 if '__main__' == __name__: |
| 77 sys.exit(BuildStep.RunBuildStep(UploadSKImageResults)) | 72 sys.exit(BuildStep.RunBuildStep(UploadSKImageResults)) |
| OLD | NEW |