Index: LayoutTests/PRESUBMIT.py |
diff --git a/LayoutTests/PRESUBMIT.py b/LayoutTests/PRESUBMIT.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..93ea7285ba39b8b2a41264dab422d47e3e372e8c |
--- /dev/null |
+++ b/LayoutTests/PRESUBMIT.py |
@@ -0,0 +1,39 @@ |
+# Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+"""LayoutTests/ presubmit script for Blink. |
+ |
+See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts |
+for more details about the presubmit API built into gcl. |
+""" |
+ |
+ |
+def _CheckTestharnessResults(input_api, output_api): |
+ expected_files = [f.AbsoluteLocalPath() for f in input_api.AffectedFiles() if f.LocalPath().endswith('-expected.txt') and f.Action() != 'D'] |
+ if len(expected_files) == 0: |
+ return [] |
+ |
+ checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(), |
+ '..', 'Tools', 'Scripts', 'check-testharness-expected-pass') |
+ |
+ args = [input_api.python_executable, checker_path] |
+ args.extend(expected_files) |
+ _, errs = input_api.subprocess.Popen(args, |
+ stdout=input_api.subprocess.PIPE, |
+ stderr=input_api.subprocess.PIPE).communicate() |
+ if errs: |
+ return [output_api.PresubmitError(errs)] |
+ return [] |
+ |
+ |
+def CheckChangeOnUpload(input_api, output_api): |
+ results = [] |
+ results.extend(_CheckTestharnessResults(input_api, output_api)) |
+ return results |
+ |
+ |
+def CheckChangeOnCommit(input_api, output_api): |
+ results = [] |
+ results.extend(_CheckTestharnessResults(input_api, output_api)) |
+ return results |