<!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>[206934] 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/206934">206934</a></dd>
<dt>Author</dt> <dd>jbedard@apple.com</dd>
<dt>Date</dt> <dd>2016-10-07 14:06:43 -0700 (Fri, 07 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move functionality common to Darwin ports into a base class
https://bugs.webkit.org/show_bug.cgi?id=160709

Reviewed by Darin Adler.

* Scripts/webkitpy/port/apple.py:
(ApplePort.determine_full_port_name): Specific iOS port check.
(ApplePort.__init__): Move leak detector to DarwinPort.
(ApplePort._make_leak_detector): Moved to DarwinPort.
(ApplePort.supports_per_test_timeout): Moved to Port.
(ApplePort.check_for_leaks): Moved to DarwinPort.
(ApplePort.print_leaks_summary): Moved to DarwinPort.
(ApplePort._path_to_webcore_library): Moved to DarwinPort.
(ApplePort.show_results_html_file): Moved to DarwinPort.
(ApplePort._merge_crash_logs): Moved to DarwinPort.
(ApplePort._look_for_all_crash_logs_in_log_dir): Moved to DarwinPort.
(ApplePort._get_crash_log): Moved to DarwinPort.
(ApplePort.look_for_new_crash_logs): Moved to DarwinPort.
(ApplePort.sample_process): Moved to DarwinPort.
(ApplePort.sample_file_path): Moved to DarwinPort.
(ApplePort.look_for_new_samples): Moved to DarwinPort.
* Scripts/webkitpy/port/base.py:
(Port.supports_per_test_timeout): Return true for all ports.
* Scripts/webkitpy/port/darwin.py: Added.
(DarwinPort): Shared iOS and Mac functions.
* Scripts/webkitpy/port/darwin_testcase.py: Added.
(DarwinTest): Shared iOS and Mac testing.
* Scripts/webkitpy/port/efl.py:
(EflPort):
(EflPort.supports_per_test_timeout): Moved to Port.
* Scripts/webkitpy/port/gtk.py:
(GtkPort._driver_class):
(GtkPort):
(GtkPort.supports_per_test_timeout): Moved to Port.
* Scripts/webkitpy/port/ios.py:
(IOSPort):
(IOSPort.operating_system):
(IOSSimulatorPort):
(IOSSimulatorPort.__init__): Inherits from DarwinPort.
(IOSSimulatorPort._port_specific_expectations_files): Moved to DarwinPort.
(IOSSimulatorPort._get_crash_log): Deleted.
(IOSSimulatorPort.xcrun_find): Deleted.
* Scripts/webkitpy/port/ios_unittest.py: Added.
(iosTest): Unit tests for the iOS port.
* Scripts/webkitpy/port/mac.py:
(MacPort):
(MacPort.__init__): Inherits from DarwinPort.
(MacPort._port_specific_expectations_files): Moved to DarwinPort.
(MacPort.make_command): Moved to DarwinPort.
(MacPort._get_crash_log): Moved to DarwinPort.
(MacPort.nm_command): Moved to DarwinPort.
* Scripts/webkitpy/port/mac_unittest.py:
(MacTest):
(MacTest.test_sdk_name): Added test.
(MacTest.test_xcrun): Added test.
(MacTest.assert_skipped_file_search_paths): Moved to DarwinTest.
(MacTest.test_default_timeout_ms): Moved to DarwinTest.
(MacTest.assert_name): Moved to DarwinTest.
(MacTest.test_helper_starts): Moved to DarwinTest.
(MacTest.test_helper_fails_to_start): Moved to DarwinTest.
(MacTest.test_helper_fails_to_stop): Moved to DarwinTest.
(MacTest.test_spindump): Moved to DarwinTest.
(MacTest.test_sample_process): Moved to DarwinTest.
(MacTest.test_sample_process_exception): Moved to DarwinTest.
* Scripts/webkitpy/port/port_testcase.py:
(PortTestCase):
(PortTestCase.test_diff_image): Added is_simulator flag.
(PortTestCase.test_diff_image): Skip test if on a simulator.
(PortTestCase.test_diff_image_crashed): Skip test if on a simulator.
* Scripts/webkitpy/port/win.py:
(WinPort):
(WinPort.look_for_new_samples): Used default, ApplePort no longer implements.
(WinPort.sample_process): Ditto.
(WinPort._make_leak_detector): Ditto.
(WinPort.check_for_leaks): Ditto.
(WinPort.print_leaks_summary): Ditto.
(WinPort._path_to_webcore_library): Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptswebkitpyportapplepy">trunk/Tools/Scripts/webkitpy/port/apple.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportbasepy">trunk/Tools/Scripts/webkitpy/port/base.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyporteflpy">trunk/Tools/Scripts/webkitpy/port/efl.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportgtkpy">trunk/Tools/Scripts/webkitpy/port/gtk.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportiospy">trunk/Tools/Scripts/webkitpy/port/ios.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportmacpy">trunk/Tools/Scripts/webkitpy/port/mac.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportmac_unittestpy">trunk/Tools/Scripts/webkitpy/port/mac_unittest.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportport_testcasepy">trunk/Tools/Scripts/webkitpy/port/port_testcase.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportwinpy">trunk/Tools/Scripts/webkitpy/port/win.py</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsScriptswebkitpyportdarwinpy">trunk/Tools/Scripts/webkitpy/port/darwin.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportdarwin_testcasepy">trunk/Tools/Scripts/webkitpy/port/darwin_testcase.py</a></li>
<li><a href="#trunkToolsScriptswebkitpyportios_unittestpy">trunk/Tools/Scripts/webkitpy/port/ios_unittest.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (206933 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-10-07 20:56:00 UTC (rev 206933)
+++ trunk/Tools/ChangeLog        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -1,3 +1,83 @@
</span><ins>+2016-10-07  Jonathan Bedard  &lt;jbedard@apple.com&gt;
+
+        Move functionality common to Darwin ports into a base class
+        https://bugs.webkit.org/show_bug.cgi?id=160709
+
+        Reviewed by Darin Adler.
+
+        * Scripts/webkitpy/port/apple.py:
+        (ApplePort.determine_full_port_name): Specific iOS port check.
+        (ApplePort.__init__): Move leak detector to DarwinPort.
+        (ApplePort._make_leak_detector): Moved to DarwinPort.
+        (ApplePort.supports_per_test_timeout): Moved to Port.
+        (ApplePort.check_for_leaks): Moved to DarwinPort.
+        (ApplePort.print_leaks_summary): Moved to DarwinPort.
+        (ApplePort._path_to_webcore_library): Moved to DarwinPort.
+        (ApplePort.show_results_html_file): Moved to DarwinPort.
+        (ApplePort._merge_crash_logs): Moved to DarwinPort.
+        (ApplePort._look_for_all_crash_logs_in_log_dir): Moved to DarwinPort.
+        (ApplePort._get_crash_log): Moved to DarwinPort.
+        (ApplePort.look_for_new_crash_logs): Moved to DarwinPort.
+        (ApplePort.sample_process): Moved to DarwinPort.
+        (ApplePort.sample_file_path): Moved to DarwinPort.
+        (ApplePort.look_for_new_samples): Moved to DarwinPort.
+        * Scripts/webkitpy/port/base.py:
+        (Port.supports_per_test_timeout): Return true for all ports.
+        * Scripts/webkitpy/port/darwin.py: Added.
+        (DarwinPort): Shared iOS and Mac functions.
+        * Scripts/webkitpy/port/darwin_testcase.py: Added.
+        (DarwinTest): Shared iOS and Mac testing.
+        * Scripts/webkitpy/port/efl.py:
+        (EflPort):
+        (EflPort.supports_per_test_timeout): Moved to Port.
+        * Scripts/webkitpy/port/gtk.py:
+        (GtkPort._driver_class):
+        (GtkPort):
+        (GtkPort.supports_per_test_timeout): Moved to Port.
+        * Scripts/webkitpy/port/ios.py:
+        (IOSPort):
+        (IOSPort.operating_system):
+        (IOSSimulatorPort):
+        (IOSSimulatorPort.__init__): Inherits from DarwinPort.
+        (IOSSimulatorPort._port_specific_expectations_files): Moved to DarwinPort.
+        (IOSSimulatorPort._get_crash_log): Deleted.
+        (IOSSimulatorPort.xcrun_find): Deleted.
+        * Scripts/webkitpy/port/ios_unittest.py: Added.
+        (iosTest): Unit tests for the iOS port.
+        * Scripts/webkitpy/port/mac.py:
+        (MacPort):
+        (MacPort.__init__): Inherits from DarwinPort.
+        (MacPort._port_specific_expectations_files): Moved to DarwinPort.
+        (MacPort.make_command): Moved to DarwinPort.
+        (MacPort._get_crash_log): Moved to DarwinPort.
+        (MacPort.nm_command): Moved to DarwinPort.
+        * Scripts/webkitpy/port/mac_unittest.py:
+        (MacTest):
+        (MacTest.test_sdk_name): Added test.
+        (MacTest.test_xcrun): Added test.
+        (MacTest.assert_skipped_file_search_paths): Moved to DarwinTest.
+        (MacTest.test_default_timeout_ms): Moved to DarwinTest.
+        (MacTest.assert_name): Moved to DarwinTest.
+        (MacTest.test_helper_starts): Moved to DarwinTest.
+        (MacTest.test_helper_fails_to_start): Moved to DarwinTest.
+        (MacTest.test_helper_fails_to_stop): Moved to DarwinTest.
+        (MacTest.test_spindump): Moved to DarwinTest.
+        (MacTest.test_sample_process): Moved to DarwinTest.
+        (MacTest.test_sample_process_exception): Moved to DarwinTest.
+        * Scripts/webkitpy/port/port_testcase.py:
+        (PortTestCase):
+        (PortTestCase.test_diff_image): Added is_simulator flag.
+        (PortTestCase.test_diff_image): Skip test if on a simulator.
+        (PortTestCase.test_diff_image_crashed): Skip test if on a simulator.
+        * Scripts/webkitpy/port/win.py:
+        (WinPort):
+        (WinPort.look_for_new_samples): Used default, ApplePort no longer implements.
+        (WinPort.sample_process): Ditto.
+        (WinPort._make_leak_detector): Ditto.
+        (WinPort.check_for_leaks): Ditto.
+        (WinPort.print_leaks_summary): Ditto.
+        (WinPort._path_to_webcore_library): Ditto.
+
</ins><span class="cx"> 2016-10-07  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Get rid of WKPageSetSession
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportapplepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/apple.py (206933 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/apple.py        2016-10-07 20:56:00 UTC (rev 206933)
+++ trunk/Tools/Scripts/webkitpy/port/apple.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> from webkitpy.common.system.executive import ScriptError
</span><span class="cx"> from webkitpy.port.base import Port
</span><span class="cx"> from webkitpy.layout_tests.models.test_configuration import TestConfiguration
</span><del>-from webkitpy.port.leakdetector import LeakDetector
</del><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="lines">@@ -61,6 +60,11 @@
</span><span class="cx">     def determine_full_port_name(cls, host, options, port_name):
</span><span class="cx">         options = options or {}
</span><span class="cx">         if port_name in (cls.port_name, cls.port_name + '-wk2'):
</span><ins>+
+            # Since IOS simulator run on mac, they need a special check
+            if host.platform.os_name == 'mac' and 'ios-simulator' in port_name:
+                return port_name
+
</ins><span class="cx">             # If the port_name matches the (badly named) cls.port_name, that
</span><span class="cx">             # means that they passed 'mac' or 'win' and didn't specify a version.
</span><span class="cx">             # That convention means that we're supposed to use the version currently
</span><span class="lines">@@ -89,23 +93,11 @@
</span><span class="cx">         port_name = port_name.replace('-wk2', '')
</span><span class="cx">         self._version = self._strip_port_name_prefix(port_name)
</span><span class="cx"> 
</span><del>-        self._leak_detector = self._make_leak_detector()
-        if self.get_option(&quot;leaks&quot;):
-            # DumpRenderTree slows down noticably if we run more than about 1000 tests in a batch
-            # with MallocStackLogging enabled.
-            self.set_option_default(&quot;batch_size&quot;, 1000)
-
-    def _make_leak_detector(self):
-        return LeakDetector(self)
-
</del><span class="cx">     def default_timeout_ms(self):
</span><span class="cx">         if self.get_option('guard_malloc'):
</span><span class="cx">             return 350 * 1000
</span><span class="cx">         return super(ApplePort, self).default_timeout_ms()
</span><span class="cx"> 
</span><del>-    def supports_per_test_timeout(self):
-        return True
-
</del><span class="cx">     def should_retry_crashes(self):
</span><span class="cx">         return True
</span><span class="cx"> 
</span><span class="lines">@@ -129,113 +121,6 @@
</span><span class="cx">                     configurations.append(TestConfiguration(version=self._strip_port_name_prefix(port_name), architecture=architecture, build_type=build_type))
</span><span class="cx">         return configurations
</span><span class="cx"> 
</span><del>-    def check_for_leaks(self, process_name, process_pid):
-        if not self.get_option('leaks'):
-            return
-        # We could use http://code.google.com/p/psutil/ to get the process_name from the pid.
-        self._leak_detector.check_for_leaks(process_name, process_pid)
-
-    def print_leaks_summary(self):
-        if not self.get_option('leaks'):
-            return
-        # We're in the manager process, so the leak detector will not have a valid list of leak files.
-        # FIXME: This is a hack, but we don't have a better way to get this information from the workers yet.
-        # FIXME: This will include too many leaks in subsequent runs until the results directory is cleared!
-        leaks_files = self._leak_detector.leaks_files_in_directory(self.results_directory())
-        if not leaks_files:
-            return
-        total_bytes_string, unique_leaks = self._leak_detector.count_total_bytes_and_unique_leaks(leaks_files)
-        total_leaks = self._leak_detector.count_total_leaks(leaks_files)
-        _log.info(&quot;%s total leaks found for a total of %s.&quot; % (total_leaks, total_bytes_string))
-        _log.info(&quot;%s unique leaks found.&quot; % unique_leaks)
-
-    def _path_to_webcore_library(self):
-        return self._build_path('WebCore.framework/Versions/A/WebCore')
-
-    def show_results_html_file(self, results_filename):
-        # We don't use self._run_script() because we don't want to wait for the script
-        # to exit and we want the output to show up on stdout in case there are errors
-        # launching the browser.
-        self._executive.popen([self.path_to_script('run-safari')] + self._arguments_for_configuration() + ['--no-saved-state', '-NSOpen', results_filename],
-            cwd=self.webkit_base(), stdout=file(os.devnull), stderr=file(os.devnull))
-
-    def _merge_crash_logs(self, logs, new_logs, crashed_processes):
-        for test, crash_log in new_logs.iteritems():
-            try:
-                process_name = test.split(&quot;-&quot;)[0]
-                pid = int(test.split(&quot;-&quot;)[1])
-            except IndexError:
-                continue
-            if not any(entry[1] == process_name and entry[2] == pid for entry in crashed_processes):
-                # if this is a new crash, then append the logs
-                logs[test] = crash_log
-        return logs
-
-    def _look_for_all_crash_logs_in_log_dir(self, newer_than):
-        crash_log = CrashLogs(self.host)
-        return crash_log.find_all_logs(include_errors=True, newer_than=newer_than)
-
-    def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn, sleep_fn, wait_for_log):
-        return None
-
-    def look_for_new_crash_logs(self, crashed_processes, start_time):
-        &quot;&quot;&quot;Since crash logs can take a long time to be written out if the system is
-           under stress do a second pass at the end of the test run.
-
-           crashes: test_name -&gt; pid, process_name tuple of crashed process
-           start_time: time the tests started at.  We're looking for crash
-               logs after that time.
-        &quot;&quot;&quot;
-        crash_logs = {}
-        for (test_name, process_name, pid) in crashed_processes:
-            # Passing None for output.  This is a second pass after the test finished so
-            # if the output had any logging we would have already collected it.
-            crash_log = self._get_crash_log(process_name, pid, None, None, start_time, wait_for_log=False)[1]
-            if not crash_log:
-                continue
-            crash_logs[test_name] = crash_log
-        all_crash_log = self._look_for_all_crash_logs_in_log_dir(start_time)
-        return self._merge_crash_logs(crash_logs, all_crash_log, crashed_processes)
-
-    def sample_process(self, name, pid):
-        exit_status = self._executive.run_command([
-            &quot;/usr/bin/sudo&quot;,
-            &quot;-n&quot;,
-            &quot;/usr/sbin/spindump&quot;,
-            pid,
-            10,
-            10,
-            &quot;-file&quot;,
-            self.spindump_file_path(name, pid),
-        ], return_exit_code=True)
-        if exit_status:
-            try:
-                self._executive.run_command([
-                    &quot;/usr/bin/sample&quot;,
-                    pid,
-                    10,
-                    10,
-                    &quot;-file&quot;,
-                    self.sample_file_path(name, pid),
-                ])
-            except ScriptError as e:
-                _log.warning('Unable to sample process:' + str(e))
-
-    def sample_file_path(self, name, pid):
-        return self._filesystem.join(self.results_directory(), &quot;{0}-{1}-sample.txt&quot;.format(name, pid))
-
-    def spindump_file_path(self, name, pid):
-        return self._filesystem.join(self.results_directory(), &quot;{0}-{1}-spindump.txt&quot;.format(name, pid))
-
-    def look_for_new_samples(self, unresponsive_processes, start_time):
-        sample_files = {}
-        for (test_name, process_name, pid) in unresponsive_processes:
-            sample_file = self.sample_file_path(process_name, pid)
-            if not self._filesystem.isfile(sample_file):
-                continue
-            sample_files[test_name] = sample_file
-        return sample_files
-
</del><span class="cx">     def _path_to_helper(self):
</span><span class="cx">         binary_name = 'LayoutTestHelper'
</span><span class="cx">         return self._build_path(binary_name)
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportbasepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/base.py (206933 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/base.py        2016-10-07 20:56:00 UTC (rev 206933)
+++ trunk/Tools/Scripts/webkitpy/port/base.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -153,9 +153,7 @@
</span><span class="cx">         return []
</span><span class="cx"> 
</span><span class="cx">     def supports_per_test_timeout(self):
</span><del>-        # FIXME: Make per-test timeouts unconditional once all ports' DumpRenderTrees support that.
-        # Windows DumpRenderTree may be the only one remaining to be fixed at this time.
-        return False
</del><ins>+        return True
</ins><span class="cx"> 
</span><span class="cx">     def default_pixel_tests(self):
</span><span class="cx">         # FIXME: Disable until they are run by default on build.webkit.org.
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdarwinpyfromrev206932trunkToolsScriptswebkitpyportapplepy"></a>
<div class="copfile"><h4>Copied: trunk/Tools/Scripts/webkitpy/port/darwin.py (from rev 206932, trunk/Tools/Scripts/webkitpy/port/apple.py) (0 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/darwin.py                                (rev 0)
+++ trunk/Tools/Scripts/webkitpy/port/darwin.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -0,0 +1,176 @@
</span><ins>+# Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import logging
+import os
+import time
+
+from webkitpy.common.system.crashlogs import CrashLogs
+from webkitpy.common.system.executive import ScriptError
+from webkitpy.port.apple import ApplePort
+from webkitpy.port.leakdetector import LeakDetector
+
+
+_log = logging.getLogger(__name__)
+
+
+class DarwinPort(ApplePort):
+
+    SDK = None
+
+    def __init__(self, host, port_name, **kwargs):
+        ApplePort.__init__(self, host, port_name, **kwargs)
+
+        self._leak_detector = LeakDetector(self)
+        if self.get_option(&quot;leaks&quot;):
+            # DumpRenderTree slows down noticably if we run more than about 1000 tests in a batch
+            # with MallocStackLogging enabled.
+            self.set_option_default(&quot;batch_size&quot;, 1000)
+
+    def default_timeout_ms(self):
+        if self.get_option('guard_malloc'):
+            return 350 * 1000
+        return super(DarwinPort, self).default_timeout_ms()
+
+    def _port_specific_expectations_files(self):
+        return list(reversed([self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in self.baseline_search_path()]))
+
+    def check_for_leaks(self, process_name, process_pid):
+        if not self.get_option('leaks'):
+            return
+        # We could use http://code.google.com/p/psutil/ to get the process_name from the pid.
+        self._leak_detector.check_for_leaks(process_name, process_pid)
+
+    def print_leaks_summary(self):
+        if not self.get_option('leaks'):
+            return
+        # We're in the manager process, so the leak detector will not have a valid list of leak files.
+        # FIXME: This is a hack, but we don't have a better way to get this information from the workers yet.
+        # FIXME: This will include too many leaks in subsequent runs until the results directory is cleared!
+        leaks_files = self._leak_detector.leaks_files_in_directory(self.results_directory())
+        if not leaks_files:
+            return
+        total_bytes_string, unique_leaks = self._leak_detector.count_total_bytes_and_unique_leaks(leaks_files)
+        total_leaks = self._leak_detector.count_total_leaks(leaks_files)
+        _log.info(&quot;%s total leaks found for a total of %s.&quot; % (total_leaks, total_bytes_string))
+        _log.info(&quot;%s unique leaks found.&quot; % unique_leaks)
+
+    def _path_to_webcore_library(self):
+        return self._build_path('WebCore.framework/Versions/A/WebCore')
+
+    def show_results_html_file(self, results_filename):
+        # We don't use self._run_script() because we don't want to wait for the script
+        # to exit and we want the output to show up on stdout in case there are errors
+        # launching the browser.
+        self._executive.popen([self.path_to_script('run-safari')] + self._arguments_for_configuration() + ['--no-saved-state', '-NSOpen', results_filename],
+            cwd=self.webkit_base(), stdout=file(os.devnull), stderr=file(os.devnull))
+
+    def _merge_crash_logs(self, logs, new_logs, crashed_processes):
+        for test, crash_log in new_logs.iteritems():
+            try:
+                process_name = test.split(&quot;-&quot;)[0]
+                pid = int(test.split(&quot;-&quot;)[1])
+            except IndexError:
+                continue
+            if not any(entry[1] == process_name and entry[2] == pid for entry in crashed_processes):
+                # if this is a new crash, then append the logs
+                logs[test] = crash_log
+        return logs
+
+    def _look_for_all_crash_logs_in_log_dir(self, newer_than):
+        crash_log = CrashLogs(self.host)
+        return crash_log.find_all_logs(include_errors=True, newer_than=newer_than)
+
+    def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=None, sleep_fn=None, wait_for_log=True):
+        return None
+
+    def look_for_new_crash_logs(self, crashed_processes, start_time):
+        &quot;&quot;&quot;Since crash logs can take a long time to be written out if the system is
+           under stress do a second pass at the end of the test run.
+
+           crashes: test_name -&gt; pid, process_name tuple of crashed process
+           start_time: time the tests started at.  We're looking for crash
+               logs after that time.
+        &quot;&quot;&quot;
+        crash_logs = {}
+        for (test_name, process_name, pid) in crashed_processes:
+            # Passing None for output.  This is a second pass after the test finished so
+            # if the output had any logging we would have already collected it.
+            crash_log = self._get_crash_log(process_name, pid, None, None, start_time, wait_for_log=False)[1]
+            if not crash_log:
+                continue
+            crash_logs[test_name] = crash_log
+        all_crash_log = self._look_for_all_crash_logs_in_log_dir(start_time)
+        return self._merge_crash_logs(crash_logs, all_crash_log, crashed_processes)
+
+    def sample_process(self, name, pid):
+        exit_status = self._executive.run_command([
+            &quot;/usr/bin/sudo&quot;,
+            &quot;-n&quot;,
+            &quot;/usr/sbin/spindump&quot;,
+            pid,
+            10,
+            10,
+            &quot;-file&quot;,
+            self.spindump_file_path(name, pid),
+        ], return_exit_code=True)
+        if exit_status:
+            try:
+                self._executive.run_command([
+                    &quot;/usr/bin/sample&quot;,
+                    pid,
+                    10,
+                    10,
+                    &quot;-file&quot;,
+                    self.sample_file_path(name, pid),
+                ])
+            except ScriptError as e:
+                _log.warning('Unable to sample process:' + str(e))
+
+    def sample_file_path(self, name, pid):
+        return self._filesystem.join(self.results_directory(), &quot;{0}-{1}-sample.txt&quot;.format(name, pid))
+
+    def spindump_file_path(self, name, pid):
+        return self._filesystem.join(self.results_directory(), &quot;{0}-{1}-spindump.txt&quot;.format(name, pid))
+
+    def look_for_new_samples(self, unresponsive_processes, start_time):
+        sample_files = {}
+        for (test_name, process_name, pid) in unresponsive_processes:
+            sample_file = self.sample_file_path(process_name, pid)
+            if not self._filesystem.isfile(sample_file):
+                continue
+            sample_files[test_name] = sample_file
+        return sample_files
+
+    def make_command(self):
+        return self.xcrun_find('make', '/usr/bin/make')
+
+    def nm_command(self):
+        return self.xcrun_find('nm', 'nm')
+
+    def xcrun_find(self, command, fallback=None):
+        fallback = fallback or command
+        try:
+            return self._executive.run_command(['xcrun', '--sdk', self.SDK, '-find', command]).rstrip()
+        except ScriptError:
+            _log.warn(&quot;xcrun failed; falling back to '%s'.&quot; % fallback)
+            return fallback
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpyportdarwin_testcasepy"></a>
<div class="addfile"><h4>Added: trunk/Tools/Scripts/webkitpy/port/darwin_testcase.py (0 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/darwin_testcase.py                                (rev 0)
+++ trunk/Tools/Scripts/webkitpy/port/darwin_testcase.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -0,0 +1,121 @@
</span><ins>+# Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from webkitpy.port import port_testcase
+from webkitpy.common.system.filesystem_mock import MockFileSystem
+from webkitpy.common.system.outputcapture import OutputCapture
+from webkitpy.tool.mocktool import MockOptions
+from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2, MockProcess, ScriptError
+from webkitpy.common.system.systemhost_mock import MockSystemHost
+
+
+class DarwinTest(port_testcase.PortTestCase):
+
+    def assert_skipped_file_search_paths(self, port_name, expected_paths, use_webkit2=False):
+        port = self.make_port(port_name=port_name, options=MockOptions(webkit_test_runner=use_webkit2))
+        self.assertEqual(port._skipped_file_search_paths(), expected_paths)
+
+    def test_default_timeout_ms(self):
+        super(DarwinTest, self).test_default_timeout_ms()
+        self.assertEqual(self.make_port(options=MockOptions(guard_malloc=True)).default_timeout_ms(), 350000)
+
+    def assert_name(self, port_name, os_version_string, expected):
+        host = MockSystemHost(os_name=self.os_name, os_version=os_version_string)
+        port = self.make_port(host=host, port_name=port_name)
+        self.assertEqual(expected, port.name())
+
+    def test_show_results_html_file(self):
+        port = self.make_port()
+        # Delay setting a should_log executive to avoid logging from MacPort.__init__.
+        port._executive = MockExecutive(should_log=True)
+        expected_logs = &quot;MOCK popen: ['Tools/Scripts/run-safari', '--release', '--no-saved-state', '-NSOpen', 'test.html'], cwd=/mock-checkout\n&quot;
+        OutputCapture().assert_outputs(self, port.show_results_html_file, [&quot;test.html&quot;], expected_logs=expected_logs)
+
+    def test_helper_starts(self):
+        host = MockSystemHost(MockExecutive())
+        port = self.make_port(host)
+        oc = OutputCapture()
+        oc.capture_output()
+        host.executive._proc = MockProcess('ready\n')
+        port.start_helper()
+        port.stop_helper()
+        oc.restore_output()
+
+        # make sure trying to stop the helper twice is safe.
+        port.stop_helper()
+
+    def test_helper_fails_to_start(self):
+        host = MockSystemHost(MockExecutive())
+        port = self.make_port(host)
+        oc = OutputCapture()
+        oc.capture_output()
+        port.start_helper()
+        port.stop_helper()
+        oc.restore_output()
+
+    def test_helper_fails_to_stop(self):
+        host = MockSystemHost(MockExecutive())
+        host.executive._proc = MockProcess()
+
+        def bad_waiter():
+            raise IOError('failed to wait')
+        host.executive._proc.wait = bad_waiter
+
+        port = self.make_port(host)
+        oc = OutputCapture()
+        oc.capture_output()
+        port.start_helper()
+        port.stop_helper()
+        oc.restore_output()
+
+    def test_spindump(self):
+
+        def logging_run_command(args):
+            print args
+
+        port = self.make_port()
+        port._executive = MockExecutive2(run_command_fn=logging_run_command)
+        expected_stdout = &quot;['/usr/bin/sudo', '-n', '/usr/sbin/spindump', 42, 10, 10, '-file', '/mock-build/layout-test-results/test-42-spindump.txt']\n&quot;
+        OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42], expected_stdout=expected_stdout)
+
+    def test_sample_process(self):
+
+        def logging_run_command(args):
+            if args[0] == '/usr/bin/sudo':
+                return 1
+            print args
+            return 0
+
+        port = self.make_port()
+        port._executive = MockExecutive2(run_command_fn=logging_run_command)
+        expected_stdout = &quot;['/usr/bin/sample', 42, 10, 10, '-file', '/mock-build/layout-test-results/test-42-sample.txt']\n&quot;
+        OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42], expected_stdout=expected_stdout)
+
+    def test_sample_process_exception(self):
+        def throwing_run_command(args):
+            if args[0] == '/usr/bin/sudo':
+                return 1
+            raise ScriptError(&quot;MOCK script error&quot;)
+
+        port = self.make_port()
+        port._executive = MockExecutive2(run_command_fn=throwing_run_command)
+        OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42])
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpyporteflpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/efl.py (206933 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/efl.py        2016-10-07 20:56:00 UTC (rev 206933)
+++ trunk/Tools/Scripts/webkitpy/port/efl.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -80,9 +80,6 @@
</span><span class="cx"> 
</span><span class="cx">         return env
</span><span class="cx"> 
</span><del>-    def supports_per_test_timeout(self):
-        return True
-
</del><span class="cx">     def default_timeout_ms(self):
</span><span class="cx">         # Tests run considerably slower under gdb
</span><span class="cx">         # or valgrind.
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportgtkpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/gtk.py (206933 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/gtk.py        2016-10-07 20:56:00 UTC (rev 206933)
+++ trunk/Tools/Scripts/webkitpy/port/gtk.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -86,9 +86,6 @@
</span><span class="cx">             return XorgDriver
</span><span class="cx">         return XvfbDriver
</span><span class="cx"> 
</span><del>-    def supports_per_test_timeout(self):
-        return True
-
</del><span class="cx">     def default_timeout_ms(self):
</span><span class="cx">         # Starting an application under Valgrind takes a lot longer than normal
</span><span class="cx">         # so increase the timeout (empirically 10x is enough to avoid timeouts).
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportiospy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/ios.py (206933 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/ios.py        2016-10-07 20:56:00 UTC (rev 206933)
+++ trunk/Tools/Scripts/webkitpy/port/ios.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -29,20 +29,19 @@
</span><span class="cx"> import time
</span><span class="cx"> 
</span><span class="cx"> from webkitpy.common.memoized import memoized
</span><del>-from webkitpy.common.system.crashlogs import CrashLogs
</del><span class="cx"> from webkitpy.common.system.executive import ScriptError
</span><span class="cx"> from webkitpy.layout_tests.models.test_configuration import TestConfiguration
</span><span class="cx"> from webkitpy.port import config as port_config
</span><span class="cx"> from webkitpy.port import driver, image_diff
</span><del>-from webkitpy.port.apple import ApplePort
-from webkitpy.port.base import Port
</del><ins>+from webkitpy.port.darwin import DarwinPort
</ins><span class="cx"> from webkitpy.xcode.simulator import Simulator, Runtime, DeviceType
</span><ins>+from webkitpy.common.system.crashlogs import CrashLogs
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-class IOSPort(ApplePort):
</del><ins>+class IOSPort(DarwinPort):
</ins><span class="cx">     port_name = &quot;ios&quot;
</span><span class="cx"> 
</span><span class="cx">     ARCHITECTURES = ['armv7', 'armv7s', 'arm64']
</span><span class="lines">@@ -67,7 +66,7 @@
</span><span class="cx">         return 'ios'
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-class IOSSimulatorPort(ApplePort):
</del><ins>+class IOSSimulatorPort(DarwinPort):
</ins><span class="cx">     port_name = &quot;ios-simulator&quot;
</span><span class="cx"> 
</span><span class="cx">     FUTURE_VERSION = 'future'
</span><span class="lines">@@ -76,6 +75,7 @@
</span><span class="cx"> 
</span><span class="cx">     DEFAULT_DEVICE_CLASS = 'iphone'
</span><span class="cx">     CUSTOM_DEVICE_CLASSES = ['ipad']
</span><ins>+    SDK = 'iphonesimulator'
</ins><span class="cx"> 
</span><span class="cx">     SIMULATOR_BUNDLE_ID = 'com.apple.iphonesimulator'
</span><span class="cx">     relay_name = 'LayoutTestRelay'
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     def __init__(self, host, port_name, **kwargs):
</span><del>-        super(IOSSimulatorPort, self).__init__(host, port_name, **kwargs)
</del><ins>+        DarwinPort.__init__(self, host, port_name, **kwargs)
</ins><span class="cx"> 
</span><span class="cx">         optional_device_class = self.get_option('device_class')
</span><span class="cx">         self._printing_cmd_line = False
</span><span class="lines">@@ -228,9 +228,6 @@
</span><span class="cx"> 
</span><span class="cx">         return map(self._webkit_baseline_path, fallback_names)
</span><span class="cx"> 
</span><del>-    def _port_specific_expectations_files(self):
-        return list(reversed([self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in self.baseline_search_path()]))
-
</del><span class="cx">     def _set_device_class(self, device_class):
</span><span class="cx">         self._device_class = device_class if device_class else self.DEFAULT_DEVICE_CLASS
</span><span class="cx"> 
</span><span class="lines">@@ -343,44 +340,6 @@
</span><span class="cx"> 
</span><span class="cx">     SUBPROCESS_CRASH_REGEX = re.compile('#CRASHED - (?P&lt;subprocess_name&gt;\S+) \(pid (?P&lt;subprocess_pid&gt;\d+)\)')
</span><span class="cx"> 
</span><del>-    def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=time.time, sleep_fn=time.sleep, wait_for_log=True):
-        time_fn = time_fn or time.time
-        sleep_fn = sleep_fn or time.sleep
-
-        # FIXME: We should collect the actual crash log for DumpRenderTree.app because it includes more
-        # information (e.g. exception codes) than is available in the stack trace written to standard error.
-        stderr_lines = []
-        crashed_subprocess_name_and_pid = None  # e.g. ('DumpRenderTree.app', 1234)
-        for line in (stderr or '').splitlines():
-            if not crashed_subprocess_name_and_pid:
-                match = self.SUBPROCESS_CRASH_REGEX.match(line)
-                if match:
-                    crashed_subprocess_name_and_pid = (match.group('subprocess_name'), int(match.group('subprocess_pid')))
-                    continue
-            stderr_lines.append(line)
-
-        if crashed_subprocess_name_and_pid:
-            return self._get_crash_log(crashed_subprocess_name_and_pid[0], crashed_subprocess_name_and_pid[1], stdout,
-                '\n'.join(stderr_lines), newer_than, time_fn, sleep_fn, wait_for_log)
-
-        # LayoutTestRelay crashed
-        _log.debug('looking for crash log for %s:%s' % (name, str(pid)))
-        crash_log = ''
-        crash_logs = CrashLogs(self.host)
-        now = time_fn()
-        deadline = now + 5 * int(self.get_option('child_processes', 1))
-        while not crash_log and now &lt;= deadline:
-            crash_log = crash_logs.find_newest_log(name, pid, include_errors=True, newer_than=newer_than)
-            if not wait_for_log:
-                break
-            if not crash_log or not [line for line in crash_log.splitlines() if not line.startswith('ERROR')]:
-                sleep_fn(0.1)
-                now = time_fn()
-
-        if not crash_log:
-            return stderr, None
-        return stderr, crash_log
-
</del><span class="cx">     def _create_device(self, number):
</span><span class="cx">         return Simulator.create_device(number, self.simulator_device_type(), self.simulator_runtime)
</span><span class="cx"> 
</span><span class="lines">@@ -419,14 +378,6 @@
</span><span class="cx">     def nm_command(self):
</span><span class="cx">         return self.xcrun_find('nm')
</span><span class="cx"> 
</span><del>-    def xcrun_find(self, command, fallback=None):
-        fallback = fallback or command
-        try:
-            return self._executive.run_command(['xcrun', '--sdk', 'iphonesimulator', '-find', command]).rstrip()
-        except ScriptError:
-            _log.warn(&quot;xcrun failed; falling back to '%s'.&quot; % fallback)
-            return fallback
-
</del><span class="cx">     @property
</span><span class="cx">     @memoized
</span><span class="cx">     def developer_dir(self):
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportios_unittestpy"></a>
<div class="addfile"><h4>Added: trunk/Tools/Scripts/webkitpy/port/ios_unittest.py (0 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/ios_unittest.py                                (rev 0)
+++ trunk/Tools/Scripts/webkitpy/port/ios_unittest.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -0,0 +1,99 @@
</span><ins>+# Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1.  Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+# 2.  Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+import time
+
+from webkitpy.port.ios import IOSSimulatorPort
+from webkitpy.port import darwin_testcase
+from webkitpy.common.system.filesystem_mock import MockFileSystem
+from webkitpy.common.system.outputcapture import OutputCapture
+from webkitpy.tool.mocktool import MockOptions
+from webkitpy.common.system.executive_mock import MockExecutive, MockExecutive2, MockProcess, ScriptError
+from webkitpy.common.system.systemhost_mock import MockSystemHost
+
+
+class iosTest(darwin_testcase.DarwinTest):
+    os_name = 'ios-simulator'
+    os_version = ''
+    port_name = 'ios-simulator'
+    port_maker = IOSSimulatorPort
+    is_simulator = True
+
+    def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
+        port = super(iosTest, self).make_port(host=host, port_name=port_name, options=options, os_name=os_name, s_version=os_version, kwargs=kwargs)
+        port.set_option('child_processes', 1)
+        return port
+
+    def test_setup_environ_for_server(self):
+        port = self.make_port(options=MockOptions(leaks=True, guard_malloc=True))
+        env = port.setup_environ_for_server(port.driver_name())
+        self.assertEqual(env['MallocStackLogging'], '1')
+        self.assertEqual(env['MallocScribble'], '1')
+        self.assertEqual(env['DYLD_INSERT_LIBRARIES'], '/usr/lib/libgmalloc.dylib')
+
+    def test_operating_system(self):
+        self.assertEqual('ios-simulator', self.make_port().operating_system())
+
+    def test_get_crash_log(self):
+        # Mac crash logs are tested elsewhere, so here we just make sure we don't crash.
+        def fake_time_cb():
+            times = [0, 20, 40]
+            return lambda: times.pop(0)
+        port = self.make_port(port_name='ios-simulator')
+        port._get_crash_log('DumpRenderTree', 1234, None, None, time.time(), wait_for_log=False)
+
+    def test_32bit(self):
+        port = self.make_port(options=MockOptions(architecture='x86'))
+
+        def run_script(script, args=None, env=None):
+            self.args = args
+
+        port._run_script = run_script
+        self.assertEqual(port.architecture(), 'x86')
+        port._build_driver()
+        self.assertEqual(self.args, ['--ios-simulator'])
+
+    def test_64bit(self):
+        # Apple Mac port is 64-bit by default
+        port = self.make_port()
+        self.assertEqual(port.architecture(), 'x86_64')
+
+        def run_script(script, args=None, env=None):
+            self.args = args
+
+        port._run_script = run_script
+        port._build_driver()
+        self.assertEqual(self.args, ['--ios-simulator'])
+
+    def test_sdk_name(self):
+        port = self.make_port()
+        self.assertEqual(port.SDK, 'iphonesimulator')
+
+    def test_xcrun(self):
+        def throwing_run_command(args):
+            print args
+            raise ScriptError(&quot;MOCK script error&quot;)
+
+        port = self.make_port()
+        port._executive = MockExecutive2(run_command_fn=throwing_run_command)
+        expected_stdout = &quot;['xcrun', '--sdk', 'iphonesimulator', '-find', 'test']\n&quot;
+        OutputCapture().assert_outputs(self, port.xcrun_find, args=['test', 'falling'], expected_stdout=expected_stdout)
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpyportmacpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/mac.py (206933 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/mac.py        2016-10-07 20:56:00 UTC (rev 206933)
+++ trunk/Tools/Scripts/webkitpy/port/mac.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -34,15 +34,16 @@
</span><span class="cx"> 
</span><span class="cx"> from webkitpy.common.system.crashlogs import CrashLogs
</span><span class="cx"> from webkitpy.common.system.executive import ScriptError
</span><del>-from webkitpy.port.apple import ApplePort
</del><ins>+from webkitpy.port.darwin import DarwinPort
</ins><span class="cx"> 
</span><span class="cx"> _log = logging.getLogger(__name__)
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-class MacPort(ApplePort):
</del><ins>+class MacPort(DarwinPort):
</ins><span class="cx">     port_name = &quot;mac&quot;
</span><span class="cx"> 
</span><span class="cx">     VERSION_FALLBACK_ORDER = ['mac-snowleopard', 'mac-lion', 'mac-mountainlion', 'mac-mavericks', 'mac-yosemite', 'mac-elcapitan', 'mac-sierra']
</span><ins>+    SDK = 'macosx'
</ins><span class="cx"> 
</span><span class="cx">     ARCHITECTURES = ['x86_64', 'x86']
</span><span class="cx"> 
</span><span class="lines">@@ -49,7 +50,7 @@
</span><span class="cx">     DEFAULT_ARCHITECTURE = 'x86_64'
</span><span class="cx"> 
</span><span class="cx">     def __init__(self, host, port_name, **kwargs):
</span><del>-        super(MacPort, self).__init__(host, port_name, **kwargs)
</del><ins>+        DarwinPort.__init__(self, host, port_name, **kwargs)
</ins><span class="cx"> 
</span><span class="cx">     def _build_driver_flags(self):
</span><span class="cx">         return ['ARCHS=i386'] if self.architecture() == 'x86' else []
</span><span class="lines">@@ -66,9 +67,6 @@
</span><span class="cx">             fallback_names = [self._wk2_port_name(), 'wk2'] + fallback_names
</span><span class="cx">         return map(self._webkit_baseline_path, fallback_names)
</span><span class="cx"> 
</span><del>-    def _port_specific_expectations_files(self):
-        return list(reversed([self._filesystem.join(self._webkit_baseline_path(p), 'TestExpectations') for p in self.baseline_search_path()]))
-
</del><span class="cx">     def configuration_specifier_macros(self):
</span><span class="cx">         return {
</span><span class="cx">             &quot;sierra+&quot;: [&quot;sierra&quot;, &quot;future&quot;],
</span><span class="lines">@@ -152,9 +150,6 @@
</span><span class="cx">             supportable_instances = default_count
</span><span class="cx">         return min(supportable_instances, default_count)
</span><span class="cx"> 
</span><del>-    def make_command(self):
-        return self.xcrun_find('make', '/usr/bin/make')
-
</del><span class="cx">     def _build_java_test_support(self):
</span><span class="cx">         # FIXME: This is unused. Remove.
</span><span class="cx">         java_tests_path = self._filesystem.join(self.layout_tests_dir(), &quot;java&quot;)
</span><span class="lines">@@ -167,31 +162,6 @@
</span><span class="cx">     def _check_port_build(self):
</span><span class="cx">         return not self.get_option('java') or self._build_java_test_support()
</span><span class="cx"> 
</span><del>-    def _get_crash_log(self, name, pid, stdout, stderr, newer_than, time_fn=None, sleep_fn=None, wait_for_log=True):
-        # Note that we do slow-spin here and wait, since it appears the time
-        # ReportCrash takes to actually write and flush the file varies when there are
-        # lots of simultaneous crashes going on.
-        # FIXME: Should most of this be moved into CrashLogs()?
-        time_fn = time_fn or time.time
-        sleep_fn = sleep_fn or time.sleep
-        crash_log = ''
-        crash_logs = CrashLogs(self.host)
-        now = time_fn()
-        # FIXME: delete this after we're sure this code is working ...
-        _log.debug('looking for crash log for %s:%s' % (name, str(pid)))
-        deadline = now + 5 * int(self.get_option('child_processes', 1))
-        while not crash_log and now &lt;= deadline:
-            crash_log = crash_logs.find_newest_log(name, pid, include_errors=True, newer_than=newer_than)
-            if not wait_for_log:
-                break
-            if not crash_log or not [line for line in crash_log.splitlines() if not line.startswith('ERROR')]:
-                sleep_fn(0.1)
-                now = time_fn()
-
-        if not crash_log:
-            return (stderr, None)
-        return (stderr, crash_log)
-
</del><span class="cx">     def start_helper(self, pixel_tests=False):
</span><span class="cx">         helper_path = self._path_to_helper()
</span><span class="cx">         if not helper_path:
</span><span class="lines">@@ -229,16 +199,6 @@
</span><span class="cx">                 _log.debug(&quot;IOError raised while stopping helper: %s&quot; % str(e))
</span><span class="cx">             self._helper = None
</span><span class="cx"> 
</span><del>-    def nm_command(self):
-        return self.xcrun_find('nm', 'nm')
-
-    def xcrun_find(self, command, fallback):
-        try:
-            return self._executive.run_command(['xcrun', '-find', command]).rstrip()
-        except ScriptError:
-            _log.warn(&quot;xcrun failed; falling back to '%s'.&quot; % fallback)
-            return fallback
-
</del><span class="cx">     def logging_patterns_to_strip(self):
</span><span class="cx">         # FIXME: Remove this after &lt;rdar://problem/15605007&gt; is fixed
</span><span class="cx">         return [(re.compile('(AVF|GVA) info:.*\n'), '')]
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportmac_unittestpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/mac_unittest.py (206933 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/mac_unittest.py        2016-10-07 20:56:00 UTC (rev 206933)
+++ trunk/Tools/Scripts/webkitpy/port/mac_unittest.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> # Copyright (C) 2010 Google Inc. All rights reserved.
</span><ins>+# Copyright (C) 2014-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="cx"> # modification, are permitted provided that the following conditions are
</span><span class="lines">@@ -26,8 +27,10 @@
</span><span class="cx"> # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> 
</span><ins>+import time
+
</ins><span class="cx"> from webkitpy.port.mac import MacPort
</span><del>-from webkitpy.port import port_testcase
</del><ins>+from webkitpy.port import darwin_testcase
</ins><span class="cx"> from webkitpy.common.system.filesystem_mock import MockFileSystem
</span><span class="cx"> from webkitpy.common.system.outputcapture import OutputCapture
</span><span class="cx"> from webkitpy.tool.mocktool import MockOptions
</span><span class="lines">@@ -35,25 +38,12 @@
</span><span class="cx"> from webkitpy.common.system.systemhost_mock import MockSystemHost
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-class MacTest(port_testcase.PortTestCase):
</del><ins>+class MacTest(darwin_testcase.DarwinTest):
</ins><span class="cx">     os_name = 'mac'
</span><span class="cx">     os_version = 'lion'
</span><span class="cx">     port_name = 'mac-lion'
</span><span class="cx">     port_maker = MacPort
</span><span class="cx"> 
</span><del>-    def assert_skipped_file_search_paths(self, port_name, expected_paths, use_webkit2=False):
-        port = self.make_port(port_name=port_name, options=MockOptions(webkit_test_runner=use_webkit2))
-        self.assertEqual(port._skipped_file_search_paths(), expected_paths)
-
-    def test_default_timeout_ms(self):
-        super(MacTest, self).test_default_timeout_ms()
-        self.assertEqual(self.make_port(options=MockOptions(guard_malloc=True)).default_timeout_ms(), 350000)
-
-    def assert_name(self, port_name, os_version_string, expected):
-        host = MockSystemHost(os_name='mac', os_version=os_version_string)
-        port = self.make_port(host=host, port_name=port_name)
-        self.assertEqual(expected, port.name())
-
</del><span class="cx">     def test_tests_for_other_platforms(self):
</span><span class="cx">         platforms = ['mac', 'mac-snowleopard']
</span><span class="cx">         port = self.make_port(port_name='mac-snowleopard')
</span><span class="lines">@@ -157,79 +147,8 @@
</span><span class="cx">             times = [0, 20, 40]
</span><span class="cx">             return lambda: times.pop(0)
</span><span class="cx">         port = self.make_port(port_name='mac-snowleopard')
</span><del>-        port._get_crash_log('DumpRenderTree', 1234, '', '', 0,
-            time_fn=fake_time_cb(), sleep_fn=lambda delay: None)
</del><ins>+        port._get_crash_log('DumpRenderTree', 1234, None, None, time.time(), wait_for_log=False)
</ins><span class="cx"> 
</span><del>-    def test_helper_starts(self):
-        host = MockSystemHost(MockExecutive())
-        port = self.make_port(host)
-        oc = OutputCapture()
-        oc.capture_output()
-        host.executive._proc = MockProcess('ready\n')
-        port.start_helper()
-        port.stop_helper()
-        oc.restore_output()
-
-        # make sure trying to stop the helper twice is safe.
-        port.stop_helper()
-
-    def test_helper_fails_to_start(self):
-        host = MockSystemHost(MockExecutive())
-        port = self.make_port(host)
-        oc = OutputCapture()
-        oc.capture_output()
-        port.start_helper()
-        port.stop_helper()
-        oc.restore_output()
-
-    def test_helper_fails_to_stop(self):
-        host = MockSystemHost(MockExecutive())
-        host.executive._proc = MockProcess()
-
-        def bad_waiter():
-            raise IOError('failed to wait')
-        host.executive._proc.wait = bad_waiter
-
-        port = self.make_port(host)
-        oc = OutputCapture()
-        oc.capture_output()
-        port.start_helper()
-        port.stop_helper()
-        oc.restore_output()
-
-    def test_spindump(self):
-
-        def logging_run_command(args):
-            print args
-
-        port = self.make_port()
-        port._executive = MockExecutive2(run_command_fn=logging_run_command)
-        expected_stdout = &quot;['/usr/bin/sudo', '-n', '/usr/sbin/spindump', 42, 10, 10, '-file', '/mock-build/layout-test-results/test-42-spindump.txt']\n&quot;
-        OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42], expected_stdout=expected_stdout)
-
-    def test_sample_process(self):
-
-        def logging_run_command(args):
-            if args[0] == '/usr/bin/sudo':
-                return 1
-            print args
-            return 0
-
-        port = self.make_port()
-        port._executive = MockExecutive2(run_command_fn=logging_run_command)
-        expected_stdout = &quot;['/usr/bin/sample', 42, 10, 10, '-file', '/mock-build/layout-test-results/test-42-sample.txt']\n&quot;
-        OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42], expected_stdout=expected_stdout)
-
-    def test_sample_process_exception(self):
-        def throwing_run_command(args):
-            if args[0] == '/usr/bin/sudo':
-                return 1
-            raise ScriptError(&quot;MOCK script error&quot;)
-
-        port = self.make_port()
-        port._executive = MockExecutive2(run_command_fn=throwing_run_command)
-        OutputCapture().assert_outputs(self, port.sample_process, args=['test', 42])
-
</del><span class="cx">     def test_32bit(self):
</span><span class="cx">         port = self.make_port(options=MockOptions(architecture='x86'))
</span><span class="cx"> 
</span><span class="lines">@@ -252,3 +171,17 @@
</span><span class="cx">         port._run_script = run_script
</span><span class="cx">         port._build_driver()
</span><span class="cx">         self.assertEqual(self.args, [])
</span><ins>+
+    def test_sdk_name(self):
+        port = self.make_port()
+        self.assertEqual(port.SDK, 'macosx')
+
+    def test_xcrun(self):
+        def throwing_run_command(args):
+            print args
+            raise ScriptError(&quot;MOCK script error&quot;)
+
+        port = self.make_port()
+        port._executive = MockExecutive2(run_command_fn=throwing_run_command)
+        expected_stdout = &quot;['xcrun', '--sdk', 'macosx', '-find', 'test']\n&quot;
+        OutputCapture().assert_outputs(self, port.xcrun_find, args=['test', 'falling'], expected_stdout=expected_stdout)
</ins></span></pre></div>
<a id="trunkToolsScriptswebkitpyportport_testcasepy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/port_testcase.py (206933 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/port_testcase.py        2016-10-07 20:56:00 UTC (rev 206933)
+++ trunk/Tools/Scripts/webkitpy/port/port_testcase.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><span class="cx"> # Copyright (C) 2010 Google Inc. All rights reserved.
</span><ins>+# Copyright (C) 2014-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="cx"> # modification, are permitted provided that the following conditions are
</span><span class="lines">@@ -81,6 +82,7 @@
</span><span class="cx">     os_version = None
</span><span class="cx">     port_maker = TestWebKitPort
</span><span class="cx">     port_name = None
</span><ins>+    is_simulator = False
</ins><span class="cx"> 
</span><span class="cx">     def make_port(self, host=None, port_name=None, options=None, os_name=None, os_version=None, **kwargs):
</span><span class="cx">         host = host or MockSystemHost(os_name=(os_name or self.os_name), os_version=(os_version or self.os_version))
</span><span class="lines">@@ -250,6 +252,10 @@
</span><span class="cx">             self.proc = MockServerProcess(port, nm, cmd, env, lines=['diff: 100% failed\n', 'diff: 100% failed\n'])
</span><span class="cx">             return self.proc
</span><span class="cx"> 
</span><ins>+        # FIXME: Can't pretend to run a simulator's setup, so just skip this test.
+        if self.is_simulator:
+            return
+
</ins><span class="cx">         port._server_process_constructor = make_proc
</span><span class="cx">         port.setup_test_run()
</span><span class="cx">         self.assertEqual(port.diff_image('foo', 'bar'), ('', 100.0, None))
</span><span class="lines">@@ -273,6 +279,10 @@
</span><span class="cx">             self.proc = MockServerProcess(port, nm, cmd, env, crashed=True)
</span><span class="cx">             return self.proc
</span><span class="cx"> 
</span><ins>+        # FIXME: Can't pretend to run a simulator's setup, so just skip this test.
+        if self.is_simulator:
+            return
+
</ins><span class="cx">         port._server_process_constructor = make_proc
</span><span class="cx">         port.setup_test_run()
</span><span class="cx">         self.assertEqual(port.diff_image('foo', 'bar'), ('', 0, 'ImageDiff crashed\n'))
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportwinpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/win.py (206933 => 206934)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/win.py        2016-10-07 20:56:00 UTC (rev 206933)
+++ trunk/Tools/Scripts/webkitpy/port/win.py        2016-10-07 21:06:43 UTC (rev 206934)
</span><span class="lines">@@ -404,28 +404,6 @@
</span><span class="cx">                 crash_logs[test_name] = crash_log
</span><span class="cx">         return crash_logs
</span><span class="cx"> 
</span><del>-    def look_for_new_samples(self, unresponsive_processes, start_time):
-        # No sampling on Windows.
-        pass
-
-    def sample_process(self, name, pid):
-        # No sampling on Windows.
-        pass
-
-    def _make_leak_detector(self):
-        return None
-
-    def check_for_leaks(self, process_name, process_pid):
-        # No leak checking on Windows.
-        pass
-
-    def print_leaks_summary(self):
-        # No leak checking on Windows.
-        pass
-
-    def _path_to_webcore_library(self):
-        return None
-
</del><span class="cx">     def find_system_pid(self, name, pid):
</span><span class="cx">         system_pid = int(pid)
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>