Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Side by Side Diff: third_party/WebKit/LayoutTests/PRESUBMIT.py

Issue 2006963002: Reland of In LayoutTests PRESUBMIT, Don't check for all-pass baseline files in platform and virtual. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Include all original changes + new fix Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 """LayoutTests/ presubmit script for Blink. 5 """LayoutTests/ presubmit script for Blink.
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
11 import filecmp 11 import filecmp
12 12
13 13
14 def _CheckTestharnessResults(input_api, output_api): 14 def _CheckTestharnessResults(input_api, output_api):
15 expected_files = [f.AbsoluteLocalPath() for f in input_api.AffectedFiles() i f f.LocalPath().endswith('-expected.txt') and f.Action() != 'D'] 15 """Checks for testharness.js test baseline files that contain only PASS line s.
16 if len(expected_files) == 0: 16
17 In general these files are unnecessary because for testharness.js tests, if there is
18 no baseline file then the test is considered to pass when the output is all PASS.
19 """
20 baseline_files = _TestharnessBaselineFilesToCheck(input_api)
21 if not baseline_files:
17 return [] 22 return []
18 23
19 checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(), 24 checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
20 '..', 'Tools', 'Scripts', 'check-testharness-expected-pass') 25 '..', 'Tools', 'Scripts', 'check-testharness-expected-pass')
21 26
22 args = [input_api.python_executable, checker_path] 27 args = [input_api.python_executable, checker_path]
23 args.extend(expected_files) 28 args.extend(baseline_files)
24 _, errs = input_api.subprocess.Popen(args, 29 _, errs = input_api.subprocess.Popen(args,
25 stdout=input_api.subprocess.PIPE, 30 stdout=input_api.subprocess.PIPE,
26 stderr=input_api.subprocess.PIPE).communicate() 31 stderr=input_api.subprocess.PIPE).communicate()
27 if errs: 32 if errs:
28 return [output_api.PresubmitError(errs)] 33 return [output_api.PresubmitError(errs)]
29 return [] 34 return []
30 35
31 36
37 def _TestharnessBaselineFilesToCheck(input_api):
38 """Returns a list of paths of -expected.txt files for testharness.js tests." ""
39 baseline_files = []
40 for f in input_api.AffectedFiles():
41 if f.Action() == 'D':
42 continue
43 path = f.AbsoluteLocalPath()
44 if not path.endswith('-expected.txt'):
45 continue
46 if (input_api.os_path.join('LayoutTests', 'platform') in path or
47 input_api.os_path.join('LayoutTests', 'virtual') in path):
48 # We want to ignore files in LayoutTests/platform, because some all- PASS
49 # platform specific baselines may be necessary to prevent fallback t o a
50 # more general baseline; we also ignore files in LayoutTests/virtual
51 # for a similar reason; some all-pass baselines are necessary to
52 # prevent fallback to the corresponding non-virtual test baseline.
53 continue
54 baseline_files.append(path)
55 return baseline_files
56
57
32 def _CheckIdenticalFiles(input_api, output_api): 58 def _CheckIdenticalFiles(input_api, output_api):
33 """Verifies that certain files are identical in various locations. 59 """Verifies that certain files are identical in various locations.
34 These files should always be updated together.""" 60 These files should always be updated together."""
35 61
36 dirty_files = set(input_api.LocalPaths()) 62 dirty_files = set(input_api.LocalPaths())
37 63
38 groups = [[ 64 groups = [[
39 'imported/wpt/resources/testharness.js', 65 'imported/wpt/resources/testharness.js',
40 'resources/testharness.js', 66 'resources/testharness.js',
41 ], [ 67 ], [
(...skipping 27 matching lines...) Expand all
69 results.extend(_CheckTestharnessResults(input_api, output_api)) 95 results.extend(_CheckTestharnessResults(input_api, output_api))
70 results.extend(_CheckIdenticalFiles(input_api, output_api)) 96 results.extend(_CheckIdenticalFiles(input_api, output_api))
71 return results 97 return results
72 98
73 99
74 def CheckChangeOnCommit(input_api, output_api): 100 def CheckChangeOnCommit(input_api, output_api):
75 results = [] 101 results = []
76 results.extend(_CheckTestharnessResults(input_api, output_api)) 102 results.extend(_CheckTestharnessResults(input_api, output_api))
77 results.extend(_CheckIdenticalFiles(input_api, output_api)) 103 results.extend(_CheckIdenticalFiles(input_api, output_api))
78 return results 104 return results
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698