haikuwebkit/Tools/Scripts/build-lldbwebkittester

80 lines
2.5 KiB
Plaintext
Raw Permalink Normal View History

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): Canonical link: https://commits.webkit.org/202386@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-28 04:19:32 +00:00
#!/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;
}
LLDB tests may use wrong configuration of lldbWebKitTester https://bugs.webkit.org/show_bug.cgi?id=189011 Reviewed by Dean Jackson. Fixes an issue where the LLDB unit tests may use the wrong configuration of lldbWebKitTester. Additionally, add back the unit tests originally added in r235376 (https://bugs.webkit.org/show_bug.cgi?id=188936). Currently the unit tests pick the LLDBWebKitTester binary based on the configuration set by script set-webkit-configuration. This may not be the same configuration specified to test-webkitpy. So, the unit tests may use the wrong binary. Instead we have test-webkitpy store the path to the correct lldbWebKitTester binary that the unit tests should use in an environment variable, called LLDB_WEBKIT_TESTER_EXECUTABLE. (We use an environment variable because the test driver, test-webkitpy, and the unit tests cannot talk to each other directly due the limitations of the Python unittest module, the Python multiprocessing module, and the general principle of unit tests - to test code in isolation). The unit tests make use of the value of this environment variable to launch lldbWebKitTester binary. * Scripts/build-lldbwebkittester: We only support building lldbWebKitTester on Mac for now. Error out if this script is invoked for a non-Mac platform. * Scripts/webkitpy/test/main.py: (Tester._run_tests): Build lldbWebKitTester and store the path to it in the environment variable LLDB_WEBKIT_TESTER_EXECUTABLE. (_build_lldb_webkit_tester): Deleted. * lldb/dump_class_layout_unittest.py: (TestDumpClassLayout.shouldSkip): Use SystemHost() here and remove the _host global variable as this is the only call site that needs the Host object now. (TestDumpClassLayout.setUpClass): Take the path to the lldbWebKitTester binary from the value of the environment variable LLDB_WEBKIT_TESTER_EXECUTABLE. * lldb/lldbWebKitTester/main.cpp: (testSummaryProviders): Add back unit test support infrastructure originally added in r235376 (https://bugs.webkit.org/show_bug.cgi?id=188936). * lldb/lldb_webkit_unittest.py: (LLDBDebugSession.setup): Take the path to the lldbWebKitTester binary from the value of the environment variable LLDB_WEBKIT_TESTER_EXECUTABLE. (TestSummaryProviders): (TestSummaryProviders.shouldSkip): Skip the tests on non-Mac platforms. (TestSummaryProviders.serial_test_WTFHashSet_tablesize_and_size): (TestSummaryProviders.serial_test_WTFOptionSet_SummaryProvider_empty): (TestSummaryProviders.serial_test_WTFOptionSet_SummaryProvider_simple): (TestSummaryProviders.serial_test_WTFOptionSetProvider_empty): (TestSummaryProviders.serial_test_WTFOptionSetProvider_simple): Add back the unit tests originally added in r235376 (https://bugs.webkit.org/show_bug.cgi?id=188936). Canonical link: https://commits.webkit.org/205096@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@236667 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-10-01 17:22:54 +00:00
if (!isAppleMacWebKit()) {
print STDERR "lldbWebKitTester is currently only supported on Mac.\n";
exit 1;
}
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): Canonical link: https://commits.webkit.org/202386@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-06-28 04:19:32 +00:00
checkRequiredSystemConfig();
setConfiguration();
chdirWebKit();
my @xcodeOptions = XcodeOptions();
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();
}