Commit 8cc52515 authored by Makoto Shimazu's avatar Makoto Shimazu Committed by Commit Bot

Skip LayoutTests for check-webkit-style at presubmit checks

check-webkit-style internally skips LayoutTests except for TestExpectations.
This CL is for skipping that before running check-webkit-style.

Bug: none
Change-Id: Id6636d8e56c346d61e102643840baee17ecb6f9c
Reviewed-on: https://chromium-review.googlesource.com/923870Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Commit-Queue: Makoto Shimazu <shimazu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537695}
parent c7b14042
...@@ -101,10 +101,16 @@ def _CheckStyle(input_api, output_api): ...@@ -101,10 +101,16 @@ def _CheckStyle(input_api, output_api):
style_checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(), style_checker_path = input_api.os_path.join(input_api.PresubmitLocalPath(),
'Tools', 'Scripts', 'check-webkit-style') 'Tools', 'Scripts', 'check-webkit-style')
args = [input_api.python_executable, style_checker_path, '--diff-files'] args = [input_api.python_executable, style_checker_path, '--diff-files']
files = [input_api.os_path.join('..', '..', f.LocalPath()) files = []
for f in input_api.AffectedFiles() for f in input_api.AffectedFiles():
# Filter out files that follow Chromium's coding style. file_path = f.LocalPath()
if not re_chromium_style_file.search(f.LocalPath())] # Filter out files that follow Chromium's coding style.
if re_chromium_style_file.search(file_path):
continue
# Filter out changes in LayoutTests.
if 'LayoutTests' + input_api.os_path.sep in file_path and 'TestExpectations' not in file_path:
continue
files.append(input_api.os_path.join('..', '..', file_path))
# Do not call check-webkit-style with empty affected file list if all # Do not call check-webkit-style with empty affected file list if all
# input_api.AffectedFiles got filtered. # input_api.AffectedFiles got filtered.
if not files: if not files:
......
...@@ -41,10 +41,12 @@ class PresubmitTest(unittest.TestCase): ...@@ -41,10 +41,12 @@ class PresubmitTest(unittest.TestCase):
""" """
diff_file_webkit_h = ['some diff'] diff_file_webkit_h = ['some diff']
diff_file_chromium_h = ['another diff'] diff_file_chromium_h = ['another diff']
diff_file_test_expectations = ['more diff']
mock_input_api = MockInputApi() mock_input_api = MockInputApi()
mock_input_api.files = [ mock_input_api.files = [
MockAffectedFile('FileWebkit.h', diff_file_webkit_h), MockAffectedFile('FileWebkit.h', diff_file_webkit_h),
MockAffectedFile('file_chromium.h', diff_file_chromium_h) MockAffectedFile('file_chromium.h', diff_file_chromium_h),
MockAffectedFile('LayoutTests/TestExpectations', diff_file_test_expectations)
] ]
# Access to a protected member _CheckStyle # Access to a protected member _CheckStyle
# pylint: disable=W0212 # pylint: disable=W0212
...@@ -52,8 +54,9 @@ class PresubmitTest(unittest.TestCase): ...@@ -52,8 +54,9 @@ class PresubmitTest(unittest.TestCase):
capture = Capture() capture = Capture()
# pylint: disable=E1101 # pylint: disable=E1101
subprocess.Popen.assert_called_with(capture, stderr=-1) subprocess.Popen.assert_called_with(capture, stderr=-1)
self.assertEqual(4, len(capture.value)) self.assertEqual(5, len(capture.value))
self.assertEqual('../../FileWebkit.h', capture.value[3]) self.assertEqual('../../FileWebkit.h', capture.value[3])
self.assertEqual('../../LayoutTests/TestExpectations', capture.value[4])
@mock.patch('subprocess.Popen') @mock.patch('subprocess.Popen')
def testCheckChangeOnUploadWithEmptyAffectedFileList(self, _): def testCheckChangeOnUploadWithEmptyAffectedFileList(self, _):
...@@ -62,10 +65,12 @@ class PresubmitTest(unittest.TestCase): ...@@ -62,10 +65,12 @@ class PresubmitTest(unittest.TestCase):
""" """
diff_file_chromium1_h = ['some diff'] diff_file_chromium1_h = ['some diff']
diff_file_chromium2_h = ['another diff'] diff_file_chromium2_h = ['another diff']
diff_file_layout_test_html = ['more diff']
mock_input_api = MockInputApi() mock_input_api = MockInputApi()
mock_input_api.files = [ mock_input_api.files = [
MockAffectedFile('first_file_chromium.h', diff_file_chromium1_h), MockAffectedFile('first_file_chromium.h', diff_file_chromium1_h),
MockAffectedFile('second_file_chromium.h', diff_file_chromium2_h) MockAffectedFile('second_file_chromium.h', diff_file_chromium2_h),
MockAffectedFile('LayoutTests/some_tests.html', diff_file_layout_test_html)
] ]
# Access to a protected member _CheckStyle # Access to a protected member _CheckStyle
# pylint: disable=W0212 # pylint: disable=W0212
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment