{"id":1942,"date":"2011-01-18T22:30:50","date_gmt":"2011-01-19T03:30:50","guid":{"rendered":"http:\/\/mikeconley.ca\/blog\/?p=1942"},"modified":"2023-12-20T16:25:14","modified_gmt":"2023-12-20T21:25:14","slug":"day-2-at-mozilla-messaging-pbranch-testing-teleconferencing-intranet-and-more-testing","status":"publish","type":"post","link":"https:\/\/mikeconley.ca\/blog\/2011\/01\/18\/day-2-at-mozilla-messaging-pbranch-testing-teleconferencing-intranet-and-more-testing\/","title":{"rendered":"Day 2 at Mozilla Messaging: pbranch, testing, teleconferencing, intranet, and more testing"},"content":{"rendered":"<p>Ok, today was my second day at <a href=\"http:\/\/www.mozillamessaging.com\">Mozilla Messaging<\/a>.\u00a0 Another good day.\u00a0 Here are some highlights:<\/p>\n<p>Today, I started off my day by wanting to learn a few things:<\/p>\n<ol>\n<li>How to use <a href=\"http:\/\/arrenbrecht.ch\/mercurial\/pbranch\/\">pbranch<\/a> to locally commit <a href=\"http:\/\/mikeconley.ca\/blog\/2011\/01\/17\/day-1-at-mozilla-messaging-getting-my-hands-dirty\/\">my Firefox patch from yesterday<\/a><\/li>\n<li>How to write tests for my patch using <a href=\"https:\/\/developer.mozilla.org\/en\/Mochitest\">Mochitest<\/a><\/li>\n<\/ol>\n<p>I started with the first one.<\/p>\n<p>So, for the most part, Mozilla uses <a href=\"http:\/\/mercurial.selenic.com\/\">Mercurial<\/a> as its distributed version control system.\u00a0 I&#8217;ve been using <a href=\"http:\/\/git-scm.com\/\">Git<\/a> (<a href=\"http:\/\/www.google.com\/search?client=ubuntu&amp;channel=fs&amp;q=git+vs+mercurial&amp;ie=utf-8&amp;oe=utf-8\">arguably Mercurial&#8217;s main competitor<\/a>) since last summer with both <a href=\"http:\/\/www.markusproject.org\">MarkUs<\/a> and <a href=\"http:\/\/www.reviewboard.org\">Review Board<\/a>.\u00a0 Mercurial is something quite different.\u00a0 Quite different indeed.<\/p>\n<p>pbranch is a tool that lets me have a patch queue.\u00a0 Basically, organization, and re-organization of any changes I make to the Mozilla code-base is a lot easier using something like pbranch.<\/p>\n<p>So I spent a few minutes going through the <a href=\"http:\/\/arrenbrecht.ch\/mercurial\/pbranch\/\">pbranch tutorial<\/a>.\u00a0 Eventually, I think I got the hang of it &#8211; basically, for my extension changes-sets, I create a new branch using hg pnew, and commit to that branch.\u00a0 I&#8217;ll keep committing to that, and when I&#8217;m all done, I&#8217;ll dump my patch to a Bugzilla attachment.\u00a0 After I pass code review, someone will merge my patch.\u00a0 Then I&#8217;ll remove my local branch and pull in my changes.\u00a0 Sweet!<\/p>\n<p>Ok, so at this point, I think I got the workflow.\u00a0 Next, I needed to figure out how to write a Mochitest.\u00a0 Thankfully, there&#8217;s <a href=\"https:\/\/developer.mozilla.org\/en\/Mochitest\">this tutorial<\/a>.<\/p>\n<p>Looking through the documentation, I was reminded of <a href=\"http:\/\/seleniumhq.org\/\">Selenium<\/a> a little bit.\u00a0 I think it&#8217;s sort of the same idea.<\/p>\n<p>So how do I write a test for my changes?\u00a0 Unfortunately, the documentation on how to write a Mochitest is a little thin.\u00a0 So I started hunting around, looking for examples to extrapolate from.<\/p>\n<p>At some point, I found myself staring at <a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/testing\/mozmill\/tests\/shared-modules\/testAddonsAPI.js\">this code<\/a>.\u00a0 Wow!\u00a0 A full-blown API for manipulating the add-ons manager!\u00a0 Great!\u00a0 But it turns out that this is for Mozmill tests, and not Mochitests.\u00a0 But a quick search through MXR showed that <em>nobody<\/em> was using that add-on manager API.\u00a0 Argh.<\/p>\n<p>Was I barking up the wrong tree here?\u00a0 Where the hell were the add-on manager tests?<\/p>\n<p>I quickly swallowed my pride, and decided to talk to an expert.\u00a0 I used Mercurial&#8217;s log function to determine who had changed extensions.js the most.\u00a0 The name <a href=\"http:\/\/www.oxymoronical.com\/\">Dave Townsend<\/a> came up.\u00a0 According to his site, he&#8217;s &#8220;Mossop&#8221; on IRC, but he wasn&#8217;t online.\u00a0 The log function also mentioned the name <a href=\"http:\/\/theunfocused.net\/\">Blair McBride<\/a>.\u00a0 On IRC, he&#8217;s &#8220;Unfocused&#8221;.\u00a0 He was online, but unavailable.<\/p>\n<p>Argh.<\/p>\n<p>It was at this point that Blake told me that the Mozilla Messaging weekly meeting was going to take place.\u00a0 Apparently this happens every Tuesday at 9:30AM PST.\u00a0 So we marched over to a conference room, hooked up this super-advanced phone (the phone had a boot-up screen, and then showed the Mozilla logo&#8230;whoa!).\u00a0 A little while later, the meeting began.\u00a0 The meeting was super fast, and super efficient &#8211; especially considering the teams are spread out across the globe.\u00a0 One person led the meeting, and called the different teams up to give their weekly status.\u00a0 I also got to introduce myself to the team.\u00a0 I rambled off something about Thunderbird+Unity and code review, and then stumbled back to my chair.\u00a0 Cool times.\u00a0 Anyhow, teleconferencing is going to take some getting used to.<\/p>\n<p>So, with the meeting over, and still no word from Unfocused, I decided to <a href=\"https:\/\/developer.mozilla.org\/En\/Developer_Guide\/Coding_Style\">clean up my code a bit<\/a>, and then posted my patch up on Bugzilla.\u00a0 I asked Dave Townsend for a code review, and said that if testing needs to happen, hopefully he&#8217;d let me know and advise me.<\/p>\n<p>It didn&#8217;t take long for a response to come back.\u00a0 Apparently, there are indeed tests for the add-ons manager, and <a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/toolkit\/mozapps\/extensions\/test\/\">they&#8217;re right here in front of my face<\/a>.\u00a0 Crap, I should have known.\u00a0 :\/<\/p>\n<p>So I dove into those tests&#8230;wow, there were a lot of them.\u00a0 And I didn&#8217;t have a clue as to how to run any of them.<\/p>\n<p>Following the Mochitest instructions, I eventually tried this:<\/p>\n<blockquote><p>TEST_PATH=toolkit\/mozapps\/extensions\/test\/ make -C $OBJDIR mochitest-plain<\/p><\/blockquote>\n<blockquote><p>(where the TEST_PATH is set to the folder of tests I want to run, and  $OBJDIR is an environment variable that points to the objdir compilation  folder for Firefox.)<\/p><\/blockquote>\n<p>But this only ran a single test out of the bunch, and there were hundreds in there.\u00a0 So what was the deal?<\/p>\n<p>It turned out that the tests I wanted to run were with higher privileges than your average Mochitest test.\u00a0 A basic Mochitest test is run using mochitest-plain.\u00a0 Apparently, <a href=\"https:\/\/developer.mozilla.org\/en\/Mozilla_automated_testing\">I needed to use mochitest-browser-chrome<\/a>.\u00a0 Took me a good half-hour to figure that one out.\u00a0 :\/<\/p>\n<p>Anyhow, BAM, I had it &#8211; the tests were running.\u00a0 The bad news:\u00a0 I had a bunch of failing tests.\u00a0 The good news:\u00a0 the same tests failed without any of my changes.\u00a0 So&#8230;great&#8230;I guess.<\/p>\n<p>It was at this point in the day that I was given access to the Mozilla Messaging Intranet (the internal wiki).\u00a0 There was plenty to read there, including something along the lines of &#8220;So you&#8217;re a new Mozilla Messaging hire&#8221;&#8230;I gave that a read.\u00a0 Very interesting.<\/p>\n<p>After that, I subscribed to a few internal mailing lists, and submitted <a href=\"http:\/\/mikeconley.ca\/blog\/category\/mozilla-2\/\">my Mozilla-centric blog feed<\/a> to be added to <a href=\"http:\/\/planet.mozilla.org\/\">Planet Mozilla<\/a> and <a href=\"http:\/\/planet.mozillamessaging.com\/\">Planet Mozilla Messaging<\/a>.\u00a0 Woop!<\/p>\n<p>Finally, I got back to testing.\u00a0 After digging through those add-ons manager tests, I finally found this:\u00a0 <a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/toolkit\/mozapps\/extensions\/test\/browser\/browser_sorting.js\">PAYDIRT<\/a>.<\/p>\n<p>Sweet!\u00a0 Tons of stuff for free in there:\u00a0 <a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/toolkit\/mozapps\/extensions\/test\/browser\/browser_sorting.js#13\">MockProvider<\/a>, <a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/toolkit\/mozapps\/extensions\/test\/browser\/browser_sorting.js#14\">createAddons<\/a>&#8230; writing tests in there looked like it&#8217;d be cake.<\/p>\n<p>But then it was home time.\u00a0 More tomorrow.<\/p>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 816px; width: 1px; height: 1px; overflow: hidden;\">\n<p>Today, I want to learn a few things:<\/p>\n<ol>\n<li>How to use pbranch to locally commit my Firefox patch from last night<\/li>\n<li>How to write tests for my patch using Mochitest<\/li>\n<\/ol>\n<p>Lets start with 1:<\/p>\n<p>So Mozilla uses Mercurial as its distributed version control system.\u00a0  I&#8217;ve been using Git since last summer with both MarkUs and Review  Board.\u00a0 Mercurial is something quite different.<\/p>\n<p>Started going through <a href=\"http:\/\/arrenbrecht.ch\/mercurial\/pbranch\/\">pbranch tutorial<\/a>.<\/p>\n<p>So for my extension changes, here&#8217;s what I&#8217;m going to do.\u00a0 I create a  new branch using pnew, and commit to that.\u00a0 I&#8217;ll keep committing to  that.\u00a0 When I&#8217;m all done, dump my patch to a Bugzilla attachment.\u00a0  Someone will merge my patch.\u00a0 Then I&#8217;ll remove my local branch and pull  in my changes.\u00a0 Sweet!<\/p>\n<p>Ok, so I&#8217;ve got the workflow (I think).\u00a0 Next, I need to figure out  how to write a Mochitest.\u00a0 Thankfully, there&#8217;s this:\u00a0  https:\/\/developer.mozilla.org\/en\/Mochitest<\/p>\n<p>I&#8217;m reminded of Selenium a little bit.\u00a0 I think it&#8217;s sort of the same idea.<\/p>\n<p>So how do I write a test for my changes?\u00a0 Unfortunately, the  documentation on how to write a Mochitest is a little thin.\u00a0 So I guess  I&#8217;ll be looking at examples, and extrapolating from there.\u00a0 Let&#8217;s see if  I can find a similar test written elsewhere.<\/p>\n<p>This is promising:\u00a0 http:\/\/mxr.mozilla.org\/mozilla-central\/source\/testing\/mozmill\/tests\/shared-modules\/testAddonsAPI.js<\/p>\n<p>Hm&#8230;but this is for Mozmill, and not Mochitest.<\/p>\n<p>Yep, Mozilla uses a lot of different testing frameworks.\u00a0 It&#8217;s a little confusing.\u00a0 Mozmill is also like Selenium<\/p>\n<p>So who is using testAddonsAPI.js?\u00a0 Argh.\u00a0 It looks like nobody.<\/p>\n<p>I&#8217;m having a hard time finding tests for any of the stuff in  extensions.js.\u00a0 So I guess it&#8217;s time to talk to the expert.\u00a0 I use hg  log to see who the most frequent committer is to extensions.js.\u00a0 The  name Dave Townsend comes up.\u00a0 http:\/\/www.oxymoronical.com\/ .\u00a0 He&#8217;s  Mossop on IRC, and not online.\u00a0 So who else is listed in hg log?\u00a0 Blair  McBride.<\/p>\n<p>Had my first Mozilla Messaging weekly meeting.\u00a0 It&#8217;s on a phone.\u00a0  Interesting how its organized&#8230;really not like any phone conversation  I&#8217;ve been a part of.\u00a0 People mute themselves&#8230;unmute when its time to  talk.\u00a0 Awkward pauses are rampant&#8230;pretty cool though.\u00a0 Coordinating  around the world.\u00a0 Nice!<\/p>\n<p>Ok, back to Blair McBride&#8230;after a little hunting around, it turns  out his IRC nickname is Unfocused.\u00a0 I&#8217;ve found him in a few of the  Mozilla IRC channels, and am waiting to hear back from him.<\/p>\n<p>No word.\u00a0 So, <a href=\"https:\/\/developer.mozilla.org\/En\/Developer_Guide\/Coding_Style\">after some scrubbing<\/a>,  I posted my patch up on Bugzilla, and asked Dave Townsend for a  review.\u00a0 If testing needs to happen, hopefully he&#8217;ll let me know and  advise me.<\/p>\n<p>Whoop, just got a message.\u00a0 The tests are here:\u00a0 <a href=\"http:\/\/mxr.mozilla.org\/mozilla-central\/source\/toolkit\/mozapps\/extensions\/test\/\" target=\"_blank\" rel=\"noopener\">http:\/\/mxr.mozilla.org\/mozilla-central\/source\/toolkit\/mozapps\/extensions\/test\/<\/a>.\u00a0 Crap, I should have known.\u00a0 :\/<\/p>\n<p>Ok, lets examine those tests&#8230; hold up.\u00a0 How do I run these?\u00a0 Trying  to run that directory with Mochitest, I only get 1 test to run&#8230;wtf?<\/p>\n<p>Success!\u00a0 TEST_PATH=toolkit\/mozapps\/extensions\/test\/ make -C . mochitest-browser-chrome<\/p>\n<p>Sweet, so all those tests run.\u00a0 Bad news though &#8211; a bunch of failing  tests.\u00a0 Going to see if it was my patch.\u00a0 Ok, looks like a bunch of  tests were failing before I even committed anything.\u00a0 That&#8217;s good, I  guess.<\/p>\n<p>So, I have to compare them in order to ensure that there aren&#8217;t MORE failing tests after my patch goes in.<\/p>\n<p>I now have access to the Intranet.\u00a0 Sweet &#8211; lots of stuff to read here.\u00a0 &#8220;So you&#8217;re a new Mozilla Messaging hire&#8230;&#8221;<\/p>\n<p>Just subscribed to a few internal mailing lists, and submitted by  Mozilla feed to be added to Planet Mozilla and Planet Mozilla  Messaging.\u00a0 Woop!<\/p>\n<p>Ok, back to testing, I&#8217;ve found this:\u00a0  http:\/\/mxr.mozilla.org\/mozilla-central\/source\/toolkit\/mozapps\/extensions\/test\/browser\/browser_sorting.js\u00a0  This looks like paydirt.<\/p>\n<p>The CEO of Mozilla Messaging (David Ascher) just welcomed me to MoMo:<\/p>\n<blockquote><p>mconley: welcome to the madhouse<\/p><\/blockquote>\n<p>Awesome. [WELCOME TO THE JUNGLE]<\/p>\n<p>Sweet!\u00a0 Tons of stuff for free:\u00a0 MockProvider, createAddons &#8211; I think this&#8217;ll be cake tomorrow.<\/p>\n<p>Ooops  &#8211; Dave Townsend just asked a good question:\u00a0 what about extensions that  are to-be-installed?\u00a0 to-be-uninstalled?\u00a0 Where do they go?<\/p>\n<p>I&#8217;ll have to check that out tomorrow.<\/p>\n<p>But right now, it&#8217;s home time.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Ok, today was my second day at Mozilla Messaging.\u00a0 Another good day.\u00a0 Here are some highlights: Today, I started off my day by wanting to learn a few things: How to use pbranch to locally commit my Firefox patch from yesterday How to write tests for my patch using Mochitest I started with the first [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[874,861],"tags":[887,888,131,639,894,883,884,893,877,885,895,891,882,896,892,890,886,889],"class_list":["post-1942","post","type-post","status-publish","format-standard","hentry","category-firefox-mozilla-2","category-mozilla-2","tag-addon-manager","tag-addons-manager","tag-extensions","tag-git","tag-intranet","tag-mercurial","tag-mochitest","tag-mochitest-browser-chrome","tag-mozilla-messaging","tag-mozmill","tag-new-hire","tag-ode-review","tag-pbranch","tag-planet","tag-running-mochitests","tag-scrum","tag-selenium","tag-teleconferencing"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/prmTy-vk","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/1942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/comments?post=1942"}],"version-history":[{"count":17,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/1942\/revisions"}],"predecessor-version":[{"id":3146,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/posts\/1942\/revisions\/3146"}],"wp:attachment":[{"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/media?parent=1942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/categories?post=1942"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mikeconley.ca\/blog\/wp-json\/wp\/v2\/tags?post=1942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}