Changeset 250121 in webkit


Ignore:
Timestamp:
Sep 19, 2019 9:55:55 PM (5 years ago)
Author:
Brent Fulgham
Message:

[FTW] Enable WebKitTestRunner build
https://bugs.webkit.org/show_bug.cgi?id=201996

Reviewed by Fujii Hironori.

It's time to start getting the test system up and running for FTW.

This patch does the following:

  1. Adds relevant CMake changes to get things building.
  2. Adds a "--ftw" flag to the build scripts that will trigger a relevant build.
  3. Updates 'webkitpy' to recognize the 'ftw' port.

Note: Pixel tests are not yet supported.

  • PlatformFTW.cmake: Build the WK2 test runner.
  • Scripts/build-webkit: Update to recognize the FTW port.
  • Scripts/webkitdirs.pm: Ditto.
  • Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl: Ditto.
  • Scripts/webkitpy/common/config/ports.py: Ditto.
  • Scripts/webkitpy/common/config/ports_unittest.py: Ditto.
  • Scripts/webkitpy/common/version_name_map.py: Ditto.
  • Scripts/webkitpy/port/factory.py: Ditto.
  • Scripts/webkitpy/port/win.py: Ditto.
  • WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:

(WTR::InjectedBundlePage::dumpDOMAsWebArchive): Don't build or run this method
on Windows.

  • WebKitTestRunner/PlatformFTW.cmake: Added.
  • WebKitTestRunner/PlatformWebView.h:
  • WebKitTestRunner/win/PlatformWebViewWin.cpp:
  • WebKitTestRunner/win/TestInvocationDirect2D.cpp: Added.

(WTR::TestInvocation::dumpPixelsAndCompareWithExpected): Add stub implementation.

