| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 DEPS = [ | 5 DEPS = [ |
| 6 'chromium', | 6 'chromium', |
| 7 'depot_tools/bot_update', | 7 'depot_tools/bot_update', |
| 8 'depot_tools/gclient', | 8 'depot_tools/gclient', |
| 9 'gitiles', | 9 'gitiles', |
| 10 'recipe_engine/generator_script', | 10 'recipe_engine/generator_script', |
| 11 'recipe_engine/path', | 11 'recipe_engine/path', |
| 12 'recipe_engine/platform', | 12 'recipe_engine/platform', |
| 13 'recipe_engine/properties', | 13 'recipe_engine/properties', |
| 14 'recipe_engine/python', | 14 'recipe_engine/python', |
| 15 ] | 15 ] |
| 16 | 16 |
| 17 from recipe_engine.recipe_api import Property |
| 18 |
| 19 PROPERTIES = { |
| 20 'platform': Property(default=None, kind=str), |
| 21 } |
| 22 |
| 17 | 23 |
| 18 def _CheckoutSteps(api): | 24 def _CheckoutSteps(api): |
| 19 """Checks out the catapult repo (and any dependencies) using gclient.""" | 25 """Checks out the catapult repo (and any dependencies) using gclient.""" |
| 20 api.gclient.set_config('catapult') | 26 api.gclient.set_config('catapult') |
| 21 api.bot_update.ensure_checkout(force=True) | 27 api.bot_update.ensure_checkout(force=True) |
| 22 api.gclient.runhooks() | 28 api.gclient.runhooks() |
| 23 | 29 |
| 24 | 30 |
| 25 def _FetchAppEngineSDKSteps(api): | 31 def _FetchAppEngineSDKSteps(api): |
| 26 """Fetches the App Engine SDK and returns its path. | 32 """Fetches the App Engine SDK and returns its path. |
| 27 | 33 |
| 28 This uses a downloader script in the infra repo to download a script | 34 This uses a downloader script in the infra repo to download a script |
| 29 which is then used to download and unpack the SDK itself. | 35 which is then used to download and unpack the SDK itself. |
| 30 """ | 36 """ |
| 31 script_content = api.gitiles.download_file( | 37 script_content = api.gitiles.download_file( |
| 32 'https://chromium.googlesource.com/infra/infra', | 38 'https://chromium.googlesource.com/infra/infra', |
| 33 'bootstrap/get_appengine.py', | 39 'bootstrap/get_appengine.py', |
| 34 step_name='Fetch SDK downloader', | 40 step_name='Fetch SDK downloader', |
| 35 # This is a commit after the latest fix to the script, | 41 # This is a commit after the latest fix to the script, |
| 36 # which includes retrying requests. | 42 # which includes retrying requests. |
| 37 branch='fd119c547fd4e56eeab77d138b0426022ae1d159') | 43 branch='fd119c547fd4e56eeab77d138b0426022ae1d159') |
| 38 api.python.inline('Run SDK downloader', script_content, args=['--dest=.']) | 44 api.python.inline('Run SDK downloader', script_content, args=['--dest=.']) |
| 39 return api.path['slave_build'].join('google_appengine') | 45 return api.path['slave_build'].join('google_appengine') |
| 40 | 46 |
| 41 | 47 |
| 42 def _RemoteSteps(api, app_engine_sdk_path): | 48 def _RemoteSteps(api, app_engine_sdk_path, platform): |
| 43 """Runs the build steps specified in catapult_build/build_steps.py. | 49 """Runs the build steps specified in catapult_build/build_steps.py. |
| 44 | 50 |
| 45 Steps are specified in catapult repo in order to avoid multi-sided patches | 51 Steps are specified in catapult repo in order to avoid multi-sided patches |
| 46 when updating tests and adding/moving directories. | 52 when updating tests and adding/moving directories. |
| 47 | 53 |
| 48 This step uses the generator_script; see documentation at | 54 This step uses the generator_script; see documentation at |
| 49 github.com/luci/recipes-py/blob/master/recipe_modules/generator_script/api.py | 55 github.com/luci/recipes-py/blob/master/recipe_modules/generator_script/api.py |
| 50 | 56 |
| 51 Use the test_checkout_path property in local tests to run against a local | 57 Use the test_checkout_path property in local tests to run against a local |
| 52 copy of catapult_build/build_steps.py. | 58 copy of catapult_build/build_steps.py. |
| 53 """ | 59 """ |
| 54 base = api.properties.get('test_checkout_path', str(api.path['checkout'])) | 60 base = api.properties.get('test_checkout_path', str(api.path['checkout'])) |
| 55 script = api.path.join(base, 'catapult_build', 'build_steps.py') | 61 script = api.path.join(base, 'catapult_build', 'build_steps.py') |
| 56 args = [ | 62 args = [ |
| 57 script, | 63 script, |
| 58 '--api-path-checkout', api.path['checkout'], | 64 '--api-path-checkout', api.path['checkout'], |
| 59 '--app-engine-sdk-pythonpath', app_engine_sdk_path, | 65 '--app-engine-sdk-pythonpath', app_engine_sdk_path, |
| 60 '--platform', api.platform.name, | 66 '--platform', platform or api.platform.name, |
| 61 ] | 67 ] |
| 62 return api.generator_script(*args) | 68 return api.generator_script(*args) |
| 63 | 69 |
| 64 | 70 |
| 65 def RunSteps(api): | 71 def RunSteps(api, platform): |
| 66 _CheckoutSteps(api) | 72 _CheckoutSteps(api) |
| 67 | 73 |
| 68 # The dashboard unit tests depend on Python modules in the App Engine SDK, | 74 # The dashboard unit tests depend on Python modules in the App Engine SDK, |
| 69 # and the unit test runner script assumes that the SDK is in PYTHONPATH. | 75 # and the unit test runner script assumes that the SDK is in PYTHONPATH. |
| 70 sdk_path = _FetchAppEngineSDKSteps(api) | 76 sdk_path = _FetchAppEngineSDKSteps(api) |
| 71 app_engine_sdk_path = api.path.pathsep.join([ | 77 app_engine_sdk_path = api.path.pathsep.join([ |
| 72 '%(PYTHONPATH)s', str(sdk_path)]) | 78 '%(PYTHONPATH)s', str(sdk_path)]) |
| 73 _RemoteSteps(api, app_engine_sdk_path) | 79 _RemoteSteps(api, app_engine_sdk_path, platform) |
| 74 | 80 |
| 75 | 81 |
| 76 def GenTests(api): | 82 def GenTests(api): |
| 77 yield ( | 83 yield ( |
| 78 api.test('basic') + | 84 api.test('basic') + |
| 79 api.properties(mastername='master.client.catapult', | 85 api.properties(mastername='master.client.catapult', |
| 80 buildername='windows', | 86 buildername='windows', |
| 81 slavename='windows_slave') + | 87 slavename='windows_slave') + |
| 82 api.step_data('Fetch SDK downloader', | 88 api.step_data('Fetch SDK downloader', |
| 83 api.gitiles.make_encoded_file( | 89 api.gitiles.make_encoded_file( |
| 84 '"<simulated contents of get_appengine.py>"')) + | 90 '"<simulated contents of get_appengine.py>"')) + |
| 85 api.generator_script( | 91 api.generator_script( |
| 86 'build_steps.py', | 92 'build_steps.py', |
| 87 {'name': 'Dashboard Tests', 'cmd': ['run_py_tests', '--no-hooks']}, | 93 {'name': 'Dashboard Tests', 'cmd': ['run_py_tests', '--no-hooks']}, |
| 88 ) | 94 ) |
| 89 ) | 95 ) |
| 96 |
| 97 yield ( |
| 98 api.test('android') + |
| 99 api.properties(mastername='master.client.catapult', |
| 100 buildername='android', |
| 101 slavename='android_slave', |
| 102 platform='android') + |
| 103 api.step_data('Fetch SDK downloader', |
| 104 api.gitiles.make_encoded_file( |
| 105 '"<simulated contents of get_appengine.py>"')) + |
| 106 api.generator_script( |
| 107 'build_steps.py', |
| 108 {'name': 'Dashboard Tests', 'cmd': ['run_py_tests', '--no-hooks']}, |
| 109 ) |
| 110 ) |
| OLD | NEW |