summaryrefslogtreecommitdiffstats
path: root/WebKitTools/Scripts/webkitpy
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-07-30 10:46:49 +0100
committerKristian Monsen <kristianm@google.com>2010-08-04 13:01:34 +0100
commit0617145a89917ae7735fe1c9538688ab9a577df5 (patch)
tree56206078694427c37ed7bdf27eb5221398b833c0 /WebKitTools/Scripts/webkitpy
parentef1adcdfc805d4d13103f6f15cc5b4d96828a60f (diff)
downloadexternal_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.zip
external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.gz
external_webkit-0617145a89917ae7735fe1c9538688ab9a577df5.tar.bz2
Merge WebKit at r64264 : Initial merge by git.
Change-Id: Ic42bef02efef8217a0f84c47176a9c617c28d1f1
Diffstat (limited to 'WebKitTools/Scripts/webkitpy')
-rw-r--r--WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py22
-rw-r--r--WebKitTools/Scripts/webkitpy/style/checkers/cpp.py14
-rw-r--r--WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py24
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py7
-rw-r--r--WebKitTools/Scripts/webkitpy/tool/steps/options.py4
5 files changed, 53 insertions, 18 deletions
diff --git a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
index e7f9ac8..f8b181c 100644
--- a/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
+++ b/WebKitTools/Scripts/webkitpy/layout_tests/port/chromium.py
@@ -34,6 +34,7 @@ from __future__ import with_statement
import codecs
import logging
import os
+import re
import shutil
import signal
import subprocess
@@ -212,6 +213,16 @@ class ChromiumPort(base.Port):
return file.read()
def test_expectations_overrides(self):
+ # FIXME: This drt_overrides handling should be removed when we switch
+ # from tes_shell to DRT.
+ drt_overrides = ''
+ if self._options.use_drt:
+ drt_overrides_path = self.path_from_webkit_base('LayoutTests',
+ 'platform', 'chromium', 'drt_expectations.txt')
+ if os.path.exists(drt_overrides_path):
+ with codecs.open(drt_overrides_path, "r", "utf-8") as file:
+ drt_overrides = file.read()
+
try:
overrides_path = self.path_from_chromium_base('webkit', 'tools',
'layout_tests', 'test_expectations.txt')
@@ -220,7 +231,7 @@ class ChromiumPort(base.Port):
if not os.path.exists(overrides_path):
return None
with codecs.open(overrides_path, "r", "utf-8") as file:
- return file.read()
+ return file.read() + drt_overrides
def test_platform_names(self):
return self.test_base_platform_names() + ('win-xp',
@@ -382,9 +393,12 @@ class ChromiumDriver(base.Driver):
if line.startswith("#URL:"):
actual_uri = line.rstrip()[5:]
if uri != actual_uri:
- _log.fatal("Test got out of sync:\n|%s|\n|%s|" %
- (uri, actual_uri))
- raise AssertionError("test out of sync")
+ # GURL capitalizes the drive letter of a file URL.
+ if (not re.search("^file:///[a-z]:", uri) or
+ uri.lower() != actual_uri.lower()):
+ _log.fatal("Test got out of sync:\n|%s|\n|%s|" %
+ (uri, actual_uri))
+ raise AssertionError("test out of sync")
elif line.startswith("#MD5:"):
actual_checksum = line.rstrip()[5:]
elif line.startswith("#TEST_TIMED_OUT"):
diff --git a/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py b/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py
index 611afdc..770ab40 100644
--- a/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py
+++ b/WebKitTools/Scripts/webkitpy/style/checkers/cpp.py
@@ -1884,6 +1884,10 @@ def check_for_null(file_extension, clean_lines, line_number, error):
if search(r'\bg_str(join|concat)\b', line):
return
+ # Don't warn about NULL usage in gdk_pixbuf_save_to_*{join,concat}(). See Bug 43090.
+ if search(r'\bgdk_pixbuf_save_to\w+\b', line):
+ return
+
if search(r'\bNULL\b', line):
error(line_number, 'readability/null', 5, 'Use 0 instead of NULL.')
return
@@ -1916,7 +1920,7 @@ def get_line_width(line):
return len(line)
-def check_style(clean_lines, line_number, file_extension, file_state, error):
+def check_style(clean_lines, line_number, file_extension, class_state, file_state, error):
"""Checks rules from the 'C++ style rules' section of cppguide.html.
Most of these rules are hard to test (naming, comment style), but we
@@ -1927,6 +1931,8 @@ def check_style(clean_lines, line_number, file_extension, file_state, error):
clean_lines: A CleansedLines instance containing the file.
line_number: The number of the line to check.
file_extension: The extension (without the dot) of the filename.
+ class_state: A _ClassState instance which maintains information about
+ the current stack of nested class declarations being parsed.
file_state: A _FileState instance which maintains information about
the state of things in the file.
error: The function to call with any errors found.
@@ -1987,6 +1993,10 @@ def check_style(clean_lines, line_number, file_extension, file_state, error):
and not ((cleansed_line.find('case ') != -1
or cleansed_line.find('default:') != -1)
and cleansed_line.find('break;') != -1)
+ # Also it's ok to have many commands in trivial single-line accessors in class definitions.
+ and not (match(r'.*\(.*\).*{.*.}', line)
+ and class_state.classinfo_stack
+ and line.count('{') == line.count('}'))
and not cleansed_line.startswith('#define ')):
error(line_number, 'whitespace/newline', 4,
'More than one command on the same line')
@@ -2841,7 +2851,7 @@ def process_line(filename, file_extension,
if search(r'\bNOLINT\b', raw_lines[line]): # ignore nolint lines
return
check_for_multiline_comments_and_strings(clean_lines, line, error)
- check_style(clean_lines, line, file_extension, file_state, error)
+ check_style(clean_lines, line, file_extension, class_state, file_state, error)
check_language(filename, clean_lines, line, file_extension, include_state,
error)
check_for_non_standard_constructs(clean_lines, line, class_state, error)
diff --git a/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py b/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py
index 2dde549..ee829aa 100644
--- a/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py
+++ b/WebKitTools/Scripts/webkitpy/style/checkers/cpp_unittest.py
@@ -164,7 +164,7 @@ class CppStyleTestBase(unittest.TestCase):
class_state = cpp_style._ClassState()
file_state = cpp_style._FileState()
for i in xrange(lines.num_lines()):
- cpp_style.check_style(lines, i, file_extension, file_state, error_collector)
+ cpp_style.check_style(lines, i, file_extension, class_state, file_state, error_collector)
cpp_style.check_for_non_standard_constructs(lines, i, class_state,
error_collector)
class_state.check_finished(error_collector)
@@ -2594,6 +2594,19 @@ class NoNonVirtualDestructorsTest(CppStyleTestBase):
self.assert_multi_line_lint(
'class Foo { void foo(); };',
'More than one command on the same line [whitespace/newline] [4]')
+ self.assert_multi_line_lint(
+ 'class MyClass {\n'
+ ' int getIntValue() { ASSERT(m_ptr); return *m_ptr; }\n'
+ '};\n',
+ '')
+ self.assert_multi_line_lint(
+ 'class MyClass {\n'
+ ' int getIntValue()\n'
+ ' {\n'
+ ' ASSERT(m_ptr); return *m_ptr;\n'
+ ' }\n'
+ '};\n',
+ 'More than one command on the same line [whitespace/newline] [4]')
self.assert_multi_line_lint(
'''class Qualified::Goo : public Foo {
@@ -3472,6 +3485,15 @@ class WebKitStyleTest(CppStyleTestBase):
self.assert_lint(
'gchar* result = g_strjoin(",", "part1", NULL);',
'')
+ self.assert_lint(
+ 'gchar* result = gdk_pixbuf_save_to_callback(pixbuf, function, data, type, error, NULL);',
+ '')
+ self.assert_lint(
+ 'gchar* result = gdk_pixbuf_save_to_buffer(pixbuf, function, data, type, error, NULL);',
+ '')
+ self.assert_lint(
+ 'gchar* result = gdk_pixbuf_save_to_stream(pixbuf, function, data, type, error, NULL);',
+ '')
# 2. C++ and C bool values should be written as true and
# false. Objective-C BOOL values should be written as YES and NO.
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py b/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py
index 8f0d153..9ceb2cb 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/abstractstep.py
@@ -35,10 +35,6 @@ from webkitpy.tool.steps.options import Options
class AbstractStep(object):
def __init__(self, tool, options):
self._tool = tool
- if options.no_squash:
- raise ScriptError('--no-squash has been removed. Use "--git-commit=HEAD.." or "-g HEAD.." to operate on the working copy.')
- if options.squash:
- raise ScriptError('--squash has been removed. It is now the default behavior if --git-commit is omitted.')
self._options = options
self._port = None
@@ -76,9 +72,6 @@ class AbstractStep(object):
return [
# We need this option here because cached_lookup uses it. :(
Options.git_commit,
- # FIXME: Get rid of these.
- Options.no_squash,
- Options.squash,
]
def run(self, state):
diff --git a/WebKitTools/Scripts/webkitpy/tool/steps/options.py b/WebKitTools/Scripts/webkitpy/tool/steps/options.py
index 9c73f5a..e7e3855 100644
--- a/WebKitTools/Scripts/webkitpy/tool/steps/options.py
+++ b/WebKitTools/Scripts/webkitpy/tool/steps/options.py
@@ -46,8 +46,6 @@ class Options(object):
git_commit = make_option("-g", "--git-commit", action="store", dest="git_commit", help="Operate on a local commit. If a range, the commits are squashed into one. HEAD.. operates on working copy changes only.")
local_commit = make_option("--local-commit", action="store_true", dest="local_commit", default=False, help="Make a local commit for each applied patch")
non_interactive = make_option("--non-interactive", action="store_true", dest="non_interactive", default=False, help="Never prompt the user, fail as fast as possible.")
- # FIXME: Remove --no-squash, once people have adjusted to using --git-commit.
- no_squash = make_option("--no-squash", action="store_true", dest="no_squash", default=False, help="Obsolete. Use --git-commit=HEAD.. instead.")
obsolete_patches = make_option("--no-obsolete", action="store_false", dest="obsolete_patches", default=True, help="Do not obsolete old patches before posting this one.")
open_bug = make_option("--open-bug", action="store_true", dest="open_bug", default=False, help="Opens the associated bug in a browser.")
parent_command = make_option("--parent-command", action="store", dest="parent_command", default=None, help="(Internal) The command that spawned this instance.")
@@ -56,7 +54,5 @@ class Options(object):
request_commit = make_option("--request-commit", action="store_true", dest="request_commit", default=False, help="Mark the patch as needing auto-commit after review.")
review = make_option("--no-review", action="store_false", dest="review", default=True, help="Do not mark the patch for review.")
reviewer = make_option("-r", "--reviewer", action="store", type="string", dest="reviewer", help="Update ChangeLogs to say Reviewed by REVIEWER.")
- # FIXME: Remove --squash, once people have adjusted to using --git-commit.
- squash = make_option("-s", "--squash", action="store_true", dest="squash", default=False, help="Obsolete. This is now the default behavior.")
test = make_option("--test", action="store_true", dest="test", default=False, help="Run run-webkit-tests before committing.")
update = make_option("--no-update", action="store_false", dest="update", default=True, help="Don't update the working directory.")