Location:
trunk/Tools
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r250117 r250121  
     12019-09-19  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [FTW] Enable WebKitTestRunner build
     4        https://bugs.webkit.org/show_bug.cgi?id=201996
     5
     6        Reviewed by Fujii Hironori.
     7
     8        It's time to start getting the test system up and running for FTW.
     9
     10        This patch does the following:
     11
     12        1. Adds relevant CMake changes to get things building.
     13        2. Adds a "--ftw" flag to the build scripts that will trigger a relevant build.
     14        3. Updates 'webkitpy' to recognize the 'ftw' port.
     15
     16        Note: Pixel tests are not yet supported.
     17
     18        * PlatformFTW.cmake: Build the WK2 test runner.
     19        * Scripts/build-webkit: Update to recognize the FTW port.
     20        * Scripts/webkitdirs.pm: Ditto.
     21        * Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl: Ditto.
     22        * Scripts/webkitpy/common/config/ports.py: Ditto.
     23        * Scripts/webkitpy/common/config/ports_unittest.py: Ditto.
     24        * Scripts/webkitpy/common/version_name_map.py: Ditto.
     25        * Scripts/webkitpy/port/factory.py: Ditto.
     26        * Scripts/webkitpy/port/win.py: Ditto.
     27        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
     28        (WTR::InjectedBundlePage::dumpDOMAsWebArchive): Don't build or run this method
     29        on Windows.
     30        * WebKitTestRunner/PlatformFTW.cmake: Added.
     31        * WebKitTestRunner/PlatformWebView.h:
     32        * WebKitTestRunner/win/PlatformWebViewWin.cpp:
     33        * WebKitTestRunner/win/TestInvocationDirect2D.cpp: Added.
     34        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected): Add stub implementation.
     35
    1362019-09-19  Fujii Hironori  <Hironori.Fujii@sony.com>
    237
  • trunk/Tools/PlatformFTW.cmake

    r248444 r250121  
    66endif ()
    77
    8 #if (ENABLE_WEBKIT)
    9 #    add_subdirectory(WebKitTestRunner)
    10 #endif ()
     8if (ENABLE_WEBKIT)
     9    add_subdirectory(WebKitTestRunner)
     10endif ()
  • trunk/Tools/Scripts/build-webkit

    r245037 r250121  
    11#!/usr/bin/env perl
    22
    3 # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Apple Inc. All rights reserved.
     3# Copyright (C) 2005-2019 Apple Inc. All rights reserved.
    44# Copyright (C) 2009 Google Inc. All rights reserved.
    55# Copyright (C) 2010 moiji-mobile.com All rights reserved.
     
    119119  --[no-]xcbuild                    Force the use of XCBuild or not
    120120
     121  --ftw                             Build the FTW Windows port
    121122  --gtk                             Build the GTK+ port
    122123  --wpe                             Build the WPE port
     
    190191
    191192# Build WTF as a separate static library on ports which support it.
    192 splice @projects, 0, 0, "Source/WTF" if isAppleWebKit() or isWinCairo();
     193splice @projects, 0, 0, "Source/WTF" if isAppleWebKit() or isWinCairo() or isFTW();
    193194
    194195splice @projects, 0, 0, "Source/bmalloc" if isAppleCocoaWebKit();
     
    203204}
    204205
    205 if ((isAppleWebKit() || isWinCairo() || isPlayStation()) && !-d "WebKitLibraries") {
     206if ((isAppleWebKit() || isWinCairo() || isPlayStation() || isFTW()) && !-d "WebKitLibraries") {
    206207    die "Error: No WebKitLibraries directory found. Please do a fresh checkout.\n";
    207208}
     
    307308
    308309my $baseProductDir = baseProductDir();
    309 if (isAppleWinWebKit() || isWinCairo() || isPlayStation()) {
     310if (isAppleWinWebKit() || isWinCairo() || isPlayStation() || isFTW()) {
    310311    my @featureArgs = cmakeArgsFromFeatures(@features, !$noExperimentalFeatures);
    311312    removeCMakeCache(@featureArgs);
     
    327328    if (exitStatus($result)) {
    328329        my $scriptDir = relativeScriptsDir();
    329         if (isAppleWinWebKit() || isWinCairo()) {
     330        if (isAppleWinWebKit() || isWinCairo() || isFTW()) {
    330331            print "\n\n===== BUILD FAILED ======\n\n";
    331332            print "Please ensure you have run $scriptDir/update-webkit to install dependencies.\n\n";
  • trunk/Tools/Scripts/webkitdirs.pm

    r248965 r250121  
    106106use constant {
    107107    AppleWin    => "AppleWin",
     108    FTW         => "FTW",
    108109    GTK         => "GTK",
    109110    iOS         => "iOS",
     
    495496    push(@args, '--32-bit') if ($architecture eq "x86" and !isWin64());
    496497    push(@args, '--64-bit') if (isWin64());
     498    push(@args, '--64-bit') if (isFTW());
     499    push(@args, '--ftw') if isFTW();
    497500    push(@args, '--gtk') if isGtk();
    498501    push(@args, '--wpe') if isWPE();
     
    506509{
    507510    my @args = ();
    508     my @extract = ('--device', '--gtk', '--ios', '--platform', '--sdk', '--simulator', '--wincairo', 'SDKROOT', 'ARCHS');
     511    my @extract = ('--device', '--gtk', '--ios', '--platform', '--sdk', '--simulator', '--wincairo', '--ftw', 'SDKROOT', 'ARCHS');
    509512    foreach (@{$_[0]}) {
    510513        my $line = $_;
     
    713716    # WEBKIT_OUTPUTDIR exist, use that as our configuration dir. This will
    714717    # allows us to run run-webkit-tests without using build-webkit.
    715     return ($ENV{"WEBKIT_OUTPUTDIR"} && isGtk()) || isAppleWinWebKit();
     718    return ($ENV{"WEBKIT_OUTPUTDIR"} && isGtk()) || isAppleWinWebKit() || isFTW();
    716719}
    717720
     
    721724    determineBaseProductDir();
    722725    determineConfiguration();
    723     if (isAppleWinWebKit() || isWinCairo() || isPlayStation()) {
     726    if (isAppleWinWebKit() || isWinCairo() || isPlayStation() || isFTW()) {
    724727        $configurationProductDir = File::Spec->catdir($baseProductDir, $configuration);
    725728    } else {
     
    10471050        return "$configurationProductDir/$libraryName.framework/Versions/A/$libraryName";
    10481051    }
    1049     if (isAppleWinWebKit()) {
     1052    if (isAppleWinWebKit() || isFTW()) {
    10501053        if ($libraryName eq "JavaScriptCore") {
    10511054            return "$baseProductDir/lib/$libraryName.lib";
     
    11691172
    11701173    my %argToPortName = (
     1174        ftw => FTW,
    11711175        gtk => GTK,
    11721176        'jsc-only' => JSCOnly,
     
    12581262}
    12591263
     1264sub isFTW()
     1265{
     1266    return portName() eq FTW;
     1267}
     1268
    12601269sub isWinCairo()
    12611270{
     
    12841293{
    12851294    return if defined($isWin64);
    1286     $isWin64 = checkForArgumentAndRemoveFromARGV("--64-bit") || ((isWinCairo() || isJSCOnly()) && !shouldBuild32Bit());
     1295    $isWin64 = checkForArgumentAndRemoveFromARGV("--64-bit") || ((isFTW() || isWinCairo() || isJSCOnly()) && !shouldBuild32Bit());
    12871296}
    12881297
     
    16941703    } elsif (isAppleMacWebKit()) {
    16951704        return "Safari";
    1696     } elsif (isAppleWinWebKit()) {
     1705    } elsif (isAppleWinWebKit() || isFTW()) {
    16971706        return "MiniBrowser";
    16981707    }
     
    17971806sub setupAppleWinEnv()
    17981807{
    1799     return unless isAppleWinWebKit();
     1808    return unless isAppleWinWebKit() || isFTW();
    18001809
    18011810    checkInstalledTools();
     
    22612270
    22622271    # Some ports have production mode, but build-webkit should always use developer mode.
    2263     push @args, "-DDEVELOPER_MODE=ON" if isGtk() || isJSCOnly() || isWPE() || isWinCairo();
     2272    push @args, "-DDEVELOPER_MODE=ON" if isFTW() || isGtk() || isJSCOnly() || isWPE() || isWinCairo();
    22642273
    22652274    if (architecture() eq "x86_64" && shouldBuild32Bit()) {
     
    24282437    if (isAnyWindows()) {
    24292438        my $productBinaryDir = executableProductDir();
    2430         if (isAppleWinWebKit()) {
     2439        if (isAppleWinWebKit() || isFTW()) {
    24312440            $env->{PATH} = join(':', $productBinaryDir, appleApplicationSupportPath(), $env->{PATH} || "");
    24322441        } elsif (isWinCairo()) {
     
    28852894    }
    28862895
    2887     if (isAppleWinWebKit()) {
     2896    if (isAppleWinWebKit() || isFTW()) {
    28882897        my $result;
    28892898        my $webKitLauncherPath = File::Spec->catfile(executableProductDir(), "MiniBrowser.exe");
     
    28992908        return runMacWebKitApp(File::Spec->catfile(productDir(), "MiniBrowser.app", "Contents", "MacOS", "MiniBrowser"));
    29002909    }
    2901     if (isAppleWinWebKit()) {
     2910    if (isAppleWinWebKit() || isFTW()) {
    29022911        my $webKitLauncherPath = File::Spec->catfile(executableProductDir(), "MiniBrowser.exe");
    29032912        return system { $webKitLauncherPath } $webKitLauncherPath, @ARGV;
  • trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl

    r226395 r250121  
    9393    description => "Debug 64-bit build",
    9494},
     95{
     96    argValue => ["--debug", "--ftw"],
     97    expectedValue => ["--debug"],
     98    description => "Debug with FTW",
     99},
    95100);
    96101
  • trunk/Tools/Scripts/webkitpy/common/config/ports.py

    r247781 r250121  
    11# Copyright (C) 2009, Google Inc. All rights reserved.
    22# Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
    3 # Copyright (C) 2015, 2017 Apple Inc. All rights reserved.
     3# Copyright (C) 2015-2019 Apple Inc. All rights reserved.
    44#
    55# Redistribution and use in source and binary forms, with or without
     
    6464    def port(port_name):
    6565        ports = {
     66            "ftw": FTWPort,
    6667            "gtk-wk2": GtkWK2Port,
    6768            "ios-device": IOSPort,
     
    205206
    206207
     208class FTWPort(DeprecatedPort):
     209    port_flag_name = "ftw"
     210
     211    def build_webkit_command(self, build_style=None):
     212        command = super(FTWPort, self).build_webkit_command(build_style=build_style)
     213        command.append('--ftw')
     214        return command
     215
     216    def run_webkit_tests_command(self, build_style=None):
     217        command = super(FTWPort, self).run_webkit_tests_command(build_style)
     218        command.append("--ftw")
     219        return command
     220
     221
    207222class GtkWK2Port(DeprecatedPort):
    208223    port_flag_name = "gtk-wk2"
  • trunk/Tools/Scripts/webkitpy/common/config/ports_unittest.py

    r247781 r250121  
    6363        self.assertEqual(WinCairoPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug", "--wincairo"])
    6464
     65    def test_ftw_port(self):
     66        self.assertEqual(FTWPort().flag(), "--port=ftw")
     67        self.assertEqual(FTWPort().run_webkit_tests_command(), DeprecatedPort().script_shell_command("run-webkit-tests") + ["--ftw"])
     68        self.assertEqual(FTWPort().build_webkit_command(), DeprecatedPort().script_shell_command("build-webkit") + ["--ftw"])
     69        self.assertEqual(FTWPort().build_webkit_command(build_style="debug"), DeprecatedPort().script_shell_command("build-webkit") + ["--debug", "--ftw"])
     70
    6571    def test_jsconly_port(self):
    6672        self.assertEqual(JscOnlyPort().flag(), "--port=jsc-only")
  • trunk/Tools/Scripts/webkitpy/common/version_name_map.py

    r246497 r250121  
    8383        self.mapping[PUBLIC_TABLE]['wincairo'] = self.mapping[PUBLIC_TABLE]['win']
    8484
     85        # FTW uses the same versions as Windows
     86        self.mapping[PUBLIC_TABLE]['ftw'] = self.mapping[PUBLIC_TABLE]['win']
     87
     88
    8589    @classmethod
    8690    def _automap_to_major_version(cls, prefix, minimum=Version(1), maximum=Version(1)):
  • trunk/Tools/Scripts/webkitpy/port/factory.py

    r240163 r250121  
    11# Copyright (C) 2010 Google Inc. All rights reserved.
    2 # Copyright (C) 2013-2018 Apple Inc. All rights reserved.
     2# Copyright (C) 2013-2019 Apple Inc. All rights reserved.
    33# Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
    44#
     
    6666            const=('wincairo'),
    6767            help=('Alias for --platform=wincairo')),
     68        optparse.make_option('--ftw', action='store_const', dest='platform',
     69            const=('ftw'),
     70            help=('Alias for --platform=ftw')),
    6871        ] + (config.apple_additions().platform_options() if config.apple_additions() else [])
    6972
     
    106109        'mock_drt.MockDRTPort',
    107110        'test.TestPort',
     111        'win.FTWPort',
    108112        'win.WinCairoPort',
    109113        'win.WinPort',
  • trunk/Tools/Scripts/webkitpy/port/win.py

    r245733 r250121  
    11# Copyright (C) 2010 Google Inc. All rights reserved.
    2 # Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
     2# Copyright (C) 2013-2019 Apple Inc. All rights reserved.
    33#
    44# Redistribution and use in source and binary forms, with or without
     
    495495
    496496        return paths
     497
     498
     499class FTWPort(WinPort):
     500    port_name = "ftw"
     501
     502    DEFAULT_ARCHITECTURE = 'x86_64'
     503
     504    def default_baseline_search_path(self, **kwargs):
     505        return map(self._webkit_baseline_path, self._search_paths())
     506
     507    def _port_specific_expectations_files(self, **kwargs):
     508        return map(lambda x: self._filesystem.join(self._webkit_baseline_path(x), 'TestExpectations'), reversed(self._search_paths()))
     509
     510    def _search_paths(self):
     511        paths = []
     512        version_name_map = VersionNameMap.map(self.host.platform)
     513        if self._os_version < self.VERSION_MIN or self._os_version > self.VERSION_MAX:
     514            versions = [self._os_version]
     515        else:
     516            sorted_versions = sorted(version_name_map.mapping_for_platform(platform=self.port_name).values())
     517            versions = sorted_versions[sorted_versions.index(self._os_version):]
     518
     519        normalize = lambda version: version.lower().replace(' ', '')
     520        to_name = lambda version: version_name_map.to_name(version, platform=self.port_name)
     521
     522        wk_version = 'wk2' if self.get_option('webkit_test_runner') else 'wk1'
     523
     524        for version in versions:
     525            name = self.port_name + '-' + normalize(to_name(version))
     526            paths.append(name + '-' + wk_version)
     527            paths.append(name)
     528
     529        paths.append(self.port_name + '-' + wk_version)
     530        paths.append(self.port_name)
     531        if self.get_option('webkit_test_runner'):
     532            paths.append('wk2')
     533        paths.extend(self.get_option("additional_platform_directory", []))
     534
     535        return paths
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

    r246034 r250121  
    5151#include <wtf/text/StringBuilder.h>
    5252
    53 #if USE(CF) && !PLATFORM(WIN_CAIRO)
     53#if USE(CF) && !PLATFORM(WIN_CAIRO) && !USE(DIRECT2D)
    5454#include "WebArchiveDumpSupport.h"
    5555#endif
     
    875875void InjectedBundlePage::dumpDOMAsWebArchive(WKBundleFrameRef frame, StringBuilder& stringBuilder)
    876876{
    877 #if USE(CF) && !PLATFORM(WIN_CAIRO)
     877#if USE(CF) && !PLATFORM(WIN_CAIRO) && !USE(DIRECT2D)
    878878    WKRetainPtr<WKDataRef> wkData = adoptWK(WKBundleFrameCopyWebArchive(frame));
    879879    RetainPtr<CFDataRef> cfData = adoptCF(CFDataCreate(0, WKDataGetBytes(wkData.get()), WKDataGetSize(wkData.get())));
  • trunk/Tools/WebKitTestRunner/PlatformWebView.h

    r248762 r250121  
    5353typedef WPEToolingBackends::HeadlessViewBackend* PlatformWindow;
    5454#elif PLATFORM(WIN)
     55#if USE(DIRECT2D)
     56#include <d2d1_1.h>
     57#else
    5558#include <cairo.h>
     59#endif
    5660class TestRunnerWindow;
    5761typedef HWND PlatformWindow;
     
    6165#if USE(CAIRO)
    6266typedef cairo_surface_t* PlatformImage;
     67#elif USE(DIRECT2D)
     68interface ID2D1Bitmap;
     69
     70typedef ID2D1Bitmap* PlatformImage;
    6371#endif
    6472
  • trunk/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp

    r246418 r250121  
    3131
    3232#include <WebCore/HWndDC.h>
    33 #include <cairo.h>
    3433#include <cstdio>
    3534#include <windows.h>
     
    3736#include <wtf/win/GDIObject.h>
    3837
     38#if USE(CAIRO)
     39#include <cairo.h>
     40#endif
     41
     42#if USE(DIRECT2D)
     43#include <d2d1_1.h>
     44#endif
    3945
    4046namespace WTR {
Note: See TracChangeset for help on using the changeset viewer.