Diff
Modified: trunk/Tools/ChangeLog (233298 => 233299)
--- trunk/Tools/ChangeLog 2018-06-28 03:05:16 UTC (rev 233298)
+++ trunk/Tools/ChangeLog 2018-06-28 04:19:32 UTC (rev 233299)
@@ -1,3 +1,79 @@
+2018-06-27 Daniel Bates <[email protected]>
+
+ Add some tests for lldb_webkit.py
+ https://bugs.webkit.org/show_bug.cgi?id=183744
+
+ Reviewed by Alexey Proskuryakov.
+
+ Adds some tests to ensure we do not regress LLDB pretty-printing of WTF::StringImpl
+ and WTF::String objects.
+
+ The tests make use of the LLDB Python API (lldb.py) and a simple debug-built test
+ program, lldbWebKitTester, to run. For now, we only support building lldbWebKitTester
+ on Mac.
+
+ * Makefile: Build the simple test tool lldbWebKitTester on Mac.
+ * Scripts/build-lldbwebkittester: Added.
+ (buildProjectOrDie):
+ * Scripts/dump-class-layout: Extract logic to compute the path to the LLDB Python module
+ from here to Scripts/webkitpy/common/system/systemhost.py so that it can used by both
+ this script and lldb/lldb_webkit_unittest.py. Also import the lldb module at the top of
+ the file and take advantage of Python's default error semantics to throw an exception
+ if the import fails instead of handling it ourself. This has the side effect that we
+ now always import the LLDB Python module even if this script is invoked with --help.
+ If this turns out to be a significant annoyance then we can look to dynamically import
+ the module as we did before this change.
+ (webkit_build_dir):
+ (main):
+ (developer_dir): Deleted.
+ (import_lldb): Deleted.
+ * Scripts/webkitpy/common/checkout/scm/scm_unittest.py: Update FIXME comment to reflect
+ that fact that test-webkitpy does not support class and module fixtures. This is because
+ test-webkitpy currently implements parallelism by breaking down existing test classes
+ into individual test methods itself and having each worker run exactly one test method (via
+ unittest.TestLoader.loadTestsFromName()) at a time. As a result of this reorganization,
+ setUpModule()/setUpClass() are called for each test method as opposed to once per test
+ class/test module.
+ (remove_dir): Ditto.
+ * Scripts/webkitpy/common/system/systemhost.py:
+ (SystemHost):
+ (SystemHost.path_to_lldb_python_directory): Added.
+ * Scripts/webkitpy/test/main.py:
+ (_find_lldb_webkit_tester): Returns whether there exists a Debug or Release-built lldbWebKitTester.
+ (_build_lldb_webkit_tester): Builds lldbWebKitTester. For now, we only support building
+ lldbWebKitTester on Mac.
+ (main): Add Tools/lldb to the test search path if the platform has lldb.py.
+ (Tester.run): Pass a boolean as to whether we will run the lldb_webkit unit tests.
+ (Tester._run_tests): Modified to take a boolean as to whether to run the lldb_webkit unit tests.
+ If we will run these tests then build lldbWebKitTester if it has not already been built as the
+ unit tests depend on this program.
+ * lldb/lldbWebKitTester/Configurations/Base.xcconfig: Added.
+ * lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig: Added.
+ * lldb/lldbWebKitTester/Configurations/lldbWebKitTester.xcconfig: Added.
+ * lldb/lldbWebKitTester/Makefile: Added.
+ * lldb/lldbWebKitTester/lldbWebKitTester.xcodeproj/project.pbxproj: Added.
+ * lldb/lldbWebKitTester/main.cpp: Added.
+ (breakForTestingSummaryProviders):
+ (utf16String):
+ (testSummaryProviders):
+ (main):
+ * lldb/lldb_webkit_unittest.py: Added.
+ (destroy_cached_debug_session):
+ (LLDBDebugSession):
+ (LLDBDebugSession.setup):
+ (LLDBDebugSession.tearDown):
+ (TestSummaryProviders):
+ (TestSummaryProviders.setUpClass):
+ (TestSummaryProviders._sbFrame):
+ (TestSummaryProviders.serial_test_WTFStringImpl_SummaryProvider_null_string):
+ (TestSummaryProviders.serial_test_WTFStringImpl_SummaryProvider_empty_string):
+ (TestSummaryProviders.serial_test_WTFStringImpl_SummaryProvider_8bit_string):
+ (TestSummaryProviders.serial_test_WTFStringImpl_SummaryProvider_16bit_string):
+ (TestSummaryProviders.serial_test_WTFString_SummaryProvider_null_string):
+ (TestSummaryProviders.serial_test_WTFString_SummaryProvider_empty_string):
+ (TestSummaryProviders.serial_test_WTFString_SummaryProvider_8bit_string):
+ (TestSummaryProviders.serial_test_WTFString_SummaryProvider_16bit_string):
+
2018-06-27 Adam Barth <[email protected]>
Add Fuchsia support to build-jsc
Modified: trunk/Tools/Makefile (233298 => 233299)
--- trunk/Tools/Makefile 2018-06-28 03:05:16 UTC (rev 233298)
+++ trunk/Tools/Makefile 2018-06-28 04:19:32 UTC (rev 233299)
@@ -2,7 +2,7 @@
ifneq (,$(SDKROOT))
ifeq (,$(findstring macosx,$(SDKROOT)))
- MODULES = DumpRenderTree WebKitTestRunner ../Source/ThirdParty/gtest/xcode TestWebKitAPI
+ MODULES = DumpRenderTree WebKitTestRunner ../Source/ThirdParty/gtest/xcode TestWebKitAPI lldb/lldbWebKitTester
endif
ifneq (,$(findstring iphone,$(SDKROOT)))
MODULES += MobileMiniBrowser
Added: trunk/Tools/Scripts/build-lldbwebkittester (0 => 233299)
--- trunk/Tools/Scripts/build-lldbwebkittester (rev 0)
+++ trunk/Tools/Scripts/build-lldbwebkittester 2018-06-28 04:19:32 UTC (rev 233299)
@@ -0,0 +1,76 @@
+#!/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();
+}
Property changes on: trunk/Tools/Scripts/build-lldbwebkittester
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property
Modified: trunk/Tools/Scripts/dump-class-layout (233298 => 233299)
--- trunk/Tools/Scripts/dump-class-layout 2018-06-28 03:05:16 UTC (rev 233298)
+++ trunk/Tools/Scripts/dump-class-layout 2018-06-28 04:19:32 UTC (rev 233299)
@@ -31,6 +31,9 @@
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 = ""
@@ -41,21 +44,6 @@
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()
@@ -196,7 +184,6 @@
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 (233298 => 233299)
--- trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py 2018-06-28 03:05:16 UTC (rev 233298)
+++ trunk/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py 2018-06-28 04:19:32 UTC (rev 233299)
@@ -61,7 +61,8 @@
# 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 we migrate to Python 2.7. Unittest in Python 2.7 supports module-specific setup and teardown functions.
+# FIXME: Remove this once test-webkitpy supports class and module fixtures (i.e. setUpClass()/setUpModule()
+# are called exactly once per class/module).
cached_svn_repo_path = None
@@ -71,7 +72,8 @@
shutil.rmtree(path)
-# FIXME: Remove this once we migrate to Python 2.7. Unittest in Python 2.7 supports module-specific setup and teardown functions.
+# FIXME: Remove this once test-webkitpy supports class and module fixtures (i.e. setUpClass()/setUpModule()
+# are called exactly once per class/module).
@atexit.register
def delete_cached_mock_repo_at_exit():
if cached_svn_repo_path:
Modified: trunk/Tools/Scripts/webkitpy/common/system/systemhost.py (233298 => 233299)
--- trunk/Tools/Scripts/webkitpy/common/system/systemhost.py 2018-06-28 03:05:16 UTC (rev 233298)
+++ trunk/Tools/Scripts/webkitpy/common/system/systemhost.py 2018-06-28 04:19:32 UTC (rev 233299)
@@ -47,3 +47,8 @@
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 (233298 => 233299)
--- trunk/Tools/Scripts/webkitpy/test/main.py 2018-06-28 03:05:16 UTC (rev 233298)
+++ trunk/Tools/Scripts/webkitpy/test/main.py 2018-06-28 04:19:32 UTC (rev 233299)
@@ -1,5 +1,6 @@
# 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
@@ -37,7 +38,10 @@
import unittest
from webkitpy.common.system.logutils import configure_logging
+from webkitpy.common.system.executive import Executive, ScriptError
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
@@ -44,20 +48,55 @@
_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')
+ try:
+ _host.executive.run_and_throw_if_fail([build_lldbwebkittester, config.flag_for_configuration(config.default_configuration())], quiet=True)
+ except ScriptError as e:
+ _log.error(e.message_with_output(output_limit=None))
+ return False
+ return True
+
+
+
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)
@@ -71,11 +110,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()
+ return not tester.run(will_run_lldb_webkit_tests=will_run_lldb_webkit_tests)
def _print_results_as_json(stream, all_test_names, failures, errors):
@@ -131,7 +170,7 @@
return parser.parse_args(argv)
- def run(self):
+ def run(self, will_run_lldb_webkit_tests=False):
self._options, args = self._parse_args()
self.printer.configure(self._options)
@@ -142,9 +181,9 @@
_log.error('No tests to run')
return False
- return self._run_tests(names)
+ return self._run_tests(names, will_run_lldb_webkit_tests)
- def _run_tests(self, names):
+ def _run_tests(self, names, will_run_lldb_webkit_tests):
# Make sure PYTHONPATH is set up properly.
sys.path = self.finder.additional_paths(sys.path) + sys.path
@@ -154,6 +193,14 @@
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
Added: trunk/Tools/lldb/lldbWebKitTester/Configurations/Base.xcconfig (0 => 233299)
--- trunk/Tools/lldb/lldbWebKitTester/Configurations/Base.xcconfig (rev 0)
+++ trunk/Tools/lldb/lldbWebKitTester/Configurations/Base.xcconfig 2018-06-28 04:19:32 UTC (rev 233299)
@@ -0,0 +1,119 @@
+// Copyright (C) 2015-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. ``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
+// 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.
+
+#include? "../../../../../Internal/Configurations/HaveInternalSDK.xcconfig"
+
+USE_INTERNAL_SDK = $(USE_INTERNAL_SDK_$(CONFIGURATION));
+USE_INTERNAL_SDK_Production = YES;
+USE_INTERNAL_SDK_Debug = $(HAVE_INTERNAL_SDK);
+USE_INTERNAL_SDK_Release = $(HAVE_INTERNAL_SDK);
+
+ALWAYS_SEARCH_USER_PATHS = NO;
+
+CLANG_CXX_LANGUAGE_STANDARD = gnu++14;
+CLANG_CXX_LIBRARY = libc++;
+CLANG_ENABLE_OBJC_WEAK = YES;
+CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+CLANG_WARN_BOOL_CONVERSION = YES;
+CLANG_WARN_CONSTANT_CONVERSION = YES;
+CLANG_WARN_CXX0X_EXTENSIONS = NO;
+CLANG_WARN_EMPTY_BODY = YES;
+CLANG_WARN_ENUM_CONVERSION = YES;
+CLANG_WARN_INFINITE_RECURSION = YES;
+CLANG_WARN_INT_CONVERSION = YES;
+CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+CLANG_WARN_STRICT_PROTOTYPES = YES;
+CLANG_WARN_SUSPICIOUS_MOVE = YES;
+CLANG_WARN_UNREACHABLE_CODE = NO;
+CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+GCC_WARN_UNDECLARED_SELECTOR = YES;
+COMBINE_HIDPI_IMAGES = NO;
+DEBUG_INFORMATION_FORMAT = dwarf-with-dsym;
+ENABLE_STRICT_OBJC_MSGSEND = YES;
+GCC_C_LANGUAGE_STANDARD = gnu99;
+GCC_DEBUGGING_SYMBOLS = default;
+GCC_DYNAMIC_NO_PIC = NO;
+GCC_ENABLE_CPP_EXCEPTIONS = NO;
+GCC_ENABLE_CPP_RTTI = NO;
+GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+GCC_ENABLE_SYMBOL_SEPARATION = NO;
+GCC_FAST_OBJC_DISPATCH = YES;
+GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+GCC_NO_COMMON_BLOCKS = YES;
+GCC_OBJC_CALL_CXX_CDTORS = YES;
+GCC_PRECOMPILE_PREFIX_HEADER = YES;
+GCC_PREPROCESSOR_DEFINITIONS = $(DEBUG_DEFINES) $(inherited);
+GCC_STRICT_ALIASING = YES;
+GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+GCC_THREADSAFE_STATICS = NO;
+GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO;
+GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
+GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+GCC_WARN_ABOUT_RETURN_TYPE = YES;
+GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES;
+GCC_WARN_SIGN_COMPARE = YES;
+GCC_WARN_UNDECLARED_SELECTOR = YES;
+GCC_WARN_UNINITIALIZED_AUTOS = YES;
+GCC_WARN_UNUSED_FUNCTION = YES;
+GCC_WARN_UNUSED_VARIABLE = NO;
+WARNING_CFLAGS = -Wcast-qual -Wchar-subscripts -Wextra-tokens -Wformat=2 -Winit-self -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wpointer-arith -Wredundant-decls -Wundef -Wwrite-strings -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare -Wimplicit-fallthrough;
+
+HEADER_SEARCH_PATHS = ${BUILT_PRODUCTS_DIR}/usr/local/include;
+
+TARGET_MAC_OS_X_VERSION_MAJOR = $(TARGET_MAC_OS_X_VERSION_MAJOR$(MACOSX_DEPLOYMENT_TARGET:suffix:identifier));
+TARGET_MAC_OS_X_VERSION_MAJOR_11 = 101100;
+TARGET_MAC_OS_X_VERSION_MAJOR_12 = 101200;
+TARGET_MAC_OS_X_VERSION_MAJOR_13 = 101300;
+TARGET_MAC_OS_X_VERSION_MAJOR_14 = 101400;
+TARGET_MAC_OS_X_VERSION_MAJOR_15 = 101500;
+
+SUPPORTED_PLATFORMS = macosx;
+
+// DEBUG_DEFINES, GCC_OPTIMIZATION_LEVEL, STRIP_INSTALLED_PRODUCT and DEAD_CODE_STRIPPING vary between the debug and normal variants.
+// We set up the values for each variant here, and have the Debug configuration in the Xcode project use the _debug variant.
+DEBUG_DEFINES_debug = ;
+DEBUG_DEFINES_normal = NDEBUG;
+DEBUG_DEFINES = $(DEBUG_DEFINES_$(CURRENT_VARIANT));
+
+GCC_OPTIMIZATION_LEVEL = $(GCC_OPTIMIZATION_LEVEL_$(CURRENT_VARIANT));
+GCC_OPTIMIZATION_LEVEL_normal[sdk=macosx*] = 2;
+GCC_OPTIMIZATION_LEVEL_debug = 0;
+
+STRIP_INSTALLED_PRODUCT = $(STRIP_INSTALLED_PRODUCT_$(CURRENT_VARIANT));
+STRIP_INSTALLED_PRODUCT_normal = YES;
+STRIP_INSTALLED_PRODUCT_debug = NO;
+
+DEAD_CODE_STRIPPING_debug = NO;
+DEAD_CODE_STRIPPING_normal = YES;
+DEAD_CODE_STRIPPING = $(DEAD_CODE_STRIPPING_$(CURRENT_VARIANT));
+
+SDKROOT = macosx.internal;
+
+OTHER_CFLAGS = $(ASAN_OTHER_CFLAGS);
+OTHER_CPLUSPLUSFLAGS = $(ASAN_OTHER_CPLUSPLUSFLAGS);
+OTHER_LDFLAGS = $(ASAN_OTHER_LDFLAGS);
Added: trunk/Tools/lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig (0 => 233299)
--- trunk/Tools/lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig (rev 0)
+++ trunk/Tools/lldb/lldbWebKitTester/Configurations/DebugRelease.xcconfig 2018-06-28 04:19:32 UTC (rev 233299)
@@ -0,0 +1,45 @@
+// Copyright (C) 2015-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. ``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
+// 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.
+
+#include "Base.xcconfig"
+
+_ONLY_ACTIVE_ARCH_ = YES;
+
+TARGET_MAC_OS_X_VERSION_MAJOR = $(MAC_OS_X_VERSION_MAJOR);
+
+MACOSX_DEPLOYMENT_TARGET = $(MACOSX_DEPLOYMENT_TARGET_$(PLATFORM_NAME)_$(TARGET_MAC_OS_X_VERSION_MAJOR));
+MACOSX_DEPLOYMENT_TARGET_macosx_101100 = 10.11;
+MACOSX_DEPLOYMENT_TARGET_macosx_101200 = 10.12;
+MACOSX_DEPLOYMENT_TARGET_macosx_101300 = 10.13;
+MACOSX_DEPLOYMENT_TARGET_macosx_101400 = 10.14;
+MACOSX_DEPLOYMENT_TARGET_macosx_101500 = 10.15;
+
+GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
+DEBUG_INFORMATION_FORMAT = dwarf;
+
+SDKROOT = $(SDKROOT_$(USE_INTERNAL_SDK));
+SDKROOT_ = macosx;
+SDKROOT_YES = macosx.internal;
+
+WK_CCACHE_DIR = $(SRCROOT)/../../../Tools/ccache;
+#include "../../../ccache/ccache.xcconfig"
Added: trunk/Tools/lldb/lldbWebKitTester/Configurations/lldbWebKitTester.xcconfig (0 => 233299)
--- trunk/Tools/lldb/lldbWebKitTester/Configurations/lldbWebKitTester.xcconfig (rev 0)
+++ trunk/Tools/lldb/lldbWebKitTester/Configurations/lldbWebKitTester.xcconfig 2018-06-28 04:19:32 UTC (rev 233299)
@@ -0,0 +1,34 @@
+// Copyright (C) 2015-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. ``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
+// 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.
+
+PRODUCT_NAME = $(TARGET_NAME);
+
+RELEASE_DEFINES_debug = ;
+RELEASE_DEFINES_normal = RELEASE_WITHOUT_OPTIMIZATIONS;
+RELEASE_DEFINES = $(RELEASE_DEFINES_$(CURRENT_VARIANT));
+
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) $(RELEASE_DEFINES);
+GCC_OPTIMIZATION_LEVEL = 0;
+STRIP_INSTALLED_PRODUCT = NO;
+DEAD_CODE_STRIPPING = NO;
+OTHER_LDFLAGS[sdk=macosx*] = $(inherited) -framework Cocoa -framework Security -force_load "$(BUILT_PRODUCTS_DIR)/libWTF.a";
Added: trunk/Tools/lldb/lldbWebKitTester/Makefile (0 => 233299)
--- trunk/Tools/lldb/lldbWebKitTester/Makefile (rev 0)
+++ trunk/Tools/lldb/lldbWebKitTester/Makefile 2018-06-28 04:19:32 UTC (rev 233299)
@@ -0,0 +1,2 @@
+SCRIPTS_PATH = ../../Scripts
+include ../../../Makefile.shared
Added: trunk/Tools/lldb/lldbWebKitTester/lldbWebKitTester.xcodeproj/project.pbxproj (0 => 233299)
--- trunk/Tools/lldb/lldbWebKitTester/lldbWebKitTester.xcodeproj/project.pbxproj (rev 0)
+++ trunk/Tools/lldb/lldbWebKitTester/lldbWebKitTester.xcodeproj/project.pbxproj 2018-06-28 04:19:32 UTC (rev 233299)
@@ -0,0 +1,205 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 7CB6844B1AFA7978002B305C /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CB6844A1AFA7978002B305C /* main.cpp */; };
+ CE6C3AFF20C0B17B003E33D8 /* libWTF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CE6C3AFE20C0B17B003E33D8 /* libWTF.a */; };
+ CE6C3B0120C0C444003E33D8 /* libicucore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = CE6C3B0020C0C443003E33D8 /* libicucore.dylib */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 7C4AB39F1AF0276C003FC8D1 /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 7C2227511AFC4D9C008C3338 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
+ 7C2227521AFC4D9C008C3338 /* lldbWebKitTester.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = lldbWebKitTester.xcconfig; sourceTree = "<group>"; };
+ 7C2227531AFC4D9C008C3338 /* DebugRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = DebugRelease.xcconfig; sourceTree = "<group>"; };
+ 7C4AB3A11AF0276C003FC8D1 /* lldbWebKitTester */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = lldbWebKitTester; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7CB6844A1AFA7978002B305C /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = SOURCE_ROOT; };
+ CE6C3AFE20C0B17B003E33D8 /* libWTF.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWTF.a; sourceTree = "<group>"; };
+ CE6C3B0020C0C443003E33D8 /* libicucore.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libicucore.dylib; path = usr/lib/libicucore.dylib; sourceTree = SDKROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 7C4AB39E1AF0276C003FC8D1 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ CE6C3B0120C0C444003E33D8 /* libicucore.dylib in Frameworks */,
+ CE6C3AFF20C0B17B003E33D8 /* libWTF.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 7C2227501AFC4D0A008C3338 /* Configurations */ = {
+ isa = PBXGroup;
+ children = (
+ 7C2227511AFC4D9C008C3338 /* Base.xcconfig */,
+ 7C2227531AFC4D9C008C3338 /* DebugRelease.xcconfig */,
+ 7C2227521AFC4D9C008C3338 /* lldbWebKitTester.xcconfig */,
+ );
+ path = Configurations;
+ sourceTree = "<group>";
+ };
+ 7C4AB3981AF0276C003FC8D1 = {
+ isa = PBXGroup;
+ children = (
+ 7C2227501AFC4D0A008C3338 /* Configurations */,
+ CE3F4425205C6A01007195B3 /* Frameworks */,
+ CE3F4424205C66D9007195B3 /* lldbWebKitTester */,
+ 7C4AB3A21AF0276C003FC8D1 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 7C4AB3A21AF0276C003FC8D1 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 7C4AB3A11AF0276C003FC8D1 /* lldbWebKitTester */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ CE3F4424205C66D9007195B3 /* lldbWebKitTester */ = {
+ isa = PBXGroup;
+ children = (
+ 7CB6844A1AFA7978002B305C /* main.cpp */,
+ );
+ name = lldbWebKitTester;
+ sourceTree = "<group>";
+ };
+ CE3F4425205C6A01007195B3 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ CE6C3B0020C0C443003E33D8 /* libicucore.dylib */,
+ CE6C3AFE20C0B17B003E33D8 /* libWTF.a */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 7C4AB3A01AF0276C003FC8D1 /* lldbWebKitTester */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7C4AB3A81AF0276C003FC8D1 /* Build configuration list for PBXNativeTarget "lldbWebKitTester" */;
+ buildPhases = (
+ 7C4AB39D1AF0276C003FC8D1 /* Sources */,
+ 7C4AB39E1AF0276C003FC8D1 /* Frameworks */,
+ 7C4AB39F1AF0276C003FC8D1 /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = lldbWebKitTester;
+ productName = lldbWebKitTester;
+ productReference = 7C4AB3A11AF0276C003FC8D1 /* lldbWebKitTester */;
+ productType = "com.apple.product-type.tool";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 7C4AB3991AF0276C003FC8D1 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0700;
+ };
+ buildConfigurationList = 7C4AB39C1AF0276C003FC8D1 /* Build configuration list for PBXProject "lldbWebKitTester" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 7C4AB3981AF0276C003FC8D1;
+ productRefGroup = 7C4AB3A21AF0276C003FC8D1 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 7C4AB3A01AF0276C003FC8D1 /* lldbWebKitTester */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 7C4AB39D1AF0276C003FC8D1 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7CB6844B1AFA7978002B305C /* main.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 7C4AB3A61AF0276C003FC8D1 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7C2227531AFC4D9C008C3338 /* DebugRelease.xcconfig */;
+ buildSettings = {
+ DEBUG_DEFINES = "$(DEBUG_DEFINES_debug)";
+ };
+ name = Debug;
+ };
+ 7C4AB3A71AF0276C003FC8D1 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7C2227531AFC4D9C008C3338 /* DebugRelease.xcconfig */;
+ buildSettings = {
+ };
+ name = Release;
+ };
+ 7C4AB3A91AF0276C003FC8D1 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7C2227521AFC4D9C008C3338 /* lldbWebKitTester.xcconfig */;
+ buildSettings = {
+ };
+ name = Debug;
+ };
+ 7C4AB3AA1AF0276C003FC8D1 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7C2227521AFC4D9C008C3338 /* lldbWebKitTester.xcconfig */;
+ buildSettings = {
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 7C4AB39C1AF0276C003FC8D1 /* Build configuration list for PBXProject "lldbWebKitTester" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7C4AB3A61AF0276C003FC8D1 /* Debug */,
+ 7C4AB3A71AF0276C003FC8D1 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7C4AB3A81AF0276C003FC8D1 /* Build configuration list for PBXNativeTarget "lldbWebKitTester" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7C4AB3A91AF0276C003FC8D1 /* Debug */,
+ 7C4AB3AA1AF0276C003FC8D1 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 7C4AB3991AF0276C003FC8D1 /* Project object */;
+}
Added: trunk/Tools/lldb/lldbWebKitTester/main.cpp (0 => 233299)
--- trunk/Tools/lldb/lldbWebKitTester/main.cpp (rev 0)
+++ trunk/Tools/lldb/lldbWebKitTester/main.cpp 2018-06-28 04:19:32 UTC (rev 233299)
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+#include <stdio.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
+
+extern void breakForTestingSummaryProviders();
+void breakForTestingSummaryProviders() { return; }
+
+template<size_t length>
+static String utf16String(const char16_t (&string)[length])
+{
+ StringBuilder builder;
+ builder.reserveCapacity(length - 1);
+ for (auto c : string)
+ builder.append(static_cast<UChar>(c));
+ return builder.toString();
+}
+
+static void testSummaryProviders()
+{
+ String aNullString { "" };
+ StringImpl* aNullStringImpl = aNullString.impl();
+
+ String anEmptyString { "" };
+ StringImpl* anEmptyStringImpl = anEmptyString.impl();
+
+ String an8BitString { "résumé" };
+ StringImpl* an8BitStringImpl = an8BitString.impl();
+
+ String a16BitString = utf16String(u"\u1680Cappuccino\u1680");
+ StringImpl* a16BitStringImpl = a16BitString.impl();
+
+ breakForTestingSummaryProviders();
+}
+
+int main(int argc, const char* argv[])
+{
+ testSummaryProviders();
+ fprintf(stderr, "This executable does nothing and is only meant for debugging lldb_webkit.py.\n");
+ return 0;
+}
Added: trunk/Tools/lldb/lldb_webkit_unittest.py (0 => 233299)
--- trunk/Tools/lldb/lldb_webkit_unittest.py (rev 0)
+++ trunk/Tools/lldb/lldb_webkit_unittest.py 2018-06-28 04:19:32 UTC (rev 233299)
@@ -0,0 +1,139 @@
+#!/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' }")
Property changes on: trunk/Tools/lldb/lldb_webkit_unittest.py
___________________________________________________________________
Added: svn:executable
+*
\ No newline at end of property