OLD | NEW |
(Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 def _PyLintChecks(input_api, output_api): |
| 6 pylint_checks = input_api.canned_checks.GetPylint(input_api, output_api, |
| 7 extra_paths_list=_GetPathsToPrepend(input_api), pylintrc='pylintrc') |
| 8 return input_api.RunTests(pylint_checks) |
| 9 |
| 10 def _GetPathsToPrepend(input_api): |
| 11 current_dir = input_api.PresubmitLocalPath() |
| 12 chromium_src_dir = input_api.os_path.join(current_dir, '..', '..', '..') |
| 13 return [ |
| 14 input_api.os_path.join(current_dir, 'gpu_tests'), |
| 15 input_api.os_path.join(chromium_src_dir, 'tools', 'perf'), |
| 16 input_api.os_path.join(chromium_src_dir, 'tools', 'telemetry'), |
| 17 ] |
| 18 |
| 19 def _WebGLTextExpectationsTests(input_api, output_api): |
| 20 if not input_api.AffectedFiles(): |
| 21 return [] |
| 22 |
| 23 cmd = [ |
| 24 input_api.os_path.join(input_api.PresubmitLocalPath(), 'run_unittests.py'), |
| 25 'gpu_tests', |
| 26 ] |
| 27 if input_api.platform == 'win32': |
| 28 cmd = [input_api.python_executable] + cmd |
| 29 |
| 30 if input_api.is_committing: |
| 31 message_type = output_api.PresubmitError |
| 32 else: |
| 33 message_type = output_api.PresubmitPromptWarning |
| 34 |
| 35 cmd_name = 'run_content_test_gpu_unittests', |
| 36 test_cmd = input_api.Command( |
| 37 name=cmd_name, |
| 38 cmd=cmd, |
| 39 kwargs={}, |
| 40 message=message_type, |
| 41 ) |
| 42 |
| 43 if input_api.verbose: |
| 44 print 'Running', cmd_name |
| 45 return input_api.RunTests([test_cmd]) |
| 46 |
| 47 def CheckChangeOnUpload(input_api, output_api): |
| 48 results = [] |
| 49 results.extend(_PyLintChecks(input_api, output_api)) |
| 50 results.extend(_WebGLTextExpectationsTests(input_api, output_api)) |
| 51 return results |
| 52 |
| 53 def CheckChangeOnCommit(input_api, output_api): |
| 54 results = [] |
| 55 results.extend(_PyLintChecks(input_api, output_api)) |
| 56 results.extend(_WebGLTextExpectationsTests(input_api, output_api)) |
| 57 return results |
OLD | NEW |