blob: 099c756ee23fbdce876735df5626041a995c7858 [file] [log] [blame]
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00001lit - LLVM Integrated Tester
2============================
3
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00004SYNOPSIS
5--------
6
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +00007:program:`lit` [*options*] [*tests*]
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00008
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +00009DESCRIPTION
10-----------
11
Dmitri Gribenkoe260d3a2012-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 Dunbar8f4a8a62012-05-08 16:50:35 +000016
Dmitri Gribenkoe260d3a2012-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 Dunbar8f4a8a62012-05-08 16:50:35 +000020
21Each specified test will be executed (potentially in parallel) and once all
Dmitri Gribenkoe260d3a2012-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 Dunbar8f4a8a62012-05-08 16:50:35 +000026
Dmitri Gribenkoe260d3a2012-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 Dunbar8f4a8a62012-05-08 16:50:35 +000030
Dmitri Gribenkoe260d3a2012-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 Gribenko6e303f72012-11-29 17:05:34 +000033:ref:`execution-options` for more information.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000034
Dmitri Gribenkoe260d3a2012-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 Dunbar8f4a8a62012-05-08 16:50:35 +000038
Dmitri Gribenkoe260d3a2012-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 Dunbar8f4a8a62012-05-08 16:50:35 +000041
42GENERAL OPTIONS
43---------------
44
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +000045.. option:: -h, --help
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000046
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +000047 Show the :program:`lit` help message.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000048
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +000049.. option:: -j N, --threads=N
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000050
Dmitri Gribenkoe260d3a2012-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 Dunbar8f4a8a62012-05-08 16:50:35 +000053
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +000054.. option:: --config-prefix=NAME
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000055
Dmitri Gribenkoe260d3a2012-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 Dunbar8f4a8a62012-05-08 16:50:35 +000058
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +000059.. option:: --param NAME, --param NAME=VALUE
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000060
Dmitri Gribenkoe260d3a2012-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 Dunbar8f4a8a62012-05-08 16:50:35 +000063 dependent.
64
Dmitri Gribenko6e303f72012-11-29 17:05:34 +000065.. _output-options:
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000066
67OUTPUT OPTIONS
68--------------
69
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +000070.. option:: -q, --quiet
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000071
72 Suppress any output except for test failures.
73
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +000074.. option:: -s, --succinct
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000075
76 Show less output, for example don't show information on tests that pass.
77
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +000078.. option:: -v, --verbose
Daniel Dunbar8f4a8a62012-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 Gribenkoe260d3a2012-11-29 18:03:08 +000083.. option:: --no-progress-bar
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000084
85 Do not use curses based progress bar.
86
Eric Fiselier18fab462014-07-31 20:11:13 +000087.. option:: --show-unsupported
88
89 Show the names of unsupported tests.
90
Eric Fiselierc85f00a2014-08-02 01:29:52 +000091.. option:: --show-xfail
92
93 Show the names of tests that were expected to fail.
94
Dmitri Gribenko6e303f72012-11-29 17:05:34 +000095.. _execution-options:
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +000096
97EXECUTION OPTIONS
98-----------------
99
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000100.. option:: --path=PATH
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000101
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000102 Specify an additional ``PATH`` to use when searching for executables in tests.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000103
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000104.. option:: --vg
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000105
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000106 Run individual tests under valgrind (using the memcheck tool). The
107 ``--error-exitcode`` argument for valgrind is used so that valgrind failures
108 will cause the program to exit with a non-zero status.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000109
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000110 When this option is enabled, :program:`lit` will also automatically provide a
111 "``valgrind``" feature that can be used to conditionally disable (or expect
112 failure in) certain tests.
Daniel Dunbar519a3492012-10-19 20:12:00 +0000113
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000114.. option:: --vg-arg=ARG
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000115
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000116 When :option:`--vg` is used, specify an additional argument to pass to
117 :program:`valgrind` itself.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000118
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000119.. option:: --vg-leak
Daniel Dunbar519a3492012-10-19 20:12:00 +0000120
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000121 When :option:`--vg` is used, enable memory leak checks. When this option is
122 enabled, :program:`lit` will also automatically provide a "``vg_leak``"
123 feature that can be used to conditionally disable (or expect failure in)
124 certain tests.
Daniel Dunbar519a3492012-10-19 20:12:00 +0000125
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000126.. option:: --time-tests
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000127
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000128 Track the wall time individual tests take to execute and includes the results
129 in the summary output. This is useful for determining which tests in a test
130 suite take the most time to execute. Note that this option is most useful
131 with ``-j 1``.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000132
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000133.. _selection-options:
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000134
135SELECTION OPTIONS
136-----------------
137
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000138.. option:: --max-tests=N
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000139
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000140 Run at most ``N`` tests and then terminate.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000141
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000142.. option:: --max-time=N
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000143
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000144 Spend at most ``N`` seconds (approximately) running tests and then terminate.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000145
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000146.. option:: --shuffle
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000147
148 Run the tests in a random order.
149
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000150ADDITIONAL OPTIONS
151------------------
152
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000153.. option:: --debug
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000154
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000155 Run :program:`lit` in debug mode, for debugging configuration issues and
156 :program:`lit` itself.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000157
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000158.. option:: --show-suites
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000159
Daniel Dunbarc4477df2013-08-08 20:59:25 +0000160 List the discovered test suites and exit.
161
162.. option:: --show-tests
163
164 List all of the the discovered tests and exit.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000165
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000166EXIT STATUS
167-----------
168
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000169:program:`lit` will exit with an exit code of 1 if there are any FAIL or XPASS
170results. Otherwise, it will exit with the status 0. Other exit codes are used
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000171for non-test related failures (for example a user error or an internal program
172error).
173
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000174.. _test-discovery:
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000175
176TEST DISCOVERY
177--------------
178
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000179The inputs passed to :program:`lit` can be either individual tests, or entire
180directories or hierarchies of tests to run. When :program:`lit` starts up, the
181first thing it does is convert the inputs into a complete list of tests to run
182as part of *test discovery*.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000183
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000184In the :program:`lit` model, every test must exist inside some *test suite*.
185:program:`lit` resolves the inputs specified on the command line to test suites
186by searching upwards from the input path until it finds a :file:`lit.cfg` or
187:file:`lit.site.cfg` file. These files serve as both a marker of test suites
188and as configuration files which :program:`lit` loads in order to understand
189how to find and run the tests inside the test suite.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000190
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000191Once :program:`lit` has mapped the inputs into test suites it traverses the
192list of inputs adding tests for individual files and recursively searching for
193tests in directories.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000194
195This behavior makes it easy to specify a subset of tests to run, while still
196allowing the test suite configuration to control exactly how tests are
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000197interpreted. In addition, :program:`lit` always identifies tests by the test
198suite they are in, and their relative path inside the test suite. For
199appropriately configured projects, this allows :program:`lit` to provide
200convenient and flexible support for out-of-tree builds.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000201
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000202.. _test-status-results:
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000203
204TEST STATUS RESULTS
205-------------------
206
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000207Each test ultimately produces one of the following six results:
208
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000209**PASS**
210
211 The test succeeded.
212
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000213**XFAIL**
214
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000215 The test failed, but that is expected. This is used for test formats which allow
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000216 specifying that a test does not currently work, but wish to leave it in the test
217 suite.
218
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000219**XPASS**
220
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000221 The test succeeded, but it was expected to fail. This is used for tests which
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000222 were specified as expected to fail, but are now succeeding (generally because
223 the feature they test was broken and has been fixed).
224
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000225**FAIL**
226
227 The test failed.
228
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000229**UNRESOLVED**
230
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000231 The test result could not be determined. For example, this occurs when the test
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000232 could not be run, the test itself is invalid, or the test was interrupted.
233
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000234**UNSUPPORTED**
235
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000236 The test is not supported in this environment. This is used by test formats
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000237 which can report unsupported tests.
238
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000239Depending on the test format tests may produce additional information about
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000240their status (generally only for failures). See the :ref:`output-options`
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000241section for more information.
242
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000243.. _lit-infrastructure:
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000244
245LIT INFRASTRUCTURE
246------------------
247
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000248This section describes the :program:`lit` testing architecture for users interested in
249creating a new :program:`lit` testing implementation, or extending an existing one.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000250
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000251:program:`lit` proper is primarily an infrastructure for discovering and running
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000252arbitrary tests, and to expose a single convenient interface to these
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000253tests. :program:`lit` itself doesn't know how to run tests, rather this logic is
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000254defined by *test suites*.
255
256TEST SUITES
257~~~~~~~~~~~
258
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000259As described in :ref:`test-discovery`, tests are always located inside a *test
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000260suite*. Test suites serve to define the format of the tests they contain, the
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000261logic for finding those tests, and any additional information to run the tests.
262
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000263:program:`lit` identifies test suites as directories containing ``lit.cfg`` or
264``lit.site.cfg`` files (see also :option:`--config-prefix`). Test suites are
265initially discovered by recursively searching up the directory hierarchy for
266all the input files passed on the command line. You can use
267:option:`--show-suites` to display the discovered test suites at startup.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000268
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000269Once a test suite is discovered, its config file is loaded. Config files
270themselves are Python modules which will be executed. When the config file is
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000271executed, two important global variables are predefined:
272
Eric Fiselier6c53c862014-08-15 05:54:19 +0000273**lit_config**
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000274
275 The global **lit** configuration object (a *LitConfig* instance), which defines
276 the builtin test formats, global configuration parameters, and other helper
277 routines for implementing test configurations.
278
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000279**config**
280
281 This is the config object (a *TestingConfig* instance) for the test suite,
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000282 which the config file is expected to populate. The following variables are also
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000283 available on the *config* object, some of which must be set by the config and
284 others are optional or predefined:
285
286 **name** *[required]* The name of the test suite, for use in reports and
287 diagnostics.
288
289 **test_format** *[required]* The test format object which will be used to
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000290 discover and run tests in the test suite. Generally this will be a builtin test
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000291 format available from the *lit.formats* module.
292
Sergey Matveev8dbcb352013-05-30 12:37:52 +0000293 **test_source_root** The filesystem path to the test suite root. For out-of-dir
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000294 builds this is the directory that will be scanned for tests.
295
296 **test_exec_root** For out-of-dir builds, the path to the test suite root inside
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000297 the object directory. This is where tests will be run and temporary output files
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000298 placed.
299
300 **environment** A dictionary representing the environment to use when executing
301 tests in the suite.
302
303 **suffixes** For **lit** test formats which scan directories for tests, this
Dmitri Gribenko9e4fc282013-01-19 20:35:18 +0000304 variable is a list of suffixes to identify test files. Used by: *ShTest*.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000305
306 **substitutions** For **lit** test formats which substitute variables into a test
Dmitri Gribenko9e4fc282013-01-19 20:35:18 +0000307 script, the list of substitutions to perform. Used by: *ShTest*.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000308
309 **unsupported** Mark an unsupported directory, all tests within it will be
Dmitri Gribenko9e4fc282013-01-19 20:35:18 +0000310 reported as unsupported. Used by: *ShTest*.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000311
312 **parent** The parent configuration, this is the config object for the directory
313 containing the test suite, or None.
314
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000315 **root** The root configuration. This is the top-most :program:`lit` configuration in
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000316 the project.
317
318 **on_clone** The config is actually cloned for every subdirectory inside a test
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000319 suite, to allow local configuration on a per-directory basis. The *on_clone*
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000320 variable can be set to a Python function which will be called whenever a
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000321 configuration is cloned (for a subdirectory). The function should takes three
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000322 arguments: (1) the parent configuration, (2) the new configuration (which the
323 *on_clone* function will generally modify), and (3) the test path to the new
324 directory being scanned.
325
Rafael Espindola2a2a0972013-07-26 22:32:58 +0000326 **pipefail** Normally a test using a shell pipe fails if any of the commands
327 on the pipe fail. If this is not desired, setting this variable to false
328 makes the test fail only if the last command in the pipe fails.
329
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000330TEST DISCOVERY
331~~~~~~~~~~~~~~
332
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000333Once test suites are located, :program:`lit` recursively traverses the source
Sergey Matveev8dbcb352013-05-30 12:37:52 +0000334directory (following *test_source_root*) looking for tests. When :program:`lit`
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000335enters a sub-directory, it first checks to see if a nested test suite is
336defined in that directory. If so, it loads that test suite recursively,
337otherwise it instantiates a local test config for the directory (see
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000338:ref:`local-configuration-files`).
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000339
340Tests are identified by the test suite they are contained within, and the
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000341relative path inside that suite. Note that the relative path may not refer to
342an actual file on disk; some test formats (such as *GoogleTest*) define
343"virtual tests" which have a path that contains both the path to the actual
344test file and a subpath to identify the virtual test.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000345
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000346.. _local-configuration-files:
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000347
348LOCAL CONFIGURATION FILES
349~~~~~~~~~~~~~~~~~~~~~~~~~
350
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000351When :program:`lit` loads a subdirectory in a test suite, it instantiates a
352local test configuration by cloning the configuration for the parent direction
353--- the root of this configuration chain will always be a test suite. Once the
354test configuration is cloned :program:`lit` checks for a *lit.local.cfg* file
355in the subdirectory. If present, this file will be loaded and can be used to
356specialize the configuration for each individual directory. This facility can
357be used to define subdirectories of optional tests, or to change other
358configuration parameters --- for example, to change the test format, or the
359suffixes which identify test files.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000360
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000361TEST RUN OUTPUT FORMAT
362~~~~~~~~~~~~~~~~~~~~~~
363
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000364The :program:`lit` output for a test run conforms to the following schema, in
365both short and verbose modes (although in short mode no PASS lines will be
366shown). This schema has been chosen to be relatively easy to reliably parse by
367a machine (for example in buildbot log scraping), and for other tools to
368generate.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000369
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000370Each test result is expected to appear on a line that matches:
371
372.. code-block:: none
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000373
Eli Bendersky9d07f942012-11-20 00:26:08 +0000374 <result code>: <test name> (<progress info>)
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000375
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000376where ``<result-code>`` is a standard test result such as PASS, FAIL, XFAIL,
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000377XPASS, UNRESOLVED, or UNSUPPORTED. The performance result codes of IMPROVED and
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000378REGRESSED are also allowed.
379
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000380The ``<test name>`` field can consist of an arbitrary string containing no
381newline.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000382
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000383The ``<progress info>`` field can be used to report progress information such
384as (1/300) or can be empty, but even when empty the parentheses are required.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000385
386Each test result may include additional (multiline) log information in the
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000387following format:
388
389.. code-block:: none
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000390
Eli Bendersky9d07f942012-11-20 00:26:08 +0000391 <log delineator> TEST '(<test name>)' <trailing delineator>
392 ... log message ...
393 <log delineator>
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000394
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000395where ``<test name>`` should be the name of a preceding reported test, ``<log
396delineator>`` is a string of "*" characters *at least* four characters long
397(the recommended length is 20), and ``<trailing delineator>`` is an arbitrary
398(unparsed) string.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000399
400The following is an example of a test run output which consists of four tests A,
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000401B, C, and D, and a log message for the failing test C:
402
403.. code-block:: none
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000404
405 PASS: A (1 of 4)
406 PASS: B (2 of 4)
407 FAIL: C (3 of 4)
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000408 ******************** TEST 'C' FAILED ********************
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000409 Test 'C' failed as a result of exit code 1.
Dmitri Gribenko6e303f72012-11-29 17:05:34 +0000410 ********************
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000411 PASS: D (4 of 4)
412
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000413LIT EXAMPLE TESTS
414~~~~~~~~~~~~~~~~~
415
Dmitri Gribenkoe260d3a2012-11-29 18:03:08 +0000416The :program:`lit` distribution contains several example implementations of
417test suites in the *ExampleTests* directory.
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000418
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000419SEE ALSO
420--------
421
Daniel Dunbar8f4a8a62012-05-08 16:50:35 +0000422valgrind(1)