<!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>[175401] 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/175401">175401</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2014-10-30 17:26:56 -0700 (Thu, 30 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>bisect-builds should support WebKit clients other than Safari
https://bugs.webkit.org/show_bug.cgi?id=138225

This patch adds support for bisecting WebKit nightly builds with clients other than Safari.

The -a / --application optional argument allows the user to specify which application (or application bundle)
should be run against the WebKit nightly builds.

Reviewed by David Kilzer.

* Scripts/bisect-builds:
Swap out $safariPath for the more general $applicationPath
Leave --safari-path as a commandline option for backwards compatibility
(mountAndRunNightly):
Use File::Spec-&gt;cat correctly (one directory per argument)
Use open --wait-apps instead of running the target application directly</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsbisectbuilds">trunk/Tools/Scripts/bisect-builds</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (175400 => 175401)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-10-31 00:18:21 UTC (rev 175400)
+++ trunk/Tools/ChangeLog        2014-10-31 00:26:56 UTC (rev 175401)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-10-30  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        bisect-builds should support WebKit clients other than Safari
+        https://bugs.webkit.org/show_bug.cgi?id=138225
+
+        This patch adds support for bisecting WebKit nightly builds with clients other than Safari.
+
+        The -a / --application optional argument allows the user to specify which application (or application bundle)
+        should be run against the WebKit nightly builds.
+
+        Reviewed by David Kilzer.
+
+        * Scripts/bisect-builds:
+        Swap out $safariPath for the more general $applicationPath
+        Leave --safari-path as a commandline option for backwards compatibility
+        (mountAndRunNightly):
+        Use File::Spec-&gt;cat correctly (one directory per argument)
+        Use open --wait-apps instead of running the target application directly
+
</ins><span class="cx"> 2014-10-30  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         &lt;rdar://problem/18821260&gt; Perpare for the mysterious future
</span></span></pre></div>
<a id="trunkToolsScriptsbisectbuilds"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/bisect-builds (175400 => 175401)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/bisect-builds        2014-10-31 00:18:21 UTC (rev 175400)
+++ trunk/Tools/Scripts/bisect-builds        2014-10-31 00:26:56 UTC (rev 175401)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> my $branch = $Settings::branch;
</span><span class="cx"> my $nightlyDownloadDirectory = $Settings::nightlyDownloadDirectory;
</span><span class="cx"> my $safariPath = $Settings::safariPath;
</span><ins>+my $applicationPath;
</ins><span class="cx"> 
</span><span class="cx"> my @nightlies;
</span><span class="cx"> 
</span><span class="lines">@@ -86,6 +87,7 @@
</span><span class="cx"> my $result = GetOptions(
</span><span class="cx">     sharedCommandLineOptions(),
</span><span class="cx">     &quot;b|branch=s&quot;             =&gt; \$branch,
</span><ins>+    &quot;a|application=s&quot;        =&gt; \$applicationPath,
</ins><span class="cx">     &quot;d|download-directory=s&quot; =&gt; \$nightlyDownloadDirectory,
</span><span class="cx">     &quot;h|help&quot;                 =&gt; \$showHelp,
</span><span class="cx">     &quot;l|local!&quot;               =&gt; \$localOnly,
</span><span class="lines">@@ -107,26 +109,30 @@
</span><span class="cx">     print STDERR &quot;Usage: &quot; . basename($0) . &quot; [options] [url]\n&quot;;
</span><span class="cx">     print STDERR &lt;&lt;END;
</span><span class="cx">   [-b|--branch name]             name of the nightly build branch (default: trunk)
</span><ins>+  [-a|--application path]        path to executable of application to test (default: /Applications/Safari.app)
+                                 * Not supported on Windows or iOS
</ins><span class="cx">   [-d|--download-directory dir]  nightly build download directory (default: ~/Library/Caches/WebKit-Nightlies)
</span><span class="cx">   [-h|--help]                    show this help message
</span><span class="cx">   [-l|--local]                   only use local (already downloaded) nightlies
</span><span class="cx">   [-p|--progression]             searching for a progression, not a regression
</span><span class="cx">   [-r|--revision M[:N]]          specify starting (and optional ending) revisions to search
</span><span class="cx">   [--safari-path path]           path to Safari application bundle (default: /Applications/Safari.app)
</span><ins>+                                 * [DEPRECATED]: The -a/--application argument will override this argument, if both are set.
</ins><span class="cx">   [-s|--sanity-check]            verify both starting and ending revisions before bisecting
</span><span class="cx"> END
</span><span class="cx">     print STDERR sharedCommandLineOptionsUsage(brackets =&gt; 1, indent =&gt; 2, switchWidth =&gt; 30);
</span><span class="cx">     exit 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+$safariPath = glob($safariPath) if $safariPath =~ /^~/;
+$safariPath = safariPathFromSafariBundle($safariPath) if $safariPath =~ m#\.app/*#;
+$applicationPath = $applicationPath ? File::Spec-&gt;rel2abs($applicationPath) : $safariPath;
+
</ins><span class="cx"> my $nightlyWebSite = &quot;http://nightly.webkit.org&quot;;
</span><span class="cx"> my $nightlyBuildsURLBase = $nightlyWebSite . File::Spec-&gt;catdir(&quot;/builds&quot;, $branch, &quot;mac&quot;);
</span><span class="cx"> my $nightlyFilesURLBase = $nightlyWebSite . File::Spec-&gt;catdir(&quot;/files&quot;, $branch, &quot;mac&quot;);
</span><span class="cx"> 
</span><span class="cx"> $nightlyDownloadDirectory = glob($nightlyDownloadDirectory) if $nightlyDownloadDirectory =~ /^~/;
</span><del>-$safariPath = glob($safariPath) if $safariPath =~ /^~/;
-$safariPath = safariPathFromSafariBundle($safariPath) if $safariPath =~ m#\.app/*#;
-
</del><span class="cx"> $nightlyDownloadDirectory = File::Spec-&gt;catdir($nightlyDownloadDirectory, $branch);
</span><span class="cx"> if (! -d $nightlyDownloadDirectory) {
</span><span class="cx">     mkpath($nightlyDownloadDirectory, 0, 0755) || die &quot;Could not create $nightlyDownloadDirectory: $!&quot;;
</span><span class="lines">@@ -411,21 +417,30 @@
</span><span class="cx">         die &quot;Could not mount $diskImage at $mountPath&quot; if $i &gt; 100;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    my $frameworkPath;
</del><ins>+    my $frameworkPath = File::Spec-&gt;catdir($mountPath, &quot;WebKit.app&quot;, &quot;Contents&quot;);
</ins><span class="cx">     if (-d &quot;/Volumes/WebKit/WebKit.app/Contents/Frameworks&quot;) {
</span><del>-        my $osXVersion = join('.', (split(/\./, findMacOSXVersion()))[0..1]);
-        $frameworkPath = &quot;/Volumes/WebKit/WebKit.app/Contents/Frameworks/$osXVersion&quot;;
</del><ins>+        my $osxShortVersion = join('.', (split(/\./, findMacOSXVersion()))[0..1]);
+        $frameworkPath = File::Spec-&gt;catdir($frameworkPath, &quot;Frameworks&quot;, $osxShortVersion);
</ins><span class="cx">     } else {
</span><del>-        $frameworkPath = &quot;/Volumes/WebKit/WebKit.app/Contents/Resources&quot;;
</del><ins>+        $frameworkPath = File::Spec-&gt;catdir($frameworkPath, &quot;Resources&quot;);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     $tempFile ||= &quot;&quot;;
</span><span class="cx"> 
</span><ins>+    # Check for both applications and application bundles.
+    my $isBundle = -d $applicationPath || (-f $applicationPath &amp;&amp; -x $applicationPath &amp;&amp; $applicationPath =~ m#/Contents/MacOS/#);
+
+    my @args = ($applicationPath);
+    unshift @args, &quot;open&quot;, &quot;--wait-apps&quot;, &quot;-a&quot; if $isBundle;
+    push @args, $tempFile if $tempFile;
+    push @args, &quot;--args&quot;, &quot;-ApplePersistenceIgnoreState&quot;, &quot;YES&quot; if $isBundle;
+
+    # FIXME: Add support for passing through additional arguments to the target application
+
</ins><span class="cx">     {
</span><span class="cx">         local %ENV = %ENV;
</span><span class="cx">         setupMacWebKitEnvironment($frameworkPath);
</span><del>-
-        `$safari $tempFile`;
</del><ins>+        system { $args[0] } @args;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     `hdiutil detach '$mountPath' 2&gt; $devNull`;
</span></span></pre>
</div>
</div>

</body>
</html>