[email protected] | 52476d9 | 2014-09-03 13:34:04 | [diff] [blame] | 1 | # Copyright (c) 2013 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 | """LayoutTests/ presubmit script for Blink. |
| 6 | |
| 7 | See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
| 8 | for more details about the presubmit API built into gcl. |
| 9 | """ |
| 10 | |
| 11 | |
| 12 | def _CheckTestharnessResults(input_api, output_api): |
| 13 | expected_files = [f.AbsoluteLocalPath() for f in input_api.AffectedFiles() if f.LocalPath().endswith('-expected.txt') and f.Action() != 'D'] |
| 14 | if len(expected_files) == 0: |
| 15 | return [] |
| 16 | |
| 17 | checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(), |
| 18 | '..', 'Tools', 'Scripts', 'check-testharness-expected-pass') |
| 19 | |
| 20 | args = [input_api.python_executable, checker_path] |
| 21 | args.extend(expected_files) |
| 22 | _, errs = input_api.subprocess.Popen(args, |
| 23 | stdout=input_api.subprocess.PIPE, |
| 24 | stderr=input_api.subprocess.PIPE).communicate() |
| 25 | if errs: |
| 26 | return [output_api.PresubmitError(errs)] |
| 27 | return [] |
| 28 | |
| 29 | |
| 30 | def CheckChangeOnUpload(input_api, output_api): |
| 31 | results = [] |
| 32 | results.extend(_CheckTestharnessResults(input_api, output_api)) |
| 33 | return results |
| 34 | |
| 35 | |
| 36 | def CheckChangeOnCommit(input_api, output_api): |
| 37 | results = [] |
| 38 | results.extend(_CheckTestharnessResults(input_api, output_api)) |
| 39 | return results |