llvm.org GIT mirror llvm / 3911374
[docs] Document usage of Inputs/ for extra test files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221406 91177308-0d34-0410-b5e6-96231b3b80d8 Sean Silva 5 years ago
1 changed file(s) with 52 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
238238 The recommended way to examine output to figure out if the test passes is using
239239 the :doc:`FileCheck tool `. *[The usage of grep in RUN
240240 lines is deprecated - please do not send or commit patches that use it.]*
241
242 Extra files
243 -----------
244
245 If your test requires extra files besides the file containing the ``RUN:``
246 lines, the idiomatic place to put them is in a subdirectory ``Inputs``.
247 You can then refer to the extra files as ``%S/Inputs/foo.bar``.
248
249 For example, consider ``test/Linker/ident.ll``. The directory structure is
250 as follows::
251
252 test/
253 Linker/
254 ident.ll
255 Inputs/
256 ident.a.ll
257 ident.b.ll
258
259 For convenience, these are the contents:
260
261 .. code-block:: llvm
262
263 ;;;;; ident.ll:
264
265 ; RUN: llvm-link %S/Inputs/ident.a.ll %S/Inputs/ident.b.ll -S | FileCheck %s
266
267 ; Verify that multiple input llvm.ident metadata are linked together.
268
269 ; CHECK-DAG: !llvm.ident = !{!0, !1, !2}
270 ; CHECK-DAG: "Compiler V1"
271 ; CHECK-DAG: "Compiler V2"
272 ; CHECK-DAG: "Compiler V3"
273
274 ;;;;; Inputs/ident.a.ll:
275
276 !llvm.ident = !{!0, !1}
277 !0 = metadata !{metadata !"Compiler V1"}
278 !1 = metadata !{metadata !"Compiler V2"}
279
280 ;;;;; Inputs/ident.b.ll:
281
282 !llvm.ident = !{!0}
283 !0 = metadata !{metadata !"Compiler V3"}
284
285 For symmetry reasons, ``ident.ll`` is just a dummy file that doesn't
286 actually participate in the test besides holding the ``RUN:`` lines.
287
288 .. note::
289
290 Some existing tests use ``RUN: true`` in extra files instead of just
291 putting the extra files in an ``Inputs/`` directory. This pattern is
292 deprecated.
241293
242294 Fragile tests
243295 -------------