<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[163998] trunk/Tools</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/163998">163998</a></dd>
<dt>Author</dt> <dd>dfarler@apple.com</dd>
<dt>Date</dt> <dd>2014-02-12 16:38:25 -0800 (Wed, 12 Feb 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Upstream iOS old-run-webkit-tests for use with DumpRenderTree in the iOS Simulator
https://bugs.webkit.org/show_bug.cgi?id=127694
Reviewed by Simon Fraser.
This is a short-term effort to get layout tests working in the iOS simulator again.
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
Pass PLATFORM_NAME to the makefile.
* DumpRenderTree/ios/PerlSupport/Makefile:
Cleanup.
* Scripts/old-run-webkit-tests:
Added functions and some exceptions for the simulator.
(installAndLaunchDumpRenderTreeAppUsingNotification):
(openIPhoneSimulator):
(quitDumpRenderTreeAppUsingNotification):
(quitIPhoneSimulator):
(simulatorSessionUUID):
(openDiffTool):
(buildDumpTool):
(openDumpTool):
(closeDumpTool):
(dumpToolDidCrash):
(expectedDirectoryForTest):
(buildPlatformResultHierarchy):
* Scripts/webkitdirs.pm:
Support functions for old-run-webkit-tests.
(determineIPhoneSimulatorVersion):
(iPhoneSimulatorVersion):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeDumpRenderTreexcodeprojprojectpbxproj">trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsDumpRenderTreeiosPerlSupportMakefile">trunk/Tools/DumpRenderTree/ios/PerlSupport/Makefile</a></li>
<li><a href="#trunkToolsScriptsoldrunwebkittests">trunk/Tools/Scripts/old-run-webkit-tests</a></li>
<li><a href="#trunkToolsScriptswebkitdirspm">trunk/Tools/Scripts/webkitdirs.pm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (163997 => 163998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-02-13 00:17:49 UTC (rev 163997)
+++ trunk/Tools/ChangeLog        2014-02-13 00:38:25 UTC (rev 163998)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2014-02-12 David Farler <dfarler@apple.com>
+
+ Upstream iOS old-run-webkit-tests for use with DumpRenderTree in the iOS Simulator
+ https://bugs.webkit.org/show_bug.cgi?id=127694
+
+ Reviewed by Simon Fraser.
+
+ This is a short-term effort to get layout tests working in the iOS simulator again.
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ Pass PLATFORM_NAME to the makefile.
+ * DumpRenderTree/ios/PerlSupport/Makefile:
+ Cleanup.
+ * Scripts/old-run-webkit-tests:
+ Added functions and some exceptions for the simulator.
+ (installAndLaunchDumpRenderTreeAppUsingNotification):
+ (openIPhoneSimulator):
+ (quitDumpRenderTreeAppUsingNotification):
+ (quitIPhoneSimulator):
+ (simulatorSessionUUID):
+ (openDiffTool):
+ (buildDumpTool):
+ (openDumpTool):
+ (closeDumpTool):
+ (dumpToolDidCrash):
+ (expectedDirectoryForTest):
+ (buildPlatformResultHierarchy):
+ * Scripts/webkitdirs.pm:
+ Support functions for old-run-webkit-tests.
+ (determineIPhoneSimulatorVersion):
+ (iPhoneSimulatorVersion):
+
</ins><span class="cx"> 2014-02-12 Mark Hahnenberg <mhahnenberg@apple.com>
</span><span class="cx">
</span><span class="cx"> Basic framework for a modern jsc CLI
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeDumpRenderTreexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (163997 => 163998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj        2014-02-13 00:17:49 UTC (rev 163997)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj        2014-02-13 00:38:25 UTC (rev 163998)
</span><span class="lines">@@ -800,7 +800,7 @@
</span><span class="cx"> /* Begin PBXLegacyTarget section */
</span><span class="cx">                 A1158D6218927AF00088C17B /* Perl Support */ = {
</span><span class="cx">                         isa = PBXLegacyTarget;
</span><del>-                        buildArgumentsString = "$(ACTION)";
</del><ins>+                        buildArgumentsString = "$(ACTION) PLATFORM_NAME=$(PLATFORM_NAME)";
</ins><span class="cx">                         buildConfigurationList = A1158D6318927AF00088C17B /* Build configuration list for PBXLegacyTarget "Perl Support" */;
</span><span class="cx">                         buildPhases = (
</span><span class="cx">                         );
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeiosPerlSupportMakefile"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/ios/PerlSupport/Makefile (163997 => 163998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/ios/PerlSupport/Makefile        2014-02-13 00:17:49 UTC (rev 163997)
+++ trunk/Tools/DumpRenderTree/ios/PerlSupport/Makefile        2014-02-13 00:38:25 UTC (rev 163998)
</span><span class="lines">@@ -21,10 +21,10 @@
</span><span class="cx"> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">
</span><del>-ifneq ($(filter iphoneos iphonesimulator, $(PLATFORM_NAME)), )
</del><ins>+ifneq (,$(filter iphonesimulator, $(PLATFORM_NAME)))
</ins><span class="cx">
</span><del>-CONFIGURATION_BUILD_DIR ?= .
-OUTPUT_DIR=$(CONFIGURATION_BUILD_DIR)
</del><ins>+TARGET_BUILD_DIR ?= .
+OUTPUT_DIR=$(TARGET_BUILD_DIR)
</ins><span class="cx">
</span><span class="cx"> WRAPPER_DIR=$(OUTPUT_DIR)/DerivedSources/DumpRenderTree
</span><span class="cx"> ifneq ($(PLATFORM_NAME),iphoneos)
</span><span class="lines">@@ -40,30 +40,9 @@
</span><span class="cx"> # FIXME: We shouldn't hard code these architectures. See <rdar://problem/9047171> for more discussion on why we have to.
</span><span class="cx"> ARCHS=i386 x86_64
</span><span class="cx">
</span><del>-OSX_VERSION = $(shell sw_vers -productVersion | cut -d. -f 2)
-ifeq "$(OSX_VERSION)" "5"
-GENERATE_WRAPPER = YES
-endif
-ifeq "$(OSX_VERSION)" "6"
-GENERATE_WRAPPER = NO
-endif
</del><span class="cx">
</span><del>-ifeq "$(GENERATE_WRAPPER)" "YES"
-
-SWIG=/usr/bin/swig
-
</del><span class="cx"> all: $(DYLIB) $(PERL_MODULE)
</span><span class="cx">
</span><del>-$(WRAPPER) $(PERL_MODULE): DumpRenderTreeSupport.c $(DUMPRENDERTREE)
-        mkdir -p $(WRAPPER_DIR)
-        $(SWIG) -o $(WRAPPER) -outdir $(OUTPUT_DIR) -perl -module DumpRenderTreeSupport $<
-
-
-else
-
-
-all: $(DYLIB) $(PERL_MODULE)
-
</del><span class="cx"> $(WRAPPER): DumpRenderTreeSupport_wrapPregenerated.c $(DUMPRENDERTREE)
</span><span class="cx">         mkdir -p $(WRAPPER_DIR)
</span><span class="cx">         cp DumpRenderTreeSupport_wrapPregenerated.c $(WRAPPER)
</span><span class="lines">@@ -71,13 +50,8 @@
</span><span class="cx"> $(PERL_MODULE): DumpRenderTreeSupportPregenerated.pm $(DUMPRENDERTREE)
</span><span class="cx">         cp DumpRenderTreeSupportPregenerated.pm $(PERL_MODULE)
</span><span class="cx">
</span><del>-
-endif
-
-OS_X_SDK = $(if $(shell xcrun --show-sdk-path -sdk "macosx" 2> /dev/null),macosx, /)
-
</del><span class="cx"> $(DYLIB): DumpRenderTreeSupport.c $(WRAPPER)
</span><del>-        TOOLCHAINS= xcrun -sdk $(OS_X_SDK) cc -g -dynamiclib -o $(DYLIB) `$(PERL) -MExtUtils::Embed -eperl_inc` `$(PERL) -MExtUtils::Embed -e'my $$opts = ldopts(0); $$opts =~ s/-arch [^ ]*( |$$)//g; print $$opts, " -arch ", join(" -arch ", split(" ",$$ENV{ARCHS}))'` $^
</del><ins>+        xcrun -sdk macosx clang -g -dynamiclib -o $(DYLIB) `$(PERL) -MExtUtils::Embed -eperl_inc` `$(PERL) -MExtUtils::Embed -e'my $$opts = ldopts(0); $$opts =~ s/-arch [^ ]*( |$$)//g; print $$opts, " -arch ", join(" -arch ", split(" ",$$ENV{ARCHS}))'` $^
</ins><span class="cx">
</span><span class="cx"> IPHONE_SIMULATOR_NOTIFCATION_BUNDLE=$(OUTPUT_DIR)/lib/perl5/darwin-thread-multi-2level/auto/IPhoneSimulatorNotification/IPhoneSimulatorNotification.bundle
</span><span class="cx"> IPHONE_SIMULATOR_NOTIFCATION_MODULE=$(OUTPUT_DIR)/lib/perl5/darwin-thread-multi-2level/IPhoneSimulatorNotification.pm
</span><span class="lines">@@ -85,12 +59,10 @@
</span><span class="cx"> all: $(IPHONE_SIMULATOR_NOTIFCATION_BUNDLE) $(IPHONE_SIMULATOR_NOTIFCATION_MODULE)
</span><span class="cx">
</span><span class="cx"> $(IPHONE_SIMULATOR_NOTIFCATION_BUNDLE) $(IPHONE_SIMULATOR_NOTIFCATION_MODULE): IPhoneSimulatorNotification/IPhoneSimulatorNotification.xs IPhoneSimulatorNotification/Makefile.PL IPhoneSimulatorNotification/lib/IPhoneSimulatorNotification.pm IPhoneSimulatorNotification/ppport.h IPhoneSimulatorNotification/t/IPhoneSimulatorNotification.t
</span><del>-        (cd IPhoneSimulatorNotification && \
-                SDKROOT=$(OS_X_SDK) TOOLCHAINS= $(PERL) Makefile.PL INSTALL_BASE=$(OUTPUT_DIR) && \
-                make SDKROOT=$(OS_X_SDK) TOOLCHAINS= && \
-                make test && \
-                make install && \
-                make realclean)
</del><ins>+        cd IPhoneSimulatorNotification && SDKROOT=iphonesimulator perl Makefile.PL INSTALL_BASE=$(OUTPUT_DIR)
+        make -C IPhoneSimulatorNotification test
+        make -C IPhoneSimulatorNotification install
+        make -C IPhoneSimulatorNotification realclean
</ins><span class="cx">         # Touch the built perl module and its bundle since IPhoneSimulatorNotification.xs and Makefile.PL always have newer dates after building.
</span><span class="cx">         touch $(IPHONE_SIMULATOR_NOTIFCATION_BUNDLE) $(IPHONE_SIMULATOR_NOTIFCATION_MODULE)
</span><span class="cx">
</span><span class="lines">@@ -108,6 +80,10 @@
</span><span class="cx">
</span><span class="cx"> else
</span><span class="cx">
</span><del>-all clean install installhdrs installsrc:
</del><ins>+install:
</ins><span class="cx">
</span><ins>+all:
+
+clean:
+
</ins><span class="cx"> endif
</span></span></pre></div>
<a id="trunkToolsScriptsoldrunwebkittests"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/old-run-webkit-tests (163997 => 163998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/old-run-webkit-tests        2014-02-13 00:17:49 UTC (rev 163997)
+++ trunk/Tools/Scripts/old-run-webkit-tests        2014-02-13 00:38:25 UTC (rev 163998)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx"> use File::Temp;
</span><span class="cx"> use FindBin;
</span><span class="cx"> use Getopt::Long;
</span><ins>+use IO::Handle;
</ins><span class="cx"> use IPC::Open2;
</span><span class="cx"> use IPC::Open3;
</span><span class="cx"> use MIME::Base64;
</span><span class="lines">@@ -126,11 +127,17 @@
</span><span class="cx"> sub toWindowsPath($);
</span><span class="cx"> sub validateSkippedArg($$;$);
</span><span class="cx"> sub writeToFile($$);
</span><ins>+sub installAndLaunchDumpRenderTreeAppUsingNotification($$);
+sub openIPhoneSimulator();
+sub quitDumpRenderTreeAppUsingNotification();
+sub quitIPhoneSimulator();
+sub simulatorSessionUUID();
</ins><span class="cx">
</span><span class="cx"> # Argument handling
</span><span class="cx"> my $addPlatformExceptions = 0;
</span><span class="cx"> my @additionalPlatformDirectories = ();
</span><span class="cx"> my $complexText = 0;
</span><ins>+my $iOSExpectedResultsDir = '';
</ins><span class="cx"> my $exitAfterNFailures = 0;
</span><span class="cx"> my $exitAfterNCrashesOrTimeouts = 0;
</span><span class="cx"> my $generateNewResults = isAppleMacWebKit() ? 1 : 0;
</span><span class="lines">@@ -217,10 +224,35 @@
</span><span class="cx">
</span><span class="cx"> my $realPlatform;
</span><span class="cx">
</span><del>-my @macPlatforms = ("mac-leopard", "mac-snowleopard", "mac-lion", "mac");
</del><ins>+my $haveInstallediOSDumpRenderTreeAppOnce;
+
+my @iPhoneSimulatorPlatforms = qw(iphone-simulator);
+my @macPlatforms = ("mac-mountainlion", "mac");
</ins><span class="cx"> my @winPlatforms = ("win-xp", "win-vista", "win-7sp0", "win");
</span><span class="cx">
</span><del>-if (isAppleMacWebKit()) {
</del><ins>+if (isIOSWebKit()) {
+ my $simulatorVersionHash = iPhoneSimulatorVersion();
+ my $simulatorVersion = "v" . $simulatorVersionHash->{major} . "." . $simulatorVersionHash->{minor};
+
+ sub versionFromPlatformSuffix {
+ my $version = shift;
+ $version =~ s/^-//;
+ $version =~ s/-/./g;
+ return "v$version";
+ }
+
+ foreach my $iphoneSimulatorPlatform (reverse @iPhoneSimulatorPlatforms) {
+ if (!$platform) {
+ $platform = $iphoneSimulatorPlatform;
+ next;
+ }
+ die "Invalid platform: $iphoneSimulatorPlatform" unless $iphoneSimulatorPlatform =~ /^iphone-simulator((-[0-9]+){2})$/;
+ last if eval(versionFromPlatformSuffix($1) . " lt $simulatorVersion");
+ $platform = $iphoneSimulatorPlatform;
+ }
+
+ $tolerance = 1.0;
+} elsif (isAppleMacWebKit()) {
</ins><span class="cx"> if (isSnowLeopard()) {
</span><span class="cx"> $platform = "mac-snowleopard";
</span><span class="cx"> $tolerance = 0.1;
</span><span class="lines">@@ -272,11 +304,13 @@
</span><span class="cx">
</span><span class="cx"> my $usage = <<EOF;
</span><span class="cx"> Usage: $programName [options] [testdir|testpath ...]
</span><ins>+ --32-bit Run tests in 32-bit mode
</ins><span class="cx"> --add-platform-exceptions Put new results for non-platform-specific failing tests into the platform-specific results directory
</span><span class="cx"> --additional-platform-directory path/to/directory
</span><span class="cx"> Look in the specified directory before looking in any of the default platform-specific directories
</span><span class="cx"> --complex-text Use the complex text code path for all text (Mac OS X and Windows only)
</span><span class="cx"> -c|--configuration config Set DumpRenderTree build configuration
</span><ins>+ -e|--expected-results Specify an alternate directory for expected results (iOS only)
</ins><span class="cx"> --gc-between-tests Force garbage collection between each test
</span><span class="cx"> -g|--guard-malloc Enable Guard Malloc
</span><span class="cx"> --exit-after-n-failures N Exit after the first N failures (includes crashes) instead of running all tests
</span><span class="lines">@@ -327,6 +361,7 @@
</span><span class="cx"> 'add-platform-exceptions' => \$addPlatformExceptions,
</span><span class="cx"> 'additional-platform-directory=s' => \@additionalPlatformDirectories,
</span><span class="cx"> 'complex-text' => \$complexText,
</span><ins>+ 'expected-results|e=s' => \$iOSExpectedResultsDir, # PLATFORM_IOS
</ins><span class="cx"> 'exit-after-n-failures=i' => \$exitAfterNFailures,
</span><span class="cx"> 'exit-after-n-crashes-or-timeouts=i' => \$exitAfterNCrashesOrTimeouts,
</span><span class="cx"> 'gc-between-tests' => \$gcBetweenTests,
</span><span class="lines">@@ -416,6 +451,8 @@
</span><span class="cx"> my $productDir = productDir();
</span><span class="cx"> $productDir .= "/Programs" if isGtk();
</span><span class="cx">
</span><ins>+quitIPhoneSimulator() if isIOSWebKit();
+
</ins><span class="cx"> # Save the current directory before chaging it via chdirWebKit
</span><span class="cx"> my $currentDir = cwd();
</span><span class="cx"> chdirWebKit();
</span><span class="lines">@@ -428,6 +465,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> my $dumpToolName = $useWebKitTestRunner ? "WebKitTestRunner" : "DumpRenderTree";
</span><ins>+if (isIOSWebKit()) {
+ $dumpToolName = $useWebKitTestRunner ? "WebKitTestRunnerApp.app/WebKitTestRunnerApp" : "DumpRenderTree.app/DumpRenderTree";
+}
</ins><span class="cx">
</span><span class="cx"> if (isAppleWinWebKit()) {
</span><span class="cx"> $dumpToolName .= "_debug" if configuration() eq "Debug_All";
</span><span class="lines">@@ -442,8 +482,25 @@
</span><span class="cx"> $imageDiffTool .= "_debug" if isCygwin() && configuration() eq "Debug_Cairo";
</span><span class="cx"> die "can't find executable $imageDiffTool (looked in $productDir)\n" if $pixelTests && !-x $imageDiffTool;
</span><span class="cx">
</span><del>-checkFrameworks() unless isCygwin();
</del><ins>+checkFrameworks() unless isCygwin() or isIOSWebKit();
</ins><span class="cx">
</span><ins>+if (isIOSWebKit()) {
+ push @INC, $productDir . "/lib/perl5/darwin-thread-multi-2level";
+ require IPhoneSimulatorNotification;
+}
+
+if (isAppleMacWebKit()) {
+ push @INC, $productDir;
+ eval 'use DumpRenderTreeSupport;';
+}
+
+openIPhoneSimulator() if isIOSWebKit();
+
+if (isAppleMacWebKit()) {
+ push @INC, $productDir;
+ require DumpRenderTreeSupport;
+}
+
</ins><span class="cx"> my $layoutTestsName = "LayoutTests";
</span><span class="cx"> my $testDirectory = File::Spec->rel2abs($layoutTestsName);
</span><span class="cx"> my $expectedDirectory = $testDirectory;
</span><span class="lines">@@ -453,13 +510,14 @@
</span><span class="cx"> my @platformTestHierarchy = buildPlatformTestHierarchy(@platformResultHierarchy);
</span><span class="cx">
</span><span class="cx"> $expectedDirectory = $ENV{"WebKitExpectedTestResultsDirectory"} if $ENV{"WebKitExpectedTestResultsDirectory"};
</span><ins>+$expectedDirectory = $iOSExpectedResultsDir if $iOSExpectedResultsDir && isIOSWebKit();
</ins><span class="cx">
</span><span class="cx"> $testResultsDirectory = File::Spec->catfile($currentDir, $testResultsDirectory);
</span><span class="cx"> # $testResultsDirectory must be empty before testing.
</span><span class="cx"> rmtree $testResultsDirectory;
</span><span class="cx"> my $testResults = File::Spec->catfile($testResultsDirectory, "results.html");
</span><span class="cx">
</span><del>-if (isAppleMacWebKit()) {
</del><ins>+if (isAppleMacWebKit() && !isIOSWebKit()) {
</ins><span class="cx"> print STDERR "Compiling Java tests\n";
</span><span class="cx"> my $javaTestsDirectory = catdir($testDirectory, "java");
</span><span class="cx">
</span><span class="lines">@@ -1097,6 +1155,8 @@
</span><span class="cx">
</span><span class="cx"> !$isDumpToolOpen || die "Failed to close $dumpToolName.\n";
</span><span class="cx">
</span><ins>+quitIPhoneSimulator() if isIOSWebKit();
+
</ins><span class="cx"> $isHttpdOpen = !closeHTTPD();
</span><span class="cx"> closeWebSocketServer();
</span><span class="cx">
</span><span class="lines">@@ -1196,6 +1256,9 @@
</span><span class="cx"> system "cygstart", $testResults if $launchSafari;
</span><span class="cx"> } elsif (isWindows()) {
</span><span class="cx"> system "start", $testResults if $launchSafari;
</span><ins>+} elsif (isIOSWebKit()) {
+ # Don't use run-safari, since it tries to load iOS frameworks in OS X Safari.
+ system "open", "-a", "Safari", $testResults if $launchSafari;
</ins><span class="cx"> } else {
</span><span class="cx"> system "Tools/Scripts/run-safari", @configurationArgs, "-NSOpen", $testResults if $launchSafari;
</span><span class="cx"> }
</span><span class="lines">@@ -1287,6 +1350,118 @@
</span><span class="cx"> close NEWFILE;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub installAndLaunchDumpRenderTreeAppUsingNotification($$)
+{
+ my ($args, $cleanEnv) = @_;
+
+ my $iPhoneSimulatorNotification = new IPhoneSimulatorNotification;
+ $iPhoneSimulatorNotification->startObservingApplicationLaunchedNotification();
+
+ my $makeNSDictionaryFromHash = sub {
+ my ($dict) = @_;
+ my $result = NSMutableDictionary->alloc()->initWithCapacity_(scalar(keys %{$dict}));
+ for my $key (keys %{$dict}) {
+ $result->setObject_forKey_(NSString->stringWithCString_($dict->{$key}), NSString->stringWithCString_($key));
+ }
+ return $result->autorelease();
+ };
+
+ my $makeNSArrayFromArray = sub {
+ my ($array) = @_;
+ my $result = NSMutableArray->alloc()->initWithCapacity_(scalar(@{$array}));
+ for my $item (@{$array}) {
+ $result->addObject_(NSString->stringWithCString_($item));
+ }
+ return $result->autorelease();
+ };
+
+ my $deviceName = architecture() eq 'i386' ? "iPhone Retina (4-inch)" : "iPhone Retina (4-inch 64-bit)";
+
+ my $sdkRoot = `xcrun --sdk iphonesimulator --show-sdk-path`;
+ chomp $sdkRoot;
+
+ my $dict = {
+ applicationArguments => &$makeNSArrayFromArray($args),
+ applicationEnvironment => &$makeNSDictionaryFromHash($cleanEnv),
+ applicationIdentifier => NSString->stringWithCString_("org.webkit.DumpRenderTree"),
+ applicationPath => NSString->stringWithCString_("$productDir/DumpRenderTree.app"),
+ deviceInfo => NSString->stringWithCString_($deviceName),
+ sessionOwner => NSString->stringWithCString_($programName),
+ sessionUUID => NSString->stringWithCString_(simulatorSessionUUID()),
+ sdkRoot => NSString->stringWithCString_($sdkRoot),
+ };
+ $iPhoneSimulatorNotification->postStartSessionNotification($dict);
+
+ while (!$iPhoneSimulatorNotification->hasReceivedApplicationLaunchedNotification()) {
+ my $date = NSDate->alloc()->initWithTimeIntervalSinceNow_(0.1);
+ NSRunLoop->currentRunLoop->runUntilDate_($date);
+ $date->release();
+ }
+
+ print "DumpRenderTree has launched.\n";
+
+ $iPhoneSimulatorNotification->stopObservingApplicationLaunchedNotification();
+
+ return $iPhoneSimulatorNotification->applicationLaunchedApplicationPID();
+}
+
+sub openIPhoneSimulator()
+{
+ my $iPhoneSimulatorNotification = new IPhoneSimulatorNotification;
+ $iPhoneSimulatorNotification->startObservingReadyNotification();
+
+ my $deviceName = architecture() eq 'i386' ? "iPhone Retina (4-inch)" : "iPhone Retina (4-inch 64-bit)";
+
+ system "open", "-a", "iPhone Simulator", "--args", "-SessionOnLaunch", "NO", "-SimulateDevice", $deviceName;
+
+ die $! if exitStatus($?);
+
+ while (!$iPhoneSimulatorNotification->hasReceivedReadyNotification()) {
+ my $date = NSDate->alloc()->initWithTimeIntervalSinceNow_(0.1);
+ NSRunLoop->currentRunLoop->runUntilDate_($date);
+ $date->release();
+ }
+
+ $iPhoneSimulatorNotification->stopObservingReadyNotification();
+}
+
+sub quitDumpRenderTreeAppUsingNotification()
+{
+ my $iPhoneSimulatorNotification = new IPhoneSimulatorNotification;
+ $iPhoneSimulatorNotification->startObservingApplicationQuitNotification();
+
+ my $dict = {
+ sessionUUID => NSString->stringWithCString_(simulatorSessionUUID()),
+ };
+ $iPhoneSimulatorNotification->postEndSessionNotification($dict);
+
+ # FIXME: <rdar://problem/7443077> DumpRenderTree should exit without having to use kill -9 from run-webkit-tests
+ kill 9, $dumpToolPID;
+
+ my $timeoutCounter = 0;
+ while (!$iPhoneSimulatorNotification->hasReceivedApplicationQuitNotification()) {
+ my $date = NSDate->alloc()->initWithTimeIntervalSinceNow_(0.1);
+ NSRunLoop->currentRunLoop->runUntilDate_($date);
+ $date->release();
+ if (++$timeoutCounter >= 600) {
+ print STDERR "ERROR: Hang waiting for application quit notification. Did DumpRenderTree.app crash instead?\n";
+ last;
+ }
+ }
+
+ $iPhoneSimulatorNotification->stopObservingApplicationQuitNotification();
+}
+
+sub quitIPhoneSimulator()
+{
+ system "osascript", "-e", "tell application \"iPhone Simulator\" to quit";
+}
+
+sub simulatorSessionUUID()
+{
+ return "theAwesomeUniqueSessionIdentifierForDumpRenderTree";
+}
+
</ins><span class="cx"> # Break up a path into the directory (with slash) and base name.
</span><span class="cx"> sub splitpath($)
</span><span class="cx"> {
</span><span class="lines">@@ -1379,8 +1554,10 @@
</span><span class="cx"> return if !$pixelTests;
</span><span class="cx">
</span><span class="cx"> my %CLEAN_ENV;
</span><ins>+ my @command = ($imageDiffTool);;
+ unshift(@command, 'xcrun', '-sdk', xcodeSDK(), 'sim') if willUseIOSSimulatorSDKWhenBuilding();
</ins><span class="cx"> $CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
</span><del>- $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, $imageDiffTool, launchWithEnv(@diffToolArgs, %CLEAN_ENV)) or die "unable to open $imageDiffTool\n";
</del><ins>+ $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, @command, launchWithEnv(@diffToolArgs, %CLEAN_ENV)) or die "unable to open $imageDiffTool\n";
</ins><span class="cx"> $isDiffToolOpen = 1;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1403,7 +1580,7 @@
</span><span class="cx"> $childErr = ">&STDERR";
</span><span class="cx"> }
</span><span class="cx">
</span><del>- my @args = argumentsForConfiguration();
</del><ins>+ my @args = ('--sdk', xcodeSDK(), argumentsForConfiguration());
</ins><span class="cx"> my $buildProcess = open3($childIn, $childOut, $childErr, $perlInterpreter, File::Spec->catfile(qw(Tools Scripts), $dumpToolBuildScript), @args) or die "Failed to run build-dumprendertree";
</span><span class="cx"> close($childIn);
</span><span class="cx"> waitpid $buildProcess, 0;
</span><span class="lines">@@ -1468,6 +1645,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> $CLEAN_ENV{DYLD_FRAMEWORK_PATH} = $productDir;
</span><ins>+ $CLEAN_ENV{DYLD_LIBRARY_PATH} = $productDir;
</ins><span class="cx"> $CLEAN_ENV{DYLD_INSERT_LIBRARIES} = "/usr/lib/libgmalloc.dylib" if $guardMalloc;
</span><span class="cx"> } elsif (isCygwin()) {
</span><span class="cx"> $CLEAN_ENV{HOMEDRIVE} = $ENV{'HOMEDRIVE'};
</span><span class="lines">@@ -1489,7 +1667,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> my @args = ($dumpTool, @toolArgs);
</span><del>- if (isAppleMacWebKit()) {
</del><ins>+ if (isAppleMacWebKit() and !isIOSWebKit()) {
</ins><span class="cx"> unshift @args, "arch", "-" . architecture();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1501,7 +1679,59 @@
</span><span class="cx">
</span><span class="cx"> $CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
</span><span class="cx">
</span><del>- $dumpToolPID = open3(\*OUT, \*IN, \*ERROR, launchWithEnv(@args, %CLEAN_ENV)) or die "Failed to start tool: $dumpTool\n";
</del><ins>+ if (isIOSWebKit()) {
+ # We're either running in the iOS Simulator or through SpringBoard, so FIFO it up!
+
+ # Remove old FIFO files if DRT previously crashed.
+ unlink </tmp/DumpRenderTree_*>;
+
+ if (!-e '/tmp/DumpRenderTree_IN') {
+ system('mkfifo', '/tmp/DumpRenderTree_IN') == 0 or die "Couldn't mkfifo DRT_IN";
+ }
+ open(\*OUT, "+> /tmp/DumpRenderTree_IN") or die "Couldn't open DRT_IN!";
+ OUT->autoflush(1);
+
+ if (!-e '/tmp/DumpRenderTree_OUT') {
+ system('mkfifo', '/tmp/DumpRenderTree_OUT') == 0 or die "Couldn't mkfifo DRT_OUT";
+ }
+ open(\*IN, "+< /tmp/DumpRenderTree_OUT") or die "Couldn't open DRT_OUT!";
+
+ if (!-e '/tmp/DumpRenderTree_ERROR') {
+ system('mkfifo', '/tmp/DumpRenderTree_ERROR') == 0 or die "Couldn't mkfifo DRT_ERROR";
+ }
+ open(\*ERROR, "+< /tmp/DumpRenderTree_ERROR") or die "Couldn't open DRT_ERROR!";
+
+ shift @args; # remove the actual binary name
+
+ if ($haveInstallediOSDumpRenderTreeAppOnce) {
+ my $simPath = `xcrun -sdk iphonesimulator -find sim`;
+ chomp $simPath;
+
+ my @env = map {
+ my $key = $_;
+ my $val = $CLEAN_ENV{$key};
+ ("-env", "$key=$val");
+ } keys %CLEAN_ENV;
+
+ my $archFlag = architecture() eq 'i386' ? '--arch=32' : '--arch=64';
+
+ local(*LAUNCHIN, *LAUNCHOUT);
+ open2(\*LAUNCHIN, \*LAUNCHOUT, $simPath, $archFlag, "LaunchApp", @env, "org.webkit.DumpRenderTree", @args) || die "$!";
+ my $stdout = <LAUNCHIN>;
+ if ($stdout =~ /Launched org.webkit.DumpRenderTree with process ID ([0-9]+)/) {
+ $dumpToolPID = $1;
+ } else {
+ die "Could not launch DumpRenderTree: $!";
+ }
+ close(LAUNCHOUT) || die "$!";
+ close(LAUNCHIN) || die "$!";
+ } else {
+ $dumpToolPID = installAndLaunchDumpRenderTreeAppUsingNotification(\@args, \%CLEAN_ENV);
+ $haveInstallediOSDumpRenderTreeAppOnce = 1;
+ }
+ } else {
+ $dumpToolPID = open3(\*OUT, \*IN, \*ERROR, launchWithEnv(@args, %CLEAN_ENV)) or die "Failed to start tool: $dumpTool\n";
+ }
</ins><span class="cx"> $isDumpToolOpen = 1;
</span><span class="cx"> $dumpToolCrashed = 0;
</span><span class="cx"> }
</span><span class="lines">@@ -1516,6 +1746,17 @@
</span><span class="cx">
</span><span class="cx"> close IN;
</span><span class="cx"> close OUT;
</span><ins>+ if (isIOSWebKit() && !dumpToolDidCrash()) {
+ if ($haveInstallediOSDumpRenderTreeAppOnce) {
+ kill 9, $dumpToolPID;
+ } else {
+ quitDumpRenderTreeAppUsingNotification();
+ }
+
+ # Since closing the FIFO doesn't actually terminate the DumpRenderTree process,
+ # do it ourselves. See above FIXME.
+ unlink </tmp/DumpRenderTree_*>;
+ }
</ins><span class="cx"> waitpid $dumpToolPID, 0;
</span><span class="cx">
</span><span class="cx"> # check for WebCore counter leaks.
</span><span class="lines">@@ -1532,10 +1773,18 @@
</span><span class="cx"> {
</span><span class="cx"> return 1 if $dumpToolCrashed;
</span><span class="cx"> return 0 unless $isDumpToolOpen;
</span><del>- my $pid = waitpid(-1, WNOHANG);
- return 1 if ($pid == $dumpToolPID);
</del><ins>+ if (isIOSWebKit()) {
+ my $count = kill 0, $dumpToolPID;
+ return 1 if !$count;
+ } else {
+ my $pid = waitpid(-1, WNOHANG);
+ return 1 if ($pid == $dumpToolPID);
+ }
</ins><span class="cx">
</span><del>- return 0;
</del><ins>+ # On Mac OS X, crashing may be significantly delayed by crash reporter.
+ return 0 unless isAppleMacWebKit() or isIOSWebKit();
+
+ return DumpRenderTreeSupport::processIsCrashing($dumpToolPID);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub configureAndOpenHTTPDIfNeeded()
</span><span class="lines">@@ -1673,7 +1922,8 @@
</span><span class="cx"> push @extraPlatforms, "mac-wk2" if $platform eq "win-wk2";
</span><span class="cx"> push @extraPlatforms, qw(mac-lion mac);
</span><span class="cx"> }
</span><del>-
</del><ins>+ push @extraPlatforms, @macPlatforms if isIOSWebKit();
+
</ins><span class="cx"> push @directories, map { catdir($platformBaseDirectory, $_) } @extraPlatforms;
</span><span class="cx"> push @directories, $expectedDirectory;
</span><span class="cx">
</span><span class="lines">@@ -2131,6 +2381,12 @@
</span><span class="cx"> if ($platform eq "wincairo") {
</span><span class="cx"> @platforms = $platform;
</span><span class="cx"> }
</span><ins>+ } elsif ($platform =~ /^iphone-simulator-/) {
+ my $i;
+ for ($i = 0; $i < @iPhoneSimulatorPlatforms; $i++) {
+ last if $iPhoneSimulatorPlatforms[$i] eq $platform;
+ }
+ push @platforms, @iPhoneSimulatorPlatforms[$i..$#iPhoneSimulatorPlatforms];
</ins><span class="cx"> } elsif ($platform =~ /^gtk-/) {
</span><span class="cx"> push @platforms, $platform;
</span><span class="cx"> push @platforms, "gtk";
</span></span></pre></div>
<a id="trunkToolsScriptswebkitdirspm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitdirs.pm (163997 => 163998)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitdirs.pm        2014-02-13 00:17:49 UTC (rev 163997)
+++ trunk/Tools/Scripts/webkitdirs.pm        2014-02-13 00:38:25 UTC (rev 163998)
</span><span class="lines">@@ -87,6 +87,7 @@
</span><span class="cx"> my $sourceDir;
</span><span class="cx"> my $currentSVNRevision;
</span><span class="cx"> my $debugger;
</span><ins>+my $iPhoneSimulatorVersion;
</ins><span class="cx"> my $nmPath;
</span><span class="cx"> my $osXVersion;
</span><span class="cx"> my $generateDsym;
</span><span class="lines">@@ -1154,6 +1155,31 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+sub determineIPhoneSimulatorVersion()
+{
+ return if $iPhoneSimulatorVersion;
+
+ if (!isIOSWebKit()) {
+ $iPhoneSimulatorVersion = -1;
+ return;
+ }
+
+ my $version = `/usr/local/bin/psw_vers -productVersion`;
+ my @splitVersion = split(/\./, $version);
+ @splitVersion >= 2 or die "Invalid version $version";
+ $iPhoneSimulatorVersion = {
+ "major" => $splitVersion[0],
+ "minor" => $splitVersion[1],
+ "subminor" => defined($splitVersion[2] ? $splitVersion[2] : 0),
+ };
+}
+
+sub iPhoneSimulatorVersion()
+{
+ determineIPhoneSimulatorVersion();
+ return $iPhoneSimulatorVersion;
+}
+
</ins><span class="cx"> sub determineNmPath()
</span><span class="cx"> {
</span><span class="cx"> return if $nmPath;
</span></span></pre>
</div>
</div>
</body>
</html>