Diff
Modified: trunk/Tools/ChangeLog (232444 => 232445)
--- trunk/Tools/ChangeLog 2018-06-02 21:13:47 UTC (rev 232444)
+++ trunk/Tools/ChangeLog 2018-06-02 23:02:50 UTC (rev 232445)
@@ -1,3 +1,16 @@
+2018-06-02 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r232421.
+ https://bugs.webkit.org/show_bug.cgi?id=186240
+
+ Breaks webkitpy tests (Requested by aakashjain on #webkit).
+
+ Reverted changeset:
+
+ "Add some tests for lldb_webkit.py"
+ https://bugs.webkit.org/show_bug.cgi?id=183744
+ https://trac.webkit.org/changeset/232421
+
2018-06-01 Daniel Bates <[email protected]>
Add some tests for lldb_webkit.py
Modified: trunk/Tools/Makefile (232444 => 232445)
--- trunk/Tools/Makefile 2018-06-02 21:13:47 UTC (rev 232444)
+++ trunk/Tools/Makefile 2018-06-02 23:02:50 UTC (rev 232445)
@@ -2,7 +2,7 @@
ifneq (,$(SDKROOT))
ifeq (,$(findstring macosx,$(SDKROOT)))
- MODULES = DumpRenderTree WebKitTestRunner ../Source/ThirdParty/gtest/xcode TestWebKitAPI lldb/lldbWebKitTester
+ MODULES = DumpRenderTree WebKitTestRunner ../Source/ThirdParty/gtest/xcode TestWebKitAPI
endif
ifneq (,$(findstring iphone,$(SDKROOT)))
MODULES += MobileMiniBrowser
Deleted: trunk/Tools/Scripts/build-lldbwebkittester (232444 => 232445)
--- trunk/Tools/Scripts/build-lldbwebkittester 2018-06-02 21:13:47 UTC (rev 232444)
+++ trunk/Tools/Scripts/build-lldbwebkittester 2018-06-02 23:02:50 UTC (rev 232445)
@@ -1,76 +0,0 @@
-#!/usr/bin/env perl
-
-# Copyright (C) 2014-2018 Apple 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.
-# 3. Neither the name of Apple Inc. ("Apple") nor the names of
-# its contributors may be used to endorse or promote products derived
-# from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY APPLE 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 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.
-
-use strict;
-use warnings;
-use File::Basename;
-use FindBin;
-use Getopt::Long qw(:config pass_through);
-use lib $FindBin::Bin;
-use webkitdirs;
-
-sub buildProjectOrDie($$);
-
-my $showHelp;
-my $clean = 0;
-
-my $programName = basename($0);
-my $usage = <<EOF;
-Usage: $programName [options] [options to pass to build system]
- --help Show this help message
- --clean Clean up the build directory
-EOF
-
-my $result = GetOptions(
- "help" => \$showHelp,
- "clean" => \$clean,
-);
-
-if ($showHelp || !$result) {
- print STDERR $usage;
- exit 1;
-}
-
-checkRequiredSystemConfig();
-setConfiguration();
-chdirWebKit();
-
-my @xcodeOptions = XcodeOptions();
-
-buildProjectOrDie("Source/bmalloc", "bmalloc");
-buildProjectOrDie("Source/WTF", "WTF");
-buildProjectOrDie("Tools/lldb/lldbWebKitTester", "lldbWebKitTester");
-
-sub buildProjectOrDie($$)
-{
- my ($path, $project) = @_;
- chdir($path) or die;
- $result = exitStatus(buildXCodeProject($project, $clean, @xcodeOptions, @ARGV));
- exit $result if $result;
- chdirWebKit();
-}
Modified: trunk/Tools/Scripts/dump-class-layout (232444 => 232445)
--- trunk/Tools/Scripts/dump-class-layout 2018-06-02 21:13:47 UTC (rev 232444)
+++ trunk/Tools/Scripts/dump-class-layout 2018-06-02 23:02:50 UTC (rev 232445)
@@ -31,9 +31,6 @@
import subprocess
from sets import Set
-from webkitpy.common.system.systemhost import SystemHost
-sys.path.append(SystemHost().path_to_lldb_python_directory())
-import lldb
framework = "WebCore"
build_directory = ""
@@ -44,6 +41,21 @@
scriptpath = os.path.dirname(os.path.realpath(__file__))
return subprocess.check_output([os.path.join(scriptpath, "webkit-build-directory"), "--top-level"]).strip()
+def developer_dir():
+ return subprocess.check_output(["xcode-select", "--print-path"])
+
+def import_lldb():
+ xcode_contents_path = os.path.split(developer_dir())[0]
+ lldb_framework_path = os.path.join(xcode_contents_path, "SharedFrameworks", "LLDB.framework", "Resources", "Python")
+ sys.path.append(lldb_framework_path)
+
+ LLDB_MODULE_NAME = "lldb"
+ try:
+ globals()[LLDB_MODULE_NAME] = __import__(LLDB_MODULE_NAME)
+ except ImportError:
+ print "Failed to import {} from {}".format(LLDB_MODULE_NAME, lldb_framework_path)
+ sys.exit(1)
+
def verify_type(target, type):
typename = type.GetName()
seenOffset = Set()
@@ -184,6 +196,7 @@
build_dir = args.build_directory
target_path = os.path.join(build_dir, args.config, args.framework + ".framework", args.framework);
+ import_lldb()
dump_class(target_path, args.classname, args.arch)
if __name__ == "__main__":
Modified: trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py (232444 => 232445)
--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py 2018-06-02 21:13:47 UTC (rev 232444)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py 2018-06-02 23:02:50 UTC (rev 232445)
@@ -60,8 +60,7 @@
# We cache the mock SVN repo so that we don't create it again for each call to an SVNTest or GitTest test_ method.
# We store it in a global variable so that we can delete this cached repo on exit(3).
-# FIXME: Remove this once test-webkitpy supports class and module fixtures (i.e. setUpClass()/setUpModule()
-# are called exactly once per class/module).
+# FIXME: Remove this once we migrate to Python 2.7. Unittest in Python 2.7 supports module-specific setup and teardown functions.
cached_svn_repo_path = None
@@ -71,8 +70,7 @@
shutil.rmtree(path)
-# FIXME: Remove this once test-webkitpy supports class and module fixtures (i.e. setUpClass()/setUpModule()
-# are called exactly once per class/module).
+# FIXME: Remove this once we migrate to Python 2.7. Unittest in Python 2.7 supports module-specific setup and teardown functions.
@atexit.register
def delete_cached_mock_repo_at_exit():
if cached_svn_repo_path:
Modified: trunk/Tools/Scripts/webkitpy/common/system/systemhost.py (232444 => 232445)
--- trunk/Tools/Scripts/webkitpy/common/system/systemhost.py 2018-06-02 21:13:47 UTC (rev 232444)
+++ trunk/Tools/Scripts/webkitpy/common/system/systemhost.py 2018-06-02 23:02:50 UTC (rev 232445)
@@ -47,8 +47,3 @@
def symbolicate_crash_log_if_needed(self, path):
return self.filesystem.read_text_file(path)
-
- def path_to_lldb_python_directory(self):
- if not self.platform.is_mac():
- return ''
- return self.executive.run_command(['xcrun', 'lldb', '--python-path'], return_stderr=False).rstrip()
Modified: trunk/Tools/Scripts/webkitpy/test/main.py (232444 => 232445)
--- trunk/Tools/Scripts/webkitpy/test/main.py 2018-06-02 21:13:47 UTC (rev 232444)
+++ trunk/Tools/Scripts/webkitpy/test/main.py 2018-06-02 23:02:50 UTC (rev 232445)
@@ -1,6 +1,5 @@
# Copyright (C) 2012 Google, Inc.
# Copyright (C) 2010 Chris Jerdonek ([email protected])
-# Copyright (C) 2018 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -38,10 +37,7 @@
import unittest
from webkitpy.common.system.logutils import configure_logging
-from webkitpy.common.system.executive import Executive
from webkitpy.common.system.filesystem import FileSystem
-from webkitpy.common.system.systemhost import SystemHost
-from webkitpy.port.config import Config
from webkitpy.test.finder import Finder
from webkitpy.test.printer import Printer
from webkitpy.test.runner import Runner, unit_test_name
@@ -48,49 +44,20 @@
_log = logging.getLogger(__name__)
-_host = SystemHost()
-_webkit_root = None
-
-def _find_lldb_webkit_tester():
- config = Config(_host.executive, _host.filesystem)
- lldb_webkit_tester_executable = os.path.join(config.build_directory(config.default_configuration()), 'lldbWebKitTester')
- return os.path.isfile(lldb_webkit_tester_executable) and os.access(lldb_webkit_tester_executable, os.X_OK)
-
-
-def _build_lldb_webkit_tester():
- if not _host.platform.is_mac():
- _log.error('lldbWebKitTester is not supported on this platform.')
- return False
- config = Config(_host.executive, _host.filesystem)
- build_lldbwebkittester = os.path.join(_webkit_root, 'Tools', 'Scripts', 'build-lldbwebkittester')
- return _host.executive.run_command([build_lldbwebkittester, config.flag_for_configuration(config.default_configuration())], return_exit_code=True) == 0
-
-
def main():
- global _webkit_root
configure_logging(logger=_log)
up = os.path.dirname
- _webkit_root = up(up(up(up(up(os.path.abspath(__file__))))))
+ webkit_root = up(up(up(up(up(os.path.abspath(__file__))))))
tester = Tester()
- tester.add_tree(os.path.join(_webkit_root, 'Tools', 'Scripts'), 'webkitpy')
+ tester.add_tree(os.path.join(webkit_root, 'Tools', 'Scripts'), 'webkitpy')
# There is no WebKit2 on Windows, so we don't need to run WebKit2 unittests on it.
if not (sys.platform.startswith('win') or sys.platform == 'cygwin'):
- tester.add_tree(os.path.join(_webkit_root, 'Source', 'WebKit', 'Scripts'), 'webkit')
+ tester.add_tree(os.path.join(webkit_root, 'Source', 'WebKit', 'Scripts'), 'webkit')
- lldb_python_directory = _host.path_to_lldb_python_directory()
- if os.path.isdir(lldb_python_directory):
- if lldb_python_directory not in sys.path:
- sys.path.append(lldb_python_directory)
- tester.add_tree(os.path.join(_webkit_root, 'Tools', 'lldb'))
- will_run_lldb_webkit_tests = True
- else:
- _log.info("Skipping lldb_webkit tests; could not find path to lldb.py '{}'.".format(lldb_python_directory))
- will_run_lldb_webkit_tests = False
-
tester.skip(('webkitpy.common.checkout.scm.scm_unittest',), 'are really, really, slow', 31818)
if sys.platform.startswith('win'):
tester.skip(('webkitpy.common.checkout', 'webkitpy.common.config', 'webkitpy.tool'), 'fail horribly on win32', 54526)
@@ -104,11 +71,11 @@
from google.appengine.dist import use_library
use_library('django', '1.2')
dev_appserver.fix_sys_path()
- tester.add_tree(os.path.join(_webkit_root, 'Tools', 'QueueStatusServer'))
+ tester.add_tree(os.path.join(webkit_root, 'Tools', 'QueueStatusServer'))
else:
_log.info('Skipping QueueStatusServer tests; the Google AppEngine Python SDK is not installed.')
- return not tester.run(will_run_lldb_webkit_tests=will_run_lldb_webkit_tests)
+ return not tester.run()
def _print_results_as_json(stream, all_test_names, failures, errors):
@@ -164,7 +131,7 @@
return parser.parse_args(argv)
- def run(self, will_run_lldb_webkit_tests=False):
+ def run(self):
self._options, args = self._parse_args()
self.printer.configure(self._options)
@@ -175,9 +142,9 @@
_log.error('No tests to run')
return False
- return self._run_tests(names, will_run_lldb_webkit_tests)
+ return self._run_tests(names)
- def _run_tests(self, names, will_run_lldb_webkit_tests):
+ def _run_tests(self, names):
# Make sure PYTHONPATH is set up properly.
sys.path = self.finder.additional_paths(sys.path) + sys.path
@@ -187,14 +154,6 @@
from webkitpy.thirdparty import autoinstall_everything
autoinstall_everything()
- if will_run_lldb_webkit_tests:
- self.printer.write_update("Checking lldbWebKitTester ...")
- if not _find_lldb_webkit_tester():
- self.printer.write_update("Building lldbWebKitTester ...")
- if not _build_lldb_webkit_tester():
- _log.error('Failed to build lldbWebKitTester.')
- return False
-
if self._options.coverage:
_log.warning("Checking code coverage, so running things serially")
self._options.child_processes = 1
Deleted: trunk/Tools/lldb/lldb_webkit_unittest.py (232444 => 232445)
--- trunk/Tools/lldb/lldb_webkit_unittest.py 2018-06-02 21:13:47 UTC (rev 232444)
+++ trunk/Tools/lldb/lldb_webkit_unittest.py 2018-06-02 23:02:50 UTC (rev 232445)
@@ -1,139 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2018 Apple 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.
-
-import atexit
-import lldb
-import lldb_webkit
-import os
-import sys
-import unittest
-
-from webkitpy.common.system.systemhost import SystemHost
-from webkitpy.port.config import Config
-
-
-# We cache the lldb debug session state so that we don't create it again for each call to a serial_test_ method.
-# We store it in a global variable so that we can delete this cached state on exit(3).
-# FIXME: Remove this once test-webkitpy supports class and module fixtures (i.e. setUpClass()/setUpModule()
-# are called exactly once per class/module).
-cached_debug_session = None
-
-
-# FIXME: Remove this once test-webkitpy supports class and module fixtures (i.e. setUpClass()/setUpModule()
-# are called exactly once per class/module).
[email protected]
-def destroy_cached_debug_session():
- if cached_debug_session:
- cached_debug_session.tearDown()
-
-
-class LLDBDebugSession(object):
- @classmethod
- def setup(cls):
- LLDB_WEBKIT_TESTER_NAME = 'lldbWebKitTester'
- BREAK_FOR_TESTING_FUNCTION_NAME = 'breakForTestingSummaryProviders'
-
- cls.sbDebugger = lldb.SBDebugger.Create()
- cls.sbDebugger.SetAsync(False)
-
- host = SystemHost()
- config = Config(host.executive, host.filesystem)
- cls.lldbWebKitTesterExecutable = os.path.join(config.build_directory(config.default_configuration()), LLDB_WEBKIT_TESTER_NAME)
-
- cls.sbTarget = cls.sbDebugger.CreateTarget(str(cls.lldbWebKitTesterExecutable))
- assert cls.sbTarget
- cls.sbTarget.BreakpointCreateByName(BREAK_FOR_TESTING_FUNCTION_NAME, cls.sbTarget.GetExecutable().GetFilename())
-
- argv = None
- envp = None
- cls.sbProcess = cls.sbTarget.LaunchSimple(argv, envp, os.getcwd())
- assert cls.sbProcess
- assert cls.sbProcess.GetState() == lldb.eStateStopped
-
- cls.sbThread = cls.sbProcess.GetThreadAtIndex(0)
- assert cls.sbThread
-
- # Frame 0 is the function with name BREAK_FOR_TESTING_FUNCTION_NAME. We want the frame of the caller of
- # BREAK_FOR_TESTING_FUNCTION_NAME because it has all the interesting local variables we want to test.
- cls.sbFrame = cls.sbThread.GetFrameAtIndex(1)
- assert cls.sbFrame
-
- @classmethod
- def tearDown(cls):
- cls.sbProcess.Kill()
-
-
-class TestSummaryProviders(unittest.TestCase):
- @classmethod
- def setUpClass(cls):
- global cached_debug_session
- if not cached_debug_session:
- cached_debug_session = LLDBDebugSession()
- cached_debug_session.setup()
-
- @property
- def _sbFrame(self):
- return cached_debug_session.sbFrame
-
- # The LLDB Python module does not work with Python multiprocessing and causes errors of the form:
- # objc[76794]: +[__MDQuery initialize] may have been in progress in another thread when fork() was called.
- # We cannot safely call it or ignore it in the fork() child process. Crashing instead.
- # So, we run the following tests serially.
-
- # MARK: WTFStringImpl_SummaryProvider test cases
-
- def serial_test_WTFStringImpl_SummaryProvider_null_string(self):
- summary = lldb_webkit.WTFStringImpl_SummaryProvider(self._sbFrame.FindVariable('aNullStringImpl'), {})
- self.assertEqual(summary, "{ length = 0, is8bit = 1, contents = '' }")
-
- def serial_test_WTFStringImpl_SummaryProvider_empty_string(self):
- summary = lldb_webkit.WTFStringImpl_SummaryProvider(self._sbFrame.FindVariable('anEmptyStringImpl'), {})
- self.assertEqual(summary, "{ length = 0, is8bit = 1, contents = '' }")
-
- def serial_test_WTFStringImpl_SummaryProvider_8bit_string(self):
- summary = lldb_webkit.WTFStringImpl_SummaryProvider(self._sbFrame.FindVariable('an8BitStringImpl'), {})
- self.assertEqual(summary, "{ length = 8, is8bit = 1, contents = 'r\\xe9sum\\xe9' }")
-
- def serial_test_WTFStringImpl_SummaryProvider_16bit_string(self):
- summary = lldb_webkit.WTFStringImpl_SummaryProvider(self._sbFrame.FindVariable('a16BitStringImpl'), {})
- self.assertEqual(summary, u"{ length = 13, is8bit = 0, contents = '\\u1680Cappuccino\\u1680\\x00' }")
-
- # MARK: WTFString_SummaryProvider test cases
-
- def serial_test_WTFString_SummaryProvider_null_string(self):
- summary = lldb_webkit.WTFString_SummaryProvider(self._sbFrame.FindVariable('aNullString'), {})
- self.assertEqual(summary, "{ length = 0, contents = '' }")
-
- def serial_test_WTFString_SummaryProvider_empty_string(self):
- summary = lldb_webkit.WTFString_SummaryProvider(self._sbFrame.FindVariable('anEmptyString'), {})
- self.assertEqual(summary, "{ length = 0, contents = '' }")
-
- def serial_test_WTFString_SummaryProvider_8bit_string(self):
- summary = lldb_webkit.WTFString_SummaryProvider(self._sbFrame.FindVariable('an8BitString'), {})
- self.assertEqual(summary, "{ length = 8, contents = 'r\\xe9sum\\xe9' }")
-
- def serial_test_WTFString_SummaryProvider_16bit_string(self):
- summary = lldb_webkit.WTFString_SummaryProvider(self._sbFrame.FindVariable('a16BitString'), {})
- self.assertEqual(summary, u"{ length = 13, contents = '\\u1680Cappuccino\\u1680\\x00' }")