OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 Chromium. | 5 """Top-level presubmit script for Chromium. |
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 gcl. | 8 for more details about the presubmit API built into gcl. |
9 """ | 9 """ |
10 | 10 |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 source_file_filter = lambda x: input_api.FilterSourceFile( | 842 source_file_filter = lambda x: input_api.FilterSourceFile( |
843 x, white_list=(file_inclusion_pattern,), black_list=black_list) | 843 x, white_list=(file_inclusion_pattern,), black_list=black_list) |
844 | 844 |
845 log_info = [] | 845 log_info = [] |
846 printf = [] | 846 printf = [] |
847 | 847 |
848 for f in input_api.AffectedSourceFiles(source_file_filter): | 848 for f in input_api.AffectedSourceFiles(source_file_filter): |
849 contents = input_api.ReadFile(f, 'rb') | 849 contents = input_api.ReadFile(f, 'rb') |
850 if re.search(r"\bD?LOG\s*\(\s*INFO\s*\)", contents): | 850 if re.search(r"\bD?LOG\s*\(\s*INFO\s*\)", contents): |
851 log_info.append(f.LocalPath()) | 851 log_info.append(f.LocalPath()) |
852 if re.search(r"\bD?LOG_IF\s*\(\s*INFO\s*,", contents): | 852 elif re.search(r"\bD?LOG_IF\s*\(\s*INFO\s*,", contents): |
853 log_info.append(f.LocalPath()) | 853 log_info.append(f.LocalPath()) |
854 if re.search(r"\bf?printf\((stdout|stderr)", contents): | 854 |
| 855 if re.search(r"\bprintf\(", contents): |
| 856 printf.append(f.LocalPath()) |
| 857 elif re.search(r"\bfprintf\((stdout|stderr)", contents): |
855 printf.append(f.LocalPath()) | 858 printf.append(f.LocalPath()) |
856 | 859 |
857 if log_info: | 860 if log_info: |
858 return [output_api.PresubmitError( | 861 return [output_api.PresubmitError( |
859 'These files spam the console log with LOG(INFO):', | 862 'These files spam the console log with LOG(INFO):', |
860 items=log_info)] | 863 items=log_info)] |
861 if printf: | 864 if printf: |
862 return [output_api.PresubmitError( | 865 return [output_api.PresubmitError( |
863 'These files spam the console log with printf/fprintf:', | 866 'These files spam the console log with printf/fprintf:', |
864 items=printf)] | 867 items=printf)] |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 trybots += ['cros_x86'] | 1138 trybots += ['cros_x86'] |
1136 | 1139 |
1137 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it | 1140 # The AOSP bot doesn't build the chrome/ layer, so ignore any changes to it |
1138 # unless they're .gyp(i) files as changes to those files can break the gyp | 1141 # unless they're .gyp(i) files as changes to those files can break the gyp |
1139 # step on that bot. | 1142 # step on that bot. |
1140 if (not all(re.search('^chrome', f) for f in files) or | 1143 if (not all(re.search('^chrome', f) for f in files) or |
1141 any(re.search('\.gypi?$', f) for f in files)): | 1144 any(re.search('\.gypi?$', f) for f in files)): |
1142 trybots += ['android_aosp'] | 1145 trybots += ['android_aosp'] |
1143 | 1146 |
1144 return trybots | 1147 return trybots |
OLD | NEW |