xref: /aosp_15_r20/external/llvm/docs/TestingGuide.rst (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker=================================
2*9880d681SAndroid Build Coastguard WorkerLLVM Testing Infrastructure Guide
3*9880d681SAndroid Build Coastguard Worker=================================
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker.. contents::
6*9880d681SAndroid Build Coastguard Worker   :local:
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker.. toctree::
9*9880d681SAndroid Build Coastguard Worker   :hidden:
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker   TestSuiteMakefileGuide
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard WorkerOverview
14*9880d681SAndroid Build Coastguard Worker========
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard WorkerThis document is the reference manual for the LLVM testing
17*9880d681SAndroid Build Coastguard Workerinfrastructure. It documents the structure of the LLVM testing
18*9880d681SAndroid Build Coastguard Workerinfrastructure, the tools needed to use it, and how to add and run
19*9880d681SAndroid Build Coastguard Workertests.
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard WorkerRequirements
22*9880d681SAndroid Build Coastguard Worker============
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard WorkerIn order to use the LLVM testing infrastructure, you will need all of the
25*9880d681SAndroid Build Coastguard Workersoftware required to build LLVM, as well as `Python <http://python.org>`_ 2.7 or
26*9880d681SAndroid Build Coastguard Workerlater.
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard WorkerIf you intend to run the :ref:`test-suite <test-suite-overview>`, you will also
29*9880d681SAndroid Build Coastguard Workerneed a development version of zlib (zlib1g-dev is known to work on several Linux
30*9880d681SAndroid Build Coastguard Workerdistributions).
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard WorkerLLVM testing infrastructure organization
33*9880d681SAndroid Build Coastguard Worker========================================
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard WorkerThe LLVM testing infrastructure contains two major categories of tests:
36*9880d681SAndroid Build Coastguard Workerregression tests and whole programs. The regression tests are contained
37*9880d681SAndroid Build Coastguard Workerinside the LLVM repository itself under ``llvm/test`` and are expected
38*9880d681SAndroid Build Coastguard Workerto always pass -- they should be run before every commit.
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard WorkerThe whole programs tests are referred to as the "LLVM test suite" (or
41*9880d681SAndroid Build Coastguard Worker"test-suite") and are in the ``test-suite`` module in subversion. For
42*9880d681SAndroid Build Coastguard Workerhistorical reasons, these tests are also referred to as the "nightly
43*9880d681SAndroid Build Coastguard Workertests" in places, which is less ambiguous than "test-suite" and remains
44*9880d681SAndroid Build Coastguard Workerin use although we run them much more often than nightly.
45*9880d681SAndroid Build Coastguard Worker
46*9880d681SAndroid Build Coastguard WorkerRegression tests
47*9880d681SAndroid Build Coastguard Worker----------------
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard WorkerThe regression tests are small pieces of code that test a specific
50*9880d681SAndroid Build Coastguard Workerfeature of LLVM or trigger a specific bug in LLVM. The language they are
51*9880d681SAndroid Build Coastguard Workerwritten in depends on the part of LLVM being tested. These tests are driven by
52*9880d681SAndroid Build Coastguard Workerthe :doc:`Lit <CommandGuide/lit>` testing tool (which is part of LLVM), and
53*9880d681SAndroid Build Coastguard Workerare located in the ``llvm/test`` directory.
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard WorkerTypically when a bug is found in LLVM, a regression test containing just
56*9880d681SAndroid Build Coastguard Workerenough code to reproduce the problem should be written and placed
57*9880d681SAndroid Build Coastguard Workersomewhere underneath this directory. For example, it can be a small
58*9880d681SAndroid Build Coastguard Workerpiece of LLVM IR distilled from an actual application or benchmark.
59*9880d681SAndroid Build Coastguard Worker
60*9880d681SAndroid Build Coastguard Worker``test-suite``
61*9880d681SAndroid Build Coastguard Worker--------------
62*9880d681SAndroid Build Coastguard Worker
63*9880d681SAndroid Build Coastguard WorkerThe test suite contains whole programs, which are pieces of code which
64*9880d681SAndroid Build Coastguard Workercan be compiled and linked into a stand-alone program that can be
65*9880d681SAndroid Build Coastguard Workerexecuted. These programs are generally written in high level languages
66*9880d681SAndroid Build Coastguard Workersuch as C or C++.
67*9880d681SAndroid Build Coastguard Worker
68*9880d681SAndroid Build Coastguard WorkerThese programs are compiled using a user specified compiler and set of
69*9880d681SAndroid Build Coastguard Workerflags, and then executed to capture the program output and timing
70*9880d681SAndroid Build Coastguard Workerinformation. The output of these programs is compared to a reference
71*9880d681SAndroid Build Coastguard Workeroutput to ensure that the program is being compiled correctly.
72*9880d681SAndroid Build Coastguard Worker
73*9880d681SAndroid Build Coastguard WorkerIn addition to compiling and executing programs, whole program tests
74*9880d681SAndroid Build Coastguard Workerserve as a way of benchmarking LLVM performance, both in terms of the
75*9880d681SAndroid Build Coastguard Workerefficiency of the programs generated as well as the speed with which
76*9880d681SAndroid Build Coastguard WorkerLLVM compiles, optimizes, and generates code.
77*9880d681SAndroid Build Coastguard Worker
78*9880d681SAndroid Build Coastguard WorkerThe test-suite is located in the ``test-suite`` Subversion module.
79*9880d681SAndroid Build Coastguard Worker
80*9880d681SAndroid Build Coastguard WorkerDebugging Information tests
81*9880d681SAndroid Build Coastguard Worker---------------------------
82*9880d681SAndroid Build Coastguard Worker
83*9880d681SAndroid Build Coastguard WorkerThe test suite contains tests to check quality of debugging information.
84*9880d681SAndroid Build Coastguard WorkerThe test are written in C based languages or in LLVM assembly language.
85*9880d681SAndroid Build Coastguard Worker
86*9880d681SAndroid Build Coastguard WorkerThese tests are compiled and run under a debugger. The debugger output
87*9880d681SAndroid Build Coastguard Workeris checked to validate of debugging information. See README.txt in the
88*9880d681SAndroid Build Coastguard Workertest suite for more information . This test suite is located in the
89*9880d681SAndroid Build Coastguard Worker``debuginfo-tests`` Subversion module.
90*9880d681SAndroid Build Coastguard Worker
91*9880d681SAndroid Build Coastguard WorkerQuick start
92*9880d681SAndroid Build Coastguard Worker===========
93*9880d681SAndroid Build Coastguard Worker
94*9880d681SAndroid Build Coastguard WorkerThe tests are located in two separate Subversion modules. The
95*9880d681SAndroid Build Coastguard Workerregressions tests are in the main "llvm" module under the directory
96*9880d681SAndroid Build Coastguard Worker``llvm/test`` (so you get these tests for free with the main LLVM tree).
97*9880d681SAndroid Build Coastguard WorkerUse ``make check-all`` to run the regression tests after building LLVM.
98*9880d681SAndroid Build Coastguard Worker
99*9880d681SAndroid Build Coastguard WorkerThe more comprehensive test suite that includes whole programs in C and C++
100*9880d681SAndroid Build Coastguard Workeris in the ``test-suite`` module. See :ref:`test-suite Quickstart
101*9880d681SAndroid Build Coastguard Worker<test-suite-quickstart>` for more information on running these tests.
102*9880d681SAndroid Build Coastguard Worker
103*9880d681SAndroid Build Coastguard WorkerRegression tests
104*9880d681SAndroid Build Coastguard Worker----------------
105*9880d681SAndroid Build Coastguard Worker
106*9880d681SAndroid Build Coastguard WorkerTo run all of the LLVM regression tests use the check-llvm target:
107*9880d681SAndroid Build Coastguard Worker
108*9880d681SAndroid Build Coastguard Worker.. code-block:: bash
109*9880d681SAndroid Build Coastguard Worker
110*9880d681SAndroid Build Coastguard Worker    % make check-llvm
111*9880d681SAndroid Build Coastguard Worker
112*9880d681SAndroid Build Coastguard WorkerIf you have `Clang <http://clang.llvm.org/>`_ checked out and built, you
113*9880d681SAndroid Build Coastguard Workercan run the LLVM and Clang tests simultaneously using:
114*9880d681SAndroid Build Coastguard Worker
115*9880d681SAndroid Build Coastguard Worker.. code-block:: bash
116*9880d681SAndroid Build Coastguard Worker
117*9880d681SAndroid Build Coastguard Worker    % make check-all
118*9880d681SAndroid Build Coastguard Worker
119*9880d681SAndroid Build Coastguard WorkerTo run the tests with Valgrind (Memcheck by default), use the ``LIT_ARGS`` make
120*9880d681SAndroid Build Coastguard Workervariable to pass the required options to lit. For example, you can use:
121*9880d681SAndroid Build Coastguard Worker
122*9880d681SAndroid Build Coastguard Worker.. code-block:: bash
123*9880d681SAndroid Build Coastguard Worker
124*9880d681SAndroid Build Coastguard Worker    % make check LIT_ARGS="-v --vg --vg-leak"
125*9880d681SAndroid Build Coastguard Worker
126*9880d681SAndroid Build Coastguard Workerto enable testing with valgrind and with leak checking enabled.
127*9880d681SAndroid Build Coastguard Worker
128*9880d681SAndroid Build Coastguard WorkerTo run individual tests or subsets of tests, you can use the ``llvm-lit``
129*9880d681SAndroid Build Coastguard Workerscript which is built as part of LLVM. For example, to run the
130*9880d681SAndroid Build Coastguard Worker``Integer/BitPacked.ll`` test by itself you can run:
131*9880d681SAndroid Build Coastguard Worker
132*9880d681SAndroid Build Coastguard Worker.. code-block:: bash
133*9880d681SAndroid Build Coastguard Worker
134*9880d681SAndroid Build Coastguard Worker    % llvm-lit ~/llvm/test/Integer/BitPacked.ll
135*9880d681SAndroid Build Coastguard Worker
136*9880d681SAndroid Build Coastguard Workeror to run all of the ARM CodeGen tests:
137*9880d681SAndroid Build Coastguard Worker
138*9880d681SAndroid Build Coastguard Worker.. code-block:: bash
139*9880d681SAndroid Build Coastguard Worker
140*9880d681SAndroid Build Coastguard Worker    % llvm-lit ~/llvm/test/CodeGen/ARM
141*9880d681SAndroid Build Coastguard Worker
142*9880d681SAndroid Build Coastguard WorkerFor more information on using the :program:`lit` tool, see ``llvm-lit --help``
143*9880d681SAndroid Build Coastguard Workeror the :doc:`lit man page <CommandGuide/lit>`.
144*9880d681SAndroid Build Coastguard Worker
145*9880d681SAndroid Build Coastguard WorkerDebugging Information tests
146*9880d681SAndroid Build Coastguard Worker---------------------------
147*9880d681SAndroid Build Coastguard Worker
148*9880d681SAndroid Build Coastguard WorkerTo run debugging information tests simply checkout the tests inside
149*9880d681SAndroid Build Coastguard Workerclang/test directory.
150*9880d681SAndroid Build Coastguard Worker
151*9880d681SAndroid Build Coastguard Worker.. code-block:: bash
152*9880d681SAndroid Build Coastguard Worker
153*9880d681SAndroid Build Coastguard Worker    % cd clang/test
154*9880d681SAndroid Build Coastguard Worker    % svn co http://llvm.org/svn/llvm-project/debuginfo-tests/trunk debuginfo-tests
155*9880d681SAndroid Build Coastguard Worker
156*9880d681SAndroid Build Coastguard WorkerThese tests are already set up to run as part of clang regression tests.
157*9880d681SAndroid Build Coastguard Worker
158*9880d681SAndroid Build Coastguard WorkerRegression test structure
159*9880d681SAndroid Build Coastguard Worker=========================
160*9880d681SAndroid Build Coastguard Worker
161*9880d681SAndroid Build Coastguard WorkerThe LLVM regression tests are driven by :program:`lit` and are located in the
162*9880d681SAndroid Build Coastguard Worker``llvm/test`` directory.
163*9880d681SAndroid Build Coastguard Worker
164*9880d681SAndroid Build Coastguard WorkerThis directory contains a large array of small tests that exercise
165*9880d681SAndroid Build Coastguard Workervarious features of LLVM and to ensure that regressions do not occur.
166*9880d681SAndroid Build Coastguard WorkerThe directory is broken into several sub-directories, each focused on a
167*9880d681SAndroid Build Coastguard Workerparticular area of LLVM.
168*9880d681SAndroid Build Coastguard Worker
169*9880d681SAndroid Build Coastguard WorkerWriting new regression tests
170*9880d681SAndroid Build Coastguard Worker----------------------------
171*9880d681SAndroid Build Coastguard Worker
172*9880d681SAndroid Build Coastguard WorkerThe regression test structure is very simple, but does require some
173*9880d681SAndroid Build Coastguard Workerinformation to be set. This information is gathered via ``configure``
174*9880d681SAndroid Build Coastguard Workerand is written to a file, ``test/lit.site.cfg`` in the build directory.
175*9880d681SAndroid Build Coastguard WorkerThe ``llvm/test`` Makefile does this work for you.
176*9880d681SAndroid Build Coastguard Worker
177*9880d681SAndroid Build Coastguard WorkerIn order for the regression tests to work, each directory of tests must
178*9880d681SAndroid Build Coastguard Workerhave a ``lit.local.cfg`` file. :program:`lit` looks for this file to determine
179*9880d681SAndroid Build Coastguard Workerhow to run the tests. This file is just Python code and thus is very
180*9880d681SAndroid Build Coastguard Workerflexible, but we've standardized it for the LLVM regression tests. If
181*9880d681SAndroid Build Coastguard Workeryou're adding a directory of tests, just copy ``lit.local.cfg`` from
182*9880d681SAndroid Build Coastguard Workeranother directory to get running. The standard ``lit.local.cfg`` simply
183*9880d681SAndroid Build Coastguard Workerspecifies which files to look in for tests. Any directory that contains
184*9880d681SAndroid Build Coastguard Workeronly directories does not need the ``lit.local.cfg`` file. Read the :doc:`Lit
185*9880d681SAndroid Build Coastguard Workerdocumentation <CommandGuide/lit>` for more information.
186*9880d681SAndroid Build Coastguard Worker
187*9880d681SAndroid Build Coastguard WorkerEach test file must contain lines starting with "RUN:" that tell :program:`lit`
188*9880d681SAndroid Build Coastguard Workerhow to run it. If there are no RUN lines, :program:`lit` will issue an error
189*9880d681SAndroid Build Coastguard Workerwhile running a test.
190*9880d681SAndroid Build Coastguard Worker
191*9880d681SAndroid Build Coastguard WorkerRUN lines are specified in the comments of the test program using the
192*9880d681SAndroid Build Coastguard Workerkeyword ``RUN`` followed by a colon, and lastly the command (pipeline)
193*9880d681SAndroid Build Coastguard Workerto execute. Together, these lines form the "script" that :program:`lit`
194*9880d681SAndroid Build Coastguard Workerexecutes to run the test case. The syntax of the RUN lines is similar to a
195*9880d681SAndroid Build Coastguard Workershell's syntax for pipelines including I/O redirection and variable
196*9880d681SAndroid Build Coastguard Workersubstitution. However, even though these lines may *look* like a shell
197*9880d681SAndroid Build Coastguard Workerscript, they are not. RUN lines are interpreted by :program:`lit`.
198*9880d681SAndroid Build Coastguard WorkerConsequently, the syntax differs from shell in a few ways. You can specify
199*9880d681SAndroid Build Coastguard Workeras many RUN lines as needed.
200*9880d681SAndroid Build Coastguard Worker
201*9880d681SAndroid Build Coastguard Worker:program:`lit` performs substitution on each RUN line to replace LLVM tool names
202*9880d681SAndroid Build Coastguard Workerwith the full paths to the executable built for each tool (in
203*9880d681SAndroid Build Coastguard Worker``$(LLVM_OBJ_ROOT)/$(BuildMode)/bin)``. This ensures that :program:`lit` does
204*9880d681SAndroid Build Coastguard Workernot invoke any stray LLVM tools in the user's path during testing.
205*9880d681SAndroid Build Coastguard Worker
206*9880d681SAndroid Build Coastguard WorkerEach RUN line is executed on its own, distinct from other lines unless
207*9880d681SAndroid Build Coastguard Workerits last character is ``\``. This continuation character causes the RUN
208*9880d681SAndroid Build Coastguard Workerline to be concatenated with the next one. In this way you can build up
209*9880d681SAndroid Build Coastguard Workerlong pipelines of commands without making huge line lengths. The lines
210*9880d681SAndroid Build Coastguard Workerending in ``\`` are concatenated until a RUN line that doesn't end in
211*9880d681SAndroid Build Coastguard Worker``\`` is found. This concatenated set of RUN lines then constitutes one
212*9880d681SAndroid Build Coastguard Workerexecution. :program:`lit` will substitute variables and arrange for the pipeline
213*9880d681SAndroid Build Coastguard Workerto be executed. If any process in the pipeline fails, the entire line (and
214*9880d681SAndroid Build Coastguard Workertest case) fails too.
215*9880d681SAndroid Build Coastguard Worker
216*9880d681SAndroid Build Coastguard WorkerBelow is an example of legal RUN lines in a ``.ll`` file:
217*9880d681SAndroid Build Coastguard Worker
218*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm
219*9880d681SAndroid Build Coastguard Worker
220*9880d681SAndroid Build Coastguard Worker    ; RUN: llvm-as < %s | llvm-dis > %t1
221*9880d681SAndroid Build Coastguard Worker    ; RUN: llvm-dis < %s.bc-13 > %t2
222*9880d681SAndroid Build Coastguard Worker    ; RUN: diff %t1 %t2
223*9880d681SAndroid Build Coastguard Worker
224*9880d681SAndroid Build Coastguard WorkerAs with a Unix shell, the RUN lines permit pipelines and I/O
225*9880d681SAndroid Build Coastguard Workerredirection to be used.
226*9880d681SAndroid Build Coastguard Worker
227*9880d681SAndroid Build Coastguard WorkerThere are some quoting rules that you must pay attention to when writing
228*9880d681SAndroid Build Coastguard Workeryour RUN lines. In general nothing needs to be quoted. :program:`lit` won't
229*9880d681SAndroid Build Coastguard Workerstrip off any quote characters so they will get passed to the invoked program.
230*9880d681SAndroid Build Coastguard WorkerTo avoid this use curly braces to tell :program:`lit` that it should treat
231*9880d681SAndroid Build Coastguard Workereverything enclosed as one value.
232*9880d681SAndroid Build Coastguard Worker
233*9880d681SAndroid Build Coastguard WorkerIn general, you should strive to keep your RUN lines as simple as possible,
234*9880d681SAndroid Build Coastguard Workerusing them only to run tools that generate textual output you can then examine.
235*9880d681SAndroid Build Coastguard WorkerThe recommended way to examine output to figure out if the test passes is using
236*9880d681SAndroid Build Coastguard Workerthe :doc:`FileCheck tool <CommandGuide/FileCheck>`. *[The usage of grep in RUN
237*9880d681SAndroid Build Coastguard Workerlines is deprecated - please do not send or commit patches that use it.]*
238*9880d681SAndroid Build Coastguard Worker
239*9880d681SAndroid Build Coastguard WorkerPut related tests into a single file rather than having a separate file per
240*9880d681SAndroid Build Coastguard Workertest. Check if there are files already covering your feature and consider
241*9880d681SAndroid Build Coastguard Workeradding your code there instead of creating a new file.
242*9880d681SAndroid Build Coastguard Worker
243*9880d681SAndroid Build Coastguard WorkerExtra files
244*9880d681SAndroid Build Coastguard Worker-----------
245*9880d681SAndroid Build Coastguard Worker
246*9880d681SAndroid Build Coastguard WorkerIf your test requires extra files besides the file containing the ``RUN:``
247*9880d681SAndroid Build Coastguard Workerlines, the idiomatic place to put them is in a subdirectory ``Inputs``.
248*9880d681SAndroid Build Coastguard WorkerYou can then refer to the extra files as ``%S/Inputs/foo.bar``.
249*9880d681SAndroid Build Coastguard Worker
250*9880d681SAndroid Build Coastguard WorkerFor example, consider ``test/Linker/ident.ll``. The directory structure is
251*9880d681SAndroid Build Coastguard Workeras follows::
252*9880d681SAndroid Build Coastguard Worker
253*9880d681SAndroid Build Coastguard Worker  test/
254*9880d681SAndroid Build Coastguard Worker    Linker/
255*9880d681SAndroid Build Coastguard Worker      ident.ll
256*9880d681SAndroid Build Coastguard Worker      Inputs/
257*9880d681SAndroid Build Coastguard Worker        ident.a.ll
258*9880d681SAndroid Build Coastguard Worker        ident.b.ll
259*9880d681SAndroid Build Coastguard Worker
260*9880d681SAndroid Build Coastguard WorkerFor convenience, these are the contents:
261*9880d681SAndroid Build Coastguard Worker
262*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm
263*9880d681SAndroid Build Coastguard Worker
264*9880d681SAndroid Build Coastguard Worker  ;;;;; ident.ll:
265*9880d681SAndroid Build Coastguard Worker
266*9880d681SAndroid Build Coastguard Worker  ; RUN: llvm-link %S/Inputs/ident.a.ll %S/Inputs/ident.b.ll -S | FileCheck %s
267*9880d681SAndroid Build Coastguard Worker
268*9880d681SAndroid Build Coastguard Worker  ; Verify that multiple input llvm.ident metadata are linked together.
269*9880d681SAndroid Build Coastguard Worker
270*9880d681SAndroid Build Coastguard Worker  ; CHECK-DAG: !llvm.ident = !{!0, !1, !2}
271*9880d681SAndroid Build Coastguard Worker  ; CHECK-DAG: "Compiler V1"
272*9880d681SAndroid Build Coastguard Worker  ; CHECK-DAG: "Compiler V2"
273*9880d681SAndroid Build Coastguard Worker  ; CHECK-DAG: "Compiler V3"
274*9880d681SAndroid Build Coastguard Worker
275*9880d681SAndroid Build Coastguard Worker  ;;;;; Inputs/ident.a.ll:
276*9880d681SAndroid Build Coastguard Worker
277*9880d681SAndroid Build Coastguard Worker  !llvm.ident = !{!0, !1}
278*9880d681SAndroid Build Coastguard Worker  !0 = metadata !{metadata !"Compiler V1"}
279*9880d681SAndroid Build Coastguard Worker  !1 = metadata !{metadata !"Compiler V2"}
280*9880d681SAndroid Build Coastguard Worker
281*9880d681SAndroid Build Coastguard Worker  ;;;;; Inputs/ident.b.ll:
282*9880d681SAndroid Build Coastguard Worker
283*9880d681SAndroid Build Coastguard Worker  !llvm.ident = !{!0}
284*9880d681SAndroid Build Coastguard Worker  !0 = metadata !{metadata !"Compiler V3"}
285*9880d681SAndroid Build Coastguard Worker
286*9880d681SAndroid Build Coastguard WorkerFor symmetry reasons, ``ident.ll`` is just a dummy file that doesn't
287*9880d681SAndroid Build Coastguard Workeractually participate in the test besides holding the ``RUN:`` lines.
288*9880d681SAndroid Build Coastguard Worker
289*9880d681SAndroid Build Coastguard Worker.. note::
290*9880d681SAndroid Build Coastguard Worker
291*9880d681SAndroid Build Coastguard Worker  Some existing tests use ``RUN: true`` in extra files instead of just
292*9880d681SAndroid Build Coastguard Worker  putting the extra files in an ``Inputs/`` directory. This pattern is
293*9880d681SAndroid Build Coastguard Worker  deprecated.
294*9880d681SAndroid Build Coastguard Worker
295*9880d681SAndroid Build Coastguard WorkerFragile tests
296*9880d681SAndroid Build Coastguard Worker-------------
297*9880d681SAndroid Build Coastguard Worker
298*9880d681SAndroid Build Coastguard WorkerIt is easy to write a fragile test that would fail spuriously if the tool being
299*9880d681SAndroid Build Coastguard Workertested outputs a full path to the input file.  For example, :program:`opt` by
300*9880d681SAndroid Build Coastguard Workerdefault outputs a ``ModuleID``:
301*9880d681SAndroid Build Coastguard Worker
302*9880d681SAndroid Build Coastguard Worker.. code-block:: console
303*9880d681SAndroid Build Coastguard Worker
304*9880d681SAndroid Build Coastguard Worker  $ cat example.ll
305*9880d681SAndroid Build Coastguard Worker  define i32 @main() nounwind {
306*9880d681SAndroid Build Coastguard Worker      ret i32 0
307*9880d681SAndroid Build Coastguard Worker  }
308*9880d681SAndroid Build Coastguard Worker
309*9880d681SAndroid Build Coastguard Worker  $ opt -S /path/to/example.ll
310*9880d681SAndroid Build Coastguard Worker  ; ModuleID = '/path/to/example.ll'
311*9880d681SAndroid Build Coastguard Worker
312*9880d681SAndroid Build Coastguard Worker  define i32 @main() nounwind {
313*9880d681SAndroid Build Coastguard Worker      ret i32 0
314*9880d681SAndroid Build Coastguard Worker  }
315*9880d681SAndroid Build Coastguard Worker
316*9880d681SAndroid Build Coastguard Worker``ModuleID`` can unexpetedly match against ``CHECK`` lines.  For example:
317*9880d681SAndroid Build Coastguard Worker
318*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm
319*9880d681SAndroid Build Coastguard Worker
320*9880d681SAndroid Build Coastguard Worker  ; RUN: opt -S %s | FileCheck
321*9880d681SAndroid Build Coastguard Worker
322*9880d681SAndroid Build Coastguard Worker  define i32 @main() nounwind {
323*9880d681SAndroid Build Coastguard Worker      ; CHECK-NOT: load
324*9880d681SAndroid Build Coastguard Worker      ret i32 0
325*9880d681SAndroid Build Coastguard Worker  }
326*9880d681SAndroid Build Coastguard Worker
327*9880d681SAndroid Build Coastguard WorkerThis test will fail if placed into a ``download`` directory.
328*9880d681SAndroid Build Coastguard Worker
329*9880d681SAndroid Build Coastguard WorkerTo make your tests robust, always use ``opt ... < %s`` in the RUN line.
330*9880d681SAndroid Build Coastguard Worker:program:`opt` does not output a ``ModuleID`` when input comes from stdin.
331*9880d681SAndroid Build Coastguard Worker
332*9880d681SAndroid Build Coastguard WorkerPlatform-Specific Tests
333*9880d681SAndroid Build Coastguard Worker-----------------------
334*9880d681SAndroid Build Coastguard Worker
335*9880d681SAndroid Build Coastguard WorkerWhenever adding tests that require the knowledge of a specific platform,
336*9880d681SAndroid Build Coastguard Workereither related to code generated, specific output or back-end features,
337*9880d681SAndroid Build Coastguard Workeryou must make sure to isolate the features, so that buildbots that
338*9880d681SAndroid Build Coastguard Workerrun on different architectures (and don't even compile all back-ends),
339*9880d681SAndroid Build Coastguard Workerdon't fail.
340*9880d681SAndroid Build Coastguard Worker
341*9880d681SAndroid Build Coastguard WorkerThe first problem is to check for target-specific output, for example sizes
342*9880d681SAndroid Build Coastguard Workerof structures, paths and architecture names, for example:
343*9880d681SAndroid Build Coastguard Worker
344*9880d681SAndroid Build Coastguard Worker* Tests containing Windows paths will fail on Linux and vice-versa.
345*9880d681SAndroid Build Coastguard Worker* Tests that check for ``x86_64`` somewhere in the text will fail anywhere else.
346*9880d681SAndroid Build Coastguard Worker* Tests where the debug information calculates the size of types and structures.
347*9880d681SAndroid Build Coastguard Worker
348*9880d681SAndroid Build Coastguard WorkerAlso, if the test rely on any behaviour that is coded in any back-end, it must
349*9880d681SAndroid Build Coastguard Workergo in its own directory. So, for instance, code generator tests for ARM go
350*9880d681SAndroid Build Coastguard Workerinto ``test/CodeGen/ARM`` and so on. Those directories contain a special
351*9880d681SAndroid Build Coastguard Worker``lit`` configuration file that ensure all tests in that directory will
352*9880d681SAndroid Build Coastguard Workeronly run if a specific back-end is compiled and available.
353*9880d681SAndroid Build Coastguard Worker
354*9880d681SAndroid Build Coastguard WorkerFor instance, on ``test/CodeGen/ARM``, the ``lit.local.cfg`` is:
355*9880d681SAndroid Build Coastguard Worker
356*9880d681SAndroid Build Coastguard Worker.. code-block:: python
357*9880d681SAndroid Build Coastguard Worker
358*9880d681SAndroid Build Coastguard Worker  config.suffixes = ['.ll', '.c', '.cpp', '.test']
359*9880d681SAndroid Build Coastguard Worker  if not 'ARM' in config.root.targets:
360*9880d681SAndroid Build Coastguard Worker    config.unsupported = True
361*9880d681SAndroid Build Coastguard Worker
362*9880d681SAndroid Build Coastguard WorkerOther platform-specific tests are those that depend on a specific feature
363*9880d681SAndroid Build Coastguard Workerof a specific sub-architecture, for example only to Intel chips that support ``AVX2``.
364*9880d681SAndroid Build Coastguard Worker
365*9880d681SAndroid Build Coastguard WorkerFor instance, ``test/CodeGen/X86/psubus.ll`` tests three sub-architecture
366*9880d681SAndroid Build Coastguard Workervariants:
367*9880d681SAndroid Build Coastguard Worker
368*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm
369*9880d681SAndroid Build Coastguard Worker
370*9880d681SAndroid Build Coastguard Worker  ; RUN: llc -mcpu=core2 < %s | FileCheck %s -check-prefix=SSE2
371*9880d681SAndroid Build Coastguard Worker  ; RUN: llc -mcpu=corei7-avx < %s | FileCheck %s -check-prefix=AVX1
372*9880d681SAndroid Build Coastguard Worker  ; RUN: llc -mcpu=core-avx2 < %s | FileCheck %s -check-prefix=AVX2
373*9880d681SAndroid Build Coastguard Worker
374*9880d681SAndroid Build Coastguard WorkerAnd the checks are different:
375*9880d681SAndroid Build Coastguard Worker
376*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm
377*9880d681SAndroid Build Coastguard Worker
378*9880d681SAndroid Build Coastguard Worker  ; SSE2: @test1
379*9880d681SAndroid Build Coastguard Worker  ; SSE2: psubusw LCPI0_0(%rip), %xmm0
380*9880d681SAndroid Build Coastguard Worker  ; AVX1: @test1
381*9880d681SAndroid Build Coastguard Worker  ; AVX1: vpsubusw LCPI0_0(%rip), %xmm0, %xmm0
382*9880d681SAndroid Build Coastguard Worker  ; AVX2: @test1
383*9880d681SAndroid Build Coastguard Worker  ; AVX2: vpsubusw LCPI0_0(%rip), %xmm0, %xmm0
384*9880d681SAndroid Build Coastguard Worker
385*9880d681SAndroid Build Coastguard WorkerSo, if you're testing for a behaviour that you know is platform-specific or
386*9880d681SAndroid Build Coastguard Workerdepends on special features of sub-architectures, you must add the specific
387*9880d681SAndroid Build Coastguard Workertriple, test with the specific FileCheck and put it into the specific
388*9880d681SAndroid Build Coastguard Workerdirectory that will filter out all other architectures.
389*9880d681SAndroid Build Coastguard Worker
390*9880d681SAndroid Build Coastguard WorkerREQUIRES and REQUIRES-ANY directive
391*9880d681SAndroid Build Coastguard Worker~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
392*9880d681SAndroid Build Coastguard Worker
393*9880d681SAndroid Build Coastguard WorkerSome tests can be enabled only in specific situation - like having
394*9880d681SAndroid Build Coastguard Workerdebug build. Use ``REQUIRES`` directive to specify those requirements.
395*9880d681SAndroid Build Coastguard Worker
396*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm
397*9880d681SAndroid Build Coastguard Worker
398*9880d681SAndroid Build Coastguard Worker    ; This test will be only enabled in the build with asserts
399*9880d681SAndroid Build Coastguard Worker    ; REQUIRES: asserts
400*9880d681SAndroid Build Coastguard Worker
401*9880d681SAndroid Build Coastguard WorkerYou can separate requirements by a comma.
402*9880d681SAndroid Build Coastguard Worker``REQUIRES`` means all listed requirements must be satisfied.
403*9880d681SAndroid Build Coastguard Worker``REQUIRES-ANY`` means at least one must be satisfied.
404*9880d681SAndroid Build Coastguard Worker
405*9880d681SAndroid Build Coastguard WorkerList of features that can be used in ``REQUIRES`` and ``REQUIRES-ANY`` can be
406*9880d681SAndroid Build Coastguard Workerfound in lit.cfg files.
407*9880d681SAndroid Build Coastguard Worker
408*9880d681SAndroid Build Coastguard WorkerSubstitutions
409*9880d681SAndroid Build Coastguard Worker-------------
410*9880d681SAndroid Build Coastguard Worker
411*9880d681SAndroid Build Coastguard WorkerBesides replacing LLVM tool names the following substitutions are performed in
412*9880d681SAndroid Build Coastguard WorkerRUN lines:
413*9880d681SAndroid Build Coastguard Worker
414*9880d681SAndroid Build Coastguard Worker``%%``
415*9880d681SAndroid Build Coastguard Worker   Replaced by a single ``%``. This allows escaping other substitutions.
416*9880d681SAndroid Build Coastguard Worker
417*9880d681SAndroid Build Coastguard Worker``%s``
418*9880d681SAndroid Build Coastguard Worker   File path to the test case's source. This is suitable for passing on the
419*9880d681SAndroid Build Coastguard Worker   command line as the input to an LLVM tool.
420*9880d681SAndroid Build Coastguard Worker
421*9880d681SAndroid Build Coastguard Worker   Example: ``/home/user/llvm/test/MC/ELF/foo_test.s``
422*9880d681SAndroid Build Coastguard Worker
423*9880d681SAndroid Build Coastguard Worker``%S``
424*9880d681SAndroid Build Coastguard Worker   Directory path to the test case's source.
425*9880d681SAndroid Build Coastguard Worker
426*9880d681SAndroid Build Coastguard Worker   Example: ``/home/user/llvm/test/MC/ELF``
427*9880d681SAndroid Build Coastguard Worker
428*9880d681SAndroid Build Coastguard Worker``%t``
429*9880d681SAndroid Build Coastguard Worker   File path to a temporary file name that could be used for this test case.
430*9880d681SAndroid Build Coastguard Worker   The file name won't conflict with other test cases. You can append to it
431*9880d681SAndroid Build Coastguard Worker   if you need multiple temporaries. This is useful as the destination of
432*9880d681SAndroid Build Coastguard Worker   some redirected output.
433*9880d681SAndroid Build Coastguard Worker
434*9880d681SAndroid Build Coastguard Worker   Example: ``/home/user/llvm.build/test/MC/ELF/Output/foo_test.s.tmp``
435*9880d681SAndroid Build Coastguard Worker
436*9880d681SAndroid Build Coastguard Worker``%T``
437*9880d681SAndroid Build Coastguard Worker   Directory of ``%t``.
438*9880d681SAndroid Build Coastguard Worker
439*9880d681SAndroid Build Coastguard Worker   Example: ``/home/user/llvm.build/test/MC/ELF/Output``
440*9880d681SAndroid Build Coastguard Worker
441*9880d681SAndroid Build Coastguard Worker``%{pathsep}``
442*9880d681SAndroid Build Coastguard Worker
443*9880d681SAndroid Build Coastguard Worker   Expands to the path separator, i.e. ``:`` (or ``;`` on Windows).
444*9880d681SAndroid Build Coastguard Worker
445*9880d681SAndroid Build Coastguard Worker
446*9880d681SAndroid Build Coastguard Worker**LLVM-specific substitutions:**
447*9880d681SAndroid Build Coastguard Worker
448*9880d681SAndroid Build Coastguard Worker``%shlibext``
449*9880d681SAndroid Build Coastguard Worker   The suffix for the host platforms shared library files. This includes the
450*9880d681SAndroid Build Coastguard Worker   period as the first character.
451*9880d681SAndroid Build Coastguard Worker
452*9880d681SAndroid Build Coastguard Worker   Example: ``.so`` (Linux), ``.dylib`` (OS X), ``.dll`` (Windows)
453*9880d681SAndroid Build Coastguard Worker
454*9880d681SAndroid Build Coastguard Worker``%exeext``
455*9880d681SAndroid Build Coastguard Worker   The suffix for the host platforms executable files. This includes the
456*9880d681SAndroid Build Coastguard Worker   period as the first character.
457*9880d681SAndroid Build Coastguard Worker
458*9880d681SAndroid Build Coastguard Worker   Example: ``.exe`` (Windows), empty on Linux.
459*9880d681SAndroid Build Coastguard Worker
460*9880d681SAndroid Build Coastguard Worker``%(line)``, ``%(line+<number>)``, ``%(line-<number>)``
461*9880d681SAndroid Build Coastguard Worker   The number of the line where this substitution is used, with an optional
462*9880d681SAndroid Build Coastguard Worker   integer offset. This can be used in tests with multiple RUN lines, which
463*9880d681SAndroid Build Coastguard Worker   reference test file's line numbers.
464*9880d681SAndroid Build Coastguard Worker
465*9880d681SAndroid Build Coastguard Worker
466*9880d681SAndroid Build Coastguard Worker**Clang-specific substitutions:**
467*9880d681SAndroid Build Coastguard Worker
468*9880d681SAndroid Build Coastguard Worker``%clang``
469*9880d681SAndroid Build Coastguard Worker   Invokes the Clang driver.
470*9880d681SAndroid Build Coastguard Worker
471*9880d681SAndroid Build Coastguard Worker``%clang_cpp``
472*9880d681SAndroid Build Coastguard Worker   Invokes the Clang driver for C++.
473*9880d681SAndroid Build Coastguard Worker
474*9880d681SAndroid Build Coastguard Worker``%clang_cl``
475*9880d681SAndroid Build Coastguard Worker   Invokes the CL-compatible Clang driver.
476*9880d681SAndroid Build Coastguard Worker
477*9880d681SAndroid Build Coastguard Worker``%clangxx``
478*9880d681SAndroid Build Coastguard Worker   Invokes the G++-compatible Clang driver.
479*9880d681SAndroid Build Coastguard Worker
480*9880d681SAndroid Build Coastguard Worker``%clang_cc1``
481*9880d681SAndroid Build Coastguard Worker   Invokes the Clang frontend.
482*9880d681SAndroid Build Coastguard Worker
483*9880d681SAndroid Build Coastguard Worker``%itanium_abi_triple``, ``%ms_abi_triple``
484*9880d681SAndroid Build Coastguard Worker   These substitutions can be used to get the current target triple adjusted to
485*9880d681SAndroid Build Coastguard Worker   the desired ABI. For example, if the test suite is running with the
486*9880d681SAndroid Build Coastguard Worker   ``i686-pc-win32`` target, ``%itanium_abi_triple`` will expand to
487*9880d681SAndroid Build Coastguard Worker   ``i686-pc-mingw32``. This allows a test to run with a specific ABI without
488*9880d681SAndroid Build Coastguard Worker   constraining it to a specific triple.
489*9880d681SAndroid Build Coastguard Worker
490*9880d681SAndroid Build Coastguard WorkerTo add more substituations, look at ``test/lit.cfg`` or ``lit.local.cfg``.
491*9880d681SAndroid Build Coastguard Worker
492*9880d681SAndroid Build Coastguard Worker
493*9880d681SAndroid Build Coastguard WorkerOptions
494*9880d681SAndroid Build Coastguard Worker-------
495*9880d681SAndroid Build Coastguard Worker
496*9880d681SAndroid Build Coastguard WorkerThe llvm lit configuration allows to customize some things with user options:
497*9880d681SAndroid Build Coastguard Worker
498*9880d681SAndroid Build Coastguard Worker``llc``, ``opt``, ...
499*9880d681SAndroid Build Coastguard Worker    Substitute the respective llvm tool name with a custom command line. This
500*9880d681SAndroid Build Coastguard Worker    allows to specify custom paths and default arguments for these tools.
501*9880d681SAndroid Build Coastguard Worker    Example:
502*9880d681SAndroid Build Coastguard Worker
503*9880d681SAndroid Build Coastguard Worker    % llvm-lit "-Dllc=llc -verify-machineinstrs"
504*9880d681SAndroid Build Coastguard Worker
505*9880d681SAndroid Build Coastguard Worker``run_long_tests``
506*9880d681SAndroid Build Coastguard Worker    Enable the execution of long running tests.
507*9880d681SAndroid Build Coastguard Worker
508*9880d681SAndroid Build Coastguard Worker``llvm_site_config``
509*9880d681SAndroid Build Coastguard Worker    Load the specified lit configuration instead of the default one.
510*9880d681SAndroid Build Coastguard Worker
511*9880d681SAndroid Build Coastguard Worker
512*9880d681SAndroid Build Coastguard WorkerOther Features
513*9880d681SAndroid Build Coastguard Worker--------------
514*9880d681SAndroid Build Coastguard Worker
515*9880d681SAndroid Build Coastguard WorkerTo make RUN line writing easier, there are several helper programs. These
516*9880d681SAndroid Build Coastguard Workerhelpers are in the PATH when running tests, so you can just call them using
517*9880d681SAndroid Build Coastguard Workertheir name. For example:
518*9880d681SAndroid Build Coastguard Worker
519*9880d681SAndroid Build Coastguard Worker``not``
520*9880d681SAndroid Build Coastguard Worker   This program runs its arguments and then inverts the result code from it.
521*9880d681SAndroid Build Coastguard Worker   Zero result codes become 1. Non-zero result codes become 0.
522*9880d681SAndroid Build Coastguard Worker
523*9880d681SAndroid Build Coastguard WorkerSometimes it is necessary to mark a test case as "expected fail" or
524*9880d681SAndroid Build Coastguard WorkerXFAIL. You can easily mark a test as XFAIL just by including ``XFAIL:``
525*9880d681SAndroid Build Coastguard Workeron a line near the top of the file. This signals that the test case
526*9880d681SAndroid Build Coastguard Workershould succeed if the test fails. Such test cases are counted separately
527*9880d681SAndroid Build Coastguard Workerby the testing tool. To specify an expected fail, use the XFAIL keyword
528*9880d681SAndroid Build Coastguard Workerin the comments of the test program followed by a colon and one or more
529*9880d681SAndroid Build Coastguard Workerfailure patterns. Each failure pattern can be either ``*`` (to specify
530*9880d681SAndroid Build Coastguard Workerfail everywhere), or a part of a target triple (indicating the test
531*9880d681SAndroid Build Coastguard Workershould fail on that platform), or the name of a configurable feature
532*9880d681SAndroid Build Coastguard Worker(for example, ``loadable_module``). If there is a match, the test is
533*9880d681SAndroid Build Coastguard Workerexpected to fail. If not, the test is expected to succeed. To XFAIL
534*9880d681SAndroid Build Coastguard Workereverywhere just specify ``XFAIL: *``. Here is an example of an ``XFAIL``
535*9880d681SAndroid Build Coastguard Workerline:
536*9880d681SAndroid Build Coastguard Worker
537*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm
538*9880d681SAndroid Build Coastguard Worker
539*9880d681SAndroid Build Coastguard Worker    ; XFAIL: darwin,sun
540*9880d681SAndroid Build Coastguard Worker
541*9880d681SAndroid Build Coastguard WorkerTo make the output more useful, :program:`lit` will scan
542*9880d681SAndroid Build Coastguard Workerthe lines of the test case for ones that contain a pattern that matches
543*9880d681SAndroid Build Coastguard Worker``PR[0-9]+``. This is the syntax for specifying a PR (Problem Report) number
544*9880d681SAndroid Build Coastguard Workerthat is related to the test case. The number after "PR" specifies the
545*9880d681SAndroid Build Coastguard WorkerLLVM bugzilla number. When a PR number is specified, it will be used in
546*9880d681SAndroid Build Coastguard Workerthe pass/fail reporting. This is useful to quickly get some context when
547*9880d681SAndroid Build Coastguard Workera test fails.
548*9880d681SAndroid Build Coastguard Worker
549*9880d681SAndroid Build Coastguard WorkerFinally, any line that contains "END." will cause the special
550*9880d681SAndroid Build Coastguard Workerinterpretation of lines to terminate. This is generally done right after
551*9880d681SAndroid Build Coastguard Workerthe last RUN: line. This has two side effects:
552*9880d681SAndroid Build Coastguard Worker
553*9880d681SAndroid Build Coastguard Worker(a) it prevents special interpretation of lines that are part of the test
554*9880d681SAndroid Build Coastguard Worker    program, not the instructions to the test case, and
555*9880d681SAndroid Build Coastguard Worker
556*9880d681SAndroid Build Coastguard Worker(b) it speeds things up for really big test cases by avoiding
557*9880d681SAndroid Build Coastguard Worker    interpretation of the remainder of the file.
558*9880d681SAndroid Build Coastguard Worker
559*9880d681SAndroid Build Coastguard Worker.. _test-suite-overview:
560*9880d681SAndroid Build Coastguard Worker
561*9880d681SAndroid Build Coastguard Worker``test-suite`` Overview
562*9880d681SAndroid Build Coastguard Worker=======================
563*9880d681SAndroid Build Coastguard Worker
564*9880d681SAndroid Build Coastguard WorkerThe ``test-suite`` module contains a number of programs that can be
565*9880d681SAndroid Build Coastguard Workercompiled and executed. The ``test-suite`` includes reference outputs for
566*9880d681SAndroid Build Coastguard Workerall of the programs, so that the output of the executed program can be
567*9880d681SAndroid Build Coastguard Workerchecked for correctness.
568*9880d681SAndroid Build Coastguard Worker
569*9880d681SAndroid Build Coastguard Worker``test-suite`` tests are divided into three types of tests: MultiSource,
570*9880d681SAndroid Build Coastguard WorkerSingleSource, and External.
571*9880d681SAndroid Build Coastguard Worker
572*9880d681SAndroid Build Coastguard Worker-  ``test-suite/SingleSource``
573*9880d681SAndroid Build Coastguard Worker
574*9880d681SAndroid Build Coastguard Worker   The SingleSource directory contains test programs that are only a
575*9880d681SAndroid Build Coastguard Worker   single source file in size. These are usually small benchmark
576*9880d681SAndroid Build Coastguard Worker   programs or small programs that calculate a particular value. Several
577*9880d681SAndroid Build Coastguard Worker   such programs are grouped together in each directory.
578*9880d681SAndroid Build Coastguard Worker
579*9880d681SAndroid Build Coastguard Worker-  ``test-suite/MultiSource``
580*9880d681SAndroid Build Coastguard Worker
581*9880d681SAndroid Build Coastguard Worker   The MultiSource directory contains subdirectories which contain
582*9880d681SAndroid Build Coastguard Worker   entire programs with multiple source files. Large benchmarks and
583*9880d681SAndroid Build Coastguard Worker   whole applications go here.
584*9880d681SAndroid Build Coastguard Worker
585*9880d681SAndroid Build Coastguard Worker-  ``test-suite/External``
586*9880d681SAndroid Build Coastguard Worker
587*9880d681SAndroid Build Coastguard Worker   The External directory contains Makefiles for building code that is
588*9880d681SAndroid Build Coastguard Worker   external to (i.e., not distributed with) LLVM. The most prominent
589*9880d681SAndroid Build Coastguard Worker   members of this directory are the SPEC 95 and SPEC 2000 benchmark
590*9880d681SAndroid Build Coastguard Worker   suites. The ``External`` directory does not contain these actual
591*9880d681SAndroid Build Coastguard Worker   tests, but only the Makefiles that know how to properly compile these
592*9880d681SAndroid Build Coastguard Worker   programs from somewhere else. When using ``LNT``, use the
593*9880d681SAndroid Build Coastguard Worker   ``--test-externals`` option to include these tests in the results.
594*9880d681SAndroid Build Coastguard Worker
595*9880d681SAndroid Build Coastguard Worker.. _test-suite-quickstart:
596*9880d681SAndroid Build Coastguard Worker
597*9880d681SAndroid Build Coastguard Worker``test-suite`` Quickstart
598*9880d681SAndroid Build Coastguard Worker-------------------------
599*9880d681SAndroid Build Coastguard Worker
600*9880d681SAndroid Build Coastguard WorkerThe modern way of running the ``test-suite`` is focused on testing and
601*9880d681SAndroid Build Coastguard Workerbenchmarking complete compilers using the
602*9880d681SAndroid Build Coastguard Worker`LNT <http://llvm.org/docs/lnt>`_ testing infrastructure.
603*9880d681SAndroid Build Coastguard Worker
604*9880d681SAndroid Build Coastguard WorkerFor more information on using LNT to execute the ``test-suite``, please
605*9880d681SAndroid Build Coastguard Workersee the `LNT Quickstart <http://llvm.org/docs/lnt/quickstart.html>`_
606*9880d681SAndroid Build Coastguard Workerdocumentation.
607*9880d681SAndroid Build Coastguard Worker
608*9880d681SAndroid Build Coastguard Worker``test-suite`` Makefiles
609*9880d681SAndroid Build Coastguard Worker------------------------
610*9880d681SAndroid Build Coastguard Worker
611*9880d681SAndroid Build Coastguard WorkerHistorically, the ``test-suite`` was executed using a complicated setup
612*9880d681SAndroid Build Coastguard Workerof Makefiles. The LNT based approach above is recommended for most
613*9880d681SAndroid Build Coastguard Workerusers, but there are some testing scenarios which are not supported by
614*9880d681SAndroid Build Coastguard Workerthe LNT approach. In addition, LNT currently uses the Makefile setup
615*9880d681SAndroid Build Coastguard Workerunder the covers and so developers who are interested in how LNT works
616*9880d681SAndroid Build Coastguard Workerunder the hood may want to understand the Makefile based setup.
617*9880d681SAndroid Build Coastguard Worker
618*9880d681SAndroid Build Coastguard WorkerFor more information on the ``test-suite`` Makefile setup, please see
619*9880d681SAndroid Build Coastguard Workerthe :doc:`Test Suite Makefile Guide <TestSuiteMakefileGuide>`.
620