| 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..21aca63ed459f3ca35d01e9809eb81df0d8a373f 100644
|
| --- a/scripts/slave/recipes/infra/recipe_simulation.py
|
| +++ b/scripts/slave/recipes/infra/recipe_simulation.py
|
| @@ -1,7 +1,9 @@
|
| # Copyright 2016 The Chromium Authors. All rights reserved.
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
| -"""A continious builder for build repo which simulates recipes."""
|
| +"""A continuous builder which runs recipe tests."""
|
| +
|
| +from recipe_engine.recipe_api import Property
|
|
|
| DEPS = [
|
| 'depot_tools/bot_update',
|
| @@ -9,21 +11,42 @@ DEPS = [
|
| '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')
|
| +
|
| + 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_textproto(result['content'].split('\n'))
|
| + path = recipes_cfg['recipes_path'][0].split('/')
|
|
|
| + api.step(
|
| + 'recipe simulation test', [
|
| + root_dir.join(*([project_under_test] + path + ['recipes.py'])),
|
| + '--use-bootstrap', 'simulation_test'
|
| + ])
|
|
|
| def GenTests(api):
|
| yield (
|
| @@ -32,5 +55,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"')
|
| )
|
|
|