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 | 6 |
7 Waterfall page: https://build.chromium.org/p/chromium.swarm/waterfall | 7 Waterfall page: https://build.chromium.org/p/chromium.swarm/waterfall |
8 """ | 8 """ |
9 | 9 |
10 from infra.libs.infra_types import freeze | 10 from infra.libs.infra_types import freeze |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 {'BUILD_CONFIG': 'Release'})) | 88 {'BUILD_CONFIG': 'Release'})) |
89 api.chromium.apply_config('chromium_deterministic_build') | 89 api.chromium.apply_config('chromium_deterministic_build') |
90 for c in recipe_config.get('chromium_apply_config', []): | 90 for c in recipe_config.get('chromium_apply_config', []): |
91 api.chromium.apply_config(c) | 91 api.chromium.apply_config(c) |
92 | 92 |
93 api.gclient.set_config(recipe_config['gclient_config'], | 93 api.gclient.set_config(recipe_config['gclient_config'], |
94 **recipe_config.get('gclient_config_kwargs', {})) | 94 **recipe_config.get('gclient_config_kwargs', {})) |
95 for c in recipe_config.get('gclient_apply_config', []): | 95 for c in recipe_config.get('gclient_apply_config', []): |
96 api.gclient.apply_config(c) | 96 api.gclient.apply_config(c) |
97 | 97 |
| 98 # Enable test isolation. Modifies GYP_DEFINES used in 'runhooks' below. |
| 99 api.isolate.set_isolate_environment(api.chromium.c) |
| 100 |
98 # Checkout chromium. | 101 # Checkout chromium. |
99 api.bot_update.ensure_checkout(force=True) | 102 api.bot_update.ensure_checkout(force=True) |
100 | 103 |
101 # Do a first build and move the build artifact to the temp directory. | 104 # Do a first build and move the build artifact to the temp directory. |
102 api.chromium.runhooks() | 105 api.chromium.runhooks() |
103 api.chromium.compile(targets, force_clobber=True, name='First build') | 106 api.chromium.compile(targets, force_clobber=True, name='First build') |
104 api.isolate.remove_build_metadata() | 107 api.isolate.remove_build_metadata() |
| 108 # This archives the results and regenerate the .isolated files. |
| 109 api.isolate.isolate_tests(api.chromium.output_dir) |
105 MoveBuildDirectory(api, str(api.chromium.output_dir), | 110 MoveBuildDirectory(api, str(api.chromium.output_dir), |
106 str(api.chromium.output_dir).rstrip('\\/') + '.1') | 111 str(api.chromium.output_dir).rstrip('\\/') + '.1') |
107 | 112 |
108 # Do the second build and move the build artifact to the temp directory. | 113 # Do the second build and move the build artifact to the temp directory. |
109 api.chromium.runhooks() | 114 api.chromium.runhooks() |
110 api.chromium.compile(targets, force_clobber=True, name='Second build') | 115 api.chromium.compile(targets, force_clobber=True, name='Second build') |
111 api.isolate.remove_build_metadata() | 116 api.isolate.remove_build_metadata() |
| 117 # This should be quick if the build is indeed deterministic. |
| 118 api.isolate.isolate_tests(api.chromium.output_dir) |
112 MoveBuildDirectory(api, str(api.chromium.output_dir), | 119 MoveBuildDirectory(api, str(api.chromium.output_dir), |
113 str(api.chromium.output_dir).rstrip('\\/') + '.2') | 120 str(api.chromium.output_dir).rstrip('\\/') + '.2') |
114 | 121 |
115 # Compare the artifacts from the 2 builds, raise an exception if they're | 122 # Compare the artifacts from the 2 builds, raise an exception if they're |
116 # not equals. | 123 # not equals. |
117 # TODO(sebmarchand): Do a smarter comparison. | 124 # TODO(sebmarchand): Do a smarter comparison. |
118 api.isolate.compare_build_artifacts( | 125 api.isolate.compare_build_artifacts( |
119 str(api.chromium.output_dir).rstrip('\\/') + '.1', | 126 str(api.chromium.output_dir).rstrip('\\/') + '.1', |
120 str(api.chromium.output_dir).rstrip('\\/') + '.2') | 127 str(api.chromium.output_dir).rstrip('\\/') + '.2') |
121 | 128 |
122 | 129 |
123 def _sanitize_nonalpha(text): | 130 def _sanitize_nonalpha(text): |
124 return ''.join(c if c.isalnum() else '_' for c in text) | 131 return ''.join(c if c.isalnum() else '_' for c in text) |
125 | 132 |
126 | 133 |
127 def GenTests(api): | 134 def GenTests(api): |
128 mastername = 'chromium.swarm' | 135 mastername = 'chromium.swarm' |
129 for buildername in DETERMINISTIC_BUILDERS: | 136 for buildername in DETERMINISTIC_BUILDERS: |
130 test_name = 'full_%s_%s' % (_sanitize_nonalpha(mastername), | 137 test_name = 'full_%s_%s' % (_sanitize_nonalpha(mastername), |
131 _sanitize_nonalpha(buildername)) | 138 _sanitize_nonalpha(buildername)) |
132 yield ( | 139 yield ( |
133 api.test(test_name) + | 140 api.test(test_name) + |
134 api.properties.scheduled() + | 141 api.properties.scheduled() + |
135 api.properties.generic(buildername=buildername, | 142 api.properties.generic(buildername=buildername, |
136 mastername=mastername) + | 143 mastername=mastername) + |
137 api.platform(DETERMINISTIC_BUILDERS[buildername]['platform'], 32) + | 144 api.platform(DETERMINISTIC_BUILDERS[buildername]['platform'], 32) + |
138 api.properties(configuration='Release') + | 145 api.properties(configuration='Release') + |
139 api.step_data('remove_build_metadata', retcode=1) | 146 api.step_data('remove_build_metadata', retcode=1) |
140 ) | 147 ) |
OLD | NEW |