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

Side by Side Diff: scripts/slave/recipes/infra/recipe_simulation.py

Issue 2064453002: add recipe continuous builders for each repo with recipes (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 6 months 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 | « scripts/slave/recipe_modules/recipe_tryjob/api.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 """A continious builder for build repo which simulates recipes.""" 4 """A continious builder for build repo which simulates recipes."""
5 5
6 from recipe_engine.recipe_api import Property
7
6 DEPS = [ 8 DEPS = [
7 'depot_tools/bot_update', 9 'depot_tools/bot_update',
8 'depot_tools/gclient', 10 'depot_tools/gclient',
9 'recipe_engine/path', 11 'recipe_engine/path',
10 'recipe_engine/properties', 12 'recipe_engine/properties',
11 'recipe_engine/python', 13 'recipe_engine/python',
14 'luci_config',
12 ] 15 ]
13 16
17 def _python(self, name, script, args, **kwargs):
martiniss 2016/06/11 02:20:30 ignore this
18 """Call python from infra's virtualenv.
14 19
15 def RunSteps(api): 20 This is needed because of the coverage module, which is not installed by
16 api.gclient.set_config('build') 21 default, but which infra's python has installed."""
17 api.bot_update.ensure_checkout(force=True) 22 return self.m.step(name, [
18 recipes_py = api.path['checkout'].join('scripts', 'slave', 'recipes.py') 23 self.m.path['checkout'].join('ENV', 'bin', 'python'),
19 api.python('recipe fetch deps', recipes_py, ['fetch']) 24 '-u', script] + args, **kwargs)
20 # In theory, this should work too. But in practice, this fails to import
21 # coverage module (http://crbug.com/577049).
22 # api.python('recipe simulation test', recipes_py, ['simulation_test'])
23 recipe_simulation_test = api.path['checkout'].join(
24 'scripts', 'slave', 'unittests', 'recipe_simulation_test.py')
25 api.python('recipe simulation test', recipe_simulation_test, ['test'])
26 25
26 PROPERTIES = {
27 'project_under_test': Property(
28 default='build', kind=str, help='luci-config project to run tests for')
29 }
30
31
32 def RunSteps(api, project_under_test):
33 cache_dir = api.path['checkout'].join('_cache_dir')
34
35 # Needed to set up the infra checkout for infra python, which has coverage.
36 c = api.gclient.make_config('infra', CACHE_DIR=cache_dir)
37 c.solutions[0].revision = 'origin/master'
38 api.bot_update.ensure_checkout(
39 force=True, gclient_config=c, cwd=api.path['checkout'].join(
40 'custom_infra'))
41
42 c = api.gclient.make_config(CACHE_DIR=cache_dir)
43 soln = c.solutions.add()
44 soln.name = project_under_test
45 soln.url = api.luci_config.get_project_metadata(
46 project_under_test)['repo_url']
47
48 api.bot_update.ensure_checkout(
49 force=True, gclient_config=c,
50 cwd=api.path['checkout'])
51
52 # TODO(martiniss): allow recipes.cfg patches to take affect
53 # This requires getting the refs.cfg from luci_config, reading the local
54 # patched version, etc.
55 result = api.luci_config.get_project_config(project_under_test, 'recipes.cfg')
56 recipes_cfg = parse_protobuf(result['content'].split('\n'))
martiniss 2016/06/11 02:20:30 should i move this function to the luci_config rec
Vadim Sh. 2016/06/11 02:25:05 luci-config can store any kinds of smallish files,
martiniss 2016/06/11 02:33:14 Ok. WDYT of adding something like luci_config.get_
57 path = recipes_cfg['recipes_path'][0].split('/')
58
59 api.step(
60 'recipe simulation test', [
61 api.path['checkout'].join('custom_infra', 'ENV', 'bin', 'python'),
62 api.path['checkout'].join(
63 (project_under_test,) + path + ('recipes.py')),
64 'simulation_test'
65 ])
27 66
28 def GenTests(api): 67 def GenTests(api):
29 yield ( 68 yield (
30 api.test('normal') + 69 api.test('normal') +
31 api.properties.generic( 70 api.properties.generic(
32 mastername='chromium.tools.build', 71 mastername='chromium.tools.build',
33 buildername='recipe simulation tester', 72 buildername='recipe simulation tester',
34 revision='deadbeaf', 73 revision='deadbeaf',
35 ) 74 )
36 ) 75 )
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/recipe_tryjob/api.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698