Chromium Code Reviews| Index: scripts/slave/recipe_modules/chromium/steps.py |
| diff --git a/scripts/slave/recipe_modules/chromium/steps.py b/scripts/slave/recipe_modules/chromium/steps.py |
| index dabf74409065e474aece531c49a6a5124b8827f0..189c5bce1afb61a2e4be89caaa215954ef38f3b5 100644 |
| --- a/scripts/slave/recipe_modules/chromium/steps.py |
| +++ b/scripts/slave/recipe_modules/chromium/steps.py |
| @@ -3,6 +3,7 @@ |
| # found in the LICENSE file. |
| import re |
| +import string |
| class Test(object): |
| @@ -103,11 +104,12 @@ class ScriptTest(Test): # pylint: disable=W0232 |
| All new tests are strongly encouraged to use this infrastructure. |
| """ |
| - def __init__(self, name, script, all_compile_targets): |
| + def __init__(self, name, script, all_compile_targets, script_args=None): |
| super(ScriptTest, self).__init__() |
| self._name = name |
| self._script = script |
| self._all_compile_targets = all_compile_targets |
| + self._script_args = script_args |
| @property |
| def name(self): |
| @@ -115,7 +117,12 @@ class ScriptTest(Test): # pylint: disable=W0232 |
| def compile_targets(self, api): |
| try: |
| - return self._all_compile_targets[self._script] |
| + substitions = {} |
|
Ken Russell (switch to Gerrit)
2015/02/25 19:07:24
typo: substitions / substitutions
shatch
2015/02/25 19:21:11
Done.
|
| + if self._script_args: |
| + substitions = {'name': self._script_args[0]} |
| + |
| + return [string.Template(s).safe_substitute(substitions) |
| + for s in self._all_compile_targets[self._script]] |
| except KeyError: |
| # Not all scripts will have test data inside recipes, |
| # so return a default value. |
| @@ -139,6 +146,9 @@ class ScriptTest(Test): # pylint: disable=W0232 |
| ]) |
| try: |
| + script_args = [] |
| + if self._script_args: |
| + script_args = ['--args', api.json.input(self._script_args)] |
| api.python( |
| name, |
| # Enforce that all scripts are in the specified directory |
| @@ -146,6 +156,7 @@ class ScriptTest(Test): # pylint: disable=W0232 |
| api.path['checkout'].join( |
| 'testing', 'scripts', api.path.basename(self._script)), |
| args=(api.chromium.get_common_args_for_scripts() + |
| + script_args + |
| ['run', '--output', api.json.output()] + |
| run_args), |
| step_test_data=lambda: api.json.test_api.output( |
| @@ -324,7 +335,8 @@ def generate_script(api, mastername, buildername, test_spec, |
| yield ScriptTest( |
| str(script_spec['name']), |
| script_spec['script'], |
| - scripts_compile_targets) |
| + scripts_compile_targets, |
| + script_spec.get('args', [])) |
| class DynamicPerfTests(Test): |