blob: 6e1008a4565fc6e294d29cd65fbd5fc7b9ea6e87 (
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
85
|
Presets
=======
Some selectors, such as ``fuzzy`` and ``syntax``, allow saving and loading presets from a file. This is a
good way to re-use a selection, either at a later date or by sharing with others. Look for a
'preset' section in ``mach <selector> --help`` to determine whether the selector supports this
functionality.
Using Presets
-------------
To save a preset, run:
.. code-block:: shell
$ mach try <selector> --save <name> <args>
For example, to save a preset that selects all Windows mochitests:
.. code-block:: shell
$ mach try fuzzy --save all-windows-mochitests --query "'win 'mochitest"
preset saved, run with: --preset=all-windows-mochitests
Then run that saved preset like this:
.. code-block:: shell
$ mach try --preset all-windows-mochitests
To see a list of all available presets run:
.. code-block:: shell
$ mach try --list-presets
Editing and Sharing Presets
---------------------------
Presets can be defined in one of two places, in your home directory or in a file checked into
mozilla-central.
Local Presets
~~~~~~~~~~~~~
These are defined in your ``$MOZBUILD_STATE_DIR``, typically ``~/.mozbuild/try_presets.yml``.
Presets defined here are your own personal collection of presets. You can modify them by running:
.. code-block:: shell
$ ./mach try --edit-presets
Shared Presets
~~~~~~~~~~~~~~
You can also check presets into mozilla-central in `tools/tryselect/try_presets.yml`_. These presets
will be available to all users of ``mach try``, so please be mindful when editing this file. Make
sure the name of the preset is scoped appropriately (i.e doesn't contain any team or module specific
terminology). It is good practice to prefix the preset name with the name of the team or module that
will get the most use out of it.
Preset Format
~~~~~~~~~~~~~
Presets are simple key/value objects, with the name as the key and a metadata object as the value.
For example, the preset saved above would look something like this in ``try_presets.yml``:
.. code-block:: yaml
all-windows-mochitests:
selector: fuzzy
description: >-
Runs all windows mochitests.
query:
- "'win 'mochitest"
The ``selector`` key (required) allows ``mach try`` to determine which subcommand to dispatch to.
The ``description`` key (optional in user presets but required for shared presets) is a human
readable string describing what the preset selects and when to use it. All other values in the
preset are forwarded to the specified selector as is.
.. _tools/tryselect/try_presets.yml: https://searchfox.org/mozilla-central/source/tools/tryselect/try_presets.yml
|