blob: 1dcaff10bfd52e5f2c5559cec1f88f4581a23187 [file] [log] [blame]
Daniel Dunbar3b709d52012-05-08 16:50:35 +00001lit - LLVM Integrated Tester
2============================
3
Daniel Dunbar3b709d52012-05-08 16:50:35 +00004SYNOPSIS
5--------
6
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +00007:program:`lit` [*options*] [*tests*]
Daniel Dunbar3b709d52012-05-08 16:50:35 +00008
Daniel Dunbar3b709d52012-05-08 16:50:35 +00009DESCRIPTION
10-----------
11
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000012:program:`lit` is a portable tool for executing LLVM and Clang style test
13suites, summarizing their results, and providing indication of failures.
14:program:`lit` is designed to be a lightweight testing tool with as simple a
15user interface as possible.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000016
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000017:program:`lit` should be run with one or more *tests* to run specified on the
18command line. Tests can be either individual test files or directories to
19search for tests (see :ref:`test-discovery`).
Daniel Dunbar3b709d52012-05-08 16:50:35 +000020
21Each specified test will be executed (potentially in parallel) and once all
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000022tests have been run :program:`lit` will print summary information on the number
23of tests which passed or failed (see :ref:`test-status-results`). The
24:program:`lit` program will execute with a non-zero exit code if any tests
25fail.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000026
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000027By default :program:`lit` will use a succinct progress display and will only
28print summary information for test failures. See :ref:`output-options` for
29options controlling the :program:`lit` progress display and output.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000030
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000031:program:`lit` also includes a number of options for controlling how tests are
32executed (specific features may depend on the particular test format). See
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +000033:ref:`execution-options` for more information.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000034
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000035Finally, :program:`lit` also supports additional options for only running a
36subset of the options specified on the command line, see
37:ref:`selection-options` for more information.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000038
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000039Users interested in the :program:`lit` architecture or designing a
40:program:`lit` testing implementation should see :ref:`lit-infrastructure`.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000041
42GENERAL OPTIONS
43---------------
44
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000045.. option:: -h, --help
Daniel Dunbar3b709d52012-05-08 16:50:35 +000046
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000047 Show the :program:`lit` help message.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000048
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000049.. option:: -j N, --threads=N
Daniel Dunbar3b709d52012-05-08 16:50:35 +000050
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000051 Run ``N`` tests in parallel. By default, this is automatically chosen to
52 match the number of detected available CPUs.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000053
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000054.. option:: --config-prefix=NAME
Daniel Dunbar3b709d52012-05-08 16:50:35 +000055
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000056 Search for :file:`{NAME}.cfg` and :file:`{NAME}.site.cfg` when searching for
57 test suites, instead of :file:`lit.cfg` and :file:`lit.site.cfg`.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000058
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000059.. option:: --param NAME, --param NAME=VALUE
Daniel Dunbar3b709d52012-05-08 16:50:35 +000060
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000061 Add a user defined parameter ``NAME`` with the given ``VALUE`` (or the empty
62 string if not given). The meaning and use of these parameters is test suite
Daniel Dunbar3b709d52012-05-08 16:50:35 +000063 dependent.
64
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +000065.. _output-options:
Daniel Dunbar3b709d52012-05-08 16:50:35 +000066
67OUTPUT OPTIONS
68--------------
69
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000070.. option:: -q, --quiet
Daniel Dunbar3b709d52012-05-08 16:50:35 +000071
72 Suppress any output except for test failures.
73
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000074.. option:: -s, --succinct
Daniel Dunbar3b709d52012-05-08 16:50:35 +000075
76 Show less output, for example don't show information on tests that pass.
77
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000078.. option:: -v, --verbose
Daniel Dunbar3b709d52012-05-08 16:50:35 +000079
80 Show more information on test failures, for example the entire test output
81 instead of just the test result.
82
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000083.. option:: --no-progress-bar
Daniel Dunbar3b709d52012-05-08 16:50:35 +000084
85 Do not use curses based progress bar.
86
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +000087.. _execution-options:
Daniel Dunbar3b709d52012-05-08 16:50:35 +000088
89EXECUTION OPTIONS
90-----------------
91
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000092.. option:: --path=PATH
Daniel Dunbar3b709d52012-05-08 16:50:35 +000093
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000094 Specify an additional ``PATH`` to use when searching for executables in tests.
Daniel Dunbar3b709d52012-05-08 16:50:35 +000095
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000096.. option:: --vg
Daniel Dunbar3b709d52012-05-08 16:50:35 +000097
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +000098 Run individual tests under valgrind (using the memcheck tool). The
99 ``--error-exitcode`` argument for valgrind is used so that valgrind failures
100 will cause the program to exit with a non-zero status.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000101
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000102 When this option is enabled, :program:`lit` will also automatically provide a
103 "``valgrind``" feature that can be used to conditionally disable (or expect
104 failure in) certain tests.
Daniel Dunbarf8545972012-10-19 20:12:00 +0000105
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000106.. option:: --vg-arg=ARG
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000107
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000108 When :option:`--vg` is used, specify an additional argument to pass to
109 :program:`valgrind` itself.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000110
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000111.. option:: --vg-leak
Daniel Dunbarf8545972012-10-19 20:12:00 +0000112
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000113 When :option:`--vg` is used, enable memory leak checks. When this option is
114 enabled, :program:`lit` will also automatically provide a "``vg_leak``"
115 feature that can be used to conditionally disable (or expect failure in)
116 certain tests.
Daniel Dunbarf8545972012-10-19 20:12:00 +0000117
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000118.. option:: --time-tests
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000119
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000120 Track the wall time individual tests take to execute and includes the results
121 in the summary output. This is useful for determining which tests in a test
122 suite take the most time to execute. Note that this option is most useful
123 with ``-j 1``.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000124
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000125.. _selection-options:
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000126
127SELECTION OPTIONS
128-----------------
129
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000130.. option:: --max-tests=N
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000131
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000132 Run at most ``N`` tests and then terminate.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000133
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000134.. option:: --max-time=N
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000135
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000136 Spend at most ``N`` seconds (approximately) running tests and then terminate.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000137
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000138.. option:: --shuffle
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000139
140 Run the tests in a random order.
141
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000142ADDITIONAL OPTIONS
143------------------
144
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000145.. option:: --debug
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000146
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000147 Run :program:`lit` in debug mode, for debugging configuration issues and
148 :program:`lit` itself.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000149
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000150.. option:: --show-suites
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000151
152 List the discovered test suites as part of the standard output.
153
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000154.. option:: --no-tcl-as-sh
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000155
156 Run Tcl scripts internally (instead of converting to shell scripts).
157
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000158.. option:: --repeat=N
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000159
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000160 Run each test ``N`` times. Currently this is primarily useful for timing
161 tests, other results are not collated in any reasonable fashion.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000162
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000163EXIT STATUS
164-----------
165
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000166:program:`lit` will exit with an exit code of 1 if there are any FAIL or XPASS
167results. Otherwise, it will exit with the status 0. Other exit codes are used
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000168for non-test related failures (for example a user error or an internal program
169error).
170
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000171.. _test-discovery:
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000172
173TEST DISCOVERY
174--------------
175
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000176The inputs passed to :program:`lit` can be either individual tests, or entire
177directories or hierarchies of tests to run. When :program:`lit` starts up, the
178first thing it does is convert the inputs into a complete list of tests to run
179as part of *test discovery*.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000180
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000181In the :program:`lit` model, every test must exist inside some *test suite*.
182:program:`lit` resolves the inputs specified on the command line to test suites
183by searching upwards from the input path until it finds a :file:`lit.cfg` or
184:file:`lit.site.cfg` file. These files serve as both a marker of test suites
185and as configuration files which :program:`lit` loads in order to understand
186how to find and run the tests inside the test suite.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000187
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000188Once :program:`lit` has mapped the inputs into test suites it traverses the
189list of inputs adding tests for individual files and recursively searching for
190tests in directories.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000191
192This behavior makes it easy to specify a subset of tests to run, while still
193allowing the test suite configuration to control exactly how tests are
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000194interpreted. In addition, :program:`lit` always identifies tests by the test
195suite they are in, and their relative path inside the test suite. For
196appropriately configured projects, this allows :program:`lit` to provide
197convenient and flexible support for out-of-tree builds.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000198
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000199.. _test-status-results:
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000200
201TEST STATUS RESULTS
202-------------------
203
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000204Each test ultimately produces one of the following six results:
205
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000206**PASS**
207
208 The test succeeded.
209
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000210**XFAIL**
211
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000212 The test failed, but that is expected. This is used for test formats which allow
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000213 specifying that a test does not currently work, but wish to leave it in the test
214 suite.
215
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000216**XPASS**
217
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000218 The test succeeded, but it was expected to fail. This is used for tests which
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000219 were specified as expected to fail, but are now succeeding (generally because
220 the feature they test was broken and has been fixed).
221
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000222**FAIL**
223
224 The test failed.
225
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000226**UNRESOLVED**
227
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000228 The test result could not be determined. For example, this occurs when the test
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000229 could not be run, the test itself is invalid, or the test was interrupted.
230
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000231**UNSUPPORTED**
232
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000233 The test is not supported in this environment. This is used by test formats
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000234 which can report unsupported tests.
235
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000236Depending on the test format tests may produce additional information about
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000237their status (generally only for failures). See the :ref:`output-options`
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000238section for more information.
239
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000240.. _lit-infrastructure:
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000241
242LIT INFRASTRUCTURE
243------------------
244
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000245This section describes the :program:`lit` testing architecture for users interested in
246creating a new :program:`lit` testing implementation, or extending an existing one.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000247
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000248:program:`lit` proper is primarily an infrastructure for discovering and running
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000249arbitrary tests, and to expose a single convenient interface to these
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000250tests. :program:`lit` itself doesn't know how to run tests, rather this logic is
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000251defined by *test suites*.
252
253TEST SUITES
254~~~~~~~~~~~
255
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000256As described in :ref:`test-discovery`, tests are always located inside a *test
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000257suite*. Test suites serve to define the format of the tests they contain, the
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000258logic for finding those tests, and any additional information to run the tests.
259
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000260:program:`lit` identifies test suites as directories containing ``lit.cfg`` or
261``lit.site.cfg`` files (see also :option:`--config-prefix`). Test suites are
262initially discovered by recursively searching up the directory hierarchy for
263all the input files passed on the command line. You can use
264:option:`--show-suites` to display the discovered test suites at startup.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000265
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000266Once a test suite is discovered, its config file is loaded. Config files
267themselves are Python modules which will be executed. When the config file is
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000268executed, two important global variables are predefined:
269
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000270**lit**
271
272 The global **lit** configuration object (a *LitConfig* instance), which defines
273 the builtin test formats, global configuration parameters, and other helper
274 routines for implementing test configurations.
275
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000276**config**
277
278 This is the config object (a *TestingConfig* instance) for the test suite,
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000279 which the config file is expected to populate. The following variables are also
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000280 available on the *config* object, some of which must be set by the config and
281 others are optional or predefined:
282
283 **name** *[required]* The name of the test suite, for use in reports and
284 diagnostics.
285
286 **test_format** *[required]* The test format object which will be used to
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000287 discover and run tests in the test suite. Generally this will be a builtin test
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000288 format available from the *lit.formats* module.
289
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000290 **test_src_root** The filesystem path to the test suite root. For out-of-dir
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000291 builds this is the directory that will be scanned for tests.
292
293 **test_exec_root** For out-of-dir builds, the path to the test suite root inside
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000294 the object directory. This is where tests will be run and temporary output files
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000295 placed.
296
297 **environment** A dictionary representing the environment to use when executing
298 tests in the suite.
299
300 **suffixes** For **lit** test formats which scan directories for tests, this
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000301 variable is a list of suffixes to identify test files. Used by: *ShTest*,
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000302 *TclTest*.
303
304 **substitutions** For **lit** test formats which substitute variables into a test
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000305 script, the list of substitutions to perform. Used by: *ShTest*, *TclTest*.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000306
307 **unsupported** Mark an unsupported directory, all tests within it will be
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000308 reported as unsupported. Used by: *ShTest*, *TclTest*.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000309
310 **parent** The parent configuration, this is the config object for the directory
311 containing the test suite, or None.
312
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000313 **root** The root configuration. This is the top-most :program:`lit` configuration in
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000314 the project.
315
316 **on_clone** The config is actually cloned for every subdirectory inside a test
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000317 suite, to allow local configuration on a per-directory basis. The *on_clone*
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000318 variable can be set to a Python function which will be called whenever a
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000319 configuration is cloned (for a subdirectory). The function should takes three
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000320 arguments: (1) the parent configuration, (2) the new configuration (which the
321 *on_clone* function will generally modify), and (3) the test path to the new
322 directory being scanned.
323
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000324TEST DISCOVERY
325~~~~~~~~~~~~~~
326
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000327Once test suites are located, :program:`lit` recursively traverses the source
328directory (following *test_src_root*) looking for tests. When :program:`lit`
329enters a sub-directory, it first checks to see if a nested test suite is
330defined in that directory. If so, it loads that test suite recursively,
331otherwise it instantiates a local test config for the directory (see
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000332:ref:`local-configuration-files`).
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000333
334Tests are identified by the test suite they are contained within, and the
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000335relative path inside that suite. Note that the relative path may not refer to
336an actual file on disk; some test formats (such as *GoogleTest*) define
337"virtual tests" which have a path that contains both the path to the actual
338test file and a subpath to identify the virtual test.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000339
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000340.. _local-configuration-files:
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000341
342LOCAL CONFIGURATION FILES
343~~~~~~~~~~~~~~~~~~~~~~~~~
344
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000345When :program:`lit` loads a subdirectory in a test suite, it instantiates a
346local test configuration by cloning the configuration for the parent direction
347--- the root of this configuration chain will always be a test suite. Once the
348test configuration is cloned :program:`lit` checks for a *lit.local.cfg* file
349in the subdirectory. If present, this file will be loaded and can be used to
350specialize the configuration for each individual directory. This facility can
351be used to define subdirectories of optional tests, or to change other
352configuration parameters --- for example, to change the test format, or the
353suffixes which identify test files.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000354
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000355TEST RUN OUTPUT FORMAT
356~~~~~~~~~~~~~~~~~~~~~~
357
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000358The :program:`lit` output for a test run conforms to the following schema, in
359both short and verbose modes (although in short mode no PASS lines will be
360shown). This schema has been chosen to be relatively easy to reliably parse by
361a machine (for example in buildbot log scraping), and for other tools to
362generate.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000363
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000364Each test result is expected to appear on a line that matches:
365
366.. code-block:: none
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000367
Eli Bendersky1f9f73a2012-11-20 00:26:08 +0000368 <result code>: <test name> (<progress info>)
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000369
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000370where ``<result-code>`` is a standard test result such as PASS, FAIL, XFAIL,
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000371XPASS, UNRESOLVED, or UNSUPPORTED. The performance result codes of IMPROVED and
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000372REGRESSED are also allowed.
373
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000374The ``<test name>`` field can consist of an arbitrary string containing no
375newline.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000376
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000377The ``<progress info>`` field can be used to report progress information such
378as (1/300) or can be empty, but even when empty the parentheses are required.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000379
380Each test result may include additional (multiline) log information in the
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000381following format:
382
383.. code-block:: none
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000384
Eli Bendersky1f9f73a2012-11-20 00:26:08 +0000385 <log delineator> TEST '(<test name>)' <trailing delineator>
386 ... log message ...
387 <log delineator>
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000388
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000389where ``<test name>`` should be the name of a preceding reported test, ``<log
390delineator>`` is a string of "*" characters *at least* four characters long
391(the recommended length is 20), and ``<trailing delineator>`` is an arbitrary
392(unparsed) string.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000393
394The following is an example of a test run output which consists of four tests A,
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000395B, C, and D, and a log message for the failing test C:
396
397.. code-block:: none
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000398
399 PASS: A (1 of 4)
400 PASS: B (2 of 4)
401 FAIL: C (3 of 4)
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000402 ******************** TEST 'C' FAILED ********************
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000403 Test 'C' failed as a result of exit code 1.
Dmitri Gribenkoe26b62c2012-11-29 17:05:34 +0000404 ********************
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000405 PASS: D (4 of 4)
406
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000407LIT EXAMPLE TESTS
408~~~~~~~~~~~~~~~~~
409
Dmitri Gribenkobc5fb062012-11-29 18:03:08 +0000410The :program:`lit` distribution contains several example implementations of
411test suites in the *ExampleTests* directory.
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000412
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000413SEE ALSO
414--------
415
Daniel Dunbar3b709d52012-05-08 16:50:35 +0000416valgrind(1)