<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sam Liu &#187; Mozilla</title>
	<atom:link href="http://www.sammyliu.com/category/mozilla/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sammyliu.com</link>
	<description>sleeprogramming</description>
	<lastBuildDate>Sat, 18 May 2013 05:02:51 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Finding Regressions in Firefox with mozcommitbuilder</title>
		<link>http://www.sammyliu.com/2011/07/05/finding-regressions-in-firefox-with-mozcommitbuilder</link>
		<comments>http://www.sammyliu.com/2011/07/05/finding-regressions-in-firefox-with-mozcommitbuilder#comments</comments>
		<pubDate>Wed, 06 Jul 2011 01:08:17 +0000</pubDate>
		<dc:creator>Sammy</dc:creator>
				<category><![CDATA[Mozilla]]></category>

		<guid isPermaLink="false">http://www.sammyliu.com/?p=5242</guid>
		<description><![CDATA[I&#8217;m super excited to announce that my main project so far as an intern is usable / currently being used to find regressions in Firefox! The readme for this tool is pretty thorough and can be found on github. The Problem The original problem presented to me was that Firefox developers would like to find [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m super excited to announce that my main project so far as an intern is usable / currently being used to find regressions in Firefox! The readme for this tool is pretty thorough and can be found on <a href="http://github.com/samliu/mozcommitbuilder">github</a>.</p>
<p><strong>The Problem</strong><br />
The original problem presented to me was that Firefox developers would like to find regressions. My mentor wrote a tool (<a href="http://github.com/mozilla/mozregression">mozregression</a>) that downloaded nightly builds and would bisect to find a regression range. However it would be nice for developers to be able to pinpoint an exact changeset and to have the regression finder check merge commits (branch aware). So I wrote mozcommitbuilder by wrapping mercurial&#8217;s internal bisect mechanism. The first iteration of the tool would download a clean copy of trunk from mozilla-central, configure the build environment, build, and run Firefox. It was able to bisect interactively, asking whether each built changeset was good or bad.</p>
<p>The ultimate goal was automation &#8212; fully automatic regression-finding that would take off and run on its own.</p>
<p style="text-align: center;"><strong>Regression Finding</strong><br />
<a href="http://www.sammyliu.com/wp-content/uploads/2011/07/Screen-shot-2011-07-05-at-5.45.07-PM.png"><img class="size-full wp-image-5243" title="Screen shot 2011-07-05 at 5.45.07 PM" src="http://www.sammyliu.com/wp-content/uploads/2011/07/Screen-shot-2011-07-05-at-5.45.07-PM.png" alt="" width="516" height="263" /></a><a href="http://www.sammyliu.com/wp-content/uploads/2011/07/Screen-shot-2011-07-05-at-5.45.07-PM.png"><br />
</a></p>
<p>For those who are unfamiliar with regression finding, basically what it entails is knowing that some feature is broken that used to be working. That means that somewhere along the line, someone / something broke the feature and the goal is to find when exactly things broke. The way we do this is by going back and doing a binary search: find the middle changeset, test it, and decide whether the break happened forward or backwards in time. It gets tricky when there are branches because then time isn&#8217;t just linear: both branches need to be checked when it comes to a merged changeset, because the parent branch could have caused the breakage.</p>
<p>Luckily, mercurial&#8217;s built-in bisect is very robust. The commitbuilder tool wraps mercurial and uses its internal bisection mechanism &#8212; it is branch aware in that it prints out the changeset for a missed branch following a bisection: so finding a regression on a merge commit may require more than one pass with the tool, but it gets the job done. However, to make matters easier, just four days ago hg 1.9 came out, which has a fully branch-aware bisect feature (see hg bisect &#8211;extend) and mozcommitbuilder leverages that on systems with the latest mercurial. With one pass, the commitbuilder tool is able to find regressions by building, running, and interactively prompting.</p>
<p><strong>Fully-automated Regression Hunting</strong><br />
As of the most recent iteration, it is also able to automate regression-finding using custom conditional scripts. Instead of telling the regression finder that a given changeset is good or bad manually, the tool can be given a script to use as its truth condition. The way this works is that a user can define a conditional script that looks something like this:</p>
<p><small>mycondition.py</small><br />
<code>def interesting(args, directory):<br />
&nbsp;&nbsp;if(something == True):<br />
&nbsp;&nbsp;&nbsp;&nbsp;return "good"<br />
&nbsp;&nbsp;else:<br />
&nbsp;&nbsp;&nbsp;&nbsp;return "bad"<br />
</code></p>
<p>And the user can call commitbuilder with something like this:<br />
<code>mozcommitbuilder -g 70168 -b 72300 -c mycondition.py arg1 arg2<br />
</code></p>
<p>The result is that the builder will download a local copy of Mozilla-central&#8217;s repository, it will switch to the relevant revision, build Firefox (and detect how many cores are on the system for maximum processor utilization), run Firefox, run the condition (can be anything, like a mochitest), and based on its output, it will bisect/build/test until the regression is found.</p>
<p>There are some interesting use cases with this tool: for example, it is currently being used in conjunction with some fuzzer scripts which he uses as the condition (automated bug finding + using the tool to find the exact regression / cause of the bug). Another use case currently in development is a condition script that runs automated tests multiple times in a row while hunting, in order to find nondeterministic regressions.</p>
<p><strong>This sounds useful!</strong><br />
<code>sudo pip install mozcommitbuilder --upgrade</code><br />
Feel free to open an issue or pull request on github. I&#8217;m generally quick about responding to those.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sammyliu.com/2011/07/05/finding-regressions-in-firefox-with-mozcommitbuilder/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
