@@ -44,20 +44,43 @@ class DiscoverFmfStepData(tmt.steps.discover.DiscoverStepData):
44
44
default = cast (Optional [str ], None ),
45
45
option = ('-u' , '--url' ),
46
46
metavar = 'REPOSITORY' ,
47
- help = 'URL of the git repository with fmf metadata.' ,
47
+ help = """
48
+ Git repository containing the metadata tree.
49
+ Current git repository used by default.
50
+ """ ,
48
51
)
52
+
49
53
ref : Optional [str ] = field (
50
54
default = cast (Optional [str ], None ),
51
55
option = ('-r' , '--ref' ),
52
56
metavar = 'REVISION' ,
53
- help = 'Branch, tag or commit specifying the git revision.' ,
57
+ help = """
58
+ Branch, tag or commit specifying the desired git
59
+ revision. Defaults to the remote repository's default
60
+ branch if ``url`` was set or to the current ``HEAD``
61
+ of the current repository.
62
+
63
+ Additionally, one can set ``ref`` dynamically.
64
+ This is possible using a special file in tmt format
65
+ stored in the *default* branch of a tests repository.
66
+ This special file should contain rules assigning attribute ``ref``
67
+ in an *adjust* block, for example depending on a test run context.
68
+
69
+ Dynamic ``ref`` assignment is enabled whenever a test plan
70
+ reference has the format ``ref: @FILEPATH``.
71
+ """ ,
54
72
normalize = normalize_ref ,
55
73
)
74
+
56
75
path : Optional [str ] = field (
57
76
default = cast (Optional [str ], None ),
58
77
option = ('-p' , '--path' ),
59
78
metavar = 'ROOT' ,
60
- help = 'Path to the metadata tree root.' ,
79
+ help = """
80
+ Path to the metadata tree root. Must be relative to
81
+ the git repository root if ``url`` was provided, absolute
82
+ local filesystem path otherwise. By default ``.`` is used.
83
+ """ ,
61
84
)
62
85
63
86
# Selecting tests
@@ -66,25 +89,39 @@ class DiscoverFmfStepData(tmt.steps.discover.DiscoverStepData):
66
89
option = ('-t' , '--test' ),
67
90
metavar = 'NAMES' ,
68
91
multiple = True ,
69
- help = 'Select tests by name.' ,
92
+ help = """
93
+ List of test names or regular expressions used to
94
+ select tests by name. Duplicate test names are allowed
95
+ to enable repetitive test execution, preserving the
96
+ listed test order.
97
+ """ ,
70
98
normalize = tmt .utils .normalize_string_list ,
71
99
)
100
+
72
101
link : list [str ] = field (
73
102
default_factory = list ,
74
103
option = '--link' ,
75
104
metavar = "RELATION:TARGET" ,
76
105
multiple = True ,
77
106
help = """
78
- Filter by linked objects (regular expressions are supported for both relation and
79
- target).
107
+ Select tests using the :ref:`/spec/core/link` keys.
108
+ Values must be in the form of ``RELATION:TARGET``,
109
+ tests containing at least one of them are selected.
110
+ Regular expressions are supported for both relation
111
+ and target. Relation part can be omitted to match all
112
+ relations.
80
113
""" ,
81
114
)
115
+
82
116
filter : list [str ] = field (
83
117
default_factory = list ,
84
118
option = ('-F' , '--filter' ),
85
119
metavar = 'FILTERS' ,
86
120
multiple = True ,
87
- help = 'Include only tests matching the filter.' ,
121
+ help = """
122
+ Apply advanced filter based on test metadata attributes.
123
+ See ``pydoc fmf.filter`` for more info.
124
+ """ ,
88
125
normalize = tmt .utils .normalize_string_list ,
89
126
)
90
127
exclude : list [str ] = field (
@@ -101,21 +138,32 @@ class DiscoverFmfStepData(tmt.steps.discover.DiscoverStepData):
101
138
default = False ,
102
139
option = ('-m' , '--modified-only' ),
103
140
is_flag = True ,
104
- help = 'If set, select only tests modified since reference revision.' ,
141
+ help = """
142
+ Set to ``true`` if you want to filter modified tests
143
+ only. The test is modified if its name starts with
144
+ the name of any directory modified since ``modified-ref``.
145
+ """ ,
105
146
)
147
+
106
148
modified_url : Optional [str ] = field (
107
149
default = cast (Optional [str ], None ),
108
150
option = '--modified-url' ,
109
151
metavar = 'REPOSITORY' ,
110
- help = 'URL of the reference git repository with fmf metadata.' ,
152
+ help = """
153
+ An additional remote repository to be used as the
154
+ reference for comparison. Will be fetched as a
155
+ reference remote in the test dir.
156
+ """ ,
111
157
)
158
+
112
159
modified_ref : Optional [str ] = field (
113
160
default = cast (Optional [str ], None ),
114
161
option = '--modified-ref' ,
115
162
metavar = 'REVISION' ,
116
163
help = """
117
- Branch, tag or commit specifying the reference git revision (if not provided, the
118
- default branch is used).
164
+ The branch, tag or commit specifying the reference git revision (if not provided, the
165
+ default branch is used). Note that you need to specify ``reference/<branch>`` to
166
+ compare to a branch from the repository specified in ``modified-url``.
119
167
""" ,
120
168
)
121
169
@@ -125,7 +173,10 @@ class DiscoverFmfStepData(tmt.steps.discover.DiscoverStepData):
125
173
option = '--dist-git-init' ,
126
174
is_flag = True ,
127
175
help = """
128
- Initialize fmf root inside extracted sources (at dist-git-extract or top directory).
176
+ Set to ``true`` to initialize fmf root inside extracted sources at
177
+ ``dist-git-extract`` location or top directory. To be used when the
178
+ sources contain fmf files (for example tests) but do not have an
179
+ associated fmf root.
129
180
""" ,
130
181
)
131
182
dist_git_remove_fmf_root : bool = field (
@@ -141,7 +192,12 @@ class DiscoverFmfStepData(tmt.steps.discover.DiscoverStepData):
141
192
default = False ,
142
193
option = '--dist-git-merge' ,
143
194
is_flag = True ,
144
- help = 'Merge copied sources and plan fmf root.' ,
195
+ help = """
196
+ Set to ``true`` to combine fmf root from the sources and fmf root from the plan.
197
+ It allows to have plans and tests defined in the DistGit repo which use tests
198
+ and other resources from the downloaded sources. Any plans in extracted sources
199
+ will not be processed.
200
+ """ ,
145
201
)
146
202
dist_git_extract : Optional [str ] = field (
147
203
default = cast (Optional [str ], None ),
@@ -234,6 +290,19 @@ class DiscoverFmf(tmt.steps.discover.DiscoverPlugin[DiscoverFmfStepData]):
234
290
235
291
If no ``ref`` is provided, the default branch from the origin is used.
236
292
293
+ The following keys are used to limit the test discovery:
294
+
295
+ ``test`` - list of test names or regular expressions used to select tests
296
+
297
+ ``link`` - select tests using the link keys
298
+
299
+ ``filter`` - apply advanced filter based on test metadata attributes
300
+
301
+ ``exclude`` - exclude tests which match a regular expression
302
+
303
+ ``prune`` - copy only immediate directories of executed tests and their required files
304
+
305
+
237
306
For DistGit repo one can download sources and use code from them in
238
307
the tests. Sources are extracted into ``$TMT_SOURCE_DIR`` path,
239
308
patches are applied by default. See options to install build
@@ -250,17 +319,6 @@ class DiscoverFmf(tmt.steps.discover.DiscoverPlugin[DiscoverFmfStepData]):
250
319
how: fmf
251
320
dist-git-source: true
252
321
253
- Related config options (all optional):
254
-
255
- * ``dist-git-merge`` - set to ``true`` if you want to copy in extracted
256
- sources to the local repo
257
- * ``dist-git-init`` - set to ``true`` and ``fmf init`` will be called inside
258
- extracted sources (at ``dist-git-extract`` or top directory)
259
- * ``dist-git-extract`` - directory (glob supported) to copy from
260
- extracted sources (defaults to inner fmf root)
261
- * ``dist-git-remove-fmf-root`` - set to ``true`` to remove fmf root from
262
- extracted sources
263
-
264
322
Selecting tests containing specified link is possible using ``link``
265
323
key accepting ``RELATION:TARGET`` format of values. Regular
266
324
expressions are supported for both relation and target part of the
@@ -276,11 +334,7 @@ class DiscoverFmf(tmt.steps.discover.DiscoverPlugin[DiscoverFmfStepData]):
276
334
in git since a given revision. This can be particularly useful when
277
335
testing changes to tests themselves (e.g. in a pull request CI).
278
336
279
- Related config options (all optional):
280
-
281
- * ``modified-only`` - set to ``true`` if you want to filter modified tests
282
- * ``modified-url`` - fetched as "reference" remote in the test dir
283
- * ``modified-ref`` - the ref to compare against
337
+ Related keys: ``modified-only``, ``modified-url``, ``modified-ref``
284
338
285
339
Example to compare local repo against upstream ``main`` branch:
286
340
0 commit comments