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

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

Issue 2002513002: 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: 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(expected_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 path = f.AbsoluteLocalPath()
42 if not path.endswith('expected.txt'):
tkent 2016/05/20 05:14:25 expected.txt -> -expected.txt
qyearsley 2016/05/20 17:14:18 Done; good catch
43 continue
44 path_parts = path.split(os.sep)
45 if 'platform' in path_parts or 'virtual' in path_parts:
tkent 2016/05/20 05:14:25 Please check 'LayoutTests' followed by 'platform',
qyearsley 2016/05/20 17:14:18 Now changed to check `input_api.os_path.join('Layo
46 # We want to ignore files in LayoutTests/platform, because some all- PASS
47 # platform specific baselines may be necessary to prevent fallback t o a
48 # more general baseline.
qyearsley 2016/05/20 17:14:18 I'd like to add a comment here about why we should
tkent 2016/05/22 23:30:37 Right.
49 continue
50 baseline_files.append(path)
51
52
32 def _CheckIdenticalFiles(input_api, output_api): 53 def _CheckIdenticalFiles(input_api, output_api):
33 """Verifies that certain files are identical in various locations. 54 """Verifies that certain files are identical in various locations.
34 These files should always be updated together.""" 55 These files should always be updated together."""
35 56
36 dirty_files = set(input_api.LocalPaths()) 57 dirty_files = set(input_api.LocalPaths())
37 58
38 groups = [[ 59 groups = [[
39 'imported/web-platform-tests/resources/testharness.js', 60 'imported/web-platform-tests/resources/testharness.js',
40 'resources/testharness.js', 61 'resources/testharness.js',
41 ], [ 62 ], [
(...skipping 27 matching lines...) Expand all
69 results.extend(_CheckTestharnessResults(input_api, output_api)) 90 results.extend(_CheckTestharnessResults(input_api, output_api))
70 results.extend(_CheckIdenticalFiles(input_api, output_api)) 91 results.extend(_CheckIdenticalFiles(input_api, output_api))
71 return results 92 return results
72 93
73 94
74 def CheckChangeOnCommit(input_api, output_api): 95 def CheckChangeOnCommit(input_api, output_api):
75 results = [] 96 results = []
76 results.extend(_CheckTestharnessResults(input_api, output_api)) 97 results.extend(_CheckTestharnessResults(input_api, output_api))
77 results.extend(_CheckIdenticalFiles(input_api, output_api)) 98 results.extend(_CheckIdenticalFiles(input_api, output_api))
78 return results 99 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