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 import os | 5 import os |
6 import re | 6 import re |
7 import sys | 7 import sys |
8 import subprocess | 8 import subprocess |
9 | 9 |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return [] | 139 return [] |
140 | 140 |
141 verify_ppapi_py = os.path.join(input_api.change.RepositoryRoot(), | 141 verify_ppapi_py = os.path.join(input_api.change.RepositoryRoot(), |
142 'native_client_sdk', 'src', 'build_tools', | 142 'native_client_sdk', 'src', 'build_tools', |
143 'verify_ppapi.py') | 143 'verify_ppapi.py') |
144 cmd = [sys.executable, verify_ppapi_py] + nacl_sdk_files | 144 cmd = [sys.executable, verify_ppapi_py] + nacl_sdk_files |
145 return RunCmdAndCheck(cmd, | 145 return RunCmdAndCheck(cmd, |
146 'PPAPI Interface modified without updating NaCl SDK.', | 146 'PPAPI Interface modified without updating NaCl SDK.', |
147 output_api) | 147 output_api) |
148 | 148 |
| 149 # Verify that changes to ppapi/thunk/interfaces_* files have a corresponding |
| 150 # change to tools/metrics/histograms/histograms.xml for UMA tracking. |
| 151 def CheckHistogramXml(input_api, output_api): |
| 152 # We can't use input_api.LocalPaths() here because we need to know about |
| 153 # changes outside of ppapi/. See tools/depot_tools/presubmit_support.py for |
| 154 # details on input_api. |
| 155 files = input_api.change.AffectedFiles() |
| 156 |
| 157 INTERFACE_FILES = ('ppapi/thunk/interfaces_legacy.h', |
| 158 'ppapi/thunk/interfaces_ppb_private_flash.h', |
| 159 'ppapi/thunk/interfaces_ppb_private.h', |
| 160 'ppapi/thunk/interfaces_ppb_private_no_permissions.h', |
| 161 'ppapi/thunk/interfaces_ppb_public_dev_channel.h', |
| 162 'ppapi/thunk/interfaces_ppb_public_dev.h', |
| 163 'ppapi/thunk/interfaces_ppb_public_stable.h') |
| 164 HISTOGRAM_XML_FILE = 'tools/metrics/histograms/histograms.xml' |
| 165 interface_changes = [] |
| 166 has_histogram_xml_change = False |
| 167 for filename in files: |
| 168 path = filename.LocalPath() |
| 169 if path in INTERFACE_FILES: |
| 170 interface_changes.append(path) |
| 171 if path == HISTOGRAM_XML_FILE: |
| 172 has_histogram_xml_change = True |
| 173 |
| 174 if interface_changes and not has_histogram_xml_change: |
| 175 return [output_api.PresubmitPromptWarning( |
| 176 'Missing change to tools/metrics/histograms/histograms.xml.\n' + |
| 177 'Run pepper_hash_for_uma to make get values for new interfaces.\n' + |
| 178 'Interface changes:\n' + '\n'.join(interface_changes))] |
| 179 return [] |
| 180 |
149 def CheckChange(input_api, output_api): | 181 def CheckChange(input_api, output_api): |
150 results = [] | 182 results = [] |
151 | 183 |
152 results.extend(RunUnittests(input_api, output_api)) | 184 results.extend(RunUnittests(input_api, output_api)) |
153 | 185 |
154 results.extend(CheckTODO(input_api, output_api)) | 186 results.extend(CheckTODO(input_api, output_api)) |
155 | 187 |
156 results.extend(CheckUnversionedPPB(input_api, output_api)) | 188 results.extend(CheckUnversionedPPB(input_api, output_api)) |
157 | 189 |
158 results.extend(CheckUpdatedNaClSDK(input_api, output_api)) | 190 results.extend(CheckUpdatedNaClSDK(input_api, output_api)) |
159 | 191 |
| 192 results.extend(CheckHistogramXml(input_api, output_api)) |
| 193 |
160 # Verify all modified *.idl have a matching *.h | 194 # Verify all modified *.idl have a matching *.h |
161 files = input_api.LocalPaths() | 195 files = input_api.LocalPaths() |
162 h_files = [] | 196 h_files = [] |
163 idl_files = [] | 197 idl_files = [] |
164 generators_changed = False | 198 generators_changed = False |
165 | 199 |
166 # These are autogenerated by the command buffer generator, they don't go | 200 # These are autogenerated by the command buffer generator, they don't go |
167 # through idl. | 201 # through idl. |
168 whitelist = ['ppb_opengles2', 'ppb_opengles2ext_dev'] | 202 whitelist = ['ppb_opengles2', 'ppb_opengles2ext_dev'] |
169 | 203 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 329 |
296 return results | 330 return results |
297 | 331 |
298 | 332 |
299 def CheckChangeOnUpload(input_api, output_api): | 333 def CheckChangeOnUpload(input_api, output_api): |
300 return CheckChange(input_api, output_api) | 334 return CheckChange(input_api, output_api) |
301 | 335 |
302 | 336 |
303 def CheckChangeOnCommit(input_api, output_api): | 337 def CheckChangeOnCommit(input_api, output_api): |
304 return CheckChange(input_api, output_api) | 338 return CheckChange(input_api, output_api) |
OLD | NEW |