OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Top-level presubmit script for content/test/gpu. | 5 """Top-level presubmit script for content/test/gpu. |
6 | 6 |
7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | 7 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
8 for more details about the presubmit API built into depot_tools. | 8 for more details about the presubmit API built into depot_tools. |
9 """ | 9 """ |
10 | 10 |
11 import re | 11 import re |
12 | 12 |
13 def _PyLintChecks(input_api, output_api): | |
14 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api, | |
15 extra_paths_list=_GetPathsToPrepend(input_api), pylintrc='pylintrc') | |
16 return input_api.RunTests(pylint_checks) | |
17 | |
18 def _GetPathsToPrepend(input_api): | 13 def _GetPathsToPrepend(input_api): |
19 current_dir = input_api.PresubmitLocalPath() | 14 current_dir = input_api.PresubmitLocalPath() |
20 chromium_src_dir = input_api.os_path.join(current_dir, '..', '..', '..') | 15 chromium_src_dir = input_api.os_path.join(current_dir, '..', '..', '..') |
21 return [ | 16 return [ |
22 input_api.os_path.join(current_dir, 'gpu_tests'), | 17 input_api.os_path.join(current_dir, 'gpu_tests'), |
23 input_api.os_path.join(chromium_src_dir, 'tools', 'perf'), | 18 input_api.os_path.join(chromium_src_dir, 'tools', 'perf'), |
24 input_api.os_path.join(chromium_src_dir, | 19 input_api.os_path.join(chromium_src_dir, |
25 'third_party', 'catapult', 'telemetry'), | 20 'third_party', 'catapult', 'telemetry'), |
26 input_api.os_path.join(chromium_src_dir, | 21 input_api.os_path.join(chromium_src_dir, |
27 'third_party', 'catapult', 'catapult_base'), | 22 'third_party', 'catapult', 'catapult_base'), |
(...skipping 22 matching lines...) Expand all Loading... |
50 kwargs={}, | 45 kwargs={}, |
51 message=message_type, | 46 message=message_type, |
52 ) | 47 ) |
53 | 48 |
54 if input_api.verbose: | 49 if input_api.verbose: |
55 print 'Running', cmd_name | 50 print 'Running', cmd_name |
56 return input_api.RunTests([test_cmd]) | 51 return input_api.RunTests([test_cmd]) |
57 | 52 |
58 def CheckChangeOnUpload(input_api, output_api): | 53 def CheckChangeOnUpload(input_api, output_api): |
59 results = [] | 54 results = [] |
60 results.extend(_PyLintChecks(input_api, output_api)) | |
61 results.extend(_GpuUnittestsArePassingCheck(input_api, output_api)) | 55 results.extend(_GpuUnittestsArePassingCheck(input_api, output_api)) |
62 return results | 56 return results |
63 | 57 |
64 def CheckChangeOnCommit(input_api, output_api): | 58 def CheckChangeOnCommit(input_api, output_api): |
65 results = [] | 59 results = [] |
66 results.extend(_PyLintChecks(input_api, output_api)) | |
67 results.extend(_GpuUnittestsArePassingCheck(input_api, output_api)) | 60 results.extend(_GpuUnittestsArePassingCheck(input_api, output_api)) |
68 return results | 61 return results |
69 | 62 |
70 def PostUploadHook(cl, change, output_api): | 63 def PostUploadHook(cl, change, output_api): |
71 """git cl upload will call this hook after the issue is created/modified. | 64 """git cl upload will call this hook after the issue is created/modified. |
72 | 65 |
73 This hook adds extra try bots list to the CL description in order to run | 66 This hook adds extra try bots list to the CL description in order to run |
74 Blink tests in addition to CQ try bots. | 67 Blink tests in addition to CQ try bots. |
75 """ | 68 """ |
76 rietveld_obj = cl.RpcServer() | 69 rietveld_obj = cl.RpcServer() |
(...skipping 11 matching lines...) Expand all Loading... |
88 results = [] | 81 results = [] |
89 new_description = description | 82 new_description = description |
90 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) | 83 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) |
91 results.append(output_api.PresubmitNotifyResult( | 84 results.append(output_api.PresubmitNotifyResult( |
92 'Automatically added optional GPU tests to run on CQ.')) | 85 'Automatically added optional GPU tests to run on CQ.')) |
93 | 86 |
94 if new_description != description: | 87 if new_description != description: |
95 rietveld_obj.update_description(issue, new_description) | 88 rietveld_obj.update_description(issue, new_description) |
96 | 89 |
97 return results | 90 return results |
OLD | NEW |