summaryrefslogtreecommitdiff
path: root/chromium/third_party/WebKit/Tools/Scripts/webkitpy
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Tools/Scripts/webkitpy')
-rw-r--r--chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py3
-rw-r--r--chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py3
-rw-r--r--chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py5
-rw-r--r--chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py139
-rw-r--r--chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py51
-rw-r--r--chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake.py150
-rw-r--r--chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py90
-rw-r--r--chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py127
-rw-r--r--chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py21
9 files changed, 467 insertions, 122 deletions
diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py
index 2597e0a1401..b3c4367c0b5 100644
--- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py
+++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py
@@ -103,9 +103,6 @@ class LayoutTestResults(object):
def run_was_interrupted(self):
return self._results["interrupted"]
- def builder_name(self):
- return self._results["builder_name"]
-
def blink_revision(self):
return int(self._results["blink_revision"])
diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py
index 99564c6054f..91c7c7a0c8a 100644
--- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py
+++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/builders.py
@@ -41,7 +41,8 @@ from webkitpy.common.memoized import memoized
_exact_matches = {
"WebKit XP": {"port_name": "win-xp"},
"WebKit Win7": {"port_name": "win-win7"},
- "WebKit Win7 (dbg)": {"port_name": "win-win7"},
+ "WebKit Win7 (dbg)(1)": {"port_name": "win-win7"},
+ "WebKit Win7 (dbg)(2)": {"port_name": "win-win7"},
"WebKit Linux": {"port_name": "linux-x86_64"},
"WebKit Linux 32": {"port_name": "linux-x86"},
"WebKit Linux (dbg)": {"port_name": "linux-x86_64"},
diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
index 087ba5ec543..0d8578a36aa 100644
--- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
+++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py
@@ -236,6 +236,11 @@ def parse_args(args):
dest="retry_failures",
help="Don't re-try any tests that produce unexpected results."),
+ # FIXME: Remove this after we remove the flag from the v8 bot.
+ optparse.make_option("--retry-crashes", action="store_true",
+ default=False,
+ help="ignored (we now always retry crashes when we retry failures)."),
+
optparse.make_option("--max-locked-shards", type="int", default=0,
help="Set the maximum number of locked shards"),
optparse.make_option("--additional-env-var", type="string", action="append", default=[],
diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py
index ee084544f74..c6357da4b7b 100644
--- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py
+++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker.py
@@ -38,6 +38,7 @@ import sys
from checkers.common import categories as CommonCategories
from checkers.common import CarriageReturnChecker
from checkers.cpp import CppChecker
+from checkers.cmake import CMakeChecker
from checkers.jsonchecker import JSONChecker
from checkers.png import PNGChecker
from checkers.python import PythonChecker
@@ -126,7 +127,113 @@ _PATH_RULES_SPECIFIER = [
# discipline as WebCore.
([# There is no clean way to avoid "yy_*" names used by flex.
- "Source/core/css/CSSParser-in.cpp"],
+ "Source/WebCore/css/CSSParser.cpp",
+ # Qt code uses '_' in some places (such as private slots
+ # and on test xxx_data methos on tests)
+ "Source/JavaScriptCore/qt/",
+ "Source/WebKit/qt/tests/",
+ "Source/WebKit/qt/declarative/",
+ "Source/WebKit/qt/examples/"],
+ ["-readability/naming"]),
+
+ ([# The Qt APIs use Qt declaration style, it puts the * to
+ # the variable name, not to the class.
+ "Source/WebKit/qt/Api/",
+ "Source/WebKit/qt/WidgetApi/"],
+ ["-readability/naming",
+ "-whitespace/declaration"]),
+
+ ([# Qt's MiniBrowser has no config.h
+ "Tools/MiniBrowser/qt",
+ "Tools/MiniBrowser/qt/raw"],
+ ["-build/include"]),
+
+ ([# The Qt APIs use Qt/QML naming style, which includes
+ # naming parameters in h files.
+ "Source/WebKit2/UIProcess/API/qt"],
+ ["-readability/parameter_name"]),
+
+ ([# The GTK+ port uses the autotoolsconfig.h header in some C sources
+ # to serve the same purpose of config.h.
+ "Tools/GtkLauncher/main.c"],
+ ["-build/include_order"]),
+
+ ([# The GTK+ APIs use GTK+ naming style, which includes
+ # lower-cased, underscore-separated values, whitespace before
+ # parens for function calls, and always having variable names.
+ # Also, GTK+ allows the use of NULL.
+ "Source/WebCore/bindings/scripts/test/GObject",
+ "Source/WebKit/gtk/webkit/",
+ "Tools/DumpRenderTree/gtk/"],
+ ["-readability/naming",
+ "-readability/parameter_name",
+ "-readability/null",
+ "-readability/enum_casing",
+ "-whitespace/parens"]),
+
+ ([# The GTK+ API use upper case, underscore separated, words in
+ # certain types of enums (e.g. signals, properties).
+ "Source/WebKit2/UIProcess/API/gtk",
+ "Source/WebKit2/WebProcess/InjectedBundle/API/gtk"],
+ ["-readability/enum_casing"]),
+
+ ([# Header files in ForwardingHeaders have no header guards or
+ # exceptional header guards (e.g., WebCore_FWD_Debugger_h).
+ "/ForwardingHeaders/"],
+ ["-build/header_guard"]),
+ ([# assembler has lots of opcodes that use underscores, so
+ # we don't check for underscores in that directory.
+ "Source/JavaScriptCore/assembler/",
+ "Source/JavaScriptCore/jit/JIT"],
+ ["-readability/naming/underscores"]),
+ ([# JITStubs has an usual syntax which causes false alarms for a few checks.
+ "JavaScriptCore/jit/JITStubs.cpp"],
+ ["-readability/parameter_name",
+ "-whitespace/parens"]),
+
+ ([# The EFL APIs use EFL naming style, which includes
+ # both lower-cased and camel-cased, underscore-sparated
+ # values.
+ "Source/WebKit/efl/ewk/",
+ "Source/WebKit2/UIProcess/API/efl/"],
+ ["-readability/naming",
+ "-readability/parameter_name"]),
+ ([# EWebLauncher and MiniBrowser are EFL simple application.
+ # They need to use efl coding style and they don't have config.h.
+ "Tools/EWebLauncher/",
+ "Tools/MiniBrowser/efl/"],
+ ["-readability/naming",
+ "-readability/parameter_name",
+ "-whitespace/declaration",
+ "-build/include_order"]),
+
+ # WebKit2 rules:
+ # WebKit2 and certain directories have idiosyncracies.
+ ([# NPAPI has function names with underscores.
+ "Source/WebKit2/WebProcess/Plugins/Netscape"],
+ ["-readability/naming"]),
+ ([# The WebKit2 C API has names with underscores and whitespace-aligned
+ # struct members. Also, we allow unnecessary parameter names in
+ # WebKit2 APIs because we're matching CF's header style.
+ # Additionally, we use word which starts with non-capital letter 'k'
+ # for types of enums.
+ "Source/WebKit2/UIProcess/API/C/",
+ "Source/WebKit2/Shared/API/c/",
+ "Source/WebKit2/WebProcess/InjectedBundle/API/c/"],
+ ["-readability/enum_casing",
+ "-readability/naming",
+ "-readability/parameter_name",
+ "-whitespace/declaration"]),
+ ([# These files define GObjects, which implies some definitions of
+ # variables and functions containing underscores.
+ "Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.cpp",
+ "Source/WebCore/platform/graphics/clutter/GraphicsLayerActor.h",
+ "Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer1.cpp",
+ "Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp",
+ "Source/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp",
+ "Source/WebCore/platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp",
+ "Source/WebCore/platform/network/soup/ProxyResolverSoup.cpp",
+ "Source/WebCore/platform/network/soup/ProxyResolverSoup.h"],
["-readability/naming"]),
# For third-party Python code, keep only the following checks--
@@ -141,6 +248,22 @@ _PATH_RULES_SPECIFIER = [
"+pep8/W291", # Trailing white space
"+whitespace/carriage_return"]),
+ ([# glu's libtess is third-party code, and doesn't follow WebKit style.
+ "Source/ThirdParty/glu"],
+ ["-readability",
+ "-whitespace",
+ "-build/header_guard",
+ "-build/include_order"]),
+
+ ([# There is no way to avoid the symbols __jit_debug_register_code
+ # and __jit_debug_descriptor when integrating with gdb.
+ "Source/JavaScriptCore/jit/GDBInterface.cpp"],
+ ["-readability/naming"]),
+
+ ([# On some systems the trailing CR is causing parser failure.
+ "Source/JavaScriptCore/parser/Keywords.table"],
+ ["+whitespace/carriage_return"]),
+
([# Jinja templates: files have .cpp or .h extensions, but contain
# template code, which can't be handled, so disable tests.
"Source/bindings/templates",
@@ -160,9 +283,12 @@ _JSON_FILE_EXTENSION = 'json'
_PYTHON_FILE_EXTENSION = 'py'
_TEXT_FILE_EXTENSIONS = [
+ 'ac',
'cc',
'cgi',
'css',
+ 'exp',
+ 'flex',
'gyp',
'gypi',
'html',
@@ -173,9 +299,13 @@ _TEXT_FILE_EXTENSIONS = [
'php',
'pl',
'pm',
+ 'pri',
+ 'pro',
'rb',
'sh',
+ 'table',
'txt',
+ 'wm',
'xhtml',
'y',
]
@@ -189,6 +319,8 @@ _XML_FILE_EXTENSIONS = [
_PNG_FILE_EXTENSION = 'png'
+_CMAKE_FILE_EXTENSION = 'cmake'
+
# Files to skip that are less obvious.
#
# Some files should be skipped when checking style. For example,
@@ -383,6 +515,7 @@ class FileType:
# WATCHLIST = 7
XML = 8
XCODEPROJ = 9
+ CMAKE = 10
class CheckerDispatcher(object):
@@ -453,6 +586,8 @@ class CheckerDispatcher(object):
return FileType.XCODEPROJ
elif file_extension == _PNG_FILE_EXTENSION:
return FileType.PNG
+ elif ((file_extension == _CMAKE_FILE_EXTENSION) or os.path.basename(file_path) == 'CMakeLists.txt'):
+ return FileType.CMAKE
elif ((not file_extension and os.path.join("Tools", "Scripts") in file_path) or
file_extension in _TEXT_FILE_EXTENSIONS or os.path.basename(file_path) == 'TestExpectations'):
return FileType.TEXT
@@ -478,6 +613,8 @@ class CheckerDispatcher(object):
checker = XcodeProjectFileChecker(file_path, handle_style_error)
elif file_type == FileType.PNG:
checker = PNGChecker(file_path, handle_style_error)
+ elif file_type == FileType.CMAKE:
+ checker = CMakeChecker(file_path, handle_style_error)
elif file_type == FileType.TEXT:
basename = os.path.basename(file_path)
if basename == 'TestExpectations':
diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py
index 1c588732051..c19367fc2b9 100644
--- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py
+++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checker_unittest.py
@@ -213,7 +213,43 @@ class GlobalVariablesTest(unittest.TestCase):
"build/include")
assertCheck("random_path.cpp",
"readability/naming")
- assertNoCheck("Source/core/css/CSSParser-in.cpp",
+ assertNoCheck("Source/WebKit/gtk/webkit/webkit.h",
+ "readability/naming")
+ assertNoCheck("Tools/DumpRenderTree/gtk/DumpRenderTree.cpp",
+ "readability/null")
+ assertNoCheck("Source/WebKit/efl/ewk/ewk_view.h",
+ "readability/naming")
+ assertNoCheck("Source/WebCore/css/CSSParser.cpp",
+ "readability/naming")
+
+ # Test if Qt exceptions are indeed working
+ assertCheck("Source/WebKit/qt/WidgetApi/qwebpage.cpp",
+ "readability/braces")
+ assertCheck("Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp",
+ "readability/braces")
+ assertCheck("Source/WebKit/qt/declarative/platformplugin/WebPlugin.cpp",
+ "readability/braces")
+ assertCheck("Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp",
+ "readability/braces")
+ assertNoCheck("Source/WebKit/qt/WidgetApi/qwebpage.cpp",
+ "readability/naming")
+ assertNoCheck("Source/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp",
+ "readability/naming")
+ assertNoCheck("Source/WebKit/qt/declarative/platformplugin/WebPlugin.cpp",
+ "readability/naming")
+ assertNoCheck("Source/WebKit/qt/examples/platformplugin/WebPlugin.cpp",
+ "readability/naming")
+
+ assertNoCheck("Tools/MiniBrowser/qt/UrlLoader.cpp",
+ "build/include")
+
+ assertNoCheck("Source/WebKit2/UIProcess/API/qt",
+ "readability/parameter_name")
+
+ assertNoCheck("Source/WebCore/ForwardingHeaders/debugger/Debugger.h",
+ "build/header_guard")
+
+ assertNoCheck("Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp",
"readability/naming")
# Third-party Python code: webkitpy/thirdparty
@@ -224,6 +260,13 @@ class GlobalVariablesTest(unittest.TestCase):
assertCheck(path, "pep8/W291")
assertCheck(path, "whitespace/carriage_return")
+ # Test if the exception for GDBInterface.cpp is in place.
+ assertNoCheck("Source/JavaScriptCore/jit/GDBInterface.cpp",
+ "readability/naming")
+
+ # Javascript keywords.
+ assertCheck("Source/JavaScriptCore/parser/Keywords.table", "whitespace/carriage_return")
+
def test_max_reports_per_category(self):
"""Check that _MAX_REPORTS_PER_CATEGORY is valid."""
all_categories = self._all_categories()
@@ -456,9 +499,12 @@ class CheckerDispatcherDispatchTest(unittest.TestCase):
def test_text_paths(self):
"""Test paths that should be checked as text."""
paths = [
+ "foo.ac",
"foo.cc",
"foo.cgi",
"foo.css",
+ "foo.exp",
+ "foo.flex",
"foo.gyp",
"foo.gypi",
"foo.html",
@@ -469,9 +515,12 @@ class CheckerDispatcherDispatchTest(unittest.TestCase):
"foo.php",
"foo.pl",
"foo.pm",
+ "foo.pri",
+ "foo.pro",
"foo.rb",
"foo.sh",
"foo.txt",
+ "foo.wm",
"foo.xhtml",
"foo.y",
os.path.join("Source", "WebCore", "inspector", "front-end", "inspector.js"),
diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake.py
new file mode 100644
index 00000000000..06b8929fab6
--- /dev/null
+++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake.py
@@ -0,0 +1,150 @@
+# Copyright (C) 2012 Intel Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+"""Supports checking WebKit style in cmake files.(.cmake, CMakeLists.txt)"""
+
+import re
+
+from common import TabChecker
+
+
+class CMakeChecker(object):
+
+ """Processes CMake lines for checking style."""
+
+ # NO_SPACE_CMDS list are based on commands section of CMake document.
+ # Now it is generated from
+ # http://www.cmake.org/cmake/help/v2.8.10/cmake.html#section_Commands.
+ # Some commands are from default CMake modules such as pkg_check_modules.
+ # Please keep list in alphabet order.
+ #
+ # For commands in this list, spaces should not be added it and its
+ # parentheses. For eg, message("testing"), not message ("testing")
+ #
+ # The conditional commands like if, else, endif, foreach, endforeach,
+ # while, endwhile and break are listed in ONE_SPACE_CMDS
+ NO_SPACE_CMDS = [
+ 'add_custom_command', 'add_custom_target', 'add_definitions',
+ 'add_dependencies', 'add_executable', 'add_library',
+ 'add_subdirectory', 'add_test', 'aux_source_directory',
+ 'build_command',
+ 'cmake_minimum_required', 'cmake_policy', 'configure_file',
+ 'create_test_sourcelist',
+ 'define_property',
+ 'enable_language', 'enable_testing', 'endfunction', 'endmacro',
+ 'execute_process', 'export',
+ 'file', 'find_file', 'find_library', 'find_package', 'find_path',
+ 'find_program', 'fltk_wrap_ui', 'function',
+ 'get_cmake_property', 'get_directory_property',
+ 'get_filename_component', 'get_property', 'get_source_file_property',
+ 'get_target_property', 'get_test_property',
+ 'include', 'include_directories', 'include_external_msproject',
+ 'include_regular_expression', 'install',
+ 'link_directories', 'list', 'load_cache', 'load_command',
+ 'macro', 'mark_as_advanced', 'math', 'message',
+ 'option',
+ #From FindPkgConfig.cmake
+ 'pkg_check_modules',
+ 'project',
+ 'qt_wrap_cpp', 'qt_wrap_ui',
+ 'remove_definitions', 'return',
+ 'separate_arguments', 'set', 'set_directory_properties', 'set_property',
+ 'set_source_files_properties', 'set_target_properties',
+ 'set_tests_properties', 'site_name', 'source_group', 'string',
+ 'target_link_libraries', 'try_compile', 'try_run',
+ 'unset',
+ 'variable_watch',
+ ]
+
+ # CMake conditional commands, require one space between command and
+ # its parentheses, such as "if (", "foreach (", etc.
+ ONE_SPACE_CMDS = [
+ 'if', 'else', 'elseif', 'endif',
+ 'foreach', 'endforeach',
+ 'while', 'endwhile',
+ 'break',
+ ]
+
+ def __init__(self, file_path, handle_style_error):
+ self._handle_style_error = handle_style_error
+ self._tab_checker = TabChecker(file_path, handle_style_error)
+
+ def check(self, lines):
+ self._tab_checker.check(lines)
+ self._num_lines = len(lines)
+ for l in xrange(self._num_lines):
+ self._process_line(l + 1, lines[l])
+
+ def _process_line(self, line_number, line_content):
+ if re.match('(^|\ +)#', line_content):
+ # ignore comment line
+ return
+ l = line_content.expandtabs(4)
+ # check command like message( "testing")
+ if re.search('\(\ +', l):
+ self._handle_style_error(line_number, 'whitespace/parentheses', 5,
+ 'No space after "("')
+ # check command like message("testing" )
+ if re.search('\ +\)', l) and not re.search('^\ +\)$', l):
+ self._handle_style_error(line_number, 'whitespace/parentheses', 5,
+ 'No space before ")"')
+ self._check_trailing_whitespace(line_number, l)
+ self._check_no_space_cmds(line_number, l)
+ self._check_one_space_cmds(line_number, l)
+ self._check_indent(line_number, line_content)
+
+ def _check_trailing_whitespace(self, line_number, line_content):
+ line_content = line_content.rstrip('\n') # chr(10), newline
+ line_content = line_content.rstrip('\r') # chr(13), carriage return
+ line_content = line_content.rstrip('\x0c') # chr(12), form feed, ^L
+ stripped = line_content.rstrip()
+ if line_content != stripped:
+ self._handle_style_error(line_number, 'whitespace/trailing', 5,
+ 'No trailing spaces')
+
+ def _check_no_space_cmds(self, line_number, line_content):
+ # check command like "SET (" or "Set("
+ for t in self.NO_SPACE_CMDS:
+ self._check_non_lowercase_cmd(line_number, line_content, t)
+ if re.search('(^|\ +)' + t.lower() + '\ +\(', line_content):
+ msg = 'No space between command "' + t.lower() + '" and its parentheses, should be "' + t + '("'
+ self._handle_style_error(line_number, 'whitespace/parentheses', 5, msg)
+
+ def _check_one_space_cmds(self, line_number, line_content):
+ # check command like "IF (" or "if(" or "if (" or "If ()"
+ for t in self.ONE_SPACE_CMDS:
+ self._check_non_lowercase_cmd(line_number, line_content, t)
+ if re.search('(^|\ +)' + t.lower() + '(\(|\ \ +\()', line_content):
+ msg = 'One space between command "' + t.lower() + '" and its parentheses, should be "' + t + ' ("'
+ self._handle_style_error(line_number, 'whitespace/parentheses', 5, msg)
+
+ def _check_non_lowercase_cmd(self, line_number, line_content, cmd):
+ if re.search('(^|\ +)' + cmd + '\ *\(', line_content, flags=re.IGNORECASE) and \
+ (not re.search('(^|\ +)' + cmd.lower() + '\ *\(', line_content)):
+ msg = 'Use lowercase command "' + cmd.lower() + '"'
+ self._handle_style_error(line_number, 'command/lowercase', 5, msg)
+
+ def _check_indent(self, line_number, line_content):
+ #TODO (halton): add indent checking
+ pass
diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py
new file mode 100644
index 00000000000..eefc8f7f19f
--- /dev/null
+++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py
@@ -0,0 +1,90 @@
+# Copyright (C) 2012 Intel Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Unit test for cmake.py."""
+
+import webkitpy.thirdparty.unittest2 as unittest
+
+from cmake import CMakeChecker
+
+
+class CMakeCheckerTest(unittest.TestCase):
+
+ """Tests CMakeChecker class."""
+
+ def test_init(self):
+ """Test __init__() method."""
+ def _mock_handle_style_error(self):
+ pass
+
+ checker = CMakeChecker("foo.cmake", _mock_handle_style_error)
+ self.assertEqual(checker._handle_style_error, _mock_handle_style_error)
+
+ def test_check(self):
+ """Test check() method."""
+ errors = []
+
+ def _mock_handle_style_error(line_number, category, confidence,
+ message):
+ error = (line_number, category, confidence, message)
+ errors.append(error)
+
+ checker = CMakeChecker("foo.cmake", _mock_handle_style_error)
+
+ lines = [
+ '# This file is sample input for cmake_unittest.py and includes below problems:\n',
+ 'IF ()',
+ '\tmessage("Error line with Tab")\n',
+ ' message("Error line with endding spaces") \n',
+ ' message( "Error line with space after (")\n',
+ ' message("Error line with space before (" )\n',
+ ' MESSAGE("Error line with upper case non-condtional command")\n',
+ ' MESSage("Error line with upper case non-condtional command")\n',
+ ' message("correct message line")\n',
+ 'ENDif ()\n',
+ '\n',
+ 'if()\n',
+ 'endif ()\n',
+ '\n',
+ 'macro ()\n',
+ 'ENDMacro()\n',
+ '\n',
+ 'function ()\n',
+ 'endfunction()\n',
+ ]
+ checker.check(lines)
+
+ self.maxDiff = None
+ self.assertEqual(errors, [
+ (3, 'whitespace/tab', 5, 'Line contains tab character.'),
+ (2, 'command/lowercase', 5, 'Use lowercase command "if"'),
+ (4, 'whitespace/trailing', 5, 'No trailing spaces'),
+ (5, 'whitespace/parentheses', 5, 'No space after "("'),
+ (6, 'whitespace/parentheses', 5, 'No space before ")"'),
+ (7, 'command/lowercase', 5, 'Use lowercase command "message"'),
+ (8, 'command/lowercase', 5, 'Use lowercase command "message"'),
+ (10, 'command/lowercase', 5, 'Use lowercase command "endif"'),
+ (12, 'whitespace/parentheses', 5, 'One space between command "if" and its parentheses, should be "if ("'),
+ (15, 'whitespace/parentheses', 5, 'No space between command "macro" and its parentheses, should be "macro("'),
+ (16, 'command/lowercase', 5, 'Use lowercase command "endmacro"'),
+ (18, 'whitespace/parentheses', 5, 'No space between command "function" and its parentheses, should be "function("'),
+ ])
diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
index ec55decae82..214395fdd17 100644
--- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
+++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
@@ -32,8 +32,6 @@ import optparse
import re
import sys
import time
-import traceback
-import urllib
import urllib2
from webkitpy.common.checkout.baselineoptimizer import BaselineOptimizer
@@ -568,74 +566,18 @@ class AutoRebaseline(AbstractParallelRebaselineCommand):
self.no_optimize_option,
# FIXME: Remove this option.
self.results_directory_option,
- optparse.make_option("--log-server", help="Server to send logs to.")
])
- def _log_to_server(self, log_server, query):
- if not log_server:
- return
- urllib2.urlopen("http://" + log_server + "/updatelog", data=urllib.urlencode(query))
-
- # Logs when there are no NeedsRebaseline lines in TestExpectations.
- # These entries overwrite the existing log entry if the existing
- # entry is also a noneedsrebaseline entry. This is special cased
- # so that the log doesn't get bloated with entries like this
- # when there are no tests that needs rebaselining.
- def _log_no_needs_rebaseline_lines(self, log_server):
- self._log_to_server(log_server, {
- "noneedsrebaseline": "on",
- })
-
- # Uploaded log entries append to the existing entry unless the
- # newentry flag is set. In that case it starts a new entry to
- # start appending to. So, we need to call this on any fresh run
- # that is going to end up logging stuff (i.e. any run that isn't
- # a noneedsrebaseline run).
- def _start_new_log_entry(self, log_server):
- self._log_to_server(log_server, {
- "log": "",
- "newentry": "on",
- })
-
- def _configure_logging(self, log_server):
- if not log_server:
- return
-
- def _log_alias(query):
- self._log_to_server(log_server, query)
-
- class LogHandler(logging.Handler):
- def __init__(self):
- logging.Handler.__init__(self)
- self._records = []
-
- # Since this does not have the newentry flag, it will append
- # to the most recent log entry (i.e. the one created by
- # _start_new_log_entry.
- def emit(self, record):
- _log_alias({
- "log": record.getMessage(),
- })
-
- handler = LogHandler()
- _log.setLevel(logging.DEBUG)
- handler.setLevel(logging.DEBUG)
- _log.addHandler(handler)
-
- def bot_revision_data(self, log_server):
+ def latest_revision_processed_on_all_bots(self):
revisions = []
for result in self.builder_data().values():
if result.run_was_interrupted():
- self._start_new_log_entry(log_server)
- _log.error("Can't rebaseline because the latest run on %s exited early." % result.builder_name())
- return []
- revisions.append({
- "builder": result.builder_name(),
- "revision": result.blink_revision(),
- })
- return revisions
-
- def tests_to_rebaseline(self, tool, min_revision, print_revisions, log_server):
+ _log.error("Can't rebaseline. The latest run on %s did not complete." % builder_name)
+ return 0
+ revisions.append(result.blink_revision())
+ return int(min(revisions))
+
+ def tests_to_rebaseline(self, tool, min_revision, print_revisions):
port = tool.port_factory.get()
expectations_file_path = port.path_to_generic_test_expectations_file()
@@ -643,16 +585,10 @@ class AutoRebaseline(AbstractParallelRebaselineCommand):
revision = None
author = None
bugs = set()
- has_any_needs_rebaseline_lines = False
for line in tool.scm().blame(expectations_file_path).split("\n"):
if "NeedsRebaseline" not in line:
continue
-
- if not has_any_needs_rebaseline_lines:
- self._start_new_log_entry(log_server)
- has_any_needs_rebaseline_lines = True
-
parsed_line = re.match("^(\S*)[^(]*\((\S*).*?([^ ]*)\ \[[^[]*$", line)
commit_hash = parsed_line.group(1)
@@ -679,7 +615,7 @@ class AutoRebaseline(AbstractParallelRebaselineCommand):
_log.info("Too many tests to rebaseline in one patch. Doing the first %d." % self.MAX_LINES_TO_REBASELINE)
break
- return tests, revision, author, bugs, has_any_needs_rebaseline_lines
+ return tests, revision, author, bugs
def link_to_patch(self, revision):
return "http://src.chromium.org/viewvc/blink?view=revision&revision=" + str(revision)
@@ -727,9 +663,9 @@ class AutoRebaseline(AbstractParallelRebaselineCommand):
def tree_status(self):
blink_tree_status_url = "http://blink-status.appspot.com/status"
status = urllib2.urlopen(blink_tree_status_url).read().lower()
- if status.find('closed') != -1 or status == "0":
+ if status.find('closed') != -1 or status == 0:
return 'closed'
- elif status.find('open') != -1 or status == "1":
+ elif status.find('open') != -1 or status == 1:
return 'open'
return 'unknown'
@@ -742,36 +678,25 @@ class AutoRebaseline(AbstractParallelRebaselineCommand):
_log.error("Cannot proceed with working directory changes. Clean working directory first.")
return
- self._configure_logging(options.log_server)
-
- revision_data = self.bot_revision_data(options.log_server)
- if not revision_data:
- return
-
- min_revision = int(min([item["revision"] for item in revision_data]))
- tests, revision, author, bugs, has_any_needs_rebaseline_lines = self.tests_to_rebaseline(tool, min_revision, print_revisions=options.verbose, log_server=options.log_server)
-
- if not has_any_needs_rebaseline_lines:
- self._log_no_needs_rebaseline_lines(options.log_server)
+ min_revision = self.latest_revision_processed_on_all_bots()
+ if not min_revision:
return
if options.verbose:
- _log.info("Min revision across all bots is %s." % min_revision)
- for item in revision_data:
- _log.info("%s: r%s" % (item["builder"], item["revision"]))
+ _log.info("Bot min revision is %s." % min_revision)
+
+ tests, revision, author, bugs = self.tests_to_rebaseline(tool, min_revision, print_revisions=options.verbose)
+ test_prefix_list, lines_to_remove = self.get_test_prefix_list(tests)
if not tests:
_log.debug('No tests to rebaseline.')
return
+ _log.info('Rebaselining %s for r%s by %s.' % (list(tests), revision, author))
if self.tree_status() == 'closed':
_log.info('Cannot proceed. Tree is closed.')
return
- _log.info('Rebaselining %s for r%s by %s.' % (list(tests), revision, author))
-
- test_prefix_list, lines_to_remove = self.get_test_prefix_list(tests)
-
try:
old_branch_name = tool.scm().current_branch()
tool.scm().delete_branch(self.AUTO_REBASELINE_BRANCH_NAME)
@@ -787,8 +712,6 @@ class AutoRebaseline(AbstractParallelRebaselineCommand):
tool.scm().commit_locally_with_message(self.commit_message(author, revision, bugs))
- # FIXME: Log the upload, pull and dcommit stdout/stderr to the log-server.
-
# FIXME: It would be nice if we could dcommit the patch without uploading, but still
# go through all the precommit hooks. For rebaselines with lots of files, uploading
# takes a long time and sometimes fails, but we don't want to commit if, e.g. the
@@ -815,14 +738,10 @@ class RebaselineOMatic(AbstractDeclarativeCommand):
def execute(self, options, args, tool):
while True:
- try:
- tool.executive.run_command(['git', 'pull'])
- rebaseline_command = [tool.filesystem.join(tool.scm().checkout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline', '--log-server', 'blinkrebaseline.appspot.com']
- if options.verbose:
- rebaseline_command.append('--verbose')
- # Use call instead of run_command so that stdout doesn't get swallowed.
- tool.executive.call(rebaseline_command)
- except:
- traceback.print_exc(file=sys.stderr)
-
+ tool.executive.run_command(['git', 'pull'])
+ rebaseline_command = [tool.filesystem.join(tool.scm().checkout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline']
+ if options.verbose:
+ rebaseline_command.append('--verbose')
+ # Use call instead of run_command so that stdout doesn't get swallowed.
+ tool.executive.call(rebaseline_command)
time.sleep(self.SLEEP_TIME_IN_SECONDS)
diff --git a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
index 6e981182780..9602cf0bee9 100644
--- a/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
+++ b/chromium/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
@@ -591,8 +591,7 @@ class TestAutoRebaseline(_BaseTestCase):
def setUp(self):
super(TestAutoRebaseline, self).setUp()
- self.command.latest_revision_processed_on_all_bots = lambda log_server: 9000
- self.command.bot_revision_data = lambda log_server: [{"builder": "Mock builder", "revision": "9000"}]
+ self.command.latest_revision_processed_on_all_bots = lambda: 9000
def test_tests_to_rebaseline(self):
def blame(path):
@@ -608,12 +607,11 @@ class TestAutoRebaseline(_BaseTestCase):
self.tool.scm().blame = blame
min_revision = 9000
- self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revision, print_revisions=False, log_server=None), (
+ self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revision, print_revisions=False), (
set(['path/to/rebaseline-without-bug-number.html', 'path/to/rebaseline-with-modifiers.html', 'path/to/rebaseline-without-modifiers.html']),
5678,
'foobarbaz1@chromium.org',
- set(['24182', '234']),
- True))
+ set(['24182', '234'])))
def test_tests_to_rebaseline_over_limit(self):
def blame(path):
@@ -628,12 +626,11 @@ class TestAutoRebaseline(_BaseTestCase):
expected_list_of_tests.append("path/to/rebaseline-%s.html" % i)
min_revision = 9000
- self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revision, print_revisions=False, log_server=None), (
+ self.assertEqual(self.command.tests_to_rebaseline(self.tool, min_revision, print_revisions=False), (
set(expected_list_of_tests),
5678,
'foobarbaz1@chromium.org',
- set(['24182']),
- True))
+ set(['24182'])))
def test_commit_message(self):
author = "foo@chromium.org"
@@ -664,7 +661,7 @@ TBR=foo@chromium.org
"""
self.tool.scm().blame = blame
- self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False, log_server=None), [], self.tool)
+ self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool)
self.assertEqual(self.tool.executive.calls, [])
def test_execute(self):
@@ -741,13 +738,13 @@ crbug.com/24182 path/to/locally-changed-lined.html [ NeedsRebaseline ]
}
self.command.tree_status = lambda: 'closed'
- self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False, log_server=None), [], self.tool)
+ self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool)
self.assertEqual(self.tool.executive.calls, [])
self.command.tree_status = lambda: 'open'
self.tool.executive.calls = []
- self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False, log_server=None), [], self.tool)
+ self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool)
self.assertEqual(self.tool.executive.calls, [
[
['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt,png', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-chocolate.html'],
@@ -829,7 +826,7 @@ Bug(foo) fast/dom/prototype-taco.html [ NeedsRebaseline ]
}
self.command.tree_status = lambda: 'open'
- self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False, log_server=None), [], self.tool)
+ self.command.execute(MockOptions(optimize=True, verbose=False, move_overwritten_baselines=False, results_directory=False), [], self.tool)
self.assertEqual(self.tool.executive.calls, [
[
['echo', 'copy-existing-baselines-internal', '--suffixes', 'txt', '--builder', 'MOCK Leopard', '--test', 'fast/dom/prototype-taco.html'],