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 | |
11 | |
12 DEPS = [ | 8 DEPS = [ |
13 'bot_update', | 9 'bot_update', |
14 'chromium', | 10 'chromium', |
15 'chromium_android', | 11 'chromium_android', |
16 'gclient', | 12 'gclient', |
17 'isolate', | 13 'isolate', |
18 'json', | 14 'json', |
19 'path', | 15 'path', |
20 'platform', | 16 'platform', |
21 'properties', | 17 'properties', |
22 'python', | 18 'python', |
23 'step', | 19 'step', |
24 ] | 20 ] |
25 | 21 |
26 DETERMINISTIC_BUILDERS = freeze({ | 22 DETERMINISTIC_BUILDERS = { |
27 'Android deterministic build': { | 23 'Android deterministic build': { |
28 'chromium_config': 'android', | 24 'chromium_config': 'android', |
29 'chromium_config_kwargs': { | 25 'chromium_config_kwargs': { |
30 'BUILD_CONFIG': 'Release', | 26 'BUILD_CONFIG': 'Release', |
31 'TARGET_BITS': 32, | 27 'TARGET_BITS': 32, |
32 'TARGET_PLATFORM': 'android', | 28 'TARGET_PLATFORM': 'android', |
33 }, | 29 }, |
34 'platform': 'linux', | 30 'platform': 'linux', |
35 'targets': ['all'], | 31 'targets': ['all'], |
36 }, | 32 }, |
(...skipping 10 matching lines...) Expand all Loading... |
47 'Windows deterministic build': { | 43 'Windows deterministic build': { |
48 'chromium_config': 'chromium', | 44 'chromium_config': 'chromium', |
49 'gclient_config': 'chromium', | 45 'gclient_config': 'chromium', |
50 'platform': 'win', | 46 'platform': 'win', |
51 }, | 47 }, |
52 'Windows Clang deterministic build': { | 48 'Windows Clang deterministic build': { |
53 'chromium_config': 'chromium_win_clang', | 49 'chromium_config': 'chromium_win_clang', |
54 'gclient_config': 'chromium', | 50 'gclient_config': 'chromium', |
55 'platform': 'win', | 51 'platform': 'win', |
56 }, | 52 }, |
57 }) | 53 } |
| 54 DETERMINISTIC_BUILDERS['android_deterministic'] = ( |
| 55 DETERMINISTIC_BUILDERS['Android deterministic build']) |
| 56 DETERMINISTIC_BUILDERS['linux_deterministic'] = ( |
| 57 DETERMINISTIC_BUILDERS['Linux deterministic build']) |
| 58 DETERMINISTIC_BUILDERS['mac_deterministic'] = ( |
| 59 DETERMINISTIC_BUILDERS['Mac deterministic build']) |
| 60 DETERMINISTIC_BUILDERS['windows_deterministic'] = ( |
| 61 DETERMINISTIC_BUILDERS['Windows deterministic build']) |
58 | 62 |
59 | 63 |
60 def MoveBuildDirectory(api, src_dir, dst_dir): | 64 def MoveBuildDirectory(api, src_dir, dst_dir): |
61 api.python.inline('Move %s to %s' % (src_dir, dst_dir), | 65 api.python.inline('Move %s to %s' % (src_dir, dst_dir), |
62 """ | 66 """ |
63 import os | 67 import os |
64 import shutil | 68 import shutil |
65 import sys | 69 import sys |
66 if os.path.exists(sys.argv[2]): | 70 if os.path.exists(sys.argv[2]): |
67 shutil.rmtree(sys.argv[2]) | 71 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') | 137 api.chromium.compile(targets, force_clobber=True, name='Second build') |
134 api.isolate.remove_build_metadata() | 138 api.isolate.remove_build_metadata() |
135 if enable_isolate: | 139 if enable_isolate: |
136 # This should be quick if the build is indeed deterministic. | 140 # This should be quick if the build is indeed deterministic. |
137 api.isolate.isolate_tests(api.chromium.output_dir) | 141 api.isolate.isolate_tests(api.chromium.output_dir) |
138 MoveBuildDirectory(api, str(api.chromium.output_dir), | 142 MoveBuildDirectory(api, str(api.chromium.output_dir), |
139 str(api.chromium.output_dir).rstrip('\\/') + '.2') | 143 str(api.chromium.output_dir).rstrip('\\/') + '.2') |
140 | 144 |
141 # Compare the artifacts from the 2 builds, raise an exception if they're | 145 # Compare the artifacts from the 2 builds, raise an exception if they're |
142 # not equals. | 146 # not equals. |
143 # TODO(sebmarchand): Do a smarter comparison. | |
144 api.isolate.compare_build_artifacts( | 147 api.isolate.compare_build_artifacts( |
145 str(api.chromium.output_dir).rstrip('\\/') + '.1', | 148 str(api.chromium.output_dir).rstrip('\\/') + '.1', |
146 str(api.chromium.output_dir).rstrip('\\/') + '.2') | 149 str(api.chromium.output_dir).rstrip('\\/') + '.2') |
147 | 150 |
148 | 151 |
149 def _sanitize_nonalpha(text): | 152 def _sanitize_nonalpha(text): |
150 return ''.join(c if c.isalnum() else '_' for c in text) | 153 return ''.join(c if c.isalnum() else '_' for c in text) |
151 | 154 |
152 | 155 |
153 def GenTests(api): | 156 def GenTests(api): |
154 mastername = 'chromium.swarm' | 157 mastername = 'chromium.swarm' |
155 for buildername in DETERMINISTIC_BUILDERS: | 158 for buildername in DETERMINISTIC_BUILDERS: |
156 test_name = 'full_%s_%s' % (_sanitize_nonalpha(mastername), | 159 test_name = 'full_%s_%s' % (_sanitize_nonalpha(mastername), |
157 _sanitize_nonalpha(buildername)) | 160 _sanitize_nonalpha(buildername)) |
158 yield ( | 161 yield ( |
159 api.test(test_name) + | 162 api.test(test_name) + |
160 api.properties.scheduled() + | 163 api.properties.scheduled() + |
161 api.properties.generic(buildername=buildername, | 164 api.properties.generic(buildername=buildername, |
162 mastername=mastername) + | 165 mastername=mastername) + |
163 api.platform(DETERMINISTIC_BUILDERS[buildername]['platform'], 32) + | 166 api.platform(DETERMINISTIC_BUILDERS[buildername]['platform'], 32) + |
164 api.properties(configuration='Release') + | 167 api.properties(configuration='Release') + |
165 api.step_data('remove_build_metadata', retcode=1) | 168 api.step_data('remove_build_metadata', retcode=1) |
166 ) | 169 ) |
OLD | NEW |