build/docs/test_manifests.rst

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 .. _test_manifests:
     3 ==============
     4 Test Manifests
     5 ==============
     7 Many test suites have their test metadata defined in files called
     8 **test manifests**.
    10 Test manifests are divided into two flavors: :ref:`manifest_destiny_manifests`
    11 and :ref:`reftest_manifests`.
    13 Naming Convention
    14 =================
    16 The build system does not enforce file naming for test manifest files.
    17 However, the following convention is used.
    19 mochitest.ini
    20    For the *plain* flavor of mochitests.
    22 chrome.ini
    23    For the *chrome* flavor of mochitests.
    25 browser.ini
    26    For the *browser chrome* flavor of mochitests.
    28 a11y.ini
    29    For the *a11y* flavor of mochitests.
    31 xpcshell.ini
    32    For *xpcshell* tests.
    34 webapprt.ini
    35    For the *chrome* flavor of webapp runtime mochitests.
    37 .. _manifest_destiny_manifests:
    39 Manifest Destiny Manifests
    40 ==========================
    42 Manifest destiny manifests are essentially ini files that conform to a basic
    43 set of assumptions.
    45 The `reference documentation <http://mozbase.readthedocs.org/en/latest/manifestdestiny.html>`_
    46 for manifest destiny manifests describes the basic format of test manifests.
    48 In summary, manifests are ini files with section names describing test files::
    50     [test_foo.js]
    51     [test_bar.js]
    53 Keys under sections can hold metadata about each test::
    55     [test_foo.js]
    56     skip-if = os == "win"
    57     [test_foo.js]
    58     skip-if = os == "linux" && debug
    59     [test_baz.js]
    60     fail-if = os == "mac" || os == "android"
    62 There is a special **DEFAULT** section whose keys/metadata apply to all
    63 sections/tests::
    65     [DEFAULT]
    66     property = value
    68     [test_foo.js]
    70 In the above example, **test_foo.js** inherits the metadata **property = value**
    71 from the **DEFAULT** section.
    73 Recognized Metadata
    74 -------------------
    76 Test manifests can define some common keys/metadata to influence behavior.
    77 Those keys are as follows:
    79 head
    80    List of files that will be executed before the test file. (Used in
    81    xpcshell tests.)
    83 tail
    84    List of files that will be executed after the test file. (Used in
    85    xpcshell tests.)
    87 support-files
    88    List of additional files required to run tests. This is typically
    89    defined in the **DEFAULT** section.
    91    Unlike other file lists, *support-files* supports a globbing mechanism
    92    to facilitate pulling in many files with minimal typing. This globbing
    93    mechanism is activated if an entry in this value contains a ``*``
    94    character. A single ``*`` will wildcard match all files in a directory.
    95    A double ``**`` will descend into child directories. For example,
    96    ``data/*`` will match ``data/foo`` but not ``data/subdir/bar`` where
    97    ``data/**`` will match ``data/foo`` and ``data/subdir/bar``.
    99    Support files starting with ``/`` are placed in a root directory, rather
   100    than a location determined by the manifest location. For mochitests,
   101    this allows for the placement of files at the server root. The source
   102    file is selected from the base name (e.g., ``foo`` for ``/path/foo``).
   103    Files starting with ``/`` cannot be selected using globbing.
   105 generated-files
   106    List of files that are generated as part of the build and don't exist in
   107    the source tree.
   109    The build system assumes that each manifest file, test file, and file
   110    listed in **head**, **tail**, and **support-files** is static and
   111    provided by the source tree (and not automatically generated as part
   112    of the build). This variable tells the build system not to make this
   113    assumption.
   115    This variable will likely go away sometime once all generated files are
   116    accounted for in the build config.
   118    If a generated file is not listed in this key, a clobber build will
   119    likely fail.
   121 dupe-manifest
   122    Record that this manifest duplicates another manifest.
   124    The common scenario is two manifest files will include a shared
   125    manifest file via the ``[include:file]`` special section. The build
   126    system enforces that each test file is only provided by a single
   127    manifest. Having this key present bypasses that check.
   129    The value of this key is ignored.
   131 run-if
   132    Run this test only if the specified condition is true.
   133    See :ref:`manifest_filter_language`.
   135 skip-if
   136    Skip this test if the specified condition is true.
   137    See :ref:`manifest_filter_language`.
   139 fail-if
   140    Expect test failure if the specified condition is true.
   141    See :ref:`manifest_filter_language`.
   143 run-sequentially
   144    If present, the test should not be run in parallel with other tests.
   146    Some test harnesses support parallel test execution on separate processes
   147    and/or threads (behavior varies by test harness). If this key is present,
   148    the test harness should not attempt to run this test in parallel with any
   149    other test.
   151    By convention, the value of this key is a string describing why the test
   152    can't be run in parallel.
   154 .. _manifest_filter_language:
   156 Manifest Filter Language
   157 ------------------------
   159 Some manifest keys accept a special filter syntax as their values. These
   160 values are essentially boolean expressions that are evaluated at test
   161 execution time.
   163 The expressions can reference a well-defined set of variables, such as
   164 ``os`` and ``debug``. These variables are populated from the
   165 ``mozinfo.json`` file. For the full list of available variables, see
   166 the :ref:`mozinfo documentation <mozinfo_attributes>`.
   168 See
   169 `the source <https://hg.mozilla.org/mozilla-central/file/default/testing/mozbase/manifestdestiny/manifestparser/manifestparser.py>`_ for the full documentation of the
   170 expression syntax until it is documented here.
   172 .. todo::
   174    Document manifest filter language.
   176 .. _manifest_file_installation:
   178 File Installation
   179 -----------------
   181 Files referenced by manifests are automatically installed into the object
   182 directory into paths defined in
   183 :py:func:`mozbuild.frontend.emitter.TreeMetadataEmitter._process_test_manifest`.
   185 Relative paths resolving to parent directory (e.g.
   186 ``support-files = ../foo.txt`` have special behavior.
   188 For ``support-files``, the file will be installed to the default destination
   189 for that manifest. Only the file's base name is used to construct the final
   190 path: directories are irrelevant.  Files starting with ``/`` are an exception,
   191 these are installed relative to the root of the destination; the base name is
   192 instead used to select the file..
   194 For all other entry types, the file installation is skipped.
   196 .. _reftest_manifests:
   198 Reftest Manifests
   199 =================
   201 See `MDN <https://developer.mozilla.org/en-US/docs/Creating_reftest-based_unit_tests>`_.

mercurial