XPCshell Test Manifest Expressions

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.


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 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.py, with many of the values initialized at configure time by writemozinfo.py which writes mozinfo.json into the root of the build directory. See also the official docs for this set of variables. Note that it currently seems like neither this list nor the one on the official docs is exhaustive, so if you need something and it's not here, best check the source code!

  • os - The operating system on which the test is being run
    • One of: 'win', 'mac', 'linux', 'android'
  • os_version - The version of the operating system on which the test is being run
  • 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.


If an expression contains a # (pound/hash) character outside of a string, the character and the rest of the line will be treated as a comment.  This is useful as the entire line will generally be reported whenever tests are reported as being skipped, meaning the comment as well as the expression itself will appear in any logs where this is reported.