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

Unified Diff: scripts/slave/recipe_modules/chromium_tests/steps.py

Issue 1588793002: Support variable substitution and tryserver- and waterfall-only cmd line args. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: scripts/slave/recipe_modules/chromium_tests/steps.py
diff --git a/scripts/slave/recipe_modules/chromium_tests/steps.py b/scripts/slave/recipe_modules/chromium_tests/steps.py
index 66782df336c5a40018d3e680dce7d84b4bef86b1..4b0485d675fc1986eb7c2a6b7e7fcd20a0ffab79 100644
--- a/scripts/slave/recipe_modules/chromium_tests/steps.py
+++ b/scripts/slave/recipe_modules/chromium_tests/steps.py
@@ -347,8 +347,24 @@ class LocalGTestTest(Test):
return self._test_runs[suffix].test_utils.gtest_results.failures
-def generate_gtest(api, mastername, buildername, test_spec,
- enable_swarming=False, scripts_compile_targets=None):
+def get_args_for_test(api, chromium_tests_api, test_spec, bot_update_step):
+ args = test_spec.get('args', [])
+ if chromium_tests_api.is_precommit_mode():
+ args = args + test_spec.get('precommit_args', [])
+ else:
+ args = args + test_spec.get('non_precommit_args', [])
+ # Perform substitution of known variables.
+ substitutions = {
+ 'builder_name': api.properties.get('buildername'),
+ 'master_name': api.properties.get('mastername'),
Sergey Berezin 2016/01/14 01:39:34 nit: IMHO, master name is an implementation detail
iannucci 2016/01/15 01:48:10 What sergey said is true... That said, if we're
+ 'build_revision': bot_update_step.presentation.properties['got_revision']
+ }
+ return [string.Template(arg).safe_substitute(substitutions) for arg in args]
+
+
+def generate_gtest(api, chromium_tests_api, mastername, buildername, test_spec,
+ bot_update_step, enable_swarming=False,
+ scripts_compile_targets=None):
def canonicalize_test(test):
if isinstance(test, basestring):
canonical_test = {'test': test}
@@ -364,7 +380,7 @@ def generate_gtest(api, mastername, buildername, test_spec,
test_spec.get(buildername, {}).get('gtest_tests', [])]
for test in get_tests(api):
- args = test.get('args', [])
+ args = get_args_for_test(api, chromium_tests_api, test, bot_update_step)
if test['shard_index'] != 0 or test['total_shards'] != 1:
args.extend(['--test-launcher-shard-index=%d' % test['shard_index'],
'--test-launcher-total-shards=%d' % test['total_shards']])
@@ -394,14 +410,16 @@ def generate_gtest(api, mastername, buildername, test_spec,
override_compile_targets=override_compile_targets)
-def generate_script(api, mastername, buildername, test_spec,
- enable_swarming=False, scripts_compile_targets=None):
+def generate_script(api, chromium_tests_api, mastername, buildername, test_spec,
+ bot_update_step, enable_swarming=False,
+ scripts_compile_targets=None):
for script_spec in test_spec.get(buildername, {}).get('scripts', []):
yield ScriptTest(
str(script_spec['name']),
script_spec['script'],
scripts_compile_targets, # pragma: no cover
- script_spec.get('args', []))
+ get_args_for_test(
+ api, chromium_tests_api, script_spec, bot_update_step))
class DynamicPerfTests(Test):
@@ -1116,8 +1134,8 @@ class SwarmingIsolatedScriptTest(SwarmingTest):
return valid, failures
-def generate_isolated_script(api, mastername, buildername, test_spec,
- enable_swarming=False,
+def generate_isolated_script(api, chromium_tests_api, mastername, buildername,
+ test_spec, bot_update_step, enable_swarming=False,
scripts_compile_targets=None):
for spec in test_spec.get(buildername, {}).get('isolated_scripts', []):
use_swarming = False
@@ -1130,7 +1148,7 @@ def generate_isolated_script(api, mastername, buildername, test_spec,
swarming_shards = swarming_spec.get('shards', 1)
swarming_dimension_sets = swarming_spec.get('dimension_sets')
name = str(spec['name'])
- args = args=spec.get('args', [])
+ args = get_args_for_test(api, chromium_tests_api, spec, bot_update_step)
target_name = spec['isolate_name']
# This features is only needed for the cases in which the *_run compile
# target is needed to generate isolate files that contains dynamically libs.

Powered by Google App Engine
This is Rietveld 408576698