Chromium Code Reviews| 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') |