{"id":204,"date":"2009-11-18T11:11:36","date_gmt":"2009-11-18T00:11:36","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=204"},"modified":"2009-11-18T11:11:36","modified_gmt":"2009-11-18T00:11:36","slug":"nanojit-test-coverage","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2009\/11\/18\/nanojit-test-coverage\/","title":{"rendered":"Nanojit test coverage"},"content":{"rendered":"<p>On i386, Nanojit has two basic modes of operation:\u00a0 SSE, and non-SSE.\u00a0 Non-SSE is for old machines that don&#8217;t support SSE instructions.\u00a0 (It might actually be SSE2 instructions, I&#8217;m not sure.)\u00a0 My two machines both support SSE and so the non-SSE is never exercised unless I specify the environment variable X86_FORCE_SSE=no.\u00a0 Since this invocation doesn&#8217;t exactly roll off the fingertips, I don&#8217;t do it often.\u00a0 It&#8217;s also easy to mistype, in which case the normal SSE code will be run but I probably won&#8217;t notice and so I&#8217;m testing something different to what I think I am testing.<\/p>\n<p>I recently committed a patch (<a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=516348\">bug 516348<\/a>) that broke the non-SSE mode.\u00a0 (It may have also broken the SSE mode, but in a less obvious way.)\u00a0 Whenever I land a patch that breaks something, I try to work out if I could have avoided the breakage through a better process.\u00a0 In this case I could have, through automation.\u00a0 I now have the following set of aliases and functions in my .bashrc:<\/p>\n<pre>alias jstt_prefix=\"python trace-test\/trace-test.py\"\r\nJSTTARGS32=\"--no-slow -f -x sunspider\/check-date-format-tofte.js\"\r\nJSTTARGS64=\"$JSTTARGS32\"\r\n\r\nalias jsdtt32=\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 jstt_prefix debug32\/js $JSTTARGS32\"\r\nalias jsott32=\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 jstt_prefix opt32\/js\u00a0\u00a0 $JSTTARGS32\"\r\nalias jsdtt32b=\"X86_FORCE_SSE2=no jstt_prefix debug32\/js $JSTTARGS32\"\r\nalias jsott32b=\"X86_FORCE_SSE2=no jstt_prefix opt32\/js\u00a0\u00a0 $JSTTARGS32\"\r\nalias jsott64=\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 jstt_prefix opt64\/js\u00a0\u00a0 $JSTTARGS64\"\r\nalias jsdtt64=\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 jstt_prefix debug64\/js $JSTTARGS64\"\r\n\r\nfunction jsatt\r\n{\r\n  if [ -d debug32 ] &amp;&amp; [ -d debug64 ] &amp;&amp; [ -d opt32 ] &amp;&amp; [ -d opt64 ] ; then\r\n    cd debug32 &amp;&amp; mq &amp;&amp; cd .. &amp;&amp; \\\r\n    cd debug64 &amp;&amp; mq &amp;&amp; cd .. &amp;&amp; \\\r\n    cd opt32 &amp;&amp; mq &amp;&amp; cd .. &amp;&amp; \\\r\n    cd opt64 &amp;&amp; mq &amp;&amp; cd ..\r\n\r\n    if [ $? -eq 0 ] ; then\r\n      echo\r\n      echo \"debug32\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &amp;&amp; jsdtt32\u00a0\u00a0 &amp;&amp; echo\r\n      echo \"debug32 (no SSE)\" &amp;&amp; jsdtt32b\u00a0 &amp;&amp; echo\r\n      echo \"debug64\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &amp;&amp; jsdtt64\u00a0\u00a0 &amp;&amp; echo\r\n      echo \"opt32\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &amp;&amp; jsott32\u00a0\u00a0 &amp;&amp; echo\r\n      echo \"opt32 (no SSE)\"\u00a0\u00a0 &amp;&amp; jsott32b\u00a0 &amp;&amp; echo\r\n      echo \"opt64\"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &amp;&amp; jsott64\u00a0\u00a0 &amp;&amp; echo\r\n    fi\r\n  else\r\n    echo \"missing one of debug32\/debug64\/opt32\/opt64\"\r\n  fi\r\n}<\/pre>\n<p>The code is boring.\u00a0 For those reading closely, it relies on the fact that I always put different builds in the directories debug32\/, opt32\/, debug64\/, opt64\/.\u00a0 And I skip check-data-format-tofte.js because it fails if you&#8217;re in a non-US timezone, see <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=515254\">bug 515214<\/a>.<\/p>\n<p>I already had &#8216;jsdtt32&#8217; et al, each of which tests a single configuration.\u00a0 But now with a single command &#8216;jsatt&#8217; (which is short for &#8220;JavaScript All trace-tests&#8221;) I can run the JS trace-tests on 6 different configurations on a single x86-64 machine: 32-bit debug (SSE), 32-bit debug (non-SSE), 64-bit debug, 32-bit optimised (SSE), 32-bit optimised (non-SSE), 64-bit optimised.\u00a0 And it builds them to make sure they&#8217;re all up-to-date.<\/p>\n<p>It&#8217;s only a small process change for me, but it means that it&#8217;s unlikely I will break any of these configurations in the future, or at least, not in a way that shows up in the trace-tests.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On i386, Nanojit has two basic modes of operation:\u00a0 SSE, and non-SSE.\u00a0 Non-SSE is for old machines that don&#8217;t support SSE instructions.\u00a0 (It might actually be SSE2 instructions, I&#8217;m not sure.)\u00a0 My two machines both support SSE and so the non-SSE is never exercised unless I specify the environment variable X86_FORCE_SSE=no.\u00a0 Since this invocation doesn&#8217;t [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/204"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/users\/139"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/comments?post=204"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/204\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}