Title: [215334] trunk/Tools
Revision
215334
Author
[email protected]
Date
2017-04-13 13:08:35 -0700 (Thu, 13 Apr 2017)

Log Message

Build ImageDiff with host SDK
https://bugs.webkit.org/show_bug.cgi?id=168531

Reviewed by David Kilzer.

ImageDiff should be built and run with the host SDK, not the target SDK.
Build ImageDiff twice, once for the target SDK and once for the host
as an intermediate step towards building for only the host SDK.

* ImageDiff/Makefile: Added.
* Makefile: Add ImageDiff to list of targets.
* Scripts/build-imagediff: Build bmalloc and WTF for the host.
* Scripts/build-webkit: Build ImageDiff for host.
* Scripts/webkitdirs.pm: Export extractNonMacOSHostConfiguration.
(extractNonMacOSHostConfiguration): Remove non-host configuration data from the array.
* Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl: Added.
* Scripts/webkitpy/port/base.py:
(Port.check_build): Attempt to build image diff if not found.
(Port.check_image_diff): Enable logging flag.
(Port._build_image_diff): Allow webkitpy to build image-diff during testing.

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/ChangeLog (215333 => 215334)


--- trunk/Tools/ChangeLog	2017-04-13 19:54:53 UTC (rev 215333)
+++ trunk/Tools/ChangeLog	2017-04-13 20:08:35 UTC (rev 215334)
@@ -1,3 +1,26 @@
+2017-04-13  Jonathan Bedard  <[email protected]>
+
+        Build ImageDiff with host SDK
+        https://bugs.webkit.org/show_bug.cgi?id=168531
+
+        Reviewed by David Kilzer.
+
+        ImageDiff should be built and run with the host SDK, not the target SDK.
+        Build ImageDiff twice, once for the target SDK and once for the host
+        as an intermediate step towards building for only the host SDK.
+
+        * ImageDiff/Makefile: Added.
+        * Makefile: Add ImageDiff to list of targets.
+        * Scripts/build-imagediff: Build bmalloc and WTF for the host.
+        * Scripts/build-webkit: Build ImageDiff for host.
+        * Scripts/webkitdirs.pm: Export extractNonMacOSHostConfiguration.
+        (extractNonMacOSHostConfiguration): Remove non-host configuration data from the array.
+        * Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl: Added.
+        * Scripts/webkitpy/port/base.py:
+        (Port.check_build): Attempt to build image diff if not found.
+        (Port.check_image_diff): Enable logging flag.
+        (Port._build_image_diff): Allow webkitpy to build image-diff during testing.
+
 2017-04-12  Alex Christensen  <[email protected]>
 
         Clean up SharedBuffer public functions

Added: trunk/Tools/ImageDiff/Makefile (0 => 215334)


--- trunk/Tools/ImageDiff/Makefile	                        (rev 0)
+++ trunk/Tools/ImageDiff/Makefile	2017-04-13 20:08:35 UTC (rev 215334)
@@ -0,0 +1,15 @@
+SCRIPTS_PATH = ../Scripts
+
+# Temporary until https://bugs.webkit.org/show_bug.cgi?id=168939 is completed
+all:
+	$(SCRIPTS_PATH)/build-imagediff $(OTHER_OPTIONS)
+
+debug d development dev develop:
+	$(SCRIPTS_PATH)/set-webkit-configuration --debug
+	$(SCRIPTS_PATH)/build-imagediff $(OTHER_OPTIONS)
+
+release r deployment dep deploy:
+	$(SCRIPTS_PATH)/set-webkit-configuration --release
+	$(SCRIPTS_PATH)/build-imagediff $(OTHER_OPTIONS)
+clean:
+	$(SCRIPTS_PATH)/build-imagediff --clean

Modified: trunk/Tools/Makefile (215333 => 215334)


--- trunk/Tools/Makefile	2017-04-13 19:54:53 UTC (rev 215333)
+++ trunk/Tools/Makefile	2017-04-13 20:08:35 UTC (rev 215334)
@@ -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 ImageDiff
 	endif
 	ifneq (,$(findstring iphone,$(SDKROOT)))
 		MODULES += MobileMiniBrowser

