kbr | e85ee56 | 2016-02-09 04:37:35 | [diff] [blame^] | 1 | # Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | """Top-level presubmit script for gpu. |
| 6 | |
| 7 | See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 | for more details about the presubmit API built into depot_tools. |
| 9 | """ |
| 10 | |
| 11 | import re |
| 12 | |
| 13 | def PostUploadHook(cl, change, output_api): |
| 14 | """git cl upload will call this hook after the issue is created/modified. |
| 15 | |
| 16 | This hook adds extra try bots list to the CL description in order to run |
| 17 | Blink tests in addition to CQ try bots. |
| 18 | """ |
| 19 | rietveld_obj = cl.RpcServer() |
| 20 | issue = cl.issue |
| 21 | description = rietveld_obj.get_description(issue) |
| 22 | if re.search(r'^CQ_INCLUDE_TRYBOTS=.*', description, re.M | re.I): |
| 23 | return [] |
| 24 | |
| 25 | bots = [ |
| 26 | 'tryserver.chromium.win:win_optional_gpu_tests_rel', |
| 27 | ] |
| 28 | |
| 29 | results = [] |
| 30 | new_description = description |
| 31 | new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) |
| 32 | results.append(output_api.PresubmitNotifyResult( |
| 33 | 'Automatically added optional GPU tests to run on CQ.')) |
| 34 | |
| 35 | if new_description != description: |
| 36 | rietveld_obj.update_description(issue, new_description) |
| 37 | |
| 38 | return results |