| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Recipe to test the deterministic build. | 5 """Recipe to test the deterministic build. |
| 6 | |
| 7 Waterfall page: https://build.chromium.org/p/chromium.swarm/waterfall | |
| 8 """ | 6 """ |
| 9 | 7 |
| 10 from infra.libs.infra_types import freeze | 8 from infra.libs.infra_types import freeze |
| 11 | 9 |
| 12 DEPS = [ | 10 DEPS = [ |
| 13 'bot_update', | 11 'bot_update', |
| 14 'chromium', | 12 'chromium', |
| 15 'chromium_android', | 13 'chromium_android', |
| 16 'gclient', | 14 'gclient', |
| 17 'isolate', | 15 'isolate', |
| (...skipping 30 matching lines...) Expand all Loading... |
| 48 'chromium_config': 'chromium', | 46 'chromium_config': 'chromium', |
| 49 'gclient_config': 'chromium', | 47 'gclient_config': 'chromium', |
| 50 'platform': 'win', | 48 'platform': 'win', |
| 51 }, | 49 }, |
| 52 'Windows Clang deterministic build': { | 50 'Windows Clang deterministic build': { |
| 53 'chromium_config': 'chromium_win_clang', | 51 'chromium_config': 'chromium_win_clang', |
| 54 'gclient_config': 'chromium', | 52 'gclient_config': 'chromium', |
| 55 'platform': 'win', | 53 'platform': 'win', |
| 56 }, | 54 }, |
| 57 }) | 55 }) |
| 56 DETERMINISTIC_BUILDERS['android_deterministic'] = ( |
| 57 DETERMINISTIC_BUILDERS['Android deterministic build']) |
| 58 DETERMINISTIC_BUILDERS['linux_deterministic'] = ( |
| 59 DETERMINISTIC_BUILDERS['Linux deterministic build']) |
| 60 DETERMINISTIC_BUILDERS['mac_deterministic'] = ( |
| 61 DETERMINISTIC_BUILDERS['Mac deterministic build']) |
| 62 DETERMINISTIC_BUILDERS['windows_deterministic'] = ( |
| 63 DETERMINISTIC_BUILDERS['Windows deterministic build']) |
| 58 | 64 |
| 59 | 65 |
| 60 def MoveBuildDirectory(api, src_dir, dst_dir): | 66 def MoveBuildDirectory(api, src_dir, dst_dir): |
| 61 api.python.inline('Move %s to %s' % (src_dir, dst_dir), | 67 api.python.inline('Move %s to %s' % (src_dir, dst_dir), |
| 62 """ | 68 """ |
| 63 import os | 69 import os |
| 64 import shutil | 70 import shutil |
| 65 import sys | 71 import sys |
| 66 if os.path.exists(sys.argv[2]): | 72 if os.path.exists(sys.argv[2]): |
| 67 shutil.rmtree(sys.argv[2]) | 73 shutil.rmtree(sys.argv[2]) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 api.chromium.compile(targets, force_clobber=True, name='Second build') | 139 api.chromium.compile(targets, force_clobber=True, name='Second build') |
| 134 api.isolate.remove_build_metadata() | 140 api.isolate.remove_build_metadata() |
| 135 if enable_isolate: | 141 if enable_isolate: |
| 136 # This should be quick if the build is indeed deterministic. | 142 # This should be quick if the build is indeed deterministic. |
| 137 api.isolate.isolate_tests(api.chromium.output_dir) | 143 api.isolate.isolate_tests(api.chromium.output_dir) |
| 138 MoveBuildDirectory(api, str(api.chromium.output_dir), | 144 MoveBuildDirectory(api, str(api.chromium.output_dir), |
| 139 str(api.chromium.output_dir).rstrip('\\/') + '.2') | 145 str(api.chromium.output_dir).rstrip('\\/') + '.2') |
| 140 | 146 |
| 141 # Compare the artifacts from the 2 builds, raise an exception if they're | 147 # Compare the artifacts from the 2 builds, raise an exception if they're |
| 142 # not equals. | 148 # not equals. |
| 143 # TODO(sebmarchand): Do a smarter comparison. | |
| 144 api.isolate.compare_build_artifacts( | 149 api.isolate.compare_build_artifacts( |
| 145 str(api.chromium.output_dir).rstrip('\\/') + '.1', | 150 str(api.chromium.output_dir).rstrip('\\/') + '.1', |
| 146 str(api.chromium.output_dir).rstrip('\\/') + '.2') | 151 str(api.chromium.output_dir).rstrip('\\/') + '.2') |
| 147 | 152 |
| 148 | 153 |
| 149 def _sanitize_nonalpha(text): | 154 def _sanitize_nonalpha(text): |
| 150 return ''.join(c if c.isalnum() else '_' for c in text) | 155 return ''.join(c if c.isalnum() else '_' for c in text) |
| 151 | 156 |
| 152 | 157 |
| 153 def GenTests(api): | 158 def GenTests(api): |
| 154 mastername = 'chromium.swarm' | 159 mastername = 'chromium.swarm' |
| 155 for buildername in DETERMINISTIC_BUILDERS: | 160 for buildername in DETERMINISTIC_BUILDERS: |
| 156 test_name = 'full_%s_%s' % (_sanitize_nonalpha(mastername), | 161 test_name = 'full_%s_%s' % (_sanitize_nonalpha(mastername), |
| 157 _sanitize_nonalpha(buildername)) | 162 _sanitize_nonalpha(buildername)) |
| 158 yield ( | 163 yield ( |
| 159 api.test(test_name) + | 164 api.test(test_name) + |
| 160 api.properties.scheduled() + | 165 api.properties.scheduled() + |
| 161 api.properties.generic(buildername=buildername, | 166 api.properties.generic(buildername=buildername, |
| 162 mastername=mastername) + | 167 mastername=mastername) + |
| 163 api.platform(DETERMINISTIC_BUILDERS[buildername]['platform'], 32) + | 168 api.platform(DETERMINISTIC_BUILDERS[buildername]['platform'], 32) + |
| 164 api.properties(configuration='Release') + | 169 api.properties(configuration='Release') + |
| 165 api.step_data('remove_build_metadata', retcode=1) | 170 api.step_data('remove_build_metadata', retcode=1) |
| 166 ) | 171 ) |
| OLD | NEW |