| 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): | 13 def _PyLintChecks(input_api, output_api): |
| 14 pylint_checks = input_api.canned_checks.GetPylint(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') | 15 extra_paths_list=_GetPathsToPrepend(input_api), pylintrc='pylintrc') |
| 16 return input_api.RunTests(pylint_checks) | 16 return input_api.RunTests(pylint_checks) |
| 17 | 17 |
| 18 def _GetPathsToPrepend(input_api): | 18 def _GetPathsToPrepend(input_api): |
| 19 current_dir = input_api.PresubmitLocalPath() | 19 current_dir = input_api.PresubmitLocalPath() |
| 20 chromium_src_dir = input_api.os_path.join(current_dir, '..', '..', '..') | 20 chromium_src_dir = input_api.os_path.join(current_dir, '..', '..', '..') |
| 21 return [ | 21 return [ |
| 22 input_api.os_path.join(current_dir, 'gpu_tests'), | 22 input_api.os_path.join(current_dir, 'gpu_tests'), |
| 23 input_api.os_path.join(chromium_src_dir, 'tools', 'perf'), | 23 input_api.os_path.join(chromium_src_dir, 'tools', 'perf'), |
| 24 input_api.os_path.join(chromium_src_dir, | 24 input_api.os_path.join(chromium_src_dir, |
| 25 'third_party', 'catapult', 'telemetry'), | 25 'third_party', 'catapult', 'telemetry'), |
| 26 input_api.os_path.join(chromium_src_dir, | 26 input_api.os_path.join(chromium_src_dir, |
| 27 'third_party', 'catapult', 'catapult_base'), | 27 'third_party', 'catapult', 'catapult_base'), |
| 28 ] | 28 ] |
| 29 | 29 |
| 30 def _WebGLTextExpectationsTests(input_api, output_api): | 30 def _GpuUnittestsArePassingCheck(input_api, output_api): |
| 31 if not input_api.AffectedFiles(): | 31 if not input_api.AffectedFiles(): |
| 32 return [] | 32 return [] |
| 33 | 33 |
| 34 cmd = [ | 34 cmd = [ |
| 35 input_api.os_path.join(input_api.PresubmitLocalPath(), 'run_unittests.py'), | 35 input_api.os_path.join(input_api.PresubmitLocalPath(), 'run_unittests.py'), |
| 36 'gpu_tests', | 36 'gpu_tests', |
| 37 ] | 37 ] |
| 38 if input_api.platform == 'win32': | 38 if input_api.platform == 'win32': |
| 39 cmd = [input_api.python_executable] + cmd | 39 cmd = [input_api.python_executable] + cmd |
| 40 | 40 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 51 message=message_type, | 51 message=message_type, |
| 52 ) | 52 ) |
| 53 | 53 |
| 54 if input_api.verbose: | 54 if input_api.verbose: |
| 55 print 'Running', cmd_name | 55 print 'Running', cmd_name |
| 56 return input_api.RunTests([test_cmd]) | 56 return input_api.RunTests([test_cmd]) |
| 57 | 57 |
| 58 def CheckChangeOnUpload(input_api, output_api): | 58 def CheckChangeOnUpload(input_api, output_api): |
| 59 results = [] | 59 results = [] |
| 60 results.extend(_PyLintChecks(input_api, output_api)) | 60 results.extend(_PyLintChecks(input_api, output_api)) |
| 61 results.extend(_WebGLTextExpectationsTests(input_api, output_api)) | 61 results.extend(_GpuUnittestsArePassingCheck(input_api, output_api)) |
| 62 return results | 62 return results |
| 63 | 63 |
| 64 def CheckChangeOnCommit(input_api, output_api): | 64 def CheckChangeOnCommit(input_api, output_api): |
| 65 results = [] | 65 results = [] |
| 66 results.extend(_PyLintChecks(input_api, output_api)) | 66 results.extend(_PyLintChecks(input_api, output_api)) |
| 67 results.extend(_WebGLTextExpectationsTests(input_api, output_api)) | 67 results.extend(_GpuUnittestsArePassingCheck(input_api, output_api)) |
| 68 return results | 68 return results |
| 69 | 69 |
| 70 def PostUploadHook(cl, change, output_api): | 70 def PostUploadHook(cl, change, output_api): |
| 71 """git cl upload will call this hook after the issue is created/modified. | 71 """git cl upload will call this hook after the issue is created/modified. |
| 72 | 72 |
| 73 This hook adds extra try bots list to the CL description in order to run | 73 This hook adds extra try bots list to the CL description in order to run |
| 74 Blink tests in addition to CQ try bots. | 74 Blink tests in addition to CQ try bots. |
| 75 """ | 75 """ |
| 76 rietveld_obj = cl.RpcServer() | 76 rietveld_obj = cl.RpcServer() |
| 77 issue = cl.issue | 77 issue = cl.issue |
| (...skipping 10 matching lines...) Expand all Loading... |
| 88 results = [] | 88 results = [] |
| 89 new_description = description | 89 new_description = description |
| 90 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) | 90 new_description += '\nCQ_INCLUDE_TRYBOTS=%s' % ';'.join(bots) |
| 91 results.append(output_api.PresubmitNotifyResult( | 91 results.append(output_api.PresubmitNotifyResult( |
| 92 'Automatically added optional GPU tests to run on CQ.')) | 92 'Automatically added optional GPU tests to run on CQ.')) |
| 93 | 93 |
| 94 if new_description != description: | 94 if new_description != description: |
| 95 rietveld_obj.update_description(issue, new_description) | 95 rietveld_obj.update_description(issue, new_description) |
| 96 | 96 |
| 97 return results | 97 return results |
| OLD | NEW |