MDN may have intermittent access issues April 18 13:00 - April 19 01:00 UTC. See whistlepig.mozilla.org for all notifications.

mozilla

Revision 32963 of XPCshell Test Manifest Expressions

  • Revision slug: XPCshell_Test_Manifest_Expressions
  • Revision title: XPCshell Test Manifest Expressions
  • Revision id: 32963
  • Created:
  • Creator: Ted_Mielczarek
  • Is current revision? No
  • Comment page created, 200 words added
Tags: 

Revision Content

XPCShell unit tests are run by specifying them in a manifest file. You can add conditions to tests in order to control when tests get run. The conditions accept a simple boolean expression syntax, described here.

Operators

In order of decreasing precedence:

  • ()
  • == !=
  • &&
  • ||

Literal Values

  • Booleans: the literal strings true and false.

  • Integers: A series of contiguous digits. Only decimal integers are supported.

  • Strings: any series of characters enclosed in double quotes " or single quotes '. No escape sequences are supported.

Variables

Variables are supported as a series of letters, digits or underscores beginning with a letter or an underscore. There are a fixed set of variables provided by the test harness via mozinfo:

  • os - The operating system on which the test is being run
    • One of: 'win', 'mac', 'linux', 'android'
  • toolkit - The graphics toolkit used by this build
    • One of: 'windows', 'cocoa', 'gtk2', 'android'
  • processor - The CPU which the code is compiled for
    • One of: 'x86', 'x86_64', 'arm'
  • bits - The pointer size of the CPU architecture, in bits
    • One of 32, 64, possibly unknown
  • debug - Set to true if this build is a debug build, false otherwise
  • crashreporter - Set to true if this build has crash reporting code enabled, false otherwise.

Revision Source

<p><a href="/en/Writing_xpcshell-based_unit_tests" title="en/Writing xpcshell-based unit tests">XPCShell unit tests</a> are run by specifying them in <a href="/en/Writing_xpcshell-based_unit_tests#Adding_your_tests_to_the_xpcshell_manifest" title="en/Writing xpcshell-based unit tests#Adding your tests to the xpcshell manifest">a manifest file</a>. You can add conditions to tests in order to control when tests get run. The conditions accept a simple boolean expression syntax, described here.</p>
<h2>Operators</h2>
<p>In order of decreasing precedence:</p>
<ul> <li>()</li> <li>== !=</li> <li>&amp;&amp;</li> <li>||</li>
</ul>
<h2>Literal Values</h2>
<ul> <li> <p>Booleans: the literal strings true and <code>false</code>.</p> </li> <li> <p>Integers: A series of contiguous digits. Only decimal integers are supported.</p> </li> <li> <p>Strings: any series of characters enclosed in double quotes " or single quotes '. No escape sequences are supported.</p> </li>
</ul>
<h2>Variables</h2>
<p>Variables are supported as a series of letters, digits or underscores beginning with a letter or an underscore. There are a fixed set of variables provided by the test harness via mozinfo:</p>
<ul> <li><code>os </code>- The operating system on which the test is being run <ul> <li>One of: 'win', 'mac', 'linux', 'android'</li> </ul> </li> <li><code>toolkit</code> - The graphics toolkit used by this build <ul> <li>One of: 'windows', 'cocoa', 'gtk2', 'android'</li> </ul> </li> <li><code>processor</code> - The CPU which the code is compiled for <ul> <li>One of: 'x86', 'x86_64', 'arm'</li> </ul> </li> <li><code>bits</code> - The pointer size of the CPU architecture, in bits <ul> <li>One of 32, 64, possibly unknown</li> </ul> </li> <li><code>debug</code> - Set to <code>true</code> if this build is a debug build, <code>false</code> otherwise</li> <li><code>crashreporter</code> - Set to <code>true</code> if this build has crash reporting code enabled, <code>false</code> otherwise.</li>
</ul>
Revert to this revision