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

Side by Side Diff: scripts/slave/recipe_modules/generator_script/api.py

Issue 23889036: Refactor the way that TestApi works so that it is actually useful. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: License headers Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 from slave import recipe_api 5 from slave import recipe_api
6 6
7 class GeneratorScriptApi(recipe_api.RecipeApi): 7 class GeneratorScriptApi(recipe_api.RecipeApi):
8 def __call__(self, path_to_script, *args): # pragma: no cover 8 def __call__(self, path_to_script, *args): # pragma: no cover
9 """Run a script and generate the steps emitted by that script.""" 9 """Run a script and generate the steps emitted by that script."""
10 f = '--output-json'
10 step_name = 'gen step(%s)' % self.m.path.basename(path_to_script) 11 step_name = 'gen step(%s)' % self.m.path.basename(path_to_script)
11 if path_to_script.endswith('.py'): 12 if path_to_script.endswith('.py'):
12 yield self.m.python( 13 yield self.m.python(
13 step_name, 14 step_name,
14 path_to_script, list(args) + [self.m.json.output()], 15 path_to_script, list(args) + [f, self.m.json.output()],
15 cwd=self.m.path.checkout()) 16 cwd=self.m.path.checkout())
16 else: 17 else:
17 yield self.m.step( 18 yield self.m.step(
18 step_name, 19 step_name,
19 [path_to_script,] + list(args) + [self.m.json.output()], 20 [path_to_script,] + list(args) + [f, self.m.json.output()],
20 cwd=self.m.path.checkout()) 21 cwd=self.m.path.checkout())
21 new_steps = self.m.step_history.last_step().json.output 22 new_steps = self.m.step_history.last_step().json.output
22 assert isinstance(new_steps, list) 23 assert isinstance(new_steps, list)
23 yield new_steps 24 yield new_steps
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/gclient/example.py ('k') | scripts/slave/recipe_modules/generator_script/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698