<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[mr mr cote]]></title>
  <link href="http://mrcote.info//atom.xml" rel="self"/>
  <link href="http://mrcote.info//"/>
  <updated>2013-06-07T01:54:05-04:00</updated>
  <id>http://mrcote.info//</id>
  <author>
    <name><![CDATA[Mark R. Côté]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[Autophone, a case study in automating that which does not want to be automated (part 1)]]></title>
    <link href="http://mrcote.info//blog/2013/06/07/autophone-1/"/>
    <updated>2013-06-07T01:53:00-04:00</updated>
    <id>http://mrcote.info//blog/2013/06/07/autophone-1</id>
    <content type="html"><![CDATA[<p><a href="https://wiki.mozilla.org/Auto-tools/Projects/AutoPhone">Autophone</a> is an
automated system that executes Python test scripts on real
user hardware, that is, actual phones. It&rsquo;s been an active project for about
a year now, and we&rsquo;ve learned a lot about the difficulties
of performing automated performance measurements on hardware that was never
intended for automation. I&rsquo;m documenting this story for posterity, since it
has been an interesting, if often frustrating, experience. If you want to
follow along, the source is <a href="https://github.com/mozilla/autophone/">on github</a>.</p>

<p>I&rsquo;m going to divide this into a few posts to hopefully avoid tl;driness and to
ensure I actually finish at least some of this.</p>

<h2>Background</h2>

<p>For correctness testing, Mozilla&rsquo;s Fennec automation is largely done with
development boards, specifically Tegras and Pandas. These boards have
wired power and ethernet, perfect for rack mounting, and all of a given
type generally behave the same.</p>

<p>These boards are not, of course, consumer devices, and,
despite having similar chipsets as real phones, they have different
performance characteristics. To really see how Fennec performs in the real
world, we need to measure Fennec on devices that people are buying and using every day. Thus
was born the Autophone project.</p>

<h2>Devices</h2>

<p>At the moment, the existing Autophone production system runs tests on kind-of-to-very &ldquo;old&rdquo; phones. This isn&rsquo;t a limitation of Autophone; rather, it&rsquo;s a
sampling of phones that were still very common last year, when the project
got truly underway. We will add newer phones as time progresses, especially
now that the system is very stable. The current system has at least one of
the following phones:</p>

<ul>
<li>HTC Google Nexus One</li>
<li>LG Revolution</li>
<li>Motorola Droid Pro</li>
<li>Samsung Galaxy SII</li>
<li>Samsung Galaxy SIII</li>
<li>Samsung Google Nexus S</li>
</ul>


<p>We have a few more phones waiting to be deployed in a second cluster.</p>

<h2>Architecture</h2>

<p>A brief discussion of Autophone&rsquo;s design may help in  understanding the
problems in automation and performance measurements by providing some context.</p>

<p>Autophone consists of a main Python process with one worker process per phone.
We used processes instead of threads to isolate certain failures from other
workers. The main process has separate threads for its TCP command
server and for a <a href="http://pulse.mozilla.org">pulse</a> listener.</p>

<p>The worker processes are each tied to a single device and are responsible
for controlling that device. The devices all have the <a href="https://wiki.mozilla.org/Auto-tools/Projects/SUTAgent">SUTAgent</a> and Watcher
installed, to which the processes talk via <a href="https://mozbase.readthedocs.org/en/latest/mozdevice.html">mozdevice</a>. A worker is spawned
when the main process receives a <a href="https://wiki.mozilla.org/Auto-tools/Projects/SUTAgent#Registration_Server">SUT registration</a> message on its command
port from an unknown device. Device info is cached in a JSON file, and
workers are also launched upon startup for any known device.</p>

<p>The workers each listen to their own queue, which receives commands from the
main process. Commands come from users, via the command server, or are
triggered by a build notification from pulse. The workers also check for
jobs every 10 seconds (see below).</p>

<p>Autophone also includes a simple build cache server. This server handles
requests for builds from the workers, fetching them via ftp as necessary,
ensuring that only one copy of a particular build is downloaded at the same
time, and that recently used builds are kept around, subject to space
restrictions. (This part is actually very common to our automation frameworks,
so it really should be extracted and put into its own module. Even better would
be to extend <a href="https://github.com/mozilla/mozdownload/">mozdownload</a> to support Fennec and have the build cache server
use that to fetch builds. But I digress.)</p>

<h2>Tests</h2>

<p>When a build notification is received from pulse, or when a user issues
a &ldquo;triggerjobs&rdquo; command, for each device an entry containing the build URL and device name is inserted into a sqlite database. A generic &ldquo;job&rdquo;
command is then issued to each worker. As mentioned above, the workers
poll this database every 10 seconds. They also poll the database immediately after
executing a command, so the &ldquo;job&rdquo; command serves merely to trigger a poll of the database. This mechanism allows for worker processes
to be restarted, since even if a &ldquo;job&rdquo; command is missed, the job itself
will be picked up from the database. Along a similar vein, if the whole
system is shut down, the current test will be restarted, and any queued
tests will remain.</p>

<p>When a job successfully completes, the associated entry for that device and
build is deleted from the jobs database. The number of attempts for each job is also recorded, and a job is abandoned after too many attempts, in case there are
unrecoverable problems with a particular build or build/device combination.</p>

<p>Tests themselves are Python classes specified in a <a href="https://mozbase.readthedocs.org/en/latest/manifestdestiny.html#manifestdestiny-create-and-manage-test-manifests">ManifestDestiny</a> manifest
file. They are (for better or for worse) executed in the worker process,
i.e., not as a (further) separate process. Test classes are derived from a base
class, PhoneTest, and are pretty much free form, requiring only a runjob()
method that takes a dict of build metadata and the worker subprocess object,
which can be used to manipulate the device as necessary, in particular to
attempt to recover a frozen/disappeared device (though this part should probably be
split into its own object, since a test shouldn&rsquo;t be messing with the worker process
object). The PhoneTest base class also provides some
convenience functions to push profiles, start fennec, and report status
messages to the main process.</p>

<p>At the moment, we have a single active test, S1S2, which measures Fennec
startup performance. We also have support
for a few unit tests (crashtests, reftests, JS reftests, mochitests, and
robocop), though these are currently disabled pending some stability fixes.</p>

<p>Next post I&rsquo;ll discuss the goal of S1S2, its challenges, and our solutions.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Whisky cents]]></title>
    <link href="http://mrcote.info//blog/2013/06/04/whisky-cents/"/>
    <updated>2013-06-04T22:49:00-04:00</updated>
    <id>http://mrcote.info//blog/2013/06/04/whisky-cents</id>
    <content type="html"><![CDATA[<p>If you&rsquo;ve the means to buy an Oban 14 or a Macallan 18 whenever a decanter
frees itself, you&rsquo;ll probably want to saunter on past this post.  However, if
you like whisky but aren&rsquo;t crazy about spending a good portion of your income
on it, let me take a few minutes to tell you about some of my favourite
everyday whiskies. I&rsquo;m not going to include links because most distillers&#8217;
sites are obnoxious in one way or another, and I don&rsquo;t have a favourite
whisky-reviews site, but a quick search should point you in the right
direction.</p>

<p>I&rsquo;m far, far away from being a connoisseur of any kind&mdash;I have had several
people tell me that regular consumption of hot peppers have killed most of
my taste buds&mdash;but I have a basic appreciation of whisky, enough to at
least be able to say what I like and what I don&rsquo;t.  I imagine that most people
would consider the following to be &ldquo;good&rdquo; whiskies, but of course your tastes
might&mdash;actually probably&mdash;vary from mine. Anyway, all this to say that I&rsquo;m
not going to embarrass myself trying to point out notes of green apple
or hibiscus or library book and just confine myself to a few broad
descriptors.</p>

<p>I&rsquo;ve quoted current prices from Quebec&rsquo;s liquor stores to give you an idea.
You&rsquo;ll probably pay less elsewhere in Canada, a fair bit less in most of the
U.S., and don&rsquo;t even talk to me about Europe.</p>

<h2>The Tyrconnell Single Malt Irish Whiskey</h2>

<p>I only briefly paused at this bottle the other day, but then I recalled the
wonders of technology and fired up my mobile Internet gateway to find a
few recommendations for the Tyrconnell. Emboldened, I brought a bottle home.</p>

<p>At $43.50, this is more grand larceny than a simple steal. It&rsquo;s a light
whiskey, no peat at all, a fruity nose with a honey taste. I haven&rsquo;t tried a
lot of Irish whiskey, but this is by far the smoothest that I&rsquo;ve had.</p>

<p>I was also really excited to hear that its maker, Cooley Distillery, was one
of the only independent distillers of single-malt whiskies in Ireland, but
alas it was purchased by Beam Inc. a couple years ago.  Oh well, still tasty.</p>

<h2>Bruichladdich Waves</h2>

<p>This is drying up in my local SAQs, but it&rsquo;s been a favourite for a couple
years now.  It&rsquo;s single malt but not vintage, meaning that it&rsquo;s a blend of
batches produced in the same fashion from the same sources.</p>

<p>In my opinion, the Waves has the perfect mix of peat and fruit. It&rsquo;s a
mild smoke on top of smooth caramel. Velvety goodness. It&rsquo;s $55 a bottle,
and I prefer it to the few other, more expensive Bruichladdichs I&rsquo;ve tried.</p>

<p>As seems to be my fate, I was delighted that Bruichladdich (&ldquo;Progressive
Hebridean Distillers&rdquo;) was one of, I believe, only two independent
distilleries in Islay, but it was sold to Rémy Cointreau last year.</p>

<h2>Amrut Indian Single Malt Whisky</h2>

<p>I&rsquo;ve only bought one bottle of this, but again it was due to recommendations
online. It is a bit spicy, but not really in a piquant way, more like cloves or
cinnamon. Quite comparable to a decent Scotch.  Alas, the details have fallen
out of my memory, but at $56.25 it&rsquo;s only a buck and a quarter more than the
Waves, so I&rsquo;ll get another bottle for sure if I can&rsquo;t find more of the Laddee.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Rebasing Etiquette]]></title>
    <link href="http://mrcote.info//blog/2012/11/21/rebasing-etiquette/"/>
    <updated>2012-11-21T00:08:00-05:00</updated>
    <id>http://mrcote.info//blog/2012/11/21/rebasing-etiquette</id>
    <content type="html"><![CDATA[<p>I bet that the moment most people decide they actually <em>do</em> like git is when
they start using &lsquo;rebase&rsquo; regularly.  I definitely do not completely
understand the git model, but rebase shows that there is some seriously
cool stuff going on.</p>

<p>Anyway, I&rsquo;ve come upon a rebasing dilemma.  The reasons for not rebasing
a public repo are clear, but pushing to a remote origin (e.g. github) is
also a form of backup.  My master branches are for collaboration, but my
dev branches are essentially just to back up my home computer, and
occasionally for feedback.  I rebase dev branches regularly, to keep my
commits together for eventual merging to master.  I occasionally switch
around or squash commits too, where it adds clarity to the history.  So,
somewhat shamefully, I find myself using &lsquo;git push -f&rsquo; a lot on branches
other than master.</p>

<p>I guess I could get a paid account and fork private dev repos, but branches
seem a lot more convenient, and I don&rsquo;t really want to hide anything from
anyone, as embarrasing as some of my work in progress sometimes seems to me.</p>

<p>Maybe the moral of this story is &ldquo;never pull from my dev branches&rdquo;?</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A-Team: Tracking our Projects]]></title>
    <link href="http://mrcote.info//blog/2012/10/27/a-team-tracking-our-projects/"/>
    <updated>2012-10-27T17:06:00-04:00</updated>
    <id>http://mrcote.info//blog/2012/10/27/a-team-tracking-our-projects</id>
    <content type="html"><![CDATA[<p>Keeping wiki pages up to date is a hard problem, but recently we found out
that people were having trouble finding out what projects we were working on.
Obviously we can&rsquo;t help people with their problems if they can&rsquo;t figure out
what we do, so I spent some time today updating the
<a href="https://wiki.mozilla.org/Auto-tools/Projects">A-Team&rsquo;s Project Central</a>. All
the projects we are working on are there, along with owners&#8217; IRC nicks and
links to project pages and/or docs.  We also have links to our quarterly goals
as well as to SmartSheet pages with details of our progress.</p>

<p>We&rsquo;ll do our best to keep it up to date!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[oh right, virtualenv]]></title>
    <link href="http://mrcote.info//blog/2012/10/12/oh-right/"/>
    <updated>2012-10-12T00:42:00-04:00</updated>
    <id>http://mrcote.info//blog/2012/10/12/oh-right</id>
    <content type="html"><![CDATA[<p>An amusingly frequent pattern:</p>

<pre><code>git clone https://github.com/mozilla/new-python-project
# ... right, virtualenv
mkdir src
mv new-python-project src
virtualenv new-python-project
cd new-python-project
mv ../src .
. bin/activate
# get to work
</code></pre>

<p>I really ought to make a script to clone new Python projects&hellip;</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A-Team: Visualizing IonMonkey]]></title>
    <link href="http://mrcote.info//blog/2012/09/25/visualizing-ionmonkey/"/>
    <updated>2012-09-25T16:56:00-04:00</updated>
    <id>http://mrcote.info//blog/2012/09/25/visualizing-ionmonkey</id>
    <content type="html"><![CDATA[<p>EDIT: Sorry, the image links were broken everywhere but on the main page of
my blog. Fixed now. Still getting used to Octopress. :)</p>

<p>It&rsquo;s been a while since I last wrote about it, but the A-Team is still
maintaining the <a href="http://mrcote.info/speedtests/">SpeedTests</a> framework,
gathering the results of a few different benchmarks on all the major browsers
on a 32-bit Windows 7 installation. I haven&rsquo;t had any time to add new tests,
but I made sure to keep the results coming in for the tests we do have.</p>

<p>With IonMonkey having <a href="https://blog.mozilla.org/javascript/2012/09/12/ionmonkey-in-firefox-18/">landed</a>
a couple weeks ago, I expected to see some big improvements. Sure enough,
we can see a big jump in Kraken, as David Anderson saw:</p>

<p><a href="http://mrcote.info/speedtests/results.html#/Kraken/Win7/2012-09-06/2012-09-25"><img src="http://mrcote.info//images/2012-09-25/kraken.png" /></a></p>

<p>That&rsquo;s about a 27% improvement, right about what David measured on his
machine. That makes Firefox about 16% faster than Chrome 21 (which itself
improved by about 6% from Chrome 20).</p>

<p>As for V8,</p>

<p><a href="http://mrcote.info/speedtests/results.html#/V8/Win7/2012-09-06/2012-09-25"><img src="http://mrcote.info//images/2012-09-25/v8.png" /></a></p>

<p>The data is a bit noisy, but it looks like an improvement of around 9-10%
on the overall results (geometric mean of the total test results). Not as
much of an improvement, and Chrome is still 25% better, overall.</p>

<p>The &ldquo;Speed&rdquo; Tests also run (a sort of old version of) test262, a conformance
suite:</p>

<p><a href="http://mrcote.info/speedtests/results.html#/test262/Win7/2012-09-06/2012-09-25"><img src="http://mrcote.info//images/2012-09-25/test262.png" /></a></p>

<p>No changes there, which is what we would expect.</p>

<p>I looked through the other tests, and it doesn&rsquo;t look like IonMonkey has made
much of a difference. But of course all these tests are very specific and/or
artificial. If there are any JavaScript-based tests that should show clear
improvements, feel free to <a href="mailto:mcote@mozilla.com">let me know</a>
and maybe I&rsquo;ll find the time to add them!</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Bugzilla OrangeFactor Extension]]></title>
    <link href="http://mrcote.info//blog/2012/09/22/bugzilla-orangefactor-extension/"/>
    <updated>2012-09-22T13:48:00-04:00</updated>
    <id>http://mrcote.info//blog/2012/09/22/bugzilla-orangefactor-extension</id>
    <content type="html"><![CDATA[<p>Thanks to dkl, <a href="https://bugzilla.mozilla.org">bmo</a> now has an extension
which shows a failure data for intermittent-orange bugs.  You&rsquo;ll have to
enable the extension by going to the <a href="https://bugzilla.mozilla.org/userprefs.cgi">Preferences
page</a> and changing &ldquo;When viewing
a bug, show its corresponding Orange Factor page&rdquo; to &ldquo;On&rdquo;.  Then the next
time you are viewing a bug about an intermittent orange, e.g.  the current
top orange, <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=789003">bug 789003</a>,
at the bottom right of the metadata you should see a sparkline and a count
of the failures over the last week, plus a link to its <a href="https://brasstacks.mozilla.com/orangefactor/?display=Bug&amp;bugid=789003">OrangeFactor page</a>.
Note that the sparkline corresponds to the failure count, not to the Orange
Factor (ratio of failures to test runs). If you think the latter would be more
useful, let me or dkl know&mdash;it&rsquo;s an easy change.</p>

<p>Bugs can be filed under <a href="https://bugzilla.mozilla.org/enter_bug.cgi?product=bugzilla.mozilla.org&amp;component=Extensions%3A%20OrangeFactor">bugzilla.mozilla.org | Extensions: OrangeFactor</a>.</p>
]]></content>
  </entry>
  
</feed>
