Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: scripts/slave/recipes/chromium_mojo.py

Issue 1412173008: Add simple build archiving for Mandoline binaries. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Use api.file.read and exec() instead of execfile for test_data. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | scripts/slave/recipes/chromium_mojo.expected/full_chromium_mojo_Chromium_Mojo_Android.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import re 5 import re
6 6
7 from recipe_engine.types import freeze 7 from recipe_engine.types import freeze
8 from recipe_engine import recipe_api 8 from recipe_engine import recipe_api
9 9
10 DEPS = [ 10 DEPS = [
11 'bot_update', 11 'bot_update',
12 'chromium', 12 'chromium',
13 'chromium_android', 13 'chromium_android',
14 'file',
14 'gsutil', 15 'gsutil',
15 'raw_io', 16 'raw_io',
16 'path', 17 'path',
17 'platform', 18 'platform',
18 'properties', 19 'properties',
19 'python', 20 'python',
20 'step', 21 'step',
21 ] 22 ]
22 23
23 24
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 # Check if the current version is already uploaded for the given platform. 118 # Check if the current version is already uploaded for the given platform.
118 bucket = 'mandoline' 119 bucket = 'mandoline'
119 url = 'gs://%s/%s' % (bucket, version) 120 url = 'gs://%s/%s' % (bucket, version)
120 result = api.gsutil.ls(bucket, '', stdout=api.raw_io.output()) 121 result = api.gsutil.ls(bucket, '', stdout=api.raw_io.output())
121 result.presentation.logs['ls result stdout'] = [result.stdout or ''] 122 result.presentation.logs['ls result stdout'] = [result.stdout or '']
122 if result.stdout and url in result.stdout: 123 if result.stdout and url in result.stdout:
123 result = api.gsutil.ls(bucket, version, stdout=api.raw_io.output()) 124 result = api.gsutil.ls(bucket, version, stdout=api.raw_io.output())
124 result.presentation.logs['ls result stdout'] = [result.stdout or ''] 125 result.presentation.logs['ls result stdout'] = [result.stdout or '']
125 url = '%s/%s' % (url, api.chromium.c.TARGET_PLATFORM) 126 url = '%s/%s' % (url, api.chromium.c.TARGET_PLATFORM)
126 127
127 api.step('upload_mandoline', None)
128 if result.stdout and url in result.stdout: 128 if result.stdout and url in result.stdout:
129 api.step.active_result.presentation.step_text = 'Skipping; already uploaded' 129 api.step('skipping mandoline upload: release already exits', None)
130 return 130 return
131 131
132 path = '%s/%s' % (version, api.chromium.c.TARGET_PLATFORM) 132 # Read a limited FILES.cfg file-list format, uploading each applicable entry.
133 name = 'Mandoline.apk' 133 files = api.path['checkout'].join('mandoline', 'tools', 'data', 'FILES.cfg')
134 local_path = api.chromium.output_dir.join('apks', name) 134 test_data = 'FILES=[{\'filepath\': \'foo\', \'platforms\': [\'linux\'],},]'
135 remote_path = '%s/%s' % (path, name) 135 files_data = api.file.read('read FILES.cfg', files, test_data=test_data)
136 api.gsutil.upload(local_path, bucket, remote_path) 136 execution_globals = {}
137 exec(files_data, execution_globals)
138 gs_path = '%s/%s' % (version, api.chromium.c.TARGET_PLATFORM)
139 for file_dictionary in execution_globals['FILES']:
140 if api.chromium.c.TARGET_PLATFORM in file_dictionary['platforms']:
141 file_path = file_dictionary['filepath']
142 local_path = api.chromium.output_dir.join(file_path)
143 remote_path = '%s/%s' % (gs_path, file_path)
144 args = ['-r'] if file_dictionary.get('directory', False) else []
145 api.gsutil.upload(local_path, bucket, remote_path, args=args)
137 146
138 147
139 @recipe_api.composite_step 148 @recipe_api.composite_step
140 def _RunApptests(api): 149 def _RunApptests(api):
141 runner = api.path['checkout'].join('mojo', 'tools', 'apptest_runner.py') 150 runner = api.path['checkout'].join('mojo', 'tools', 'apptest_runner.py')
142 api.python('app_tests', runner, [api.chromium.output_dir, '--verbose']) 151 api.python('app_tests', runner, [api.chromium.output_dir, '--verbose'])
143 152
144 153
145 def _RunUnitAndAppTests(api): 154 def _RunUnitAndAppTests(api):
146 with api.step.defer_results(): 155 with api.step.defer_results():
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 api.chromium.compile(targets=['mandoline:all']) 218 api.chromium.compile(targets=['mandoline:all'])
210 219
211 if api.chromium.c.TARGET_PLATFORM == 'android': 220 if api.chromium.c.TARGET_PLATFORM == 'android':
212 api.chromium_android.detect_and_setup_devices() 221 api.chromium_android.detect_and_setup_devices()
213 222
214 bot_config = _GetBotConfig(api) 223 bot_config = _GetBotConfig(api)
215 if bot_config.get('run_perf_tests', False): 224 if bot_config.get('run_perf_tests', False):
216 _RunPerfTests(api, bot_config['perf_test_info']) 225 _RunPerfTests(api, bot_config['perf_test_info'])
217 else: 226 else:
218 _RunUnitAndAppTests(api) 227 _RunUnitAndAppTests(api)
219 # TODO(msw): Upload binaries on Windows and Linux. 228 _UploadMandolineToGoogleStorage(api)
220 if api.chromium.c.TARGET_PLATFORM == 'android':
221 _UploadMandolineToGoogleStorage(api)
222 229
223 230
224 def GenTests(api): 231 def GenTests(api):
225 for test in api.chromium.gen_tests_for_builders(BUILDERS): 232 for test in api.chromium.gen_tests_for_builders(BUILDERS):
226 yield test 233 yield test
227 234
228 # Ensure upload is skipped if version/platform binaries are already uploaded. 235 # Ensure upload is skipped if version/platform binaries are already uploaded.
229 test = api.test('test_upload_skipped_for_existing_binaries') 236 test = api.test('test_upload_skipped_for_existing_binaries')
230 test += api.platform.name('linux') 237 test += api.platform.name('linux')
231 test += api.properties.generic(buildername='Chromium Mojo Android', 238 test += api.properties.generic(buildername='Chromium Mojo Android',
232 mastername='chromium.mojo') 239 mastername='chromium.mojo')
233 # This relies on api.chromium.get_version's hard-coded step_test_data version. 240 # This relies on api.chromium.get_version's hard-coded step_test_data version.
234 test_ls = api.raw_io.output('gs://mandoline/37.0.2021.0/android/') 241 test_ls = api.raw_io.output('gs://mandoline/37.0.2021.0/android/')
235 test += api.step_data('gsutil ls gs://mandoline/', stdout=test_ls) 242 test += api.step_data('gsutil ls gs://mandoline/', stdout=test_ls)
236 test += api.step_data('gsutil ls gs://mandoline/37.0.2021.0', stdout=test_ls) 243 test += api.step_data('gsutil ls gs://mandoline/37.0.2021.0', stdout=test_ls)
237 yield test 244 yield test
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipes/chromium_mojo.expected/full_chromium_mojo_Chromium_Mojo_Android.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698