| 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 """Compares the GM images from archived webpages to the baselines. | 6 """Compares the GM images from archived webpages to the baselines. |
| 7 | 7 |
| 8 This module can be run from the command-line like this: | 8 This module can be run from the command-line like this: |
| 9 | 9 |
| 10 cd buildbot/third_party/chromium_buildbot/slave/\ | 10 cd buildbot/third_party/chromium_buildbot/slave/\ |
| 11 Test-Ubuntu12-ShuttleA-ATI5770-x86_64-Release/build/trunk | 11 Test-Ubuntu12-ShuttleA-ATI5770-x86_64-Release/build/trunk |
| 12 | 12 |
| 13 PYTHONPATH=../../../../site_config:\ | 13 PYTHONPATH=../../../../site_config:\ |
| 14 ../../../../scripts \ | 14 ../../../../scripts \ |
| 15 python ../../../../../../slave/skia_slave_scripts/\ | 15 python ../../../../../../slave/skia_slave_scripts/\ |
| 16 compare_and_upload_webpage_gms.py \ | 16 compare_and_upload_webpage_gms.py \ |
| 17 --configuration "Debug" --target_platform "" --revision 0 \ | 17 --configuration "Debug" --target_platform "" --revision 0 \ |
| 18 --autogen_svn_baseurl "" --make_flags "" --test_args "" --gm_args "" \ | 18 --autogen_svn_baseurl "" --make_flags "" --test_args "" --gm_args "" \ |
| 19 --bench_args "" --num_cores 8 --perf_output_basedir "" \ | 19 --bench_args "" --num_cores 8 --perf_output_basedir "" \ |
| 20 --builder_name Test-Ubuntu12-ShuttleA-ATI5770-x86_64-Release \ | 20 --builder_name Test-Ubuntu12-ShuttleA-ATI5770-x86_64-Release \ |
| 21 --got_revision 0 --gm_image_subdir base-shuttle_ubuntu12_ati5770 \ | 21 --got_revision 0 \ |
| 22 --is_try False --do_upload_results True --dest_gsbase gs://rmistry | 22 --is_try False --do_upload_results True --dest_gsbase gs://rmistry |
| 23 | 23 |
| 24 """ | 24 """ |
| 25 | 25 |
| 26 import os | 26 import os |
| 27 import posixpath | 27 import posixpath |
| 28 import shutil | 28 import shutil |
| 29 import sys | 29 import sys |
| 30 import tempfile | 30 import tempfile |
| 31 | 31 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 44 GM_COMPARISON_LINES_TO_EXTRACT_IMAGES = [ | 44 GM_COMPARISON_LINES_TO_EXTRACT_IMAGES = [ |
| 45 'have identical dimensions but some differing pixels', | 45 'have identical dimensions but some differing pixels', |
| 46 'have differing dimensions', | 46 'have differing dimensions', |
| 47 'not found in baseDir and found in comparisonDir', | 47 'not found in baseDir and found in comparisonDir', |
| 48 ] | 48 ] |
| 49 | 49 |
| 50 GM_COMPARISON_LINES_TO_DELETE_IMAGES = [ | 50 GM_COMPARISON_LINES_TO_DELETE_IMAGES = [ |
| 51 'found in baseDir and not found in comparisonDir', | 51 'found in baseDir and not found in comparisonDir', |
| 52 ] | 52 ] |
| 53 | 53 |
| 54 IMAGES_FOR_UPLOAD_CHUNKS = [ | |
| 55 'base-macmini', | |
| 56 'base-macmini-lion-float', | |
| 57 'base-macmini-10_8', | |
| 58 'base-shuttle_ubuntu12_ati5770', | |
| 59 ] | |
| 60 | |
| 61 | 54 |
| 62 class CompareAndUploadWebpageGMs(BuildStep): | 55 class CompareAndUploadWebpageGMs(BuildStep): |
| 63 | 56 |
| 64 def __init__( | 57 def __init__( |
| 65 self, | 58 self, |
| 66 timeout=build_step.DEFAULT_TIMEOUT * SKP_TIMEOUT_MULTIPLIER, | 59 timeout=build_step.DEFAULT_TIMEOUT * SKP_TIMEOUT_MULTIPLIER, |
| 67 no_output_timeout=( | 60 no_output_timeout=( |
| 68 build_step.DEFAULT_NO_OUTPUT_TIMEOUT * SKP_TIMEOUT_MULTIPLIER), | 61 build_step.DEFAULT_NO_OUTPUT_TIMEOUT * SKP_TIMEOUT_MULTIPLIER), |
| 69 **kwargs): | 62 **kwargs): |
| 70 """Constructs a RenderWebpagePictures BuildStep instance. | 63 """Constructs a RenderWebpagePictures BuildStep instance. |
| 71 | 64 |
| 72 timeout: maximum time allowed for this BuildStep. The default value here is | 65 timeout: maximum time allowed for this BuildStep. The default value here is |
| 73 increased because there could be a lot of skps' whose images have | 66 increased because there could be a lot of skps' whose images have |
| 74 to be copied over to Google Storage. | 67 to be copied over to Google Storage. |
| 75 no_output_timeout: maximum time allowed for this BuildStep to run without | 68 no_output_timeout: maximum time allowed for this BuildStep to run without |
| 76 any output. | 69 any output. |
| 77 """ | 70 """ |
| 78 build_step.BuildStep.__init__(self, timeout=timeout, | 71 build_step.BuildStep.__init__(self, timeout=timeout, |
| 79 no_output_timeout=no_output_timeout, | 72 no_output_timeout=no_output_timeout, |
| 80 **kwargs) | 73 **kwargs) |
| 81 | 74 |
| 82 self._dest_gsbase = (self._args.get('dest_gsbase') or | 75 self._dest_gsbase = (self._args.get('dest_gsbase') or |
| 83 sync_bucket_subdir.DEFAULT_PERFDATA_GS_BASE) | 76 sync_bucket_subdir.DEFAULT_PERFDATA_GS_BASE) |
| 84 | 77 |
| 85 self._upload_chunks = ( | 78 self._upload_chunks = True |
| 86 True if self._gm_image_subdir in IMAGES_FOR_UPLOAD_CHUNKS | |
| 87 else False) | |
| 88 | 79 |
| 89 # Check if gm-expected exists on Google Storage. | 80 # Check if gm-expected exists on Google Storage. |
| 90 self._gm_expected_exists_on_storage = gs_utils.DoesStorageObjectExist( | 81 self._gm_expected_exists_on_storage = gs_utils.DoesStorageObjectExist( |
| 91 posixpath.join(self._dest_gsbase, | 82 posixpath.join(self._dest_gsbase, |
| 92 self._storage_playback_dirs.PlaybackGmExpectedDir(), | 83 self._storage_playback_dirs.PlaybackGmExpectedDir(), |
| 93 gs_utils.TIMESTAMP_COMPLETED_FILENAME)) | 84 gs_utils.TIMESTAMP_COMPLETED_FILENAME)) |
| 94 # Check if gm-actual exists on Google Storage. | 85 # Check if gm-actual exists on Google Storage. |
| 95 self._gm_actual_exists_on_storage = gs_utils.DoesStorageObjectExist( | 86 self._gm_actual_exists_on_storage = gs_utils.DoesStorageObjectExist( |
| 96 posixpath.join(self._dest_gsbase, | 87 posixpath.join(self._dest_gsbase, |
| 97 self._storage_playback_dirs.PlaybackGmActualDir(), | 88 self._storage_playback_dirs.PlaybackGmActualDir(), |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 f = open(comparison_file, 'r') | 305 f = open(comparison_file, 'r') |
| 315 try: | 306 try: |
| 316 value = f.read() | 307 value = f.read() |
| 317 return value.strip() | 308 return value.strip() |
| 318 finally: | 309 finally: |
| 319 f.close() | 310 f.close() |
| 320 | 311 |
| 321 | 312 |
| 322 if '__main__' == __name__: | 313 if '__main__' == __name__: |
| 323 sys.exit(BuildStep.RunBuildStep(CompareAndUploadWebpageGMs)) | 314 sys.exit(BuildStep.RunBuildStep(CompareAndUploadWebpageGMs)) |
| OLD | NEW |