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

Unified Diff: presubmit_support.py

Issue 54373011: Rework bot and test parsing to allow receipt of (bot, set(test)) specifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/trychange_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: presubmit_support.py
diff --git a/presubmit_support.py b/presubmit_support.py
index 8f3575cefca5f2f17706a9cb790141ba35f28b8d..52fae3a611aa8d223a76fefba764bc8ff062fca1 100755
--- a/presubmit_support.py
+++ b/presubmit_support.py
@@ -1032,13 +1032,21 @@ class GetTrySlavesExecuter(object):
(type(result), str(result)))
for item in result:
if not isinstance(item, basestring):
- raise PresubmitFailure('All try slaves names must be strings.')
- if item != item.strip():
+ if not isinstance(item, tuple):
+ raise PresubmitFailure('PRESUBMIT.py returned invalid tryslave/test'
+ ' format.')
+ # New-style [('bot', set(['tests']))] format.
+ botname = item[0]
+ else:
+ # Old-style ['bot'] format.
+ botname = item
+
+ if botname != botname.strip():
raise PresubmitFailure(
'Try slave names cannot start/end with whitespace')
- if ',' in item:
+ if ',' in botname:
raise PresubmitFailure(
- 'Do not use \',\' separated builder or test names: %s' % item)
+ 'Do not use \',\' separated builder or test names: %s' % botname)
else:
result = []
return result
@@ -1084,7 +1092,16 @@ def DoGetTrySlaves(change,
results += executer.ExecPresubmitScript(
presubmit_script, filename, project, change)
- slaves = list(set(results))
+ if results and isinstance(results[0], tuple):
+ # New-style [('bot', set(['tests']))] format.
+ slave_dict = {}
+ for result in results:
+ slave_dict.setdefault(result[0], set()).update(result[1])
+ slaves = list(slave_dict.iteritems())
+ else:
+ # Old-style ['bot'] format.
+ slaves = list(set(results))
ghost stip (do not use) 2013/11/01 02:13:00 looks like it would just update slaves after each
+
if slaves and verbose:
output_stream.write(', '.join(slaves))
output_stream.write('\n')
« no previous file with comments | « no previous file | tests/trychange_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698