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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 REPO_URL='https://chromium.googlesource.com/chromium/src.git', | 85 REPO_URL='https://chromium.googlesource.com/chromium/src.git', |
86 Internal=False, | 86 Internal=False, |
87 **recipe_config.get('chromium_config_kwargs', | 87 **recipe_config.get('chromium_config_kwargs', |
88 {'BUILD_CONFIG': 'Release'})) | 88 {'BUILD_CONFIG': 'Release'})) |
89 api.chromium.apply_config(recipe_config['chromium_config']) | 89 api.chromium.apply_config(recipe_config['chromium_config']) |
90 | 90 |
91 | 91 |
92 def GenSteps(api): | 92 def GenSteps(api): |
93 buildername = api.properties['buildername'] | 93 buildername = api.properties['buildername'] |
94 recipe_config = DETERMINISTIC_BUILDERS[buildername] | 94 recipe_config = DETERMINISTIC_BUILDERS[buildername] |
| 95 enable_isolate = True |
95 | 96 |
96 targets = recipe_config.get('targets', ['chromium_swarm_tests']) | 97 targets = recipe_config.get('targets', ['chromium_swarm_tests']) |
97 if recipe_config.get('chromium_config_kwargs'): | 98 if recipe_config.get('chromium_config_kwargs'): |
98 target_platform = recipe_config['chromium_config_kwargs'].get( | 99 target_platform = recipe_config['chromium_config_kwargs'].get( |
99 'TARGET_PLATFORM') | 100 'TARGET_PLATFORM') |
100 else: | 101 else: |
101 target_platform = recipe_config.get('platform') | 102 target_platform = recipe_config.get('platform') |
102 | 103 |
103 if target_platform in ('linux', 'mac', 'win'): | 104 if target_platform in ('linux', 'mac', 'win'): |
104 ConfigureChromiumBuilder(api, recipe_config) | 105 ConfigureChromiumBuilder(api, recipe_config) |
105 elif target_platform is 'android': | 106 elif target_platform is 'android': |
| 107 # Disable the tests isolation on Android as it's not supported yet. |
| 108 enable_isolate = False |
106 ConfigureAndroidBuilder(api, recipe_config) | 109 ConfigureAndroidBuilder(api, recipe_config) |
107 api.chromium_android.init_and_sync() | 110 api.chromium_android.init_and_sync() |
108 | 111 |
109 # Enable test isolation. Modifies GYP_DEFINES used in 'runhooks' below. | 112 if enable_isolate: |
110 api.isolate.set_isolate_environment(api.chromium.c) | 113 # Enable test isolation. Modifies GYP_DEFINES used in 'runhooks' below. |
| 114 api.isolate.set_isolate_environment(api.chromium.c) |
111 | 115 |
112 # Do a first build and move the build artifact to the temp directory. | 116 # Do a first build and move the build artifact to the temp directory. |
113 api.chromium.runhooks() | 117 api.chromium.runhooks() |
114 api.chromium.compile(targets, force_clobber=True, name='First build') | 118 api.chromium.compile(targets, force_clobber=True, name='First build') |
115 api.isolate.remove_build_metadata() | 119 api.isolate.remove_build_metadata() |
116 # This archives the results and regenerate the .isolated files. | 120 if enable_isolate: |
117 api.isolate.isolate_tests(api.chromium.output_dir) | 121 # This archives the results and regenerate the .isolated files. |
| 122 api.isolate.isolate_tests(api.chromium.output_dir) |
118 MoveBuildDirectory(api, str(api.chromium.output_dir), | 123 MoveBuildDirectory(api, str(api.chromium.output_dir), |
119 str(api.chromium.output_dir).rstrip('\\/') + '.1') | 124 str(api.chromium.output_dir).rstrip('\\/') + '.1') |
120 | 125 |
121 # Do the second build and move the build artifact to the temp directory. | 126 # Do the second build and move the build artifact to the temp directory. |
122 api.chromium.runhooks() | 127 api.chromium.runhooks() |
123 api.chromium.compile(targets, force_clobber=True, name='Second build') | 128 api.chromium.compile(targets, force_clobber=True, name='Second build') |
124 api.isolate.remove_build_metadata() | 129 api.isolate.remove_build_metadata() |
125 # This should be quick if the build is indeed deterministic. | 130 if enable_isolate: |
126 api.isolate.isolate_tests(api.chromium.output_dir) | 131 # This should be quick if the build is indeed deterministic. |
| 132 api.isolate.isolate_tests(api.chromium.output_dir) |
127 MoveBuildDirectory(api, str(api.chromium.output_dir), | 133 MoveBuildDirectory(api, str(api.chromium.output_dir), |
128 str(api.chromium.output_dir).rstrip('\\/') + '.2') | 134 str(api.chromium.output_dir).rstrip('\\/') + '.2') |
129 | 135 |
130 # Compare the artifacts from the 2 builds, raise an exception if they're | 136 # Compare the artifacts from the 2 builds, raise an exception if they're |
131 # not equals. | 137 # not equals. |
132 # TODO(sebmarchand): Do a smarter comparison. | 138 # TODO(sebmarchand): Do a smarter comparison. |
133 api.isolate.compare_build_artifacts( | 139 api.isolate.compare_build_artifacts( |
134 str(api.chromium.output_dir).rstrip('\\/') + '.1', | 140 str(api.chromium.output_dir).rstrip('\\/') + '.1', |
135 str(api.chromium.output_dir).rstrip('\\/') + '.2') | 141 str(api.chromium.output_dir).rstrip('\\/') + '.2') |
136 | 142 |
137 | 143 |
138 def _sanitize_nonalpha(text): | 144 def _sanitize_nonalpha(text): |
139 return ''.join(c if c.isalnum() else '_' for c in text) | 145 return ''.join(c if c.isalnum() else '_' for c in text) |
140 | 146 |
141 | 147 |
142 def GenTests(api): | 148 def GenTests(api): |
143 mastername = 'chromium.swarm' | 149 mastername = 'chromium.swarm' |
144 for buildername in DETERMINISTIC_BUILDERS: | 150 for buildername in DETERMINISTIC_BUILDERS: |
145 test_name = 'full_%s_%s' % (_sanitize_nonalpha(mastername), | 151 test_name = 'full_%s_%s' % (_sanitize_nonalpha(mastername), |
146 _sanitize_nonalpha(buildername)) | 152 _sanitize_nonalpha(buildername)) |
147 yield ( | 153 yield ( |
148 api.test(test_name) + | 154 api.test(test_name) + |
149 api.properties.scheduled() + | 155 api.properties.scheduled() + |
150 api.properties.generic(buildername=buildername, | 156 api.properties.generic(buildername=buildername, |
151 mastername=mastername) + | 157 mastername=mastername) + |
152 api.platform(DETERMINISTIC_BUILDERS[buildername]['platform'], 32) + | 158 api.platform(DETERMINISTIC_BUILDERS[buildername]['platform'], 32) + |
153 api.properties(configuration='Release') + | 159 api.properties(configuration='Release') + |
154 api.step_data('remove_build_metadata', retcode=1) | 160 api.step_data('remove_build_metadata', retcode=1) |
155 ) | 161 ) |
OLD | NEW |