summaryrefslogtreecommitdiffstats
path: root/docs/code-quality/lint/linters/perfdocs.rst
blob: 1ec2e33e6897ed090ac6850867b3b1ef217d3640 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
PerfDocs
========

`PerfDocs`_ is a tool that checks to make sure all performance tests are documented in tree.

At the moment, it is only used for this documentation verification, but in the future it will also auto-generate documentation from these descriptions that will be displayed in the source-docs documentation page (rather than the wiki, which is where they currently reside).

Run Locally
-----------

The mozlint integration of PerfDocs can be run using mach:

.. parsed-literal::

    $ mach lint --linter perfdocs .


Configuration
-------------

There are no configuration options available for this linter. It scans the full source tree under ``testing``, looking for folders named ``perfdocs`` and then validates their content. This has only been implemented for Raptor so far, but Talos will be added in the future. We also hope to expand this to search outside the ``testing`` directory.

The ``perfdocs`` folders, there needs to be an ``index.rst`` file and it needs to contain the string ``{documentation}`` in some location in the file which is where the test documentation will be placed. The folders must also have a ``config.yml`` file following this schema:

.. code-block:: python

    CONFIG_SCHEMA = {
        "type": "object",
        "properties": {
            "name": {"type": "string"},
            "manifest": {"type": "string"},
            "suites": {
                "type": "object",
                "properties": {
                    "suite_name": {
                        "type": "object",
                        "properties": {
                            "tests": {
                                "type": "object",
                                "properties": {
                                    "test_name": {"type": "string"},
                                }
                            },
                            "description": {"type": "string"},
                        },
                        "required": [
                            "description"
                        ]
                    }
                }
            }
        },
        "required": [
            "name",
            "manifest",
            "suites"
        ]
    }

Here is an example of a configuration file for the Raptor framework:

.. parsed-literal::

    name: raptor
    manifest: testing/raptor/raptor/raptor.toml
    suites:
        desktop:
            description: "Desktop tests."
            tests:
                raptor-tp6: "Raptor TP6 tests."
        mobile:
            description: "Mobile tests"
        benchmarks:
            description: "Benchmark tests."
            tests:
                wasm: "All wasm tests."

Note that there needs to be a FrameworkGatherer implemented for the framework being documented since each of them may have different ways of parsing test manifests for the tests. See `RaptorGatherer <https://searchfox.org/mozilla-central/source/tools/lint/perfdocs/framework_gatherers.py>`_ for an example gatherer that was implemented for Raptor.

Sources
-------

* `Configuration <https://searchfox.org/mozilla-central/source/tools/lint/perfdocs.yml>`__
* `Source <https://searchfox.org/mozilla-central/source/tools/lint/perfdocs>`__