Modified: trunk/Tools/Scripts/build-imagediff (215333 => 215334)


--- trunk/Tools/Scripts/build-imagediff	2017-04-13 19:54:53 UTC (rev 215333)
+++ trunk/Tools/Scripts/build-imagediff	2017-04-13 20:08:35 UTC (rev 215334)
@@ -58,6 +58,22 @@
 setConfiguration();
 chdirWebKit();
 
+# Build bmalloc
+chdir "Source/bmalloc" or die;
+$result = buildXCodeProject("bmalloc", $clean, XcodeOptions(), @ARGV);
+if (exitStatus($result)) {
+    exit exitStatus($result);
+}
+chdirWebKit();
+ 
+# Build WTF
+chdir "Source/WTF" or die;
+$result = buildXCodeProject("WTF", $clean, XcodeOptions(), @ARGV);
+if (exitStatus($result)) {
+    exit exitStatus($result);
+}
+chdirWebKit();
+
 my @xcodeOptions = ("-target", "ImageDiff");
 push @xcodeOptions, XcodeOptions();
 

Modified: trunk/Tools/Scripts/build-webkit (215333 => 215334)


--- trunk/Tools/Scripts/build-webkit	2017-04-13 19:54:53 UTC (rev 215333)
+++ trunk/Tools/Scripts/build-webkit	2017-04-13 20:08:35 UTC (rev 215334)
@@ -297,6 +297,24 @@
         if (exitStatus($result)) {
             exit exitStatus($result);
         }
+
+        # Build ImageDiff for host
+        my @command = File::Spec->catfile(getcwd(), "/Tools/Scripts/build-imagediff");
+        chdirWebKit();
+        if (!-e $command[0]) {
+          die "build-imagediff script not found";
+        }
+
+        if ($clean) {
+          push @command, " --clean";
+        }
+        push @command, argumentsForConfiguration();
+        push @command, @ARGV;
+        @command = extractNonMacOSHostConfiguration(\@command);
+        $result = system(@command);
+        if (exitStatus($result)) {
+            exit exitStatus($result);
+        }
     }
 }
 

Modified: trunk/Tools/Scripts/webkitdirs.pm (215333 => 215334)


--- trunk/Tools/Scripts/webkitdirs.pm	2017-04-13 19:54:53 UTC (rev 215333)
+++ trunk/Tools/Scripts/webkitdirs.pm	2017-04-13 20:08:35 UTC (rev 215334)
@@ -68,6 +68,7 @@
        &currentSVNRevision
        &debugSafari
        &executableProductDir
+       &extractNonHostConfiguration
        &findOrCreateSimulatorForIOSDevice
        &iosSimulatorDeviceByName
        &nmPath
@@ -452,6 +453,26 @@
     return @args;
 }
 
