<!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>[171967] 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/171967">171967</a></dd>
<dt>Author</dt> <dd>dfarler@apple.com</dd>
<dt>Date</dt> <dd>2014-08-02 11:01:29 -0700 (Sat, 02 Aug 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove old-run-webkit-tests
https://bugs.webkit.org/show_bug.cgi?id=135374

Reviewed by Csaba Osztrogonác.

* Scripts/old-run-webkit-tests: Removed.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkToolsScriptsoldrunwebkittests">trunk/Tools/Scripts/old-run-webkit-tests</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (171966 => 171967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-08-02 17:34:34 UTC (rev 171966)
+++ trunk/Tools/ChangeLog        2014-08-02 18:01:29 UTC (rev 171967)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-07-30  David Farler  &lt;dfarler@apple.com&gt;
+
+        Remove old-run-webkit-tests
+        https://bugs.webkit.org/show_bug.cgi?id=135374
+
+        Reviewed by Csaba Osztrogonác.
+
+        * Scripts/old-run-webkit-tests: Removed.
+
</ins><span class="cx"> 2014-08-02  Dan Bernstein  &lt;mitz@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         prepare-ChangeLog --no-write shouldn’t require ChangeLog to exist
</span></span></pre></div>
<a id="trunkToolsScriptsoldrunwebkittests"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/Scripts/old-run-webkit-tests (171966 => 171967)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/old-run-webkit-tests        2014-08-02 17:34:34 UTC (rev 171966)
+++ trunk/Tools/Scripts/old-run-webkit-tests        2014-08-02 18:01:29 UTC (rev 171967)
</span><span class="lines">@@ -1,3022 +0,0 @@
</span><del>-#!/usr/bin/perl -w
-
-# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
-# Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
-# Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com)
-# Copyright (C) 2007 Eric Seidel &lt;eric@webkit.org&gt;
-# Copyright (C) 2009 Google Inc. All rights reserved.
-# Copyright (C) 2009 Andras Becsi (becsi.andras@stud.u-szeged.hu), University of Szeged
-#
-# 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. (&quot;Apple&quot;) 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 &quot;AS IS&quot; 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.
-
-# Script to run the WebKit Open Source Project layout tests.
-
-# Run all the tests passed in on the command line.
-# If no tests are passed, find all the .html, .shtml, .xml, .xhtml, .xhtmlmp, .pl, .php (and svg) files in the test directory.
-
-# Run each text.
-# Compare against the existing file xxx-expected.txt.
-# If there is a mismatch, generate xxx-actual.txt and xxx-diffs.txt.
-
-# At the end, report:
-#   the number of tests that got the expected results
-#   the number of tests that ran, but did not get the expected results
-#   the number of tests that failed to run
-#   the number of tests that were run but had no expected results to compare against
-
-use strict;
-use warnings;
-
-use CGI;
-use Config;
-use Cwd;
-use Data::Dumper;
-use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK);
-use File::Basename;
-use File::Copy;
-use File::Find;
-use File::Path;
-use File::Spec;
-use File::Spec::Functions;
-use File::Temp;
-use FindBin;
-use Getopt::Long;
-use IO::Handle;
-use IPC::Open2;
-use IPC::Open3;
-use MIME::Base64;
-use Time::HiRes qw(time usleep);
-
-use List::Util 'shuffle';
-
-use lib $FindBin::Bin;
-use webkitperl::features;
-use webkitperl::httpd;
-use webkitdirs;
-use VCSUtils;
-use POSIX;
-
-sub buildPlatformResultHierarchy();
-sub buildPlatformTestHierarchy(@);
-sub captureSavedCrashLog($$);
-sub checkPythonVersion();
-sub closeCygpaths();
-sub closeDumpTool();
-sub closeWebSocketServer();
-sub configureAndOpenHTTPDIfNeeded();
-sub countAndPrintLeaks($$$);
-sub countFinishedTest($$$$);
-sub deleteExpectedAndActualResults($);
-sub dumpToolDidCrash();
-sub epiloguesAndPrologues($$);
-sub expectedDirectoryForTest($;$;$);
-sub fileNameWithNumber($$);
-sub findNewestFileMatchingGlob($);
-sub htmlForResultsSection(\@$&amp;);
-sub isTextOnlyTest($);
-sub launchWithEnv(\@\%);
-sub resolveAndMakeTestResultsDirectory();
-sub numericcmp($$);
-sub openDiffTool();
-sub buildDumpTool($);
-sub openDumpTool();
-sub parseLeaksandPrintUniqueLeaks();
-sub openWebSocketServerIfNeeded();
-sub pathcmp($$);
-sub printFailureMessageForTest($$);
-sub processIgnoreTests($$);
-sub processSkippedFileEntry($$$);
-sub readChecksumFromPng($);
-sub readFromDumpToolWithTimer(**);
-sub readSkippedFiles($);
-sub recordActualResultsAndDiff($$);
-sub sampleDumpTool();
-sub setFileHandleNonBlocking(*$);
-sub setUpWindowsCrashLogSaving();
-sub slowestcmp($$);
-sub splitpath($);
-sub startsWith($$);
-sub stopRunningTestsEarlyIfNeeded();
-sub stripExtension($);
-sub stripMetrics($$);
-sub testCrashedOrTimedOut($$$$$$);
-sub toCygwinPath($);
-sub toURL($);
-sub toWindowsPath($);
-sub validateSkippedArg($$;$);
-sub writeToFile($$);
-sub installAndLaunchDumpToolAppUsingNotification($$);
-sub quitDumpToolUsingNotification();
-sub simulatorSessionUUID();
-
-# Argument handling
-my $addPlatformExceptions = 0;
-my @additionalPlatformDirectories = ();
-my $complexText = 0;
-my $iOSExpectedResultsDir = '';
-my $exitAfterNFailures = 0;
-my $exitAfterNCrashesOrTimeouts = 0;
-my $generateNewResults = isAppleMacWebKit() ? 1 : 0;
-my $guardMalloc = '';
-# FIXME: Dynamic HTTP-port configuration in this file is wrong.  The various
-# apache config files in LayoutTests/http/config govern the port numbers.
-# Dynamic configuration as-written will also cause random failures in
-# an IPv6 environment.  See https://bugs.webkit.org/show_bug.cgi?id=37104.
-my $httpdPort = 8000;
-my $httpdSSLPort = 8443;
-my $httpdAuxiliaryPort = 8080; # Port used by various tests in http/tests/security.
-my $ignoreMetrics = 0;
-my $webSocketPort = 8880;
-# wss is disabled until all platforms support pyOpenSSL.
-# my $webSocketSecurePort = 9323;
-my @ignoreTests;
-my $iterations = 1;
-my $launchSafari = 1;
-my $mergeDepth;
-my $pixelTests = '';
-my $platform;
-my $quiet = '';
-my $randomizeTests = 0;
-my $repeatEach = 1;
-my $report10Slowest = 0;
-my $resetResults = 0;
-my $reverseTests = 0;
-my $root;
-my $runSample = 1;
-my $shouldCheckLeaks = 0;
-my $showHelp = 0;
-my $stripEditingCallbacks;
-my $testHTTP = 1;
-my $testWebSocket = 1;
-my $testMedia = 1;
-my $tmpDir = &quot;/tmp&quot;;
-my $testResultsDirectory = File::Spec-&gt;catdir($tmpDir, &quot;layout-test-results&quot;);
-my $testsPerDumpTool = 1000;
-my $threaded = 0;
-my $gcBetweenTests = 0;
-# DumpRenderTree has an internal timeout of 30 seconds, so this must be &gt; 30.
-my $timeoutSeconds = 35;
-my $tolerance = 0;
-my $treatSkipped = &quot;default&quot;;
-my $useRemoteLinksToTests = 0;
-my $useValgrind = 0;
-my $verbose = 0;
-my $shouldWaitForHTTPD = 0;
-my $useWebKitTestRunner = 0;
-my $noBuildDumpTool = 0;
-chomp(my $developerDir = $ENV{DEVELOPER_DIR} || `xcode-select --print-path`);
-my $simulatorApp = &quot;$developerDir/Applications/iOS Simulator.app&quot;;
-unless (-d $simulatorApp) {
-    $simulatorApp = &quot;$developerDir/Applications/iPhone Simulator.app&quot;;
-}
-
-# These arguments are ignored, but exist for compatibility with new-run-webkit-tests.
-my $builderName = '';
-my $buildNumber = '';
-my $masterName = '';
-my $testResultsServer = '';
-
-my @leaksFilenames;
-
-if (isWindows()) {
-    print &quot;This script has to be run under Cygwin to function correctly.\n&quot;;
-    exit 1;
-}
-
-my $perlInterpreter = &quot;perl&quot;;
-
-my $expectedTag = &quot;expected&quot;;
-my $mismatchTag = &quot;mismatch&quot;;
-my $refTag = &quot;ref&quot;;
-my $notrefTag = &quot;notref&quot;;
-my $actualTag = &quot;actual&quot;;
-my $prettyDiffTag = &quot;pretty-diff&quot;;
-my $diffsTag = &quot;diffs&quot;;
-my $errorTag = &quot;stderr&quot;;
-my $crashLogTag = &quot;crash-log&quot;;
-
-my $windowsCrashLogFilePrefix = &quot;CrashLog&quot;;
-
-# These are defined here instead of closer to where they are used so that they
-# will always be accessible from the END block that uses them, even if the user
-# presses Ctrl-C before Perl has finished evaluating this whole file.
-my $windowsPostMortemDebuggerKey = &quot;/HKLM/SOFTWARE/Microsoft/Windows NT/CurrentVersion/AeDebug&quot;;
-my %previousWindowsPostMortemDebuggerValues;
-
-my $realPlatform;
-
-my $haveInstallediOSDumpToolAppOnce;
-
-my @iPhoneSimulatorPlatforms = qw(ios-sim);
-my @macPlatforms = (&quot;mac-mountainlion&quot;, &quot;mac&quot;);
-my @winPlatforms = (&quot;win-xp&quot;, &quot;win-vista&quot;, &quot;win-7sp0&quot;, &quot;win&quot;);
-
-if (isIOSWebKit()) {
-    my $simulatorVersionHash = iPhoneSimulatorVersion();
-    my $simulatorVersion = &quot;v&quot; . $simulatorVersionHash-&gt;{major} . &quot;.&quot; . $simulatorVersionHash-&gt;{minor};
-
-    sub versionFromPlatformSuffix {
-        my $version = shift;
-        $version =~ s/^-//;
-        $version =~ s/-/./g;
-        return &quot;v$version&quot;;
-    }
-
-    foreach my $iphoneSimulatorPlatform (reverse @iPhoneSimulatorPlatforms) {
-        if (!$platform) {
-            $platform = $iphoneSimulatorPlatform;
-            next;
-        }
-        die &quot;Invalid platform: $iphoneSimulatorPlatform&quot; unless $iphoneSimulatorPlatform =~ /^iphone-simulator((-[0-9]+){2})$/;
-        last if eval(versionFromPlatformSuffix($1) . &quot; lt $simulatorVersion&quot;);
-        $platform = $iphoneSimulatorPlatform;
-    }
-
-    $tolerance = 1.0;
-} elsif (isAppleMacWebKit()) {
-    if (isSnowLeopard()) {
-        $platform = &quot;mac-snowleopard&quot;;
-        $tolerance = 0.1;
-    } elsif (isLion()) {
-        $platform = &quot;mac-lion&quot;;
-        $tolerance = 0.1;
-    } else {
-        $platform = &quot;mac&quot;;
-    }
-} elsif (isGtk()) {
-    $platform = &quot;gtk&quot;;
-} elsif (isWinCairo()) {
-    $platform = &quot;wincairo&quot;;
-} elsif (isCygwin() || isWindows()) {
-    if (isWindowsXP()) {
-        $platform = &quot;win-xp&quot;;
-    } elsif (isWindowsVista()) {
-        $platform = &quot;win-vista&quot;;
-    } elsif (isWindows7SP0()) {
-        $platform = &quot;win-7sp0&quot;;
-    } else {
-        $platform = &quot;win&quot;;
-    }
-}
-
-if (isAppleWinWebKit()) {
-    my $testfontPath = $ENV{&quot;WEBKIT_TESTFONTS&quot;};
-    if (!$testfontPath || !-d &quot;$testfontPath&quot;) {
-        print &quot;The WEBKIT_TESTFONTS environment variable is not defined or not set properly\n&quot;;
-        print &quot;You must set it before running the tests.\n&quot;;
-        exit 1;
-    }
-}
-
-if (!defined($platform)) {
-    print &quot;WARNING: Your platform is not recognized. Any platform-specific results will be generated in platform/undefined.\n&quot;;
-    $platform = &quot;undefined&quot;;
-}
-
-if (!checkPythonVersion()) {
-    print &quot;WARNING: Your platform does not have Python 2.5+, which is required to run websocket server, so disabling websocket/tests.\n&quot;;
-    $testWebSocket = 0;
-}
-
-my $programName = basename($0);
-my $launchSafariDefault = $launchSafari ? &quot;launch&quot; : &quot;do not launch&quot;;
-my $httpDefault = $testHTTP ? &quot;run&quot; : &quot;do not run&quot;;
-my $sampleDefault = $runSample ? &quot;run&quot; : &quot;do not run&quot;;
-
-my $usage = &lt;&lt;EOF;
-Usage: $programName [options] [testdir|testpath ...]
-  --32-bit                        Run tests in 32-bit mode
-  --add-platform-exceptions       Put new results for non-platform-specific failing tests into the platform-specific results directory
-  --additional-platform-directory path/to/directory
-                                  Look in the specified directory before looking in any of the default platform-specific directories
-  --complex-text                  Use the complex text code path for all text (Mac OS X and Windows only)
-  -c|--configuration config       Set DumpRenderTree/WebKitTestRunner build configuration
-  -e|--expected-results           Specify an alternate directory for expected results (iOS only)
-  --gc-between-tests              Force garbage collection between each test
-  -g|--guard-malloc               Enable Guard Malloc
-  --exit-after-n-failures N       Exit after the first N failures (includes crashes) instead of running all tests
-  --exit-after-n-crashes-or-timeouts N
-                                  Exit after the first N crashes instead of running all tests
-  -h|--help                       Show this help message
-  --[no-]http                     Run (or do not run) http tests (default: $httpDefault)
-  --[no-]wait-for-httpd           Wait for httpd if some other test session is using it already (same as WEBKIT_WAIT_FOR_HTTPD=1). (default: $shouldWaitForHTTPD) 
-  -i|--ignore-tests               Comma-separated list of directories or tests to ignore
-  --iterations n                  Number of times to run the set of tests (e.g. ABCABCABC)
-  --[no-]launch-safari            Launch (or do not launch) Safari to display test results (default: $launchSafariDefault)
-  --[no-]show-results             Same as --[no-]launch-safari
-  -l|--leaks                      Enable leaks checking
-  --[no-]new-test-results         Generate results for new tests
-  --nthly n                       Restart DumpRenderTree/WebKitTestRunner every n tests (default: $testsPerDumpTool)
-  -p|--pixel-tests                Enable pixel tests
-  --tolerance t                   Ignore image differences less than this percentage (default: $tolerance)
-  --platform                      Override the detected platform to use for tests and results (default: $platform)
-  --port                          Web server port to use with http tests
-  -q|--quiet                      Less verbose output
-  --reset-results                 Reset ALL results (including pixel tests if --pixel-tests is set)
-  -o|--results-directory          Output results directory (default: $testResultsDirectory)
-  --random                        Run the tests in a random order
-  --repeat-each n                 Number of times to run each test (e.g. AAABBBCCC)
-  --reverse                       Run the tests in reverse alphabetical order
-  --root                          Path to root tools build
-  --[no-]sample-on-timeout        Run sample on timeout (default: $sampleDefault) (Mac OS X only)
-  -1|--singly                     Isolate each test case run (implies --nthly 1 --verbose)
-  --skipped=[default|ignore|only] Specifies how to treat the Skipped file
-                                     default: Tests/directories listed in the Skipped file are not tested
-                                     ignore:  The Skipped file is ignored
-                                     only:    Only those tests/directories listed in the Skipped file will be run
-  --slowest                       Report the 10 slowest tests
-  --ignore-metrics                Ignore metrics in tests
-  --[no-]strip-editing-callbacks  Remove editing callbacks from expected results
-  -t|--threaded                   Run a concurrent JavaScript thead with each test
-  --timeout t                     Sets the number of seconds before a test times out (default: $timeoutSeconds)
-  --valgrind                      Run DumpRenderTree inside valgrind (Linux only)
-  -v|--verbose                    More verbose output (overrides --quiet)
-  -m|--merge-leak-depth arg       Merges leak callStacks and prints the number of unique leaks beneath a callstack depth of arg.  Defaults to 5.
-  --use-remote-links-to-tests     Link to test files within the SVN repository in the results.
-  -2|--webkit-test-runner         Use WebKitTestRunner rather than DumpRenderTree.
-EOF
-
-setConfiguration();
-
-my $getOptionsResult = GetOptions(
-    'add-platform-exceptions' =&gt; \$addPlatformExceptions,
-    'additional-platform-directory=s' =&gt; \@additionalPlatformDirectories,
-    'complex-text' =&gt; \$complexText,
-    'expected-results|e=s' =&gt; \$iOSExpectedResultsDir,  # PLATFORM_IOS 
-    'exit-after-n-failures=i' =&gt; \$exitAfterNFailures,
-    'exit-after-n-crashes-or-timeouts=i' =&gt; \$exitAfterNCrashesOrTimeouts,
-    'gc-between-tests' =&gt; \$gcBetweenTests,
-    'guard-malloc|g' =&gt; \$guardMalloc,
-    'help|h' =&gt; \$showHelp,
-    'http!' =&gt; \$testHTTP,
-    'wait-for-httpd!' =&gt; \$shouldWaitForHTTPD,
-    'ignore-metrics!' =&gt; \$ignoreMetrics,
-    'ignore-tests|i=s' =&gt; \@ignoreTests,
-    'iterations=i' =&gt; \$iterations,
-    'launch-safari!' =&gt; \$launchSafari,
-    'leaks|l' =&gt; \$shouldCheckLeaks,
-    'merge-leak-depth|m:5' =&gt; \$mergeDepth,
-    'new-test-results!' =&gt; \$generateNewResults,
-    'no-build' =&gt; \$noBuildDumpTool,
-    'nthly=i' =&gt; \$testsPerDumpTool,
-    'pixel-tests|p' =&gt; \$pixelTests,
-    'platform=s' =&gt; \$platform,
-    'port=i' =&gt; \$httpdPort,
-    'quiet|q' =&gt; \$quiet,
-    'random' =&gt; \$randomizeTests,
-    'repeat-each=i' =&gt; \$repeatEach,
-    'reset-results' =&gt; \$resetResults,
-    'results-directory|o=s' =&gt; \$testResultsDirectory,
-    'reverse' =&gt; \$reverseTests,
-    'root=s' =&gt; \$root,
-    'sample-on-timeout!' =&gt; \$runSample,
-    'show-results!' =&gt; \$launchSafari,
-    'singly|1' =&gt; sub { $testsPerDumpTool = 1; },
-    'skipped=s' =&gt; \&amp;validateSkippedArg,
-    'slowest' =&gt; \$report10Slowest,
-    'strip-editing-callbacks!' =&gt; \$stripEditingCallbacks,
-    'threaded|t' =&gt; \$threaded,
-    'timeout=i' =&gt; \$timeoutSeconds,
-    'tolerance=f' =&gt; \$tolerance,
-    'use-remote-links-to-tests' =&gt; \$useRemoteLinksToTests,
-    'valgrind' =&gt; \$useValgrind,
-    'verbose|v' =&gt; \$verbose,
-    'webkit-test-runner|2' =&gt; \$useWebKitTestRunner,
-    # These arguments are ignored (but are used by new-run-webkit-tests).
-    'builder-name=s' =&gt; \$builderName,
-    'build-number=s' =&gt; \$buildNumber,
-    'master-name=s' =&gt; \$masterName,
-    'test-results-server=s' =&gt; \$testResultsServer,
-    'simulator-app=s' =&gt; \$simulatorApp,
-);
-
-if (!$getOptionsResult || $showHelp) {
-    print STDERR $usage;
-    exit 1;
-}
-
-if ($useWebKitTestRunner) {
-    if (isIOSWebKit()) {
-        $realPlatform = $platform;
-        $platform = &quot;ios-sim-wk2&quot;;
-    } elsif (isAppleMacWebKit()) {
-        $realPlatform = $platform;
-        $platform = &quot;mac-wk2&quot;;
-    } elsif (isAppleWinWebKit()) {
-        $stripEditingCallbacks = 0 unless defined $stripEditingCallbacks;
-        $realPlatform = $platform;
-        $platform = &quot;win-wk2&quot;;
-    } elsif (isGtk()) {
-        $realPlatform = $platform;
-        $platform = &quot;gtk-wk2&quot;;
-    }
-}
-
-$timeoutSeconds *= 10 if $guardMalloc;
-
-$stripEditingCallbacks = isCygwin() unless defined $stripEditingCallbacks;
-
-my $ignoreSkipped = $treatSkipped eq &quot;ignore&quot;;
-my $skippedOnly = $treatSkipped eq &quot;only&quot;;
-
-my $configuration = configuration();
-
-# We need an environment variable to be able to enable the feature per-slave
-$shouldWaitForHTTPD = $ENV{&quot;WEBKIT_WAIT_FOR_HTTPD&quot;} unless ($shouldWaitForHTTPD);
-$verbose = 1 if $testsPerDumpTool == 1;
-
-if ($shouldCheckLeaks &amp;&amp; $testsPerDumpTool &gt; 1000) {
-    print STDERR &quot;\nWARNING: Running more than 1000 tests at a time with MallocStackLogging enabled may cause a crash.\n\n&quot;;
-}
-
-# Generating remote links causes a lot of unnecessary spew on GTK build bot
-$useRemoteLinksToTests = 0 if isGtk();
-
-setConfigurationProductDir(Cwd::abs_path($root)) if (defined($root));
-my $productDir = productDir();
-$productDir .= &quot;/Programs&quot; if isGtk();
-
-quitIOSSimulator() if isIOSWebKit();
-
-# Save the current directory before chaging it via chdirWebKit
-my $currentDir = cwd();
-chdirWebKit();
-
-if (!defined($root) &amp;&amp; !$noBuildDumpTool) {
-    # FIXME: We build both DumpRenderTree and WebKitTestRunner for WebKitTestRunner runs because
-    # DumpRenderTree includes TestNetscapePlugin. It should be factored out into its own project.
-    buildDumpTool(&quot;DumpRenderTree&quot;);
-    buildDumpTool(&quot;WebKitTestRunner&quot;) if $useWebKitTestRunner;
-}
-
-my $dumpToolName = $useWebKitTestRunner ? &quot;WebKitTestRunner&quot; : &quot;DumpRenderTree&quot;;
-if (isIOSWebKit()) {
-    $dumpToolName = $useWebKitTestRunner ? &quot;WebKitTestRunnerApp.app/WebKitTestRunnerApp&quot; : &quot;DumpRenderTree.app/DumpRenderTree&quot;;
-}
-
-if (isAppleWinWebKit()) {
-    $dumpToolName .= &quot;_debug&quot; if configuration() eq &quot;Debug_All&quot;;
-    $dumpToolName .= &quot;_debug&quot; if configuration() eq &quot;Debug_Cairo&quot;;
-    $dumpToolName .= $Config{_exe};
-}
-my $dumpTool = File::Spec-&gt;catfile($productDir, $dumpToolName);
-die &quot;can't find executable $dumpToolName (looked in $productDir)\n&quot; unless -x $dumpTool;
-
-my $imageDiffTool = &quot;$productDir/ImageDiff&quot;;
-$imageDiffTool .= &quot;_debug&quot; if isCygwin() &amp;&amp; configuration() eq &quot;Debug_All&quot;;
-$imageDiffTool .= &quot;_debug&quot; if isCygwin() &amp;&amp; configuration() eq &quot;Debug_Cairo&quot;;
-die &quot;can't find executable $imageDiffTool (looked in $productDir)\n&quot; if $pixelTests &amp;&amp; !-x $imageDiffTool;
-
-checkFrameworks() unless isCygwin() or isIOSWebKit();
-
-if (isIOSWebKit()) {
-    push @INC, $productDir . &quot;/lib/perl5/darwin-thread-multi-2level&quot;;
-    require IPhoneSimulatorNotification;
-}
-
-if (isAppleMacWebKit()) {
-    push @INC, $productDir;
-    eval 'use DumpRenderTreeSupport;';
-}
-
-openIOSSimulator() if isIOSWebKit();
-
-if (isAppleMacWebKit()) {
-    push @INC, $productDir;
-    require DumpRenderTreeSupport;
-}
-
-my $layoutTestsName = &quot;LayoutTests&quot;;
-my $testDirectory = File::Spec-&gt;rel2abs($layoutTestsName);
-my $expectedDirectory = $testDirectory;
-my $platformBaseDirectory = catdir($testDirectory, &quot;platform&quot;);
-my $platformTestDirectory = catdir($platformBaseDirectory, $platform);
-my @platformResultHierarchy = buildPlatformResultHierarchy();
-my @platformTestHierarchy = buildPlatformTestHierarchy(@platformResultHierarchy);
-
-$expectedDirectory = $ENV{&quot;WebKitExpectedTestResultsDirectory&quot;} if $ENV{&quot;WebKitExpectedTestResultsDirectory&quot;};
-$expectedDirectory = $iOSExpectedResultsDir if $iOSExpectedResultsDir &amp;&amp; isIOSWebKit();
-
-$testResultsDirectory = File::Spec-&gt;catfile($currentDir, $testResultsDirectory);
-# $testResultsDirectory must be empty before testing.
-rmtree $testResultsDirectory;
-my $testResults = File::Spec-&gt;catfile($testResultsDirectory, &quot;results.html&quot;);
-
-if (isAppleMacWebKit() &amp;&amp; !isIOSWebKit()) {
-    print STDERR &quot;Compiling Java tests\n&quot;;
-    my $javaTestsDirectory = catdir($testDirectory, &quot;java&quot;);
-
-    if (system(&quot;/usr/bin/make&quot;, &quot;-C&quot;, &quot;$javaTestsDirectory&quot;)) {
-        exit 1;
-    }
-} elsif (isCygwin()) {
-    setUpWindowsCrashLogSaving();
-}
-
-print &quot;Running tests from $testDirectory\n&quot;;
-if ($pixelTests) {
-    print &quot;Enabling pixel tests with a tolerance of $tolerance%\n&quot;;
-    if (isDarwin()) {
-        if (!$useWebKitTestRunner) {
-            print &quot;WARNING: Temporarily changing the main display color profile:\n&quot;;
-            print &quot;\tThe colors on your screen will change for the duration of the testing.\n&quot;;
-            print &quot;\tThis allows the pixel tests to have consistent color values across all machines.\n&quot;;
-        }
-
-        if (isPerianInstalled()) {
-            print &quot;WARNING: Perian's QuickTime component is installed and this may affect pixel test results!\n&quot;;
-            print &quot;\tYou should avoid generating new pixel results in this environment.\n&quot;;
-            print &quot;\tSee https://bugs.webkit.org/show_bug.cgi?id=22615 for details.\n&quot;;
-        }
-    }
-}
-
-system &quot;ln&quot;, &quot;-s&quot;, $testDirectory, &quot;/tmp/LayoutTests&quot; unless -x &quot;/tmp/LayoutTests&quot;;
-
-my %ignoredFiles = ( &quot;results.html&quot; =&gt; 1 );
-my %ignoredDirectories = map { $_ =&gt; 1 } qw(platform);
-my %ignoredLocalDirectories = map { $_ =&gt; 1 } qw(.svn _svn resources script-tests);
-my %supportedFileExtensions = map { $_ =&gt; 1 } qw(htm html shtml xml xhtml xhtmlmp pl php mht);
-
-if (!checkWebCoreFeatureSupport(&quot;MathML&quot;, 0)) {
-    $ignoredDirectories{'mathml'} = 1;
-}
-
-if (!checkWebCoreFeatureSupport(&quot;MHTML&quot;, 0)) {
-    $ignoredDirectories{'mhtml'} = 1;
-}
-
-# FIXME: We should fix webkitperl/features.pm:hasFeature() to do the correct feature detection for Cygwin.
-if (checkWebCoreFeatureSupport(&quot;SVG&quot;, 0)) {
-    $supportedFileExtensions{'svg'} = 1;
-} elsif (isCygwin()) {
-    $supportedFileExtensions{'svg'} = 1;
-} else {
-    $ignoredLocalDirectories{'svg'} = 1;
-}
-
-if (!$testHTTP) {
-    $ignoredDirectories{'http'} = 1;
-    $ignoredDirectories{'websocket'} = 1;
-} elsif (!hasHTTPD()) {
-    print &quot;\nNo httpd found. Cannot run http tests.\nPlease use --no-http if you do not want to run http tests.\n&quot;;
-    exit 1;
-}
-
-if (!$testWebSocket) {
-    $ignoredDirectories{'websocket'} = 1;
-}
-
-if (!$testMedia) {
-    $ignoredDirectories{'media'} = 1;
-    $ignoredDirectories{'http/tests/media'} = 1;
-}
-
-my $supportedFeaturesResult = &quot;&quot;;
-
-if (isCygwin()) {
-    # Collect supported features list
-    my $supportedFeaturesCommand = &quot;\&quot;$dumpTool\&quot; --print-supported-features 2&gt;&amp;1&quot;;
-    $supportedFeaturesResult = `$supportedFeaturesCommand 2&gt;&amp;1`;
-}
-
-my $hasAcceleratedCompositing = 0;
-my $has3DRendering = 0;
-
-if (isCygwin()) {
-    $hasAcceleratedCompositing = $supportedFeaturesResult =~ /AcceleratedCompositing/;
-    $has3DRendering = $supportedFeaturesResult =~ /3DRendering/;
-} else {
-    $hasAcceleratedCompositing = checkWebCoreFeatureSupport(&quot;Accelerated Compositing&quot;, 0);
-    $has3DRendering = checkWebCoreFeatureSupport(&quot;3D Rendering&quot;, 0);
-}
-
-if (!$hasAcceleratedCompositing) {
-    $ignoredDirectories{'compositing'} = 1;
-
-    # This test has slightly different floating-point rounding when accelerated
-    # compositing is enabled.
-    $ignoredFiles{'svg/custom/use-on-symbol-inside-pattern.svg'} = 1;
-
-    # This test has an iframe that is put in a layer only in compositing mode.
-    $ignoredFiles{'media/media-document-audio-repaint.html'} = 1;
-
-    if (isAppleWebKit()) {
-        # In Apple's ports, the default controls for &lt;video&gt; contain a &quot;full
-        # screen&quot; button only if accelerated compositing is enabled.
-        $ignoredFiles{'media/controls-after-reload.html'} = 1;
-        $ignoredFiles{'media/controls-drag-timebar.html'} = 1;
-        $ignoredFiles{'media/controls-strict.html'} = 1;
-        $ignoredFiles{'media/controls-styling.html'} = 1;
-        $ignoredFiles{'media/controls-without-preload.html'} = 1;
-        $ignoredFiles{'media/video-controls-rendering.html'} = 1;
-        $ignoredFiles{'media/video-display-toggle.html'} = 1;
-        $ignoredFiles{'media/video-no-audio.html'} = 1;
-    }
-
-    # Here we're using !$hasAcceleratedCompositing as a proxy for &quot;is a headless XP machine&quot; (like
-    # our test slaves). Headless XP machines can neither support accelerated compositing nor pass
-    # this test, so skipping the test here is expedient, if a little sloppy. See
-    # &lt;http://webkit.org/b/48333&gt;.
-    $ignoredFiles{'platform/win/plugins/npn-invalidate-rect-invalidates-window.html'} = 1 if isAppleWinWebKit();
-}
-
-if (!$has3DRendering) {
-    $ignoredDirectories{'animations/3d'} = 1;
-    $ignoredDirectories{'transforms/3d'} = 1;
-
-    # These tests use the -webkit-transform-3d media query.
-    $ignoredFiles{'fast/media/mq-transform-02.html'} = 1;
-    $ignoredFiles{'fast/media/mq-transform-03.html'} = 1;
-}
-
-if (!checkWebCoreFeatureSupport(&quot;3D Canvas&quot;, 0)) {
-    $ignoredDirectories{'fast/canvas/webgl'} = 1;
-    $ignoredDirectories{'compositing/webgl'} = 1;
-    $ignoredDirectories{'http/tests/canvas/webgl'} = 1;
-}
-
-if (isAppleMacWebKit() &amp;&amp; $platform ne &quot;mac-wk2&quot; &amp;&amp; osXVersion()-&gt;{minor} &gt;= 6 &amp;&amp; architecture() =~ /x86_64/) {
-    # This test relies on executing JavaScript during NPP_Destroy, which isn't supported with
-    # out-of-process plugins in WebKit1. See &lt;http://webkit.org/b/58077&gt;.
-    $ignoredFiles{'plugins/npp-set-window-called-during-destruction.html'} = 1;
-}
-
-processIgnoreTests(join(',', @ignoreTests), &quot;ignore-tests&quot;) if @ignoreTests;
-if (!$ignoreSkipped) {
-    if (!$skippedOnly || @ARGV == 0) {
-        readSkippedFiles(&quot;&quot;);
-    } else {
-        # Since readSkippedFiles() appends to @ARGV, we must use a foreach
-        # loop so that we only iterate over the original argument list.
-        foreach my $argnum (0 .. $#ARGV) {
-            readSkippedFiles(shift @ARGV);
-        }
-    }
-}
-
-my @tests = findTestsToRun();
-
-die &quot;no tests to run\n&quot; if !@tests;
-
-my %counts;
-my %tests;
-my %imagesPresent;
-my %imageDifferences;
-my %durations;
-my $count = 0;
-my $leaksOutputFileNumber = 1;
-my $totalLeaks = 0;
-my $stoppedRunningEarlyMessage;
-
-my @toolArgs = ();
-push @toolArgs, &quot;--pixel-tests&quot; if $pixelTests;
-push @toolArgs, &quot;--threaded&quot; if $threaded;
-push @toolArgs, &quot;--complex-text&quot; if $complexText;
-push @toolArgs, &quot;--gc-between-tests&quot; if $gcBetweenTests;
-push @toolArgs, &quot;-&quot;;
-
-my @diffToolArgs = ();
-push @diffToolArgs, &quot;--tolerance&quot;, $tolerance;
-
-$| = 1;
-
-my $dumpToolPID;
-my $isDumpToolOpen = 0;
-my $dumpToolCrashed = 0;
-my $imageDiffToolPID;
-my $isDiffToolOpen = 0;
-
-my $atLineStart = 1;
-my $lastDirectory = &quot;&quot;;
-
-my $isHttpdOpen = 0;
-my $isWebSocketServerOpen = 0;
-my $webSocketServerPidFile = 0;
-my $failedToStartWebSocketServer = 0;
-# wss is disabled until all platforms support pyOpenSSL.
-# my $webSocketSecureServerPID = 0;
-
-sub catch_pipe { $dumpToolCrashed = 1; }
-$SIG{&quot;PIPE&quot;} = &quot;catch_pipe&quot;;
-
-print &quot;Testing &quot;, scalar @tests, &quot; test cases&quot;;
-print &quot; $iterations times&quot; if ($iterations &gt; 1);
-print &quot;, repeating each test $repeatEach times&quot; if ($repeatEach &gt; 1);
-print &quot;.\n&quot;;
-
-my $overallStartTime = time;
-
-my %expectedResultPaths;
-
-my @originalTests = @tests;
-# Add individual test repetitions
-if ($repeatEach &gt; 1) {
-    @tests = ();
-    foreach my $test (@originalTests) {
-        for (my $i = 0; $i &lt; $repeatEach; $i++) {
-            push(@tests, $test);
-        }
-    }
-}
-# Add test set repetitions
-for (my $i = 1; $i &lt; $iterations; $i++) {
-    push(@tests, @originalTests);
-}
-
-my $absTestResultsDirectory = resolveAndMakeTestResultsDirectory();
-open my $tests_run_fh, '&gt;', &quot;$absTestResultsDirectory/tests_run.txt&quot; or die $!;
-
-for my $test (@tests) {
-    my $newDumpTool = not $isDumpToolOpen;
-    openDumpTool();
-
-    my $base = stripExtension($test);
-    my $expectedExtension = &quot;.txt&quot;;
-    
-    my $dir = $base;
-    $dir =~ s|/[^/]+$||;
-
-    if ($newDumpTool || $dir ne $lastDirectory) {
-        foreach my $logue (epiloguesAndPrologues($newDumpTool ? &quot;&quot; : $lastDirectory, $dir)) {
-            if (isCygwin()) {
-                $logue = toWindowsPath($logue);
-            } else {
-                $logue = canonpath($logue);
-            }
-            if ($verbose) {
-                print &quot;running epilogue or prologue $logue\n&quot;;
-            }
-            print OUT &quot;$logue\n&quot;;
-            # Throw away output from DumpRenderTree.
-            # Once for the test output and once for pixel results (empty)
-            while (&lt;IN&gt;) {
-                last if /#EOF/;
-            }
-            while (&lt;IN&gt;) {
-                last if /#EOF/;
-            }
-        }
-    }
-
-    if ($verbose) {
-        print &quot;running $test -&gt; &quot;;
-        $atLineStart = 0;
-    } elsif (!$quiet) {
-        if ($dir ne $lastDirectory) {
-            print &quot;\n&quot; unless $atLineStart;
-            print &quot;$dir &quot;;
-        }
-        print &quot;.&quot;;
-        $atLineStart = 0;
-    }
-
-    $lastDirectory = $dir;
-
-    my $result;
-
-    my $startTime = time if $report10Slowest;
-
-    print $tests_run_fh &quot;$test\n&quot;;
-
-    # Try to read expected hash file for pixel tests
-    my $suffixPixelTest = &quot;&quot;;
-    if ($pixelTests) {
-        # ' is the separator between arguments.
-        $suffixPixelTest = &quot;'--pixel-test&quot;;
-        if (!$resetResults) {
-            my $expectedPixelDir = expectedDirectoryForTest($base, 0, &quot;png&quot;);
-            if (my $expectedHash = readChecksumFromPng(File::Spec-&gt;catfile($expectedPixelDir, &quot;$base-$expectedTag.png&quot;))) {
-                # Format expected hash into a suffix string that is appended to the path / URL passed to DRT.
-                $suffixPixelTest = &quot;'--pixel-test'$expectedHash&quot;;
-            }
-        }
-    }
-
-    if ($test =~ /^http\//) {
-        configureAndOpenHTTPDIfNeeded();
-        if ($test =~ /^http\/tests\/websocket\//) {
-            if ($test =~ /^websocket\/tests\/local\//) {
-                my $testPath = &quot;$testDirectory/$test&quot;;
-                if (isCygwin()) {
-                    $testPath = toWindowsPath($testPath);
-                } else {
-                    $testPath = canonpath($testPath);
-                }
-                print OUT &quot;$testPath\n&quot;;
-            } else {
-                if (openWebSocketServerIfNeeded()) {
-                    my $path = canonpath($test);
-                    if ($test =~ /^http\/tests\/websocket\/tests\/ssl\//) {
-                        # wss is disabled until all platforms support pyOpenSSL.
-                        print STDERR &quot;Error: wss is disabled until all platforms support pyOpenSSL.&quot;;
-                    } else {
-                        $path =~ s/^http\/tests\///;
-                        print OUT &quot;http://127.0.0.1:$httpdPort/$path\n&quot;;
-                    }
-                } else {
-                    # We failed to launch the WebSocket server.  Display a useful error message rather than attempting
-                    # to run tests that expect the server to be available.
-                    my $errorMessagePath = &quot;$testDirectory/http/tests/websocket/resources/server-failed-to-start.html&quot;;
-                    $errorMessagePath = isCygwin() ? toWindowsPath($errorMessagePath) : canonpath($errorMessagePath);
-                    print OUT &quot;$errorMessagePath\n&quot;;
-                }
-            }
-        } elsif ($test !~ /^http\/tests\/local\// &amp;&amp; $test !~ /^http\/tests\/ssl\//) {
-            my $path = canonpath($test);
-            $path =~ s/^http\/tests\///;
-            print OUT &quot;http://127.0.0.1:$httpdPort/$path$suffixPixelTest\n&quot;;
-        } elsif ($test =~ /^http\/tests\/ssl\//) {
-            my $path = canonpath($test);
-            $path =~ s/^http\/tests\///;
-            print OUT &quot;https://127.0.0.1:$httpdSSLPort/$path$suffixPixelTest\n&quot;;
-        } else {
-            my $testPath = &quot;$testDirectory/$test&quot;;
-            if (isCygwin()) {
-                $testPath = toWindowsPath($testPath);
-            } else {
-                $testPath = canonpath($testPath);
-            }
-            print OUT &quot;$testPath$suffixPixelTest\n&quot;;
-        }
-    } else {
-        my $testPath = &quot;$testDirectory/$test&quot;;
-        if (isCygwin()) {
-            $testPath = toWindowsPath($testPath);
-        } else {
-            $testPath = canonpath($testPath);
-        }
-        print OUT &quot;$testPath$suffixPixelTest\n&quot; if defined $testPath;
-    }
-
-    # DumpRenderTree is expected to dump two &quot;blocks&quot; to stdout for each test.
-    # Each block is terminated by a #EOF on a line by itself.
-    # The first block is the output of the test (in text, RenderTree or other formats).
-    # The second block is for optional pixel data in PNG format, and may be empty if
-    # pixel tests are not being run, or the test does not dump pixels (e.g. text tests).
-    my $readResults = readFromDumpToolWithTimer(IN, ERROR);
-
-    my $actual = $readResults-&gt;{output};
-    my $error = $readResults-&gt;{error};
-
-    $expectedExtension = $readResults-&gt;{extension};
-    my $expectedFileName = &quot;$base-$expectedTag.$expectedExtension&quot;;
-
-    my $isText = isTextOnlyTest($actual);
-
-    my $expectedDir = expectedDirectoryForTest($base, $isText, $expectedExtension);
-    $expectedResultPaths{$base} = File::Spec-&gt;catfile($expectedDir, $expectedFileName);
-
-    unless ($readResults-&gt;{status} eq &quot;success&quot;) {
-        my $crashed = $readResults-&gt;{status} eq &quot;crashed&quot;;
-        my $webProcessCrashed = $readResults-&gt;{status} eq &quot;webProcessCrashed&quot;;
-        testCrashedOrTimedOut($test, $base, $crashed, $webProcessCrashed, $actual, $error);
-        countFinishedTest($test, $base, $webProcessCrashed ? &quot;webProcessCrash&quot; : $crashed ? &quot;crash&quot; : &quot;timedout&quot;, 0);
-        last if stopRunningTestsEarlyIfNeeded();
-        next;
-    }
-
-    $durations{$test} = time - $startTime if $report10Slowest;
-
-    my $expected;
-
-    if (!$resetResults &amp;&amp; open EXPECTED, &quot;&lt;&quot;, $expectedResultPaths{$base}) {
-        $expected = &quot;&quot;;
-        while (&lt;EXPECTED&gt;) {
-            next if $stripEditingCallbacks &amp;&amp; $_ =~ /^EDITING DELEGATE:/;
-            $expected .= $_;
-        }
-        close EXPECTED;
-    }
-
-    if ($ignoreMetrics &amp;&amp; !$isText &amp;&amp; defined $expected) {
-        ($actual, $expected) = stripMetrics($actual, $expected);
-    }
-
-    if ($shouldCheckLeaks &amp;&amp; $testsPerDumpTool == 1) {
-        print &quot;        $test -&gt; &quot;;
-    }
-
-    my $actualPNG = &quot;&quot;;
-    my $diffPNG = &quot;&quot;;
-    my $diffPercentage = 0;
-    my $diffResult = &quot;passed&quot;;
-
-    my $actualHash = &quot;&quot;;
-    my $expectedHash = &quot;&quot;;
-    my $actualPNGSize = 0;
-
-    while (&lt;IN&gt;) {
-        last if /#EOF/;
-        if (/ActualHash: ([a-f0-9]{32})/) {
-            $actualHash = $1;
-        } elsif (/ExpectedHash: ([a-f0-9]{32})/) {
-            $expectedHash = $1;
-        } elsif (/Content-Length: (\d+)\s*/) {
-            $actualPNGSize = $1;
-            read(IN, $actualPNG, $actualPNGSize);
-        }
-    }
-
-    if ($verbose &amp;&amp; $pixelTests &amp;&amp; !$resetResults &amp;&amp; $actualPNGSize) {
-        if ($actualHash eq &quot;&quot; &amp;&amp; $expectedHash eq &quot;&quot;) {
-            printFailureMessageForTest($test, &quot;WARNING: actual &amp; expected pixel hashes are missing!&quot;);
-        } elsif ($actualHash eq &quot;&quot;) {
-            printFailureMessageForTest($test, &quot;WARNING: actual pixel hash is missing!&quot;);
-        } elsif ($expectedHash eq &quot;&quot;) {
-            printFailureMessageForTest($test, &quot;WARNING: expected pixel hash is missing!&quot;);
-        }
-    }
-
-    if ($actualPNGSize &gt; 0) {
-        my $expectedPixelDir = expectedDirectoryForTest($base, 0, &quot;png&quot;);
-        my $expectedPNGPath = File::Spec-&gt;catfile($expectedPixelDir, &quot;$base-$expectedTag.png&quot;);
-
-        if (!$resetResults &amp;&amp; ($expectedHash ne $actualHash || ($actualHash eq &quot;&quot; &amp;&amp; $expectedHash eq &quot;&quot;))) {
-            if (-f $expectedPNGPath) {
-                my $expectedPNGSize = -s $expectedPNGPath;
-                my $expectedPNG = &quot;&quot;;
-                open EXPECTEDPNG, $expectedPNGPath;
-                read(EXPECTEDPNG, $expectedPNG, $expectedPNGSize);
-
-                openDiffTool();
-                print DIFFOUT &quot;Content-Length: $actualPNGSize\n&quot;;
-                print DIFFOUT $actualPNG;
-
-                print DIFFOUT &quot;Content-Length: $expectedPNGSize\n&quot;;
-                print DIFFOUT $expectedPNG;
-
-                while (&lt;DIFFIN&gt;) {
-                    last if /^error/ || /^diff:/;
-                    if (/Content-Length: (\d+)\s*/) {
-                        read(DIFFIN, $diffPNG, $1);
-                    }
-                }
-
-                if (/^diff: (.+)% (passed|failed)/) {
-                    $diffPercentage = $1 + 0;
-                    $imageDifferences{$base} = $diffPercentage;
-                    $diffResult = $2;
-                }
-                
-                if (!$diffPercentage) {
-                    printFailureMessageForTest($test, &quot;pixel hash failed (but pixel test still passes)&quot;);
-                }
-            } elsif ($verbose) {
-                printFailureMessageForTest($test, &quot;WARNING: expected image is missing!&quot;);
-            }
-        }
-
-        if ($resetResults || !-f $expectedPNGPath) {
-            if (!$addPlatformExceptions) {
-                mkpath catfile($expectedPixelDir, dirname($base)) if $testDirectory ne $expectedPixelDir;
-                writeToFile($expectedPNGPath, $actualPNG);
-            } else {
-                mkpath catfile($platformTestDirectory, dirname($base));
-                writeToFile(&quot;$platformTestDirectory/$base-$expectedTag.png&quot;, $actualPNG);
-            }
-        }
-    }
-
-    if (dumpToolDidCrash()) {
-        $result = &quot;crash&quot;;
-        testCrashedOrTimedOut($test, $base, 1, 0, $actual, $error);
-    } elsif (!defined $expected) {
-        if ($verbose) {
-            print &quot;new &quot; . ($resetResults ? &quot;result&quot; : &quot;test&quot;);
-        }
-        $result = &quot;new&quot;;
-
-        if ($generateNewResults || $resetResults) {
-            if (!$addPlatformExceptions) {
-                mkpath catfile($expectedDir, dirname($base)) if $testDirectory ne $expectedDir;
-                writeToFile(&quot;$expectedDir/$expectedFileName&quot;, $actual);
-            } else {
-                mkpath catfile($platformTestDirectory, dirname($base));
-                writeToFile(&quot;$platformTestDirectory/$expectedFileName&quot;, $actual);
-            }
-        }
-        deleteExpectedAndActualResults($base);
-        recordActualResultsAndDiff($base, $actual);
-        if (!$resetResults) {
-            # Always print the file name for new tests, as they will probably need some manual inspection.
-            # in verbose mode we already printed the test case, so no need to do it again.
-            unless ($verbose) {
-                print &quot;\n&quot; unless $atLineStart;
-                print &quot;$test -&gt; &quot;;
-            }
-            my $resultsDir = catdir($expectedDir, dirname($base));
-            if (!$verbose) {
-                print &quot;new&quot;;
-            }
-            if ($generateNewResults) {
-                print &quot; (results generated in $resultsDir)&quot;;
-            }
-            print &quot;\n&quot; unless $atLineStart;
-            $atLineStart = 1;
-        }
-    } elsif ($actual eq $expected &amp;&amp; $diffResult eq &quot;passed&quot;) {
-        if ($verbose) {
-            print &quot;succeeded\n&quot;;
-            $atLineStart = 1;
-        }
-        $result = &quot;match&quot;;
-        deleteExpectedAndActualResults($base);
-    } else {
-        $result = &quot;mismatch&quot;;
-
-        my $pixelTestFailed = $pixelTests &amp;&amp; $diffPNG &amp;&amp; $diffPNG ne &quot;&quot;;
-        my $testFailed = $actual ne $expected;
-
-        my $message = !$testFailed ? &quot;pixel test failed&quot; : &quot;failed&quot;;
-
-        if (($testFailed || $pixelTestFailed) &amp;&amp; $addPlatformExceptions) {
-            my $testBase = catfile($testDirectory, $base);
-            my $expectedBase = catfile($expectedDir, $base);
-            my $testIsMaximallyPlatformSpecific = $testBase =~ m|^\Q$platformTestDirectory\E/|;
-            my $expectedResultIsMaximallyPlatformSpecific = $expectedBase =~ m|^\Q$platformTestDirectory\E/|;
-            if (!$testIsMaximallyPlatformSpecific &amp;&amp; !$expectedResultIsMaximallyPlatformSpecific) {
-                mkpath catfile($platformTestDirectory, dirname($base));
-                if ($testFailed) {
-                    my $expectedFile = catfile($platformTestDirectory, &quot;$expectedFileName&quot;);
-                    writeToFile(&quot;$expectedFile&quot;, $actual);
-                }
-                if ($pixelTestFailed) {
-                    my $expectedFile = catfile($platformTestDirectory, &quot;$base-$expectedTag.png&quot;);
-                    writeToFile(&quot;$expectedFile&quot;, $actualPNG);
-                }
-                $message .= &quot; (results generated in $platformTestDirectory)&quot;;
-            }
-        }
-
-        printFailureMessageForTest($test, $message);
-
-        my $dir = &quot;$testResultsDirectory/$base&quot;;
-        $dir =~ s|/([^/]+)$|| or die &quot;Failed to find test name from base\n&quot;;
-        my $testName = $1;
-        mkpath $dir;
-
-        deleteExpectedAndActualResults($base);
-        recordActualResultsAndDiff($base, $actual);
-
-        if ($pixelTestFailed) {
-            $imagesPresent{$base} = 1;
-
-            writeToFile(&quot;$testResultsDirectory/$base-$actualTag.png&quot;, $actualPNG);
-            writeToFile(&quot;$testResultsDirectory/$base-$diffsTag.png&quot;, $diffPNG);
-
-            my $expectedPixelDir = expectedDirectoryForTest($base, 0, &quot;png&quot;);
-            copy(&quot;$expectedPixelDir/$base-$expectedTag.png&quot;, &quot;$testResultsDirectory/$base-$expectedTag.png&quot;);
-
-            open DIFFHTML, &quot;&gt;$testResultsDirectory/$base-$diffsTag.html&quot; or die;
-            print DIFFHTML &quot;&lt;html&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;head&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;title&gt;$base Image Compare&lt;/title&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;script language=\&quot;Javascript\&quot; type=\&quot;text/javascript\&quot;&gt;\n&quot;;
-            print DIFFHTML &quot;var currentImage = 0;\n&quot;;
-            print DIFFHTML &quot;var imageNames = new Array(\&quot;Actual\&quot;, \&quot;Expected\&quot;);\n&quot;;
-            print DIFFHTML &quot;var imagePaths = new Array(\&quot;$testName-$actualTag.png\&quot;, \&quot;$testName-$expectedTag.png\&quot;);\n&quot;;
-            if (-f &quot;$testDirectory/$base-w3c.png&quot;) {
-                copy(&quot;$testDirectory/$base-w3c.png&quot;, &quot;$testResultsDirectory/$base-w3c.png&quot;);
-                print DIFFHTML &quot;imageNames.push(\&quot;W3C\&quot;);\n&quot;;
-                print DIFFHTML &quot;imagePaths.push(\&quot;$testName-w3c.png\&quot;);\n&quot;;
-            }
-            print DIFFHTML &quot;function animateImage() {\n&quot;;
-            print DIFFHTML &quot;    var image = document.getElementById(\&quot;animatedImage\&quot;);\n&quot;;
-            print DIFFHTML &quot;    var imageText = document.getElementById(\&quot;imageText\&quot;);\n&quot;;
-            print DIFFHTML &quot;    image.src = imagePaths[currentImage];\n&quot;;
-            print DIFFHTML &quot;    imageText.innerHTML = imageNames[currentImage] + \&quot; Image\&quot;;\n&quot;;
-            print DIFFHTML &quot;    currentImage = (currentImage + 1) % imageNames.length;\n&quot;;
-            print DIFFHTML &quot;    setTimeout('animateImage()',2000);\n&quot;;
-            print DIFFHTML &quot;}\n&quot;;
-            print DIFFHTML &quot;&lt;/script&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;/head&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;body onLoad=\&quot;animateImage();\&quot;&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;table&gt;\n&quot;;
-            if ($diffPercentage) {
-                print DIFFHTML &quot;&lt;tr&gt;\n&quot;;
-                print DIFFHTML &quot;&lt;td&gt;Difference between images: &lt;a href=\&quot;$testName-$diffsTag.png\&quot;&gt;$diffPercentage%&lt;/a&gt;&lt;/td&gt;\n&quot;;
-                print DIFFHTML &quot;&lt;/tr&gt;\n&quot;;
-            }
-            print DIFFHTML &quot;&lt;tr&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;td&gt;&lt;a href=\&quot;&quot; . toURL(&quot;$testDirectory/$test&quot;) . &quot;\&quot;&gt;test file&lt;/a&gt;&lt;/td&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;/tr&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;tr&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;td id=\&quot;imageText\&quot; style=\&quot;text-weight: bold;\&quot;&gt;Actual Image&lt;/td&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;/tr&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;tr&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;td&gt;&lt;img src=\&quot;$testName-$actualTag.png\&quot; id=\&quot;animatedImage\&quot;&gt;&lt;/td&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;/tr&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;/table&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;/body&gt;\n&quot;;
-            print DIFFHTML &quot;&lt;/html&gt;\n&quot;;
-        }
-    }
-
-    if ($error) {
-        my $dir = dirname(File::Spec-&gt;catdir($testResultsDirectory, $base));
-        mkpath $dir;
-        
-        writeToFile(File::Spec-&gt;catfile($testResultsDirectory, &quot;$base-$errorTag.txt&quot;), $error);
-        
-        $counts{error}++;
-        push @{$tests{error}}, $test;
-    }
-
-    countFinishedTest($test, $base, $result, $isText);
-    last if stopRunningTestsEarlyIfNeeded();
-}
-
-close($tests_run_fh);
-
-my $totalTestingTime = time - $overallStartTime;
-my $waitTime = getWaitTime();
-if ($waitTime &gt; 0.1) {
-    my $normalizedTestingTime = $totalTestingTime - $waitTime;
-    printf &quot;\n%0.2fs HTTPD waiting time\n&quot;, $waitTime . &quot;&quot;;
-    printf &quot;%0.2fs normalized testing time&quot;, $normalizedTestingTime . &quot;&quot;;
-}
-printf &quot;\n%0.2fs total testing time\n&quot;, $totalTestingTime . &quot;&quot;;
-
-!$isDumpToolOpen || die &quot;Failed to close $dumpToolName.\n&quot;;
-
-quitIOSSimulator() if isIOSWebKit();
-
-$isHttpdOpen = !closeHTTPD();
-closeWebSocketServer();
-
-# Because multiple instances of this script are running concurrently we cannot 
-# safely delete this symlink.
-# system &quot;rm /tmp/LayoutTests&quot;;
-
-# FIXME: Do we really want to check the image-comparison tool for leaks every time?
-if ($isDiffToolOpen &amp;&amp; $shouldCheckLeaks) {
-    $totalLeaks += countAndPrintLeaks(&quot;ImageDiff&quot;, $imageDiffToolPID, &quot;$testResultsDirectory/ImageDiff-leaks.txt&quot;);
-}
-
-if ($totalLeaks) {
-    if ($mergeDepth) {
-        parseLeaksandPrintUniqueLeaks();
-    } else { 
-        print &quot;\nWARNING: $totalLeaks total leaks found!\n&quot;;
-        print &quot;See above for individual leaks results.\n&quot; if ($leaksOutputFileNumber &gt; 2);
-    }
-}
-
-close IN;
-close OUT;
-close ERROR;
-
-if ($report10Slowest) {
-    print &quot;\n\nThe 10 slowest tests:\n\n&quot;;
-    my $count = 0;
-    for my $test (sort slowestcmp keys %durations) {
-        printf &quot;%0.2f secs: %s\n&quot;, $durations{$test}, $test;
-        last if ++$count == 10;
-    }
-}
-
-print &quot;\n&quot;;
-
-if ($skippedOnly &amp;&amp; $counts{&quot;match&quot;}) {
-    print &quot;The following tests are in the Skipped file (&quot; . File::Spec-&gt;abs2rel(&quot;$platformTestDirectory/Skipped&quot;, $testDirectory) . &quot;), but succeeded:\n&quot;;
-    foreach my $test (@{$tests{&quot;match&quot;}}) {
-        print &quot;  $test\n&quot;;
-    }
-}
-
-if ($resetResults || ($counts{match} &amp;&amp; $counts{match} == $count)) {
-    print &quot;all $count test cases succeeded\n&quot;;
-    unlink $testResults;
-    exit;
-}
-
-printResults();
-
-mkpath $testResultsDirectory;
-
-open HTML, &quot;&gt;&quot;, $testResults or die &quot;Failed to open $testResults. $!&quot;;
-print HTML &lt;&lt;EOF;
-&lt;html&gt;
-&lt;head&gt;
-&lt;title&gt;Layout Test Results&lt;/title&gt;
-&lt;style&gt;
-.stopped-running-early-message {
-    border: 3px solid #d00;
-    font-weight: bold;
-}
-&lt;/style&gt;
-&lt;/head&gt;
-&lt;/body&gt;
-EOF
-
-if ($ignoreMetrics) {
-    print HTML &quot;&lt;h4&gt;Tested with metrics ignored.&lt;/h4&gt;&quot;;
-}
-
-if ($stoppedRunningEarlyMessage) {
-    print HTML &quot;&lt;p class='stopped-running-early-message'&gt;$stoppedRunningEarlyMessage&lt;/p&gt;&quot;;
-}
-
-print HTML htmlForResultsSection(@{$tests{mismatch}}, &quot;Tests where results did not match expected results&quot;, \&amp;linksForMismatchTest);
-print HTML htmlForResultsSection(@{$tests{timedout}}, &quot;Tests that timed out&quot;, \&amp;linksForErrorTest);
-print HTML htmlForResultsSection(@{$tests{crash}}, &quot;Tests that caused the DumpRenderTree tool to crash&quot;, \&amp;linksForErrorTest);
-print HTML htmlForResultsSection(@{$tests{webProcessCrash}}, &quot;Tests that caused the Web process to crash&quot;, \&amp;linksForErrorTest);
-print HTML htmlForResultsSection(@{$tests{error}}, &quot;Tests that had stderr output&quot;, \&amp;linksForErrorTest);
-print HTML htmlForResultsSection(@{$tests{new}}, &quot;Tests that had no expected results (probably new)&quot;, \&amp;linksForNewTest);
-
-print HTML &quot;&lt;p&gt;httpd access log: &lt;a href=\&quot;access_log.txt\&quot;&gt;access_log.txt&lt;/a&gt;&lt;/p&gt;\n&quot;;
-print HTML &quot;&lt;p&gt;httpd error log: &lt;a href=\&quot;error_log.txt\&quot;&gt;error_log.txt&lt;/a&gt;&lt;/p&gt;\n&quot;;
-
-print HTML &quot;&lt;/body&gt;\n&quot;;
-print HTML &quot;&lt;/html&gt;\n&quot;;
-close HTML;
-
-my @configurationArgs = argumentsForConfiguration();
-
-if (isGtk()) {
-  push(@configurationArgs, '-2') if $useWebKitTestRunner;
-  system &quot;Tools/Scripts/run-launcher&quot;, @configurationArgs, &quot;file://&quot;.$testResults if $launchSafari;
-} elsif (isCygwin()) {
-  system &quot;cygstart&quot;, $testResults if $launchSafari;
-} elsif (isWindows()) {
-  system &quot;start&quot;, $testResults if $launchSafari;
-} elsif (isIOSWebKit()) {
-  # Don't use run-safari, since it tries to load iOS frameworks in OS X Safari.
-  system &quot;open&quot;, &quot;-a&quot;, &quot;Safari&quot;, $testResults if $launchSafari;
-} else {
-  system &quot;Tools/Scripts/run-safari&quot;, @configurationArgs, &quot;-NSOpen&quot;, $testResults if $launchSafari;
-}
-
-closeCygpaths() if isCygwin();
-
-exit 1;
-
-sub countAndPrintLeaks($$$)
-{
-    my ($dumpToolName, $dumpToolPID, $leaksFilePath) = @_;
-
-    print &quot;\n&quot; unless $atLineStart;
-    $atLineStart = 1;
-
-    # We are excluding the following reported leaks so they don't get in our way when looking for WebKit leaks:
-    # This allows us ignore known leaks and only be alerted when new leaks occur. Some leaks are in the old
-    # versions of the system frameworks that are being used by the leaks bots. Even though a leak has been
-    # fixed, it will be listed here until the bot has been updated with the newer frameworks.
-
-    my @typesToExclude = (
-    );
-
-    my @callStacksToExclude = (
-        &quot;Flash_EnforceLocalSecurity&quot;, # leaks in Flash plug-in code, rdar://problem/4449747
-        &quot;ScanFromString&quot;, # &lt;http://code.google.com/p/angleproject/issues/detail?id=249&gt; leak in ANGLE
-    );
-
-    if (isSnowLeopard()) {
-        push @callStacksToExclude, (
-            &quot;readMakerNoteProps&quot;, # &lt;rdar://problem/7156432&gt; leak in ImageIO
-            &quot;QTKitMovieControllerView completeUISetup&quot;, # &lt;rdar://problem/7155156&gt; leak in QTKit
-            &quot;getVMInitArgs&quot;, # &lt;rdar://problem/7714444&gt; leak in Java
-            &quot;Java_java_lang_System_initProperties&quot;, # &lt;rdar://problem/7714465&gt; leak in Java
-            &quot;glrCompExecuteKernel&quot;, # &lt;rdar://problem/7815391&gt; leak in graphics driver while using OpenGL
-            &quot;NSNumberFormatter getObjectValue:forString:errorDescription:&quot;, # &lt;rdar://problem/7149350&gt; Leak in NSNumberFormatter
-        );
-    }
-
-    if (isLion()) {
-        push @callStacksToExclude, (
-            &quot;FigByteFlumeCustomURLCreateWithURL&quot;, # &lt;rdar://problem/10461926&gt; leak in CoreMedia
-            &quot;PDFPage\\(PDFPageInternal\\) pageLayoutIfAvail&quot;, # &lt;rdar://problem/10462055&gt; leak in PDFKit
-            &quot;SecTransformExecute&quot;, # &lt;rdar://problem/10470667&gt; leak in Security.framework
-            &quot;_NSCopyStyleRefForFocusRingStyleClip&quot;, # &lt;rdar://problem/10462031&gt; leak in AppKit
-        );
-    }
-
-    my $leaksTool = sourceDir() . &quot;/Tools/Scripts/run-leaks&quot;;
-    my $excludeString = &quot;--exclude-callstack '&quot; . (join &quot;' --exclude-callstack '&quot;, @callStacksToExclude) . &quot;'&quot;;
-    $excludeString .= &quot; --exclude-type '&quot; . (join &quot;' --exclude-type '&quot;, @typesToExclude) . &quot;'&quot; if @typesToExclude;
-
-    print &quot; ? checking for leaks in $dumpToolName\n&quot;;
-    my $leaksOutput = `$leaksTool $excludeString $dumpToolPID`;
-    my ($count, $bytes) = $leaksOutput =~ /Process $dumpToolPID: (\d+) leaks? for (\d+) total/;
-    my ($excluded) = $leaksOutput =~ /(\d+) leaks? excluded/;
-
-    my $adjustedCount = $count;
-    $adjustedCount -= $excluded if $excluded;
-
-    if (!$adjustedCount) {
-        print &quot; - no leaks found\n&quot;;
-        unlink $leaksFilePath;
-        return 0;
-    } else {
-        my $dir = $leaksFilePath;
-        $dir =~ s|/[^/]+$|| or die;
-        mkpath $dir;
-
-        if ($excluded) {
-            print &quot; + $adjustedCount leaks ($bytes bytes including $excluded excluded leaks) were found, details in $leaksFilePath\n&quot;;
-        } else {
-            print &quot; + $count leaks ($bytes bytes) were found, details in $leaksFilePath\n&quot;;
-        }
-
-        writeToFile($leaksFilePath, $leaksOutput);
-        
-        push @leaksFilenames, $leaksFilePath;
-    }
-
-    return $adjustedCount;
-}
-
-sub writeToFile($$)
-{
-    my ($filePath, $contents) = @_;
-    open NEWFILE, &quot;&gt;&quot;, &quot;$filePath&quot; or die &quot;Could not create $filePath. $!\n&quot;;
-    print NEWFILE $contents;
-    close NEWFILE;
-}
-
-sub installAndLaunchDumpToolAppUsingNotification($$)
-{
-    my ($args, $cleanEnv) = @_;
-    my $productDir = productDir();
-    my $appBundle;
-    if ($useWebKitTestRunner) {
-        $appBundle = &quot;$productDir/WebKitTestRunnerApp.app&quot;;
-    } else {
-        $appBundle = &quot;$productDir/DumpRenderTree.app&quot;;
-    }
-    my $simulatorOptions = {applicationArguments =&gt; $args, applicationEnvironment =&gt; $cleanEnv, sessionUUID =&gt; simulatorSessionUUID()};
-    my $pid = installAndLaunchIOSWebKitAppInSimulator($appBundle, findOrCreateSimulatorForIOSDevice(&quot;WebKit Tester&quot;), $simulatorOptions);
-    print appDisplayNameFromBundle($appBundle) . &quot; has launched.\n&quot;;
-    return $pid;
-}
-
-sub quitDumpToolUsingNotification()
-{
-    my $iPhoneSimulatorNotification = new IPhoneSimulatorNotification;
-    $iPhoneSimulatorNotification-&gt;startObservingApplicationQuitNotification();
-
-    my $dict = {
-        sessionUUID =&gt; NSString-&gt;stringWithCString_(simulatorSessionUUID()),
-    };
-    $iPhoneSimulatorNotification-&gt;postEndSessionNotification($dict);
-
-    # FIXME: &lt;rdar://problem/7443077&gt; DumpRenderTree should exit without having to use kill -9 from run-webkit-tests
-    kill 9, $dumpToolPID;
-
-    my $timeoutCounter = 0;
-    while (!$iPhoneSimulatorNotification-&gt;hasReceivedApplicationQuitNotification()) {
-        my $date = NSDate-&gt;alloc()-&gt;initWithTimeIntervalSinceNow_(0.1);
-        NSRunLoop-&gt;currentRunLoop-&gt;runUntilDate_($date);
-        $date-&gt;release();
-        if (++$timeoutCounter &gt;= 600) {
-            print STDERR &quot;ERROR: Hang waiting for application quit notification. Did $dumpToolName crash instead?\n&quot;;
-            last;
-        }
-    }
-
-    $iPhoneSimulatorNotification-&gt;stopObservingApplicationQuitNotification();
-}
-
-sub simulatorSessionUUID()
-{
-    return &quot;theAwesomeUniqueSessionIdentifierForDumpRenderTree&quot;;
-}
-
-# Break up a path into the directory (with slash) and base name.
-sub splitpath($)
-{
-    my ($path) = @_;
-
-    my $pathSeparator = &quot;/&quot;;
-    my $dirname = dirname($path) . $pathSeparator;
-    $dirname = &quot;&quot; if $dirname eq &quot;.&quot; . $pathSeparator;
-
-    return ($dirname, basename($path));
-}
-
-# Sort first by directory, then by file, so all paths in one directory are grouped
-# rather than being interspersed with items from subdirectories.
-# Use numericcmp to sort directory and filenames to make order logical.
-sub pathcmp($$)
-{
-    my ($patha, $pathb) = @_;
-
-    my ($dira, $namea) = splitpath($patha);
-    my ($dirb, $nameb) = splitpath($pathb);
-
-    return numericcmp($dira, $dirb) if $dira ne $dirb;
-    return numericcmp($namea, $nameb);
-}
-
-# Sort numeric parts of strings as numbers, other parts as strings.
-# Makes 1.33 come after 1.3, which is cool.
-sub numericcmp($$)
-{
-    my ($aa, $bb) = @_;
-
-    my @a = split /(\d+)/, $aa;
-    my @b = split /(\d+)/, $bb;
-
-    # Compare one chunk at a time.
-    # Each chunk is either all numeric digits, or all not numeric digits.
-    while (@a &amp;&amp; @b) {
-        my $a = shift @a;
-        my $b = shift @b;
-        
-        # Use numeric comparison if chunks are non-equal numbers.
-        return $a &lt;=&gt; $b if $a =~ /^\d/ &amp;&amp; $b =~ /^\d/ &amp;&amp; $a != $b;
-
-        # Use string comparison if chunks are any other kind of non-equal string.
-        return $a cmp $b if $a ne $b;
-    }
-    
-    # One of the two is now empty; compare lengths for result in this case.
-    return @a &lt;=&gt; @b;
-}
-
-# Sort slowest tests first.
-sub slowestcmp($$)
-{
-    my ($testa, $testb) = @_;
-
-    my $dura = $durations{$testa};
-    my $durb = $durations{$testb};
-    return $durb &lt;=&gt; $dura if $dura != $durb;
-    return pathcmp($testa, $testb);
-}
-
-sub launchWithEnv(\@\%)
-{
-    my ($args, $env) = @_;
-
-    # Dump the current environment as perl code and then put it in quotes so it is one parameter.
-    my $environmentDumper = Data::Dumper-&gt;new([\%{$env}], [qw(*ENV)]);
-    $environmentDumper-&gt;Indent(0);
-    $environmentDumper-&gt;Purity(1);
-    my $allEnvVars = $environmentDumper-&gt;Dump();
-    unshift @{$args}, &quot;\&quot;$allEnvVars\&quot;&quot;;
-
-    my $execScript = File::Spec-&gt;catfile(sourceDir(), qw(Tools Scripts execAppWithEnv));
-    unshift @{$args}, $perlInterpreter, $execScript;
-    return @{$args};
-}
-
-sub resolveAndMakeTestResultsDirectory()
-{
-    my $absTestResultsDirectory = File::Spec-&gt;rel2abs(glob $testResultsDirectory);
-    mkpath $absTestResultsDirectory;
-    return $absTestResultsDirectory;
-}
-
-sub openDiffTool()
-{
-    return if $isDiffToolOpen;
-    return if !$pixelTests;
-
-    my %CLEAN_ENV;
-    my @command = ($imageDiffTool);;
-    unshift(@command, 'xcrun', '-sdk', xcodeSDK(), 'sim') if willUseIOSSimulatorSDKWhenBuilding();
-    $CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
-    $imageDiffToolPID = open2(\*DIFFIN, \*DIFFOUT, @command, launchWithEnv(@diffToolArgs, %CLEAN_ENV)) or die &quot;unable to open $imageDiffTool\n&quot;;
-    $isDiffToolOpen = 1;
-}
-
-sub unlinkFIFOs()
-{
-    my $identifier = iOSDumpToolAppIdentifier();
-    unlink glob &quot;/tmp/${identifier}_*&quot;;
-}
-
-sub buildDumpTool($)
-{
-    my ($dumpToolName) = @_;
-
-    my $dumpToolBuildScript =  &quot;build-&quot; . lc($dumpToolName);
-    print STDERR &quot;Running $dumpToolBuildScript\n&quot;;
-
-    local *DEVNULL;
-    my ($childIn, $childOut, $childErr);
-    if ($quiet) {
-        open(DEVNULL, &quot;&gt;&quot;, File::Spec-&gt;devnull()) or die &quot;Failed to open /dev/null&quot;;
-        $childOut = &quot;&gt;&amp;DEVNULL&quot;;
-        $childErr = &quot;&gt;&amp;DEVNULL&quot;;
-    } else {
-        # When not quiet, let the child use our stdout/stderr.
-        $childOut = &quot;&gt;&amp;STDOUT&quot;;
-        $childErr = &quot;&gt;&amp;STDERR&quot;;
-    }
-
-    my @args = ('--sdk', xcodeSDK(), argumentsForConfiguration());
-    push @args, ('-target', 'WebKitTestRunnerApp') if $useWebKitTestRunner and $dumpToolName eq 'WebKitTestRunner';
-
-    my $buildProcess = open3($childIn, $childOut, $childErr, $perlInterpreter, File::Spec-&gt;catfile(qw(Tools Scripts), $dumpToolBuildScript), @args) or die &quot;Failed to run build-$dumpToolName&quot;;
-    close($childIn);
-    waitpid $buildProcess, 0;
-    my $buildResult = $?;
-    close($childOut);
-    close($childErr);
-
-    close DEVNULL if ($quiet);
-
-    if ($buildResult) {
-        print STDERR &quot;Compiling $dumpToolName failed!\n&quot;;
-        exit exitStatus($buildResult);
-    }
-}
-
-sub iOSDumpToolAppIdentifier()
-{
-    return $useWebKitTestRunner ? &quot;org.webkit.WebKitTestRunnerApp&quot; : &quot;org.webkit.DumpRenderTree&quot;;
-}
-
-sub openDumpTool()
-{
-    return if $isDumpToolOpen;
-
-    if ($verbose &amp;&amp; $testsPerDumpTool != 1) {
-        print &quot;| Opening DumpTool |\n&quot;;
-    }
-
-    my %CLEAN_ENV;
-
-    # Generic environment variables
-    if (defined $ENV{'WEBKIT_TESTFONTS'}) {
-        $CLEAN_ENV{WEBKIT_TESTFONTS} = $ENV{'WEBKIT_TESTFONTS'};
-    }
-
-    # unique temporary directory for each DumpRendertree - needed for running more DumpRenderTree in parallel
-    $CLEAN_ENV{DUMPRENDERTREE_TEMP} = File::Temp::tempdir('DumpRenderTree-XXXXXX', TMPDIR =&gt; 1, CLEANUP =&gt; 1);
-    $CLEAN_ENV{XML_CATALOG_FILES} = &quot;&quot;; # work around missing /etc/catalog &lt;rdar://problem/4292995&gt;
-    $CLEAN_ENV{LOCAL_RESOURCE_ROOT} = $testDirectory; # Used by layoutTestConstroller.pathToLocalResource()
-
-    # Platform spesifics
-    if (isLinux()) {
-        if (defined $ENV{'DISPLAY'}) {
-            $CLEAN_ENV{DISPLAY} = $ENV{'DISPLAY'};
-        } else {
-            $CLEAN_ENV{DISPLAY} = &quot;:1&quot;;
-        }
-        if (defined $ENV{'XAUTHORITY'}) {
-            $CLEAN_ENV{XAUTHORITY} = $ENV{'XAUTHORITY'};
-        }
-
-        $CLEAN_ENV{HOME} = $ENV{'HOME'};
-        $CLEAN_ENV{LANG} = $ENV{'LANG'};
-
-        if (defined $ENV{'LD_LIBRARY_PATH'}) {
-            $CLEAN_ENV{LD_LIBRARY_PATH} = $ENV{'LD_LIBRARY_PATH'};
-        }
-        if (defined $ENV{'DBUS_SESSION_BUS_ADDRESS'}) {
-            $CLEAN_ENV{DBUS_SESSION_BUS_ADDRESS} = $ENV{'DBUS_SESSION_BUS_ADDRESS'};
-        }
-    } elsif (isDarwin()) {
-        if (defined $ENV{'DYLD_LIBRARY_PATH'}) {
-            $CLEAN_ENV{DYLD_LIBRARY_PATH} = $ENV{'DYLD_LIBRARY_PATH'};
-        }
-        if (defined $ENV{'HOME'}) {
-            $CLEAN_ENV{HOME} = $ENV{'HOME'};
-        }
-
-        $CLEAN_ENV{DYLD_FRAMEWORK_PATH} = $productDir;
-        $CLEAN_ENV{DYLD_LIBRARY_PATH} = $productDir;
-        $CLEAN_ENV{DYLD_INSERT_LIBRARIES} = &quot;/usr/lib/libgmalloc.dylib&quot; if $guardMalloc;
-    } elsif (isCygwin()) {
-        $CLEAN_ENV{HOMEDRIVE} = $ENV{'HOMEDRIVE'};
-        $CLEAN_ENV{HOMEPATH} = $ENV{'HOMEPATH'};
-        $CLEAN_ENV{_NT_SYMBOL_PATH} = $ENV{_NT_SYMBOL_PATH};
-    }
-
-    # Port specifics
-    if (isGtk()) {
-        $CLEAN_ENV{LIBOVERLAY_SCROLLBAR} = &quot;0&quot;;
-        $CLEAN_ENV{GTK_MODULES} = &quot;gail&quot;;
-
-        if ($useWebKitTestRunner) {
-            my $injectedBundlePath = productDir() . &quot;/Libraries/.libs/libTestRunnerInjectedBundle&quot;;
-            $CLEAN_ENV{TEST_RUNNER_INJECTED_BUNDLE_FILENAME} = $injectedBundlePath;
-            my $testPluginPath = productDir() . &quot;/TestNetscapePlugin/.libs&quot;;
-            $CLEAN_ENV{TEST_RUNNER_TEST_PLUGIN_PATH} = $testPluginPath;
-        }
-    }
-
-    my @args = ($dumpTool, @toolArgs);
-    if (isAppleMacWebKit() and !isIOSWebKit()) {
-        unshift @args, &quot;arch&quot;, &quot;-&quot; . architecture();
-    }
-
-    if ($useWebKitTestRunner) {
-        # Make WebKitTestRunner use a similar timeout. We don't use the exact same timeout to avoid
-        # race conditions.
-        push @args, &quot;--timeout&quot;, $timeoutSeconds - 5;
-    }
-
-    $CLEAN_ENV{MallocStackLogging} = 1 if $shouldCheckLeaks;
-
-    if (isIOSWebKit()) {
-        unlinkFIFOs();
-
-        my $appIdentifier = iOSDumpToolAppIdentifier();
-
-        my $fifoOut = &quot;/tmp/${appIdentifier}_OUT&quot;;
-        my $fifoIn = &quot;/tmp/${appIdentifier}_IN&quot;;
-        my $fifoError = &quot;/tmp/${appIdentifier}_ERROR&quot;;
-
-        foreach my $fifo ($fifoOut, $fifoIn, $fifoError) {
-            if (! -e $fifo) {
-                system('mkfifo', $fifo) == 0 or die &quot;Couldn't mkfifo $fifo&quot;;
-            }
-        }
-
-        open(\*OUT, &quot;+&gt; $fifoIn&quot;) or die &quot;Couldn't open $fifoIn!&quot;;
-        open(\*IN, &quot;+&lt; $fifoOut&quot;) or die &quot;Couldn't open $fifoOut!&quot;;
-        open(\*ERROR, &quot;+&lt; $fifoError&quot;) or die &quot;Couldn't open $fifoError!&quot;;
-        OUT-&gt;autoflush(1);
-
-        shift @args; # remove the actual binary name
-
-        if ($haveInstallediOSDumpToolAppOnce) {
-            my $simPath = `xcrun -sdk iphonesimulator -find sim`;
-            chomp $simPath;
-
-            my @env = map {
-                my $key = $_;
-                my $val = $CLEAN_ENV{$key};
-                (&quot;-env&quot;, &quot;$key=$val&quot;);
-            } keys %CLEAN_ENV;
-
-            my $archFlag = architecture() eq 'i386' ? '--arch=32' : '--arch=64';
-
-            local(*LAUNCHIN, *LAUNCHOUT);
-            open2(\*LAUNCHIN, \*LAUNCHOUT, $simPath, $archFlag, &quot;LaunchApp&quot;, @env, $appIdentifier, @args) || die &quot;$!&quot;;
-            my $stdout = &lt;LAUNCHIN&gt;;
-            if ($stdout =~ /Launched $appIdentifier with process ID ([0-9]+)/) {
-                $dumpToolPID = $1;
-            } else {
-                die &quot;Could not launch $appIdentifier: $!&quot;;
-            }
-            close(LAUNCHOUT) || die &quot;$!&quot;;
-            close(LAUNCHIN) || die &quot;$!&quot;;
-        } else {
-            $dumpToolPID = installAndLaunchDumpToolAppUsingNotification(\@args, \%CLEAN_ENV);
-            $haveInstallediOSDumpToolAppOnce = 1;
-        }
-    } else {
-        $dumpToolPID = open3(\*OUT, \*IN, \*ERROR, launchWithEnv(@args, %CLEAN_ENV)) or die &quot;Failed to start tool: $dumpTool\n&quot;;
-    }
-    $isDumpToolOpen = 1;
-    $dumpToolCrashed = 0;
-}
-
-sub closeDumpTool()
-{
-    return if !$isDumpToolOpen;
-
-    if ($verbose &amp;&amp; $testsPerDumpTool != 1) {
-        print &quot;| Closing DumpTool |\n&quot;;
-    }
-
-    close IN;
-    close OUT;
-    if (isIOSWebKit() &amp;&amp; !dumpToolDidCrash()) {
-        if ($haveInstallediOSDumpToolAppOnce) {
-            kill 9, $dumpToolPID;
-        } else {
-            quitDumpToolUsingNotification();
-        }
-
-        unlinkFIFOs();
-    }
-    waitpid $dumpToolPID, 0;

-    # check for WebCore counter leaks.
-    if ($shouldCheckLeaks) {
-        while (&lt;ERROR&gt;) {
-            print;
-        }
-    }
-    close ERROR;
-    $isDumpToolOpen = 0;
-}
-
-sub dumpToolDidCrash()
-{
-    return 1 if $dumpToolCrashed;
-    return 0 unless $isDumpToolOpen;
-    if (isIOSWebKit()) {
-        my $count = kill 0, $dumpToolPID;
-        return 1 if !$count;
-    } else {
-        my $pid = waitpid(-1, WNOHANG);
-        return 1 if ($pid == $dumpToolPID);
-    }
-
-    # On Mac OS X, crashing may be significantly delayed by crash reporter.
-    return 0 unless isAppleMacWebKit() or isIOSWebKit();
-
-    return DumpRenderTreeSupport::processIsCrashing($dumpToolPID);
-}
-
-sub configureAndOpenHTTPDIfNeeded()
-{
-    return if $isHttpdOpen;
-    my $absTestResultsDirectory = resolveAndMakeTestResultsDirectory();
-    my @args = (
-        &quot;-c&quot;, &quot;CustomLog \&quot;$absTestResultsDirectory/access_log.txt\&quot; common&quot;,
-        &quot;-c&quot;, &quot;ErrorLog \&quot;$absTestResultsDirectory/error_log.txt\&quot;&quot;,
-    );
-    foreach ($httpdPort, $httpdAuxiliaryPort, $httpdSSLPort) {
-        # We listen to both IPv4 and IPv6 loop-back addresses, but
-        # ignore requests to 8000 from random users on network.
-        # See &lt;https://bugs.webkit.org/show_bug.cgi?id=37104&gt;.
-        push @args, (&quot;-C&quot;, &quot;Listen 127.0.0.1:$_&quot;);
-        push @args, (&quot;-C&quot;, &quot;Listen [::1]:$_&quot;);
-    }
-
-    my @defaultArgs = getDefaultConfigForTestDirectory($testDirectory);
-    @args = (@defaultArgs, @args);
-
-    waitForHTTPDLock() if $shouldWaitForHTTPD;
-    $isHttpdOpen = openHTTPD(@args);
-}
-
-sub checkPythonVersion()
-{
-    # we have not chdir to sourceDir yet.
-    system $perlInterpreter, File::Spec-&gt;catfile(sourceDir(), qw(Tools Scripts ensure-valid-python)), &quot;--check-only&quot;;
-    return exitStatus($?) == 0;
-}
-
-sub openWebSocketServerIfNeeded()
-{
-    return 1 if $isWebSocketServerOpen;
-    return 0 if $failedToStartWebSocketServer;
-
-    my $webSocketHandlerDir = &quot;$testDirectory&quot;;
-    my $absTestResultsDirectory = resolveAndMakeTestResultsDirectory();
-    $webSocketServerPidFile = &quot;$absTestResultsDirectory/websocket.pid&quot;;
-
-    my @args = (
-        &quot;Tools/Scripts/new-run-webkit-websocketserver&quot;,
-        &quot;--server&quot;, &quot;start&quot;,
-        &quot;--port&quot;, &quot;$webSocketPort&quot;,
-        &quot;--root&quot;, &quot;$webSocketHandlerDir&quot;,
-        &quot;--output-dir&quot;, &quot;$absTestResultsDirectory&quot;,
-        &quot;--pidfile&quot;, &quot;$webSocketServerPidFile&quot;
-    );
-    system &quot;/usr/bin/python&quot;, @args;
-
-    $isWebSocketServerOpen = 1;
-    return 1;
-}
-
-sub closeWebSocketServer()
-{
-    return if !$isWebSocketServerOpen;
-
-    my @args = (
-        &quot;Tools/Scripts/new-run-webkit-websocketserver&quot;,
-        &quot;--server&quot;, &quot;stop&quot;,
-        &quot;--pidfile&quot;, &quot;$webSocketServerPidFile&quot;
-    );
-    system &quot;/usr/bin/python&quot;, @args;
-    unlink &quot;$webSocketServerPidFile&quot;;
-
-    # wss is disabled until all platforms support pyOpenSSL.
-    $isWebSocketServerOpen = 0;
-}
-
-sub fileNameWithNumber($$)
-{
-    my ($base, $number) = @_;
-    return &quot;$base$number&quot; if ($number &gt; 1);
-    return $base;
-}
-
-sub processIgnoreTests($$)
-{
-    my @ignoreList = split(/\s*,\s*/, shift);
-    my $listName = shift;
-
-    my $disabledSuffix = &quot;-disabled&quot;;
-
-    my $addIgnoredDirectories = sub {
-        return () if exists $ignoredLocalDirectories{basename($File::Find::dir)};
-        $ignoredDirectories{File::Spec-&gt;abs2rel($File::Find::dir, $testDirectory)} = 1;
-        return @_;
-    };
-    foreach my $item (@ignoreList) {
-        my $path = catfile($testDirectory, $item); 
-        if (-d $path) {
-            $ignoredDirectories{$item} = 1;
-            find({ preprocess =&gt; $addIgnoredDirectories, wanted =&gt; sub {} }, $path);
-        }
-        elsif (-f $path) {
-            $ignoredFiles{$item} = 1;
-        } elsif (-f $path . $disabledSuffix) {
-            # The test is disabled, so do nothing.
-        } else {
-            print &quot;$listName list contained '$item', but no file of that name could be found\n&quot;;
-        }
-    }
-}
-
-sub stripExtension($)
-{
-    my ($test) = @_;
-
-    $test =~ s/\.[a-zA-Z]+$//;
-    return $test;
-}
-
-sub isTextOnlyTest($)
-{
-    my ($actual) = @_;
-    my $isText;
-    if ($actual =~ /^layer at/ms) {
-        $isText = 0;
-    } else {
-        $isText = 1;
-    }
-    return $isText;
-}
-
-sub expectedDirectoryForTest($;$;$)
-{
-    my ($base, $isText, $expectedExtension) = @_;
-
-    my @directories = @platformResultHierarchy;
-
-    my @extraPlatforms = ();
-    if (isAppleWinWebKit()) {
-        push @extraPlatforms, &quot;mac-wk2&quot; if $platform eq &quot;win-wk2&quot;;
-        push @extraPlatforms, qw(mac-lion mac);
-    }
-    push @extraPlatforms, @macPlatforms if isIOSWebKit();
-
-    push @directories, map { catdir($platformBaseDirectory, $_) } @extraPlatforms;
-    push @directories, $expectedDirectory;
-
-    # If we already have expected results, just return their location.
-    foreach my $directory (@directories) {
-        return $directory if -f File::Spec-&gt;catfile($directory, &quot;$base-$expectedTag.$expectedExtension&quot;);
-    }
-
-    # For cross-platform tests, text-only results should go in the cross-platform directory,
-    # while render tree dumps should go in the least-specific platform directory.
-    return $isText ? $expectedDirectory : $platformResultHierarchy[$#platformResultHierarchy];
-}
-
-sub countFinishedTest($$$$)
-{
-    my ($test, $base, $result, $isText) = @_;
-
-    if (($count + 1) % $testsPerDumpTool == 0 || $count == $#tests) {
-        if ($shouldCheckLeaks) {
-            my $fileName;
-            if ($testsPerDumpTool == 1) {
-                $fileName = File::Spec-&gt;catfile($testResultsDirectory, &quot;$base-leaks.txt&quot;);
-            } else {
-                $fileName = File::Spec-&gt;catfile($testResultsDirectory, fileNameWithNumber($dumpToolName, $leaksOutputFileNumber) . &quot;-leaks.txt&quot;);
-            }
-            my $leakCount = countAndPrintLeaks($dumpToolName, $dumpToolPID, $fileName);
-            $totalLeaks += $leakCount;
-            $leaksOutputFileNumber++ if ($leakCount);
-        }
-
-        closeDumpTool();
-    }
-    
-    $count++;
-    $counts{$result}++;
-    push @{$tests{$result}}, $test;
-}
-
-sub testCrashedOrTimedOut($$$$$$)
-{
-    my ($test, $base, $didCrash, $webProcessCrashed, $actual, $error) = @_;
-
-    printFailureMessageForTest($test, $webProcessCrashed ? &quot;Web process crashed&quot; : $didCrash ? &quot;crashed&quot; : &quot;timed out&quot;);
-
-    sampleDumpTool() unless $didCrash || $webProcessCrashed;
-
-    my $dir = dirname(File::Spec-&gt;catdir($testResultsDirectory, $base));
-    mkpath $dir;
-
-    deleteExpectedAndActualResults($base);
-
-    if (defined($error) &amp;&amp; length($error)) {
-        writeToFile(File::Spec-&gt;catfile($testResultsDirectory, &quot;$base-$errorTag.txt&quot;), $error);
-    }
-
-    recordActualResultsAndDiff($base, $actual);
-
-    # There's no point in killing the dump tool when it's crashed. And it will kill itself when the
-    # web process crashes.
-    kill 9, $dumpToolPID unless $didCrash || $webProcessCrashed;
-
-    closeDumpTool();
-
-    captureSavedCrashLog($base, $webProcessCrashed) if $didCrash || $webProcessCrashed;
-
-    return unless isCygwin() &amp;&amp; !$didCrash &amp;&amp; $base =~ /^http/;
-    # On Cygwin, http tests timing out can be a symptom of a non-responsive httpd.
-    # If we timed out running an http test, try restarting httpd.
-    $isHttpdOpen = !closeHTTPD();
-    configureAndOpenHTTPDIfNeeded();
-}
-
-sub captureSavedCrashLog($$)
-{
-    my ($base, $webProcessCrashed) = @_;
-
-    my $crashLog;
-
-    my $glob;
-    if (isCygwin()) {
-        $glob = File::Spec-&gt;catfile($testResultsDirectory, $windowsCrashLogFilePrefix . &quot;*.txt&quot;);
-    } elsif (isAppleMacWebKit()) {
-        $glob = File::Spec-&gt;catfile(&quot;~&quot;, &quot;Library&quot;, &quot;Logs&quot;, &quot;DiagnosticReports&quot;, ($webProcessCrashed ? &quot;WebProcess&quot; : $dumpToolName) . &quot;_*.crash&quot;);
-
-        # Even though the dump tool has exited, CrashReporter might still be running. We need to
-        # wait for it to exit to ensure it has saved its crash log to disk. For simplicitly, we'll
-        # assume that the ReportCrash process with the highest PID is the one we want.
-        if (my @reportCrashPIDs = sort map { /^\s*(\d+)/; $1 } grep { /ReportCrash/ } `/bin/ps x`) {
-            my $reportCrashPID = $reportCrashPIDs[$#reportCrashPIDs];
-            # We use kill instead of waitpid because ReportCrash is not one of our child processes.
-            usleep(250000) while kill(0, $reportCrashPID) &gt; 0;
-        }
-    }
-
-    return unless $glob;
-
-    # We assume that the newest crash log in matching the glob is the one that corresponds to the crash that just occurred.
-    if (my $newestCrashLog = findNewestFileMatchingGlob($glob)) {
-        # The crash log must have been created after this script started running.
-        $crashLog = $newestCrashLog if -M $newestCrashLog &lt; 0;
-    }
-
-    return unless $crashLog;
-
-    move($crashLog, File::Spec-&gt;catfile($testResultsDirectory, &quot;$base-$crashLogTag.txt&quot;));
-}
-
-sub findNewestFileMatchingGlob($)
-{
-    my ($glob) = @_;
-
-    my @paths = glob $glob;
-    return unless scalar(@paths);
-
-    my @pathsAndTimes = map { [$_, -M $_] } @paths;
-    @pathsAndTimes = sort { $b-&gt;[1] &lt;=&gt; $a-&gt;[1] } @pathsAndTimes;
-    return $pathsAndTimes[$#pathsAndTimes]-&gt;[0];
-}
-
-sub printFailureMessageForTest($$)
-{
-    my ($test, $description) = @_;
-
-    unless ($verbose) {
-        print &quot;\n&quot; unless $atLineStart;
-        print &quot;$test -&gt; &quot;;
-    }
-    print &quot;$description\n&quot;;
-    $atLineStart = 1;
-}
-
-my %cygpaths = ();
-
-sub openCygpathIfNeeded($)
-{
-    my ($options) = @_;
-
-    return unless isCygwin();
-    return $cygpaths{$options} if $cygpaths{$options} &amp;&amp; $cygpaths{$options}-&gt;{&quot;open&quot;};
-
-    local (*CYGPATHIN, *CYGPATHOUT);
-    my $pid = open2(\*CYGPATHIN, \*CYGPATHOUT, &quot;cygpath -f - $options&quot;);
-    my $cygpath =  {
-        &quot;pid&quot; =&gt; $pid,
-        &quot;in&quot; =&gt; *CYGPATHIN,
-        &quot;out&quot; =&gt; *CYGPATHOUT,
-        &quot;open&quot; =&gt; 1
-    };
-
-    $cygpaths{$options} = $cygpath;
-
-    return $cygpath;
-}
-
-sub closeCygpaths()
-{
-    return unless isCygwin();
-
-    foreach my $cygpath (values(%cygpaths)) {
-        close $cygpath-&gt;{&quot;in&quot;};
-        close $cygpath-&gt;{&quot;out&quot;};
-        waitpid($cygpath-&gt;{&quot;pid&quot;}, 0);
-        $cygpath-&gt;{&quot;open&quot;} = 0;
-
-    }
-}
-
-sub convertPathUsingCygpath($$)
-{
-    my ($path, $options) = @_;
-
-    # cygpath -f (at least in Cygwin 1.7) converts spaces into newlines. We remove spaces here and
-    # add them back in after conversion to work around this.
-    my $spaceSubstitute = &quot;__NOTASPACE__&quot;;
-    $path =~ s/ /\Q$spaceSubstitute\E/g;
-
-    my $cygpath = openCygpathIfNeeded($options);
-    local *inFH = $cygpath-&gt;{&quot;in&quot;};
-    local *outFH = $cygpath-&gt;{&quot;out&quot;};
-    print outFH $path . &quot;\n&quot;;
-    my $convertedPath = &lt;inFH&gt;;
-    chomp($convertedPath) if defined $convertedPath;
-
-    $convertedPath =~ s/\Q$spaceSubstitute\E/ /g;
-    return $convertedPath;
-}
-
-sub toCygwinPath($)
-{
-    my ($path) = @_;
-    return unless isCygwin();
-
-    return convertPathUsingCygpath($path, &quot;-u&quot;);
-}
-
-sub toWindowsPath($)
-{
-    my ($path) = @_;
-    return unless isCygwin();
-
-    return convertPathUsingCygpath($path, &quot;-w&quot;);
-}
-
-sub toURL($)
-{
-    my ($path) = @_;
-
-    if ($useRemoteLinksToTests) {
-        my $relativePath = File::Spec-&gt;abs2rel($path, $testDirectory);
-
-        # If the file is below the test directory then convert it into a link to the file in SVN
-        if ($relativePath !~ /^\.\.\//) {
-            my $revision = svnRevisionForDirectory($testDirectory);
-            my $svnPath = pathRelativeToSVNRepositoryRootForPath($path);
-            return &quot;http://trac.webkit.org/export/$revision/$svnPath&quot;;
-        }
-    }
-
-    return $path unless isCygwin();
-
-    return &quot;file:///&quot; . convertPathUsingCygpath($path, &quot;-m&quot;);
-}
-
-sub validateSkippedArg($$;$)
-{
-    my ($option, $value, $value2) = @_;
-    my %validSkippedValues = map { $_ =&gt; 1 } qw(default ignore only);
-    $value = lc($value);
-    die &quot;Invalid argument '&quot; . $value . &quot;' for option $option&quot; unless $validSkippedValues{$value};
-    $treatSkipped = $value;
-}
-
-sub htmlForResultsSection(\@$&amp;)
-{
-    my ($tests, $description, $linkGetter) = @_;
-
-    my @html = ();
-    return join(&quot;\n&quot;, @html) unless @{$tests};
-
-    push @html, &quot;&lt;p&gt;$description:&lt;/p&gt;&quot;;
-    push @html, &quot;&lt;table&gt;&quot;;
-    foreach my $test (@{$tests}) {
-        push @html, &quot;&lt;tr&gt;&quot;;
-        push @html, &quot;&lt;td&gt;&lt;a href=\&quot;&quot; . toURL(&quot;$testDirectory/$test&quot;) . &quot;\&quot;&gt;$test&lt;/a&gt;&lt;/td&gt;&quot;;
-        foreach my $link (@{&amp;{$linkGetter}($test)}) {
-            push @html, &quot;&lt;td&gt;&quot;;
-            push @html, &quot;&lt;a href=\&quot;$link-&gt;{href}\&quot;&gt;$link-&gt;{text}&lt;/a&gt;&quot; if -f File::Spec-&gt;catfile($testResultsDirectory, $link-&gt;{href});
-            push @html, &quot;&lt;/td&gt;&quot;;
-        }
-        push @html, &quot;&lt;/tr&gt;&quot;;
-    }
-    push @html, &quot;&lt;/table&gt;&quot;;
-
-    return join(&quot;\n&quot;, @html);
-}
-
-sub linksForExpectedAndActualResults($)
-{
-    my ($base) = @_;
-
-    my @links = ();
-
-    return \@links unless -s &quot;$testResultsDirectory/$base-$diffsTag.txt&quot;;
-    
-    my $expectedResultPath = $expectedResultPaths{$base};
-    my ($expectedResultFileName, $expectedResultsDirectory, $expectedResultExtension) = fileparse($expectedResultPath, qr{\.[^.]+$});
-
-    push @links, { href =&gt; &quot;$base-$expectedTag$expectedResultExtension&quot;, text =&gt; &quot;expected&quot; };
-    push @links, { href =&gt; &quot;$base-$actualTag$expectedResultExtension&quot;, text =&gt; &quot;actual&quot; };
-    push @links, { href =&gt; &quot;$base-$diffsTag.txt&quot;, text =&gt; &quot;diff&quot; };
-    push @links, { href =&gt; &quot;$base-$prettyDiffTag.html&quot;, text =&gt; &quot;pretty diff&quot; };
-
-    return \@links;
-}
-
-sub linksForMismatchTest
-{
-    my ($test) = @_;
-
-    my @links = ();
-
-    my $base = stripExtension($test);
-
-    push @links, @{linksForExpectedAndActualResults($base)};
-    return \@links unless $pixelTests &amp;&amp; $imagesPresent{$base};
-
-    push @links, { href =&gt; &quot;$base-$expectedTag.png&quot;, text =&gt; &quot;expected image&quot; };
-    push @links, { href =&gt; &quot;$base-$diffsTag.html&quot;, text =&gt; &quot;image diffs&quot; };
-    push @links, { href =&gt; &quot;$base-$diffsTag.png&quot;, text =&gt; &quot;$imageDifferences{$base}%&quot; };
-
-    return \@links;
-}
-
-sub crashLocation($)
-{
-    my ($base) = @_;
-
-    my $crashLogFile = File::Spec-&gt;catfile($testResultsDirectory, &quot;$base-$crashLogTag.txt&quot;);
-
-    if (isCygwin()) {
-        # We're looking for the following text:
-        #
-        # FOLLOWUP_IP:
-        # module!function+offset [file:line]
-        #
-        # The second contains the function that crashed (or the function that ended up jumping to a bad
-        # address, as in the case of a null function pointer).
-
-        open LOG, &quot;&lt;&quot;, $crashLogFile or return;
-        while (my $line = &lt;LOG&gt;) {
-            last if $line =~ /^FOLLOWUP_IP:/;
-        }
-        my $desiredLine = &lt;LOG&gt;;
-        close LOG;
-
-        return unless $desiredLine;
-
-        # Just take everything up to the first space (which is where the file/line information should
-        # start).
-        $desiredLine =~ /^(\S+)/;
-        return $1;
-    }
-
-    if (isAppleMacWebKit()) {
-        # We're looking for the following text:
-        #
-        # Thread M Crashed:
-        # N   module                              address function + offset (file:line)
-        #
-        # Some lines might have a module of &quot;???&quot; if we've jumped to a bad address. We should skip
-        # past those.
-
-        open LOG, &quot;&lt;&quot;, $crashLogFile or return;
-        while (my $line = &lt;LOG&gt;) {
-            last if $line =~ /^Thread \d+ Crashed:/;
-        }
-        my $location;
-        while (my $line = &lt;LOG&gt;) {
-            $line =~ /^\d+\s+(\S+)\s+\S+ (.* \+ \d+)/ or next;
-            my $module = $1;
-            my $functionAndOffset = $2;
-            next if $module eq &quot;???&quot;;
-            $location = &quot;$module: $functionAndOffset&quot;;
-            last;
-        }
-        close LOG;
-        return $location;
-    }
-}
-
-sub linksForErrorTest
-{
-    my ($test) = @_;
-
-    my @links = ();
-
-    my $base = stripExtension($test);
-
-    my $crashLogText = &quot;crash log&quot;;
-    if (my $crashLocation = crashLocation($base)) {
-        $crashLogText .= &quot; (&lt;code&gt;&quot; . CGI::escapeHTML($crashLocation) . &quot;&lt;/code&gt;)&quot;;
-    }
-
-    push @links, @{linksForExpectedAndActualResults($base)};
-    push @links, { href =&gt; &quot;$base-$errorTag.txt&quot;, text =&gt; &quot;stderr&quot; };
-    push @links, { href =&gt; &quot;$base-$crashLogTag.txt&quot;, text =&gt; $crashLogText };
-
-    return \@links;
-}
-
-sub linksForNewTest
-{
-    my ($test) = @_;
-
-    my @links = ();
-
-    my $base = stripExtension($test);
-
-    my $expectedResultPath = $expectedResultPaths{$base};
-    my ($expectedResultFileName, $expectedResultsDirectory, $expectedResultExtension) = fileparse($expectedResultPath, qr{\.[^.]+$});
-
-    push @links, { href =&gt; &quot;$base-$actualTag$expectedResultExtension&quot;, text =&gt; &quot;result&quot; };
-    if ($pixelTests &amp;&amp; $imagesPresent{$base}) {
-        push @links, { href =&gt; &quot;$base-$expectedTag.png&quot;, text =&gt; &quot;image&quot; };
-    }
-
-    return \@links;
-}
-
-sub deleteExpectedAndActualResults($)
-{
-    my ($base) = @_;
-
-    unlink &quot;$testResultsDirectory/$base-$actualTag.txt&quot;;
-    unlink &quot;$testResultsDirectory/$base-$diffsTag.txt&quot;;
-    unlink &quot;$testResultsDirectory/$base-$errorTag.txt&quot;;
-    unlink &quot;$testResultsDirectory/$base-$crashLogTag.txt&quot;;
-}
-
-sub recordActualResultsAndDiff($$)
-{
-    my ($base, $actualResults) = @_;
-
-    return unless defined($actualResults) &amp;&amp; length($actualResults);
-
-    my $expectedResultPath = $expectedResultPaths{$base};
-    my ($expectedResultFileNameMinusExtension, $expectedResultDirectoryPath, $expectedResultExtension) = fileparse($expectedResultPath, qr{\.[^.]+$});
-    my $actualResultsPath = File::Spec-&gt;catfile($testResultsDirectory, &quot;$base-$actualTag$expectedResultExtension&quot;);
-    my $copiedExpectedResultsPath = File::Spec-&gt;catfile($testResultsDirectory, &quot;$base-$expectedTag$expectedResultExtension&quot;);
-
-    mkpath(dirname($actualResultsPath));
-    writeToFile(&quot;$actualResultsPath&quot;, $actualResults);
-
-    # We don't need diff and pretty diff for tests without expected file.
-    if ( !-f $expectedResultPath) {
-        return;
-    }
-
-    copy(&quot;$expectedResultPath&quot;, &quot;$copiedExpectedResultsPath&quot;);
-
-    my $diffOuputBasePath = File::Spec-&gt;catfile($testResultsDirectory, $base);
-    my $diffOutputPath = &quot;$diffOuputBasePath-$diffsTag.txt&quot;;
-    system &quot;diff -u \&quot;$copiedExpectedResultsPath\&quot; \&quot;$actualResultsPath\&quot; &gt; \&quot;$diffOutputPath\&quot;&quot;;
-
-    my $prettyDiffOutputPath = &quot;$diffOuputBasePath-$prettyDiffTag.html&quot;;
-    my $prettyPatchPath = &quot;Websites/bugs.webkit.org/PrettyPatch/&quot;;
-    my $prettifyPath = &quot;$prettyPatchPath/prettify.rb&quot;;
-    system &quot;ruby -I \&quot;$prettyPatchPath\&quot; \&quot;$prettifyPath\&quot; \&quot;$diffOutputPath\&quot; &gt; \&quot;$prettyDiffOutputPath\&quot;&quot;;
-}
-
-sub buildPlatformResultHierarchy()
-{
-    mkpath($platformTestDirectory) if ($platform eq &quot;undefined&quot; &amp;&amp; !-d &quot;$platformTestDirectory&quot;);
-
-    my @platforms;
-
-    my $isMac = $platform =~ /^mac/;
-    my $isWin = $platform =~ /^win/;
-    my $isIOS = $platform =~ /^ios/;
-    if ($isMac || $isWin || $isIOS) {
-        my $effectivePlatform = $platform;
-        if ($platform eq &quot;mac-wk2&quot; || $platform eq &quot;win-wk2&quot; || $platform eq &quot;ios-sim-wk2&quot;) {
-            push @platforms, $platform;
-            $effectivePlatform = $realPlatform;
-        }
-
-        my @platformList = $isMac ? @macPlatforms : @winPlatforms;
-        @platformList = @iPhoneSimulatorPlatforms if $isIOS;
-        my $i;
-        for ($i = 0; $i &lt; @platformList; $i++) {
-            last if $platformList[$i] eq $effectivePlatform;
-        }
-        for (; $i &lt; @platformList; $i++) {
-            push @platforms, $platformList[$i];
-        }
-
-        if ($platform eq &quot;wincairo&quot;) {
-            @platforms = $platform;
-        }
-    } elsif ($platform =~ /^gtk-/) {
-        push @platforms, $platform;
-        push @platforms, &quot;gtk&quot;;
-    } else {
-        @platforms = $platform;
-    }
-
-    my @hierarchy;
-    for (my $i = 0; $i &lt; @platforms; $i++) {
-        my $scoped = catdir($platformBaseDirectory, $platforms[$i]);
-        push(@hierarchy, $scoped) if (-d $scoped);
-    }

-    unshift @hierarchy, grep { -d $_ } @additionalPlatformDirectories;
-
-    return @hierarchy;
-}
-
-sub buildPlatformTestHierarchy(@)
-{
-    my (@platformHierarchy) = @_;
-
-    my @result;
-    my $wk2Platform;
-    for (my $i = 0; $i &lt; @platformHierarchy; ++$i) {
-        if ($platformHierarchy[$i] =~ /-wk2/) {
-            $wk2Platform = splice @platformHierarchy, $i, 1;
-            last;
-        }
-    }
-
-    push @result, $platformHierarchy[0];
-    push @result, $wk2Platform if defined $wk2Platform;
-    push @result, $platformHierarchy[$#platformHierarchy] if @platformHierarchy &gt;= 2;
-
-    if ($verbose) {
-        my @searchPaths;
-        foreach my $searchPath (@result) {
-            my ($dir, $name) = splitpath($searchPath);
-            push @searchPaths, $name;
-        }
-        my $searchPathHierarchy = join(' -&gt; ', @searchPaths);
-        print &quot;Baseline search path: $searchPathHierarchy\n&quot;;
-    }
-
-    return @result;
-}
-
-sub epiloguesAndPrologues($$)
-{
-    my ($lastDirectory, $directory) = @_;
-    my @lastComponents = split('/', $lastDirectory);
-    my @components = split('/', $directory);
-
-    while (@lastComponents) {
-        if (!defined($components[0]) || $lastComponents[0] ne $components[0]) {
-            last;
-        }
-        shift @components;
-        shift @lastComponents;
-    }
-
-    my @result;
-    my $leaving = $lastDirectory;
-    foreach (@lastComponents) {
-        my $epilogue = $leaving . &quot;/resources/run-webkit-tests-epilogue.html&quot;;
-        foreach (@platformResultHierarchy) {
-            push @result, catdir($_, $epilogue) if (stat(catdir($_, $epilogue)));
-        }
-        push @result, catdir($testDirectory, $epilogue) if (stat(catdir($testDirectory, $epilogue)));
-        $leaving =~ s|(^\|/)[^/]+$||;
-    }
-
-    my $entering = $leaving;
-    foreach (@components) {
-        $entering .= '/' . $_;
-        my $prologue = $entering . &quot;/resources/run-webkit-tests-prologue.html&quot;;
-        push @result, catdir($testDirectory, $prologue) if (stat(catdir($testDirectory, $prologue)));
-        foreach (reverse @platformResultHierarchy) {
-            push @result, catdir($_, $prologue) if (stat(catdir($_, $prologue)));
-        }
-    }
-    return @result;
-}
-    
-sub parseLeaksandPrintUniqueLeaks()
-{
-    return unless @leaksFilenames;
-
-    my $mergedFilenames = join &quot; &quot;, @leaksFilenames;
-    my $parseMallocHistoryTool = sourceDir() . &quot;/Tools/Scripts/parse-malloc-history&quot;;
-    
-    open MERGED_LEAKS, &quot;cat $mergedFilenames | $parseMallocHistoryTool --merge-depth $mergeDepth  - |&quot; ;
-    my @leakLines = &lt;MERGED_LEAKS&gt;;
-    close MERGED_LEAKS;
-    
-    my $uniqueLeakCount = 0;
-    my $totalBytes;
-    foreach my $line (@leakLines) {
-        ++$uniqueLeakCount if ($line =~ /^(\d*)\scalls/);
-        $totalBytes = $1 if $line =~ /^total\:\s(.*)\s\(/;
-    }
-    
-    print &quot;\nWARNING: $totalLeaks total leaks found for a total of $totalBytes!\n&quot;;
-    print &quot;WARNING: $uniqueLeakCount unique leaks found!\n&quot;;
-    print &quot;See above for individual leaks results.\n&quot; if ($leaksOutputFileNumber &gt; 2);
-    
-}
-
-sub extensionForMimeType($)
-{
-    my ($mimeType) = @_;
-
-    if ($mimeType eq &quot;application/x-webarchive&quot;) {
-        return &quot;webarchive&quot;;
-    } elsif ($mimeType eq &quot;application/pdf&quot;) {
-        return &quot;pdf&quot;;
-    } elsif ($mimeType eq &quot;audio/wav&quot;) {
-        return &quot;wav&quot;;
-    }
-    return &quot;txt&quot;;
-}
-
-# Read up to the first #EOF (the content block of the test), or until detecting crashes or timeouts.
-sub readFromDumpToolWithTimer(**)
-{
-    my ($fhIn, $fhError) = @_;
-
-    setFileHandleNonBlocking($fhIn, 1);
-    setFileHandleNonBlocking($fhError, 1);
-
-    my $maximumSecondsWithoutOutput = $timeoutSeconds;
-    my $microsecondsToWaitBeforeReadingAgain = 1000;
-
-    my $timeOfLastSuccessfulRead = time;
-
-    my @output = ();
-    my @error = ();
-    my $status = &quot;success&quot;;
-    my $mimeType = &quot;text/plain&quot;;
-    my $encoding = &quot;&quot;;
-    # We don't have a very good way to know when the &quot;headers&quot; stop
-    # and the content starts, so we use this as a hack:
-    my $haveSeenContentType = 0;
-    my $haveSeenContentTransferEncoding = 0;
-    my $haveSeenEofIn = 0;
-    my $haveSeenEofError = 0;
-
-    while (1) {
-        if (time - $timeOfLastSuccessfulRead &gt; $maximumSecondsWithoutOutput) {
-            $status = dumpToolDidCrash() ? &quot;crashed&quot; : &quot;timedOut&quot;;
-            last;
-        }
-
-        # Once we've seen the EOF, we must not read anymore.
-        my $lineIn = readline($fhIn) unless $haveSeenEofIn;
-        my $lineError = readline($fhError) unless $haveSeenEofError;
-        if (!defined($lineIn) &amp;&amp; !defined($lineError)) {
-            last if ($haveSeenEofIn &amp;&amp; $haveSeenEofError);
-
-            if ($! != EAGAIN) {
-                $status = &quot;crashed&quot;;
-                last;
-            }
-
-            # No data ready
-            usleep($microsecondsToWaitBeforeReadingAgain);
-            next;
-        }
-
-        $timeOfLastSuccessfulRead = time;
-
-        if (defined($lineIn)) {
-            if (!$haveSeenContentType &amp;&amp; $lineIn =~ /^Content-Type: (\S+)$/) {
-                $mimeType = $1;
-                $haveSeenContentType = 1;
-            } elsif (!$haveSeenContentTransferEncoding &amp;&amp; $lineIn =~ /^Content-Transfer-Encoding: (\S+)$/) {
-                $encoding = $1;
-                $haveSeenContentTransferEncoding = 1;
-            } elsif ($lineIn =~ /^DumpMalloc|^DumpJSHeap: (\S+)$/) {
-                    # Ignored. Only used in performance tests.
-            } elsif ($lineIn =~ /(.*)#EOF$/) {
-                if ($1 ne &quot;&quot;) {
-                    push @output, $1;
-                }
-                $haveSeenEofIn = 1;
-            } else {
-                push @output, $lineIn;
-            }
-        }
-        if (defined($lineError)) {
-            if ($lineError =~ /#CRASHED - WebProcess/) {
-                $status = &quot;webProcessCrashed&quot;;
-                last;
-            }
-            if ($lineError =~ /#CRASHED/) {
-                $status = &quot;crashed&quot;;
-                last;
-            }
-            if ($lineError =~ /#EOF/) {
-                $haveSeenEofError = 1;
-            } else {
-                push @error, $lineError;
-            }
-        }
-    }
-
-    setFileHandleNonBlocking($fhIn, 0);
-    setFileHandleNonBlocking($fhError, 0);
-    my $joined_output = join(&quot;&quot;, @output);
-    if ($encoding eq &quot;base64&quot;) {
-        $joined_output = decode_base64($joined_output);
-    }
-    return {
-        output =&gt; $joined_output,
-        error =&gt; join(&quot;&quot;, @error),
-        status =&gt; $status,
-        mimeType =&gt; $mimeType,
-        extension =&gt; extensionForMimeType($mimeType)
-    };
-}
-
-sub setFileHandleNonBlocking(*$)
-{
-    my ($fh, $nonBlocking) = @_;
-
-    my $flags = fcntl($fh, F_GETFL, 0) or die &quot;Couldn't get filehandle flags&quot;;
-
-    if ($nonBlocking) {
-        $flags |= O_NONBLOCK;
-    } else {
-        $flags &amp;= ~O_NONBLOCK;
-    }
-
-    fcntl($fh, F_SETFL, $flags) or die &quot;Couldn't set filehandle flags&quot;;
-
-    return 1;
-}
-
-sub sampleDumpTool()
-{
-    return unless isAppleMacWebKit();
-    return unless $runSample;
-
-    my $outputDirectory = &quot;$ENV{HOME}/Library/Logs/DumpRenderTree&quot;;
-    -d $outputDirectory or mkdir $outputDirectory;
-
-    my $outputFile = &quot;$outputDirectory/HangReport.txt&quot;;
-    system &quot;/usr/bin/sample&quot;, $dumpToolPID, qw(10 10 -file), $outputFile;
-}
-
-sub stripMetrics($$)
-{
-    my ($actual, $expected) = @_;
-
-    foreach my $result ($actual, $expected) {
-        $result =~ s/at \(-?[0-9]+,-?[0-9]+\) *//g;
-        $result =~ s/size -?[0-9]+x-?[0-9]+ *//g;
-        $result =~ s/text run width -?[0-9]+: //g;
-        $result =~ s/text run width -?[0-9]+ [a-zA-Z ]+: //g;
-        $result =~ s/RenderButton {BUTTON} .*/RenderButton {BUTTON}/g;
-        $result =~ s/RenderImage {INPUT} .*/RenderImage {INPUT}/g;
-        $result =~ s/RenderBlock {INPUT} .*/RenderBlock {INPUT}/g;
-        $result =~ s/RenderTextControl {INPUT} .*/RenderTextControl {INPUT}/g;
-        $result =~ s/\([0-9]+px/px/g;
-        $result =~ s/ *&quot; *\n +&quot; */ /g;
-        $result =~ s/&quot; +$/&quot;/g;
-        $result =~ s/- /-/g;
-        $result =~ s/\n( *)&quot;\s+/\n$1&quot;/g;
-        $result =~ s/\s+&quot;\n/&quot;\n/g;
-        $result =~ s/scrollWidth [0-9]+/scrollWidth/g;
-        $result =~ s/scrollHeight [0-9]+/scrollHeight/g;
-        $result =~ s/scrollX [0-9]+/scrollX/g;
-        $result =~ s/scrollY [0-9]+/scrollY/g;
-        $result =~ s/scrolled to [0-9]+,[0-9]+/scrolled/g;
-    }
-
-    return ($actual, $expected);
-}
-
-sub fileShouldBeIgnored
-{
-    my ($filePath) = @_;
-    foreach my $ignoredDir (keys %ignoredDirectories) {
-        if ($filePath =~ m/^$ignoredDir/) {
-            return 1;
-        }
-    }
-    return 0;
-}
-
-sub readSkippedFiles($)
-{
-    my ($constraintPath) = @_;
-
-    my @skippedFileDirectories = @platformTestHierarchy;
-
-    # Because nearly all of the skipped tests for WebKit 2 on Mac are due to
-    # cross-platform issues, the Windows ports use the Mac skipped list
-    # additionally to their own to avoid maintaining separate lists.
-    push(@skippedFileDirectories, catdir($platformBaseDirectory, &quot;wk2&quot;)) if ($platform eq &quot;win-wk2&quot; || $platform eq &quot;mac-wk2&quot; || $platform eq &quot;gtk-wk2&quot;);
-
-    if ($verbose) {
-        foreach my $skippedPath (@skippedFileDirectories) {
-            print &quot;Using Skipped file: $skippedPath\n&quot;;
-        }
-    }
-
-    foreach my $level (@skippedFileDirectories) {
-        # If a Skipped file exists in the directory, use that and ignore the TestExpectations file,
-        # but if it doesn't, treat every entry in the TestExpectations file as if it should be Skipped.
-        if (open SKIPPED, &quot;&lt;&quot;, &quot;$level/Skipped&quot;) {
-            if ($verbose) {
-                my ($dir, $name) = splitpath($level);
-                print &quot;Skipped tests in $name:\n&quot;;
-            }
-
-            while (&lt;SKIPPED&gt;) {
-                my $skipped = $_;
-                chomp $skipped;
-                $skipped =~ s/^[ \n\r]+//;
-                $skipped =~ s/[ \n\r]+$//;
-                if ($skipped &amp;&amp; $skipped !~ /^#/) {
-                    processSkippedFileEntry($skipped, &quot;Skipped&quot;, $constraintPath);
-                }
-            }
-            close SKIPPED;
-        } elsif (open EXPECTATIONS, &quot;&lt;&quot;, &quot;$level/TestExpectations&quot;) {
-            if ($verbose) {
-                my ($dir, $name) = splitpath($level);
-                print &quot;Skipping tests from $name:\n&quot;;
-            }
-            LINE: while (&lt;EXPECTATIONS&gt;) {
-                my $line = $_;
-                chomp $line;
-                $line =~ s/^[ \n\r]+//;
-                $line =~ s/[ \n\r]+$//;
-                $line =~ s/#.*$//;
-
-                # This logic roughly mirrors the logic in test_expectations.py _tokenize_line() but we
-                # don't bother to look at any of the modifiers or expectations and just skip everything.
-
-                my $state = &quot;start&quot;;
-                my $skipped = &quot;&quot;;
-                TOKEN: foreach my $token (split(/\s+/, $line)) {
-                    if (startsWith($token, &quot;BUG&quot;) || startsWith($token, &quot;//&quot;)) {
-                        # Ignore any lines with the old-style syntax.
-                        next LINE;
-                    }
-                    if (startsWith($token, &quot;webkit.org/b/&quot;) || startsWith($token, &quot;Bug(&quot;)) {
-                        # Skip over bug identifiers; note that we don't bother looking for
-                        # Chromium or V8 URLs since ORWT doesn't work with Chromium.
-                        next TOKEN;
-                    } elsif ($token eq &quot;[&quot;) {
-                        if ($state eq 'start') {
-                            $state = 'configuration';
-                        }
-                    } elsif ($token eq &quot;]&quot;) {
-                        if ($state eq 'configuration') {
-                            $state = 'name';
-                        }
-                    } elsif (($state eq &quot;name&quot;) || ($state eq &quot;start&quot;)) {
-                        $skipped = $token;
-                        # Skip over the rest of the line.
-                        last TOKEN;
-                    }
-                }
-                if ($skipped) {
-                    processSkippedFileEntry($skipped, &quot;TestExpectations&quot;, $constraintPath);
-                }
-            }
-            close EXPECTATIONS;
-        }
-    }
-}
-
-sub processSkippedFileEntry($$$)
-{
-    my ($skipped, $listname, $constraintPath) = @_;
-
-    if ($skippedOnly) {
-        if (!fileShouldBeIgnored($skipped)) {
-            if (!$constraintPath) {
-                # Always add $skipped since no constraint path was specified on the command line.
-                push(@ARGV, $skipped);
-            } elsif ($skipped =~ /^($constraintPath)/ || (&quot;LayoutTests/&quot;.$skipped) =~ /^($constraintPath)/ ) {
-                # Add $skipped only if it matches the current path constraint, e.g.,
-                # &quot;--skipped=only dir1&quot; with &quot;dir1/file1.html&quot; on the skipped list or
-                # &quot;--skipped=only LayoutTests/dir1&quot; with &quot;dir1/file1.html&quot; on the skipped list
-                push(@ARGV, $skipped);
-            } elsif ($constraintPath =~ /^(&quot;LayoutTests\/&quot;.$skipped)/ || $constraintPath =~ /^($skipped)/) {
-                # Add current path constraint if it is more specific than the skip list entry,
-                # e.g., &quot;--skipped=only dir1/dir2/dir3&quot; with &quot;dir1&quot; on the skipped list or
-                # e.g., &quot;--skipped=only LayoutTests/dir1/dir2/dir3&quot; with &quot;dir1&quot; on the skipped list.
-                push(@ARGV, $constraintPath);
-            }
-        } elsif ($verbose) {
-            print &quot;    $skipped\n&quot;;
-        }
-    } else {
-        if ($verbose) {
-            print &quot;    $skipped\n&quot;;
-        }
-        processIgnoreTests($skipped, $listname);
-    }
-}
-
-sub startsWith($$)
-{
-    my ($string, $substring) = @_;
-    return index($string, $substring) == 0;
-}
-
-sub readChecksumFromPng($)
-{
-    my ($path) = @_;
-    my $data;
-    if (open(PNGFILE, $path) &amp;&amp; read(PNGFILE, $data, 2048) &amp;&amp; $data =~ /tEXtchecksum\0([a-fA-F0-9]{32})/) {
-        return $1;
-    }
-}
-
-my @testsFound;
-
-sub isUsedInReftest($)
-{
-    my $filename = $_[0];
-    my @extensions = ('html','shtml','xml','xhtml','htm','php','svg','mht','pl');
-    my $extensionsJoined = join(&quot;|&quot;, @extensions);
-    my $suffixExtensionExpression = &quot;-($expectedTag|$refTag|$notrefTag)(-$mismatchTag)?\\.(&quot;.$extensionsJoined.&quot;)\$&quot;;
-    my $prefixExtensionExpression = &quot;^($refTag|$notrefTag)-&quot;;
-    if ($filename =~ /$suffixExtensionExpression/ || $filename =~ /$prefixExtensionExpression/) {
-        return 1;
-    }
-    my $base = stripExtension($filename);
-
-    foreach my $extension (@extensions) {
-        if (-f &quot;$base-$expectedTag.$extension&quot; || 
-            -f &quot;$base-$refTag.$extension&quot; || -f &quot;$base-$notrefTag.$extension&quot; ||
-            -f &quot;$base-$expectedTag-$mismatchTag.$extension&quot; ||
-            -f &quot;$refTag-$base.$extension&quot; || -f &quot;$notrefTag-$base.$extension&quot;) {
-            return 1;
-        }
-    }
-    return 0;
-}
-
-sub directoryFilter
-{
-    return () if exists $ignoredLocalDirectories{basename($File::Find::dir)};
-    return () if exists $ignoredDirectories{File::Spec-&gt;abs2rel($File::Find::dir, $testDirectory)};
-    return @_;
-}
-
-sub fileFilter
-{
-    my $filename = $_;
-    if ($filename =~ /\.([^.]+)$/) {
-        my $extension = $1;
-        if (exists $supportedFileExtensions{$extension} &amp;&amp; !isUsedInReftest($filename)) {
-            my $path = File::Spec-&gt;abs2rel(catfile($File::Find::dir, $filename), $testDirectory);
-            push @testsFound, $path if !exists $ignoredFiles{$path};
-        }
-    }
-}
-
-sub findTestsToRun
-{
-    my @testsToRun = ();
-
-    for my $test (@ARGV) {
-        $test =~ s/^(\Q$layoutTestsName\E|\Q$testDirectory\E)\///;
-        my $fullPath = catfile($testDirectory, $test);
-        if (file_name_is_absolute($test)) {
-            print &quot;can't run test $test outside $testDirectory\n&quot;;
-        } elsif (-f $fullPath &amp;&amp; !isUsedInReftest($fullPath)) {
-            my ($filename, $pathname, $fileExtension) = fileparse($test, qr{\.[^.]+$});
-            if (!exists $supportedFileExtensions{substr($fileExtension, 1)}) {
-                print &quot;test $test does not have a supported extension\n&quot;;
-            } elsif ($testHTTP || $pathname !~ /^http\//) {
-                push @testsToRun, $test;
-            }
-        } elsif (-d $fullPath) {
-            @testsFound = ();
-            find({ preprocess =&gt; \&amp;directoryFilter, wanted =&gt; \&amp;fileFilter }, $fullPath);
-            for my $level (@platformTestHierarchy) {
-                my $platformPath = catfile($level, $test);
-                find({ preprocess =&gt; \&amp;directoryFilter, wanted =&gt; \&amp;fileFilter }, $platformPath) if (-d $platformPath);
-            }
-            push @testsToRun, sort pathcmp @testsFound;
-            @testsFound = ();
-        } else {
-            print &quot;test $test not found\n&quot;;
-        }
-    }
-
-    if (!scalar @ARGV) {
-        @testsFound = ();
-        find({ preprocess =&gt; \&amp;directoryFilter, wanted =&gt; \&amp;fileFilter }, $testDirectory);
-        for my $level (@platformTestHierarchy) {
-            find({ preprocess =&gt; \&amp;directoryFilter, wanted =&gt; \&amp;fileFilter }, $level);
-        }
-        push @testsToRun, sort pathcmp @testsFound;
-        @testsFound = ();
-
-        # We need to minimize the time when Apache and WebSocketServer is locked by tests
-        # so run them last if no explicit order was specified in the argument list.
-        my @httpTests;
-        my @websocketTests;
-        my @otherTests;
-        foreach my $test (@testsToRun) {
-            if ($test =~ /^http\//) {
-                push(@httpTests, $test);
-            } elsif ($test =~ /^websocket\//) {
-                push(@websocketTests, $test);
-            } else {
-                push(@otherTests, $test);
-            }
-        }
-        @testsToRun = (@otherTests, @httpTests, @websocketTests);
-    }
-
-    # Reverse the tests
-    @testsToRun = reverse @testsToRun if $reverseTests;
-
-    # Shuffle the array
-    @testsToRun = shuffle(@testsToRun) if $randomizeTests;
-
-    return @testsToRun;
-}
-
-sub printResults
-{
-    my %text = (
-        match =&gt; &quot;succeeded&quot;,
-        mismatch =&gt; &quot;had incorrect layout&quot;,
-        new =&gt; &quot;were new&quot;,
-        timedout =&gt; &quot;timed out&quot;,
-        crash =&gt; &quot;crashed&quot;,
-        webProcessCrash =&gt; &quot;Web process crashed&quot;,
-        error =&gt; &quot;had stderr output&quot;
-    );
-
-    for my $type (&quot;match&quot;, &quot;mismatch&quot;, &quot;new&quot;, &quot;timedout&quot;, &quot;crash&quot;, &quot;webProcessCrash&quot;, &quot;error&quot;) {
-        my $typeCount = $counts{$type};
-        next unless $typeCount;
-        my $typeText = $text{$type};
-        my $message;
-        if ($typeCount == 1) {
-            $typeText =~ s/were/was/;
-            $message = sprintf &quot;1 test case %s\n&quot;, $typeText;
-        } else {
-            $message = sprintf &quot;%d test cases %s\n&quot;, $typeCount, $typeText;
-        }
-        $message =~ s-\(0%\)-(&lt;1%)-;
-        print $message;
-    }
-}
-
-sub stopRunningTestsEarlyIfNeeded()
-{
-    # --reset-results does not check pass vs. fail, so exitAfterNFailures makes no sense with --reset-results.
-    return 0 if $resetResults;
-
-    my $passCount = $counts{match} || 0; # $counts{match} will be undefined if we've not yet passed a test (e.g. the first test fails).
-    my $newCount = $counts{new} || 0;
-    my $failureCount = $count - $passCount - $newCount; # &quot;Failure&quot; here includes timeouts, crashes, etc.
-    if ($exitAfterNFailures &amp;&amp; $failureCount &gt;= $exitAfterNFailures) {
-        $stoppedRunningEarlyMessage = &quot;Exiting early after $failureCount failures. $count tests run.&quot;;
-        print &quot;\n&quot;, $stoppedRunningEarlyMessage;
-        closeDumpTool();
-        return 1;
-    }
-
-    my $crashCount = $counts{crash} || 0;
-    my $webProcessCrashCount = $counts{webProcessCrash} || 0;
-    my $timeoutCount = $counts{timedout} || 0;
-    if ($exitAfterNCrashesOrTimeouts &amp;&amp; $crashCount + $webProcessCrashCount + $timeoutCount &gt;= $exitAfterNCrashesOrTimeouts) {
-        $stoppedRunningEarlyMessage = &quot;Exiting early after $crashCount crashes, $webProcessCrashCount web process crashes, and $timeoutCount timeouts. $count tests run.&quot;;
-        print &quot;\n&quot;, $stoppedRunningEarlyMessage;
-        closeDumpTool();
-        return 1;
-    }
-
-    return 0;
-}
-
-# Store this at global scope so it won't be GCed (and thus unlinked) until the program exits.
-my $debuggerTempDirectory;
-
-sub createDebuggerCommandFile()
-{
-    return unless isCygwin();
-
-    my @commands = (
-        '.logopen /t &quot;' . toWindowsPath($testResultsDirectory) . &quot;\\&quot; . $windowsCrashLogFilePrefix . '.txt&quot;',
-        '.srcpath &quot;' . toWindowsPath(sourceDir()) . '&quot;',
-        '!analyze -vv',
-        '~*kpn',
-        'q',
-    );
-
-    $debuggerTempDirectory = File::Temp-&gt;newdir;
-
-    my $commandFile = File::Spec-&gt;catfile($debuggerTempDirectory, &quot;debugger-commands.txt&quot;);
-    unless (open COMMANDS, '&gt;', $commandFile) {
-        print &quot;Failed to open $commandFile. Crash logs will not be saved.\n&quot;;
-        return;
-    }
-    print COMMANDS join(&quot;\n&quot;, @commands), &quot;\n&quot;;
-    unless (close COMMANDS) {
-        print &quot;Failed to write to $commandFile. Crash logs will not be saved.\n&quot;;
-        return;
-    }
-
-    return $commandFile;
-}
-
-sub setUpWindowsCrashLogSaving()
-{
-    return unless isCygwin();
-
-    unless (defined $ENV{_NT_SYMBOL_PATH}) {
-        print &quot;The _NT_SYMBOL_PATH environment variable is not set. Crash logs will not be saved.\nSee &lt;http://trac.webkit.org/wiki/BuildingOnWindows#GettingCrashLogs&gt;.\n&quot;;
-        return;
-    }
-
-    my @possiblePaths = (
-        File::Spec-&gt;catfile(toCygwinPath($ENV{PROGRAMFILES}), &quot;Windows Kits&quot;, &quot;8.0&quot;, &quot;Debuggers&quot;, &quot;x64&quot;, &quot;ntsd.exe&quot;),
-        File::Spec-&gt;catfile(toCygwinPath($ENV{PROGRAMFILES}), &quot;Windows Kits&quot;, &quot;8.0&quot;, &quot;Debuggers&quot;, &quot;x86&quot;, &quot;ntsd.exe&quot;),
-        File::Spec-&gt;catfile(toCygwinPath($ENV{PROGRAMFILES}), &quot;Debugging Tools for Windows (x86)&quot;, &quot;ntsd.exe&quot;),
-        File::Spec-&gt;catfile(toCygwinPath($ENV{ProgramW6432}), &quot;Debugging Tools for Windows (x64)&quot;, &quot;ntsd.exe&quot;),
-        File::Spec-&gt;catfile(toCygwinPath($ENV{SYSTEMROOT}), &quot;system32&quot;, &quot;ntsd.exe&quot;),
-    );
-
-    my $ntsdPath = shift @possiblePaths;
-
-    while (not -f $ntsdPath) {
-        if (!@possiblePaths) {
-            print STDERR &quot;Can't find ntsd.exe. Crash logs will not be saved.\nSee &lt;http://trac.webkit.org/wiki/BuildingOnWindows#GettingCrashLogs&gt;.\n&quot;;
-            return;
-        }
-
-        $ntsdPath = shift @possiblePaths;
-    }
-
-    # If we used -c (instead of -cf) we could pass the commands directly on the command line. But
-    # when the commands include multiple quoted paths (e.g., for .logopen and .srcpath), Windows
-    # fails to invoke the post-mortem debugger at all (perhaps due to a bug in Windows's command
-    # line parsing). So we save the commands to a file instead and tell the debugger to execute them
-    # using -cf.
-    my $commandFile = createDebuggerCommandFile() or return;
-
-    my @options = (
-        '-p %ld',
-        '-e %ld',
-        '-g',
-        '-lines',
-        '-cf &quot;' . toWindowsPath($commandFile) . '&quot;',
-    );
-
-    my %values = (
-        Debugger =&gt; '&quot;' . toWindowsPath($ntsdPath) . '&quot; ' . join(' ', @options),
-        Auto =&gt; 1
-    );
-
-    foreach my $value (keys %values) {
-        $previousWindowsPostMortemDebuggerValues{$value} = readRegistryString(&quot;$windowsPostMortemDebuggerKey/$value&quot;);
-        next if writeRegistryString(&quot;$windowsPostMortemDebuggerKey/$value&quot;, $values{$value});
-
-        print &quot;Failed to set \&quot;$windowsPostMortemDebuggerKey/$value\&quot;. Crash logs will not be saved.\nSee &lt;http://trac.webkit.org/wiki/BuildingOnWindows#GettingCrashLogs&gt;.\n&quot;;
-        return;
-    }
-
-    print &quot;Crash logs will be saved to $testResultsDirectory.\n&quot;;
-}
-
-END {
-    return unless isCygwin();
-
-    foreach my $value (keys %previousWindowsPostMortemDebuggerValues) {
-        next if writeRegistryString(&quot;$windowsPostMortemDebuggerKey/$value&quot;, $previousWindowsPostMortemDebuggerValues{$value});
-        print &quot;Failed to restore \&quot;$windowsPostMortemDebuggerKey/$value\&quot; to its previous value \&quot;$previousWindowsPostMortemDebuggerValues{$value}\&quot;\n.&quot;;
-    }
-}
</del></span></pre>
</div>
</div>

</body>
</html>