OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
Primiano Tucci (use gerrit)
2014/05/22 09:30:38
The PRESUBMIT.py shouldn't have a shbang and shoul
| |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 """binary_size presubmit script | |
7 | |
8 See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts | |
9 for more details about the presubmit API built into gcl. | |
10 """ | |
11 | |
12 def _RunUnitTests(input_api, output_api): | |
Primiano Tucci (use gerrit)
2014/05/22 09:30:38
Is there an actual reason why you didn't just copy
| |
13 # Skip if nothing to do | |
14 run_unit_test_path = input_api.os_path.join( | |
15 input_api.PresubmitLocalPath(), 'explain_binary_size_delta_unittest.py') | |
Primiano Tucci (use gerrit)
2014/05/22 09:30:38
We already have the mechanisms in place to run dis
| |
16 cmd_name = 'explain_binary_size_delta_unittest' | |
17 if input_api.platform == 'win32': | |
Primiano Tucci (use gerrit)
2014/05/22 09:30:38
Neither we need platform specific black magic.
| |
18 # Windows needs some help. | |
19 cmd = [input_api.python_executable, run_unit_test_path] | |
20 else: | |
21 cmd = [run_unit_test_path] | |
22 | |
23 if input_api.is_committing: | |
24 message_type = output_api.PresubmitError | |
25 else: | |
26 message_type = output_api.PresubmitPromptWarning | |
27 | |
28 test_cmd = input_api.Command( | |
29 name=cmd_name, | |
30 cmd=cmd, | |
31 kwargs={}, | |
32 message=message_type) | |
33 if input_api.verbose: | |
34 print('Running ' + cmd_name) | |
35 return input_api.RunTests([test_cmd]) | |
36 | |
37 | |
38 def CheckChangeOnUpload(input_api, output_api): | |
39 return _RunUnitTests(input_api, output_api) | |
40 | |
41 | |
42 def CheckChangeOnCommit(input_api, output_api): | |
43 return _RunUnitTests(input_api, output_api) | |
OLD | NEW |