+sub extractNonMacOSHostConfiguration
+{
+    my @args = ();
+    my @extract = ('--device', '--efl', '--gtk', '--ios', '--platform', '--sdk', '--simulator', '--wincairo', 'SDKROOT', 'ARCHS');
+    foreach (@{$_[0]}) {
+        my $line = $_;
+        my $flag = 0;
+        foreach (@extract) {
+            if (length($line) >= length($_) && substr($line, 0, length($_)) eq $_
+                && index($line, 'i386') == -1 && index($line, 'x86_64') == -1) {
+                $flag = 1;
+            }
+        }
+        if (!$flag) {
+            push @args, $_;
+        }
+    }
+    return @args;
+}
+
 sub determineXcodeSDK
 {
     return if defined $xcodeSDK;

Added: trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl (0 => 215334)


--- trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl	                        (rev 0)
+++ trunk/Tools/Scripts/webkitperl/webkitdirs_unittest/extractNonMacOSHostConfiguration.pl	2017-04-13 20:08:35 UTC (rev 215334)
@@ -0,0 +1,111 @@
+#!/usr/bin/perl -w
+
+# Copyright (C) 2017 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.
+
+# Unit tests for webkitdirs::extractNonMacOSHostConfiguration.
+
+use strict;
+use warnings;
+
+use Config;
+use Test::More;
+use webkitdirs;
+
+my @testCases = (
+{
+    argValue => [],
+    expectedValue => [],
+    description => "Empty configuration",
+},
+{
+    argValue => ["--debug"],
+    expectedValue => ["--debug"],
+    description => "Debug configuration",
+},
+{
+    argValue => ["--release"],
+    expectedValue => ["--release"],
+    description => "Release configuration",
+},
+{
+    argValue => ["--debug", "--device"],
+    expectedValue => ["--debug"],
+    description => "Debug with device",
+},
+{
+    argValue => ["--debug", "--ios-simulator"],
+    expectedValue => ["--debug"],
+    description => "Debug with simulator",
+},
+{
+    argValue => ["--debug", "--gtk"],
+    expectedValue => ["--debug"],
+    description => "Debug with GTK",
+},
+{
+    argValue => ["--debug", "--efl"],
+    expectedValue => ["--debug"],
+    description => "Debug with EFL",
+},
+{
+    argValue => ["--debug", "--wincairo"],
+    expectedValue => ["--debug"],
+    description => "Debug with WinCairo",
+},
+{
+    argValue => ["--clean"],
+    expectedValue => ["--clean"],
+    description => "Clean",
+},
+{
+    argValue => ["--debug", "--device", "ARCHS=arm64"],
+    expectedValue => ["--debug"],
+    description => "Debug with device architecture",
+},
+{
+    argValue => ["--debug", "SDKROOT=iphoneos", "ARCHS=arm64"],
+    expectedValue => ["--debug"],
+    description => "Debug with device SDK",
+},
+{
+    argValue => ["--debug", "ARCHS=i386"],
+    expectedValue => ["--debug", "ARCHS=i386"],
+    description => "Debug 32-bit build",
+},
+{
+    argValue => ["--debug", "ARCHS=x86_64"],
+    expectedValue => ["--debug", "ARCHS=x86_64"],
+    description => "Debug 64-bit build",
+},
+);
+
+plan(tests => 1 * @testCases);
+print "\n";
+foreach my $testCase (@testCases) {
+    my @result = extractNonMacOSHostConfiguration($testCase->{argValue});
+    my @expected = @{$testCase->{expectedValue}};
+    is_deeply(
+        \@result,
+        \@expected,
+        "prependToEnvironmentVariableList: $testCase->{description}");
+}

Modified: trunk/Tools/Scripts/webkitpy/port/base.py (215333 => 215334)


--- trunk/Tools/Scripts/webkitpy/port/base.py	2017-04-13 19:54:53 UTC (rev 215333)
+++ trunk/Tools/Scripts/webkitpy/port/base.py	2017-04-13 20:08:35 UTC (rev 215334)
@@ -229,11 +229,13 @@
             return False
         if self.get_option('install') and not self._check_driver():
             return False
-        if self.get_option('pixel_tests'):
-            if not self.check_image_diff():
-                return False
         if self.get_option('install') and not self._check_port_build():
             return False
+        if not self.check_image_diff():
+            if self.get_option('build'):
+                return self._build_image_diff()
+            else:
+                return False
         return True
 
     def _check_driver(self):
@@ -261,7 +263,8 @@
         """This routine is used to check whether image_diff binary exists."""
         image_diff_path = self._path_to_image_diff()
         if not self._filesystem.exists(image_diff_path):
-            _log.error("ImageDiff was not found at %s" % image_diff_path)
+            if logging:
+                _log.error("ImageDiff was not found at %s" % image_diff_path)
             return False
         return True
 
@@ -1426,6 +1429,17 @@
             return False
         return True
 
+    def _build_image_diff(self):
+        environment = self.host.copy_current_environment()
+        environment.disable_gcc_smartquotes()
+        env = environment.to_dictionary()
+        try:
+            self._run_script("build-imagediff", env=env)
+        except ScriptError, e:
+            _log.error(e.message_with_output(output_limit=None))
+            return False
+        return True
+
     def _build_driver_flags(self):
         return []
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to