{"id":84,"date":"2011-06-29T12:30:48","date_gmt":"2011-06-29T17:30:48","guid":{"rendered":"http:\/\/blog.mozilla.org\/ted\/?p=84"},"modified":"2011-06-29T12:30:48","modified_gmt":"2011-06-29T17:30:48","slug":"xpcshell-manifests-phase-2","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/ted\/2011\/06\/29\/xpcshell-manifests-phase-2\/","title":{"rendered":"xpcshell manifests, phase 2"},"content":{"rendered":"<p>Recently we <a title=\"Bug 616999 - switch to a manifest format for xpcshell instead of walking directories\" href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=616999\">implemented<\/a> a <a href=\"https:\/\/elvis314.wordpress.com\/2011\/05\/20\/converting-xpcshell-from-listing-directories-to-a-manifest\/\">manifest format<\/a> for <a title=\"Writing xpcshell-based unit tests\" href=\"https:\/\/developer.mozilla.org\/en\/Writing_xpcshell-based_unit_tests\">xpcshell unit tests<\/a> (with <a href=\"https:\/\/elvis314.wordpress.com\">Joel Maher<\/a> doing the lion&#8217;s share of the work). After that work landed, we realized there were some things missing from our initial design, so we set out to revamp a few things to make it easier to write useful manifests.<\/p>\n<p>We decided to make the manifests support boolean expressions, similar to what <a title=\"Creating reftest-based unit tests\" href=\"https:\/\/developer.mozilla.org\/en\/Creating_reftest-based_unit_tests\">reftest<\/a> manifests allow, except with a restricted grammar, and not &#8220;all of JavaScript&#8221;. To make this useful, we had to offer a set of values to test, so <a href=\"http:\/\/k0s.org\/\">Jeff Hammel<\/a> buckled down and <a title=\"Bug 606524 - new package: MozInfo\" href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=606524\">wrote<\/a> a Python module called <a href=\"http:\/\/k0s.org\/mozilla\/hg\/mozinfo\/\">mozinfo<\/a> that had been in discussion for a long time. I <a title=\"Bug 663180 - Make configure write mozinfo JSON data about build configuration for test harnesses to use\" href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=663180\">wrote<\/a> a <a title=\"Bug 664197 - integrate mozinfo + new manifest parser work into xpcshell harness\" href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=664197\">few bits<\/a> to hook this all up between the build system and the xpcshell test harness, and it <a href=\"http:\/\/tbpl.mozilla.org\/?rev=5974e4cb3fc2\">all landed on mozilla-central<\/a> this morning.<\/p>\n<p>I&#8217;ll update the <a href=\"https:\/\/developer.mozilla.org\/en\/Writing_xpcshell-based_unit_tests\">MDN documentation<\/a> later today, but for a preview, a sample manifest entry might look like:<\/p>\n<pre>[test_foo.js]\r\nskip-if = os == 'win' || os == 'linux'<\/pre>\n<p>If you look in your object directory in a build containing these patches (or in the xpcshell directory of a test package from a tinderbox build), you&#8217;ll find a mozinfo.json, which is where most of the values you can use in these expressions come from. For example, the mozinfo.json for my 64-bit Linux build looks like:<\/p>\n<pre>{'os': 'linux', 'toolkit': 'gtk2', 'crashreporter': false, 'debug': false, 'bits': 64, 'processor': 'x86_64'}<\/pre>\n<p>You can annotate tests with &#8220;skip-if, run-if and fail-if&#8221; conditions currently. &#8220;skip-if&#8221; indicates that a test should not be run if the condition evaluates to true, &#8220;run-if&#8221; indicates that a test should only be run if the condition evaluates to true and &#8220;fail-if&#8221; indicates that the test is known to fail if the condition is true. Tests marked fail-if will produce TEST-KNOWN-FAIL output if they fail, and TEST-UNEXPECTED-PASS (which is treated as a failure) if they pass.<\/p>\n<p>Hopefully this work will enable developers to more easily work with xpcshell tests. We&#8217;d appreciate any feedback you have on these changes!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently we implemented a manifest format for xpcshell unit tests (with Joel Maher doing the lion&#8217;s share of the work). After that work landed, we realized there were some things missing from our initial design, so we set out to revamp a few things to make it easier to write useful manifests. We decided to [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[189,122],"tags":[2025,4563,2024],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/posts\/84"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/comments?post=84"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/posts\/84\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/media?parent=84"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/categories?post=84"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/ted\/wp-json\/wp\/v2\/tags?post=84"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}