Chromium Code Reviews| Index: scripts/slave/recipes/infra/recipe_simulation.py |
| diff --git a/scripts/slave/recipes/infra/recipe_simulation.py b/scripts/slave/recipes/infra/recipe_simulation.py |
| index 7283e3a183c4398271289d88923fa4f1d2732815..c15a16404b4cd17c9aecd07bdffc3fbfa6dad610 100644 |
| --- a/scripts/slave/recipes/infra/recipe_simulation.py |
| +++ b/scripts/slave/recipes/infra/recipe_simulation.py |
| @@ -3,27 +3,59 @@ |
| # found in the LICENSE file. |
| """A continious builder for build repo which simulates recipes.""" |
|
tandrii(chromium)
2016/06/14 12:22:51
update doc
martiniss
2016/06/14 23:11:33
Done.
|
| +from recipe_engine.recipe_api import Property |
| + |
| DEPS = [ |
| 'depot_tools/bot_update', |
| 'depot_tools/gclient', |
| 'recipe_engine/path', |
| 'recipe_engine/properties', |
| 'recipe_engine/python', |
| + 'recipe_engine/step', |
| + 'luci_config', |
| ] |
| +PROPERTIES = { |
| + 'project_under_test': Property( |
| + default='build', kind=str, help='luci-config project to run tests for') |
| +} |
| + |
| + |
| +def RunSteps(api, project_under_test): |
| + root_dir = api.path['slave_build'] |
| + cache_dir = root_dir.join('_cache_dir') |
| + |
| + # Needed to set up the infra checkout for infra python, which has coverage. |
|
tandrii(chromium)
2016/06/14 12:22:51
bleh, isn't that slow every time running runhooks
martiniss
2016/06/14 23:11:33
Done in https://codereview.chromium.org/2061263003
|
| + c = api.gclient.make_config('infra', CACHE_DIR=cache_dir) |
| + c.solutions[0].revision = 'origin/master' |
|
tandrii(chromium)
2016/06/14 12:22:51
and why not a fixed revision? I don't see a need t
|
| + api.bot_update.ensure_checkout( |
| + force=True, gclient_config=c, cwd=root_dir.join('custom_infra')) |
| + |
| + cache_dir = root_dir.join('_cache_dir') |
|
tandrii(chromium)
2016/06/14 12:22:51
remove line, it's a dup
martiniss
2016/06/14 23:11:34
Done.
|
| + |
| + c = api.gclient.make_config(CACHE_DIR=cache_dir) |
| + soln = c.solutions.add() |
| + soln.name = project_under_test |
| + soln.url = api.luci_config.get_project_metadata( |
| + project_under_test)['repo_url'] |
| + |
| + api.bot_update.ensure_checkout( |
| + force=True, gclient_config=c, |
| + cwd=root_dir) |
| -def RunSteps(api): |
| - api.gclient.set_config('build') |
| - api.bot_update.ensure_checkout(force=True) |
| - recipes_py = api.path['checkout'].join('scripts', 'slave', 'recipes.py') |
| - api.python('recipe fetch deps', recipes_py, ['fetch']) |
| - # In theory, this should work too. But in practice, this fails to import |
| - # coverage module (http://crbug.com/577049). |
| - # api.python('recipe simulation test', recipes_py, ['simulation_test']) |
| - recipe_simulation_test = api.path['checkout'].join( |
| - 'scripts', 'slave', 'unittests', 'recipe_simulation_test.py') |
| - api.python('recipe simulation test', recipe_simulation_test, ['test']) |
| + # TODO(martiniss): allow recipes.cfg patches to take affect |
| + # This requires getting the refs.cfg from luci_config, reading the local |
| + # patched version, etc. |
| + result = api.luci_config.get_project_config(project_under_test, 'recipes.cfg') |
| + recipes_cfg = api.luci_config.parse_protobuf(result['content'].split('\n')) |
| + path = recipes_cfg['recipes_path'][0].split('/') |
| + api.step( |
| + 'recipe simulation test', [ |
| + root_dir.join('custom_infra', 'ENV', 'bin', 'python'), |
| + root_dir.join(*([project_under_test] + path + ['recipes.py'])), |
| + 'simulation_test' |
| + ]) |
| def GenTests(api): |
| yield ( |
| @@ -32,5 +64,10 @@ def GenTests(api): |
| mastername='chromium.tools.build', |
| buildername='recipe simulation tester', |
| revision='deadbeaf', |
| - ) |
| + project_under_test='build', |
| + ) + |
| + api.luci_config.get_projects(('build',)) + |
| + api.luci_config.get_project_config( |
| + 'build', 'recipes.cfg', |
| + 'recipes_path: "foobar"') |
| ) |