Chromium Code Reviews| Index: tools-webrtc/PRESUBMIT.py |
| diff --git a/tools-webrtc/PRESUBMIT.py b/tools-webrtc/PRESUBMIT.py |
| index 2f7b835ba9636485ea3378cb3101a7751bd0956a..03ef7cce794e7239078b56e10c7ac6368784a8d8 100644 |
| --- a/tools-webrtc/PRESUBMIT.py |
| +++ b/tools-webrtc/PRESUBMIT.py |
| @@ -6,6 +6,20 @@ |
| # in the file PATENTS. All contributing project authors may |
| # be found in the AUTHORS file in the root of the source tree. |
| +import subprocess |
| + |
| + |
| +def _RunCommand(command, cwd): |
| + """Runs a command and returns the output from that command.""" |
| + p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
| + cwd=cwd) |
| + stdout = p.stdout.read() |
| + stderr = p.stderr.read() |
| + p.wait() |
| + p.stdout.close() |
| + p.stderr.close() |
| + return p.returncode, stdout, stderr |
| + |
| def _LicenseHeader(input_api): |
| """Returns the license header regexp.""" |
| # Accept any year number from 2003 to the current year |
| @@ -27,11 +41,23 @@ def _LicenseHeader(input_api): |
| } |
| return license_header |
| +def _CheckPackageBoundariesTest(input_api, output_api): |
|
kjellander_webrtc
2017/01/19 10:51:26
Please remove this and make the test use the Pytho
|
| + """Checks that check_package_boundaries.py is working correctly.""" |
| + cwd = input_api.PresubmitLocalPath() |
| + command = ['python', 'check_package_boundaries_test.py'] |
| + returncode, _, stderr = _RunCommand(command, cwd) |
| + if returncode: |
| + return [output_api.PresubmitError( |
| + 'check_package_boundaries test failed:\n\n' |
| + '%s' % stderr)] |
| + return [] |
| + |
| def _CommonChecks(input_api, output_api): |
| """Checks common to both upload and commit.""" |
| results = [] |
| results.extend(input_api.canned_checks.CheckLicense( |
| input_api, output_api, _LicenseHeader(input_api))) |
| + results.extend(_CheckPackageBoundariesTest(input_api, output_api)) |
| return results |
| def CheckChangeOnUpload(input_api, output_api): |