1LIT(1)                        LLVM Command Guide                        LIT(1)
2
3
4

NAME

6       lit - LLVM Integrated Tester
7

SYNOPSIS

9       lit [options] [tests]
10

DESCRIPTION

12       lit is a portable tool for executing LLVM and Clang style test suites,
13       summarizing their results, and providing indication of failures. lit is
14       designed to be a lightweight testing tool with as simple a user
15       interface as possible.
16
17       lit should be run with one or more tests to run specified on the
18       command line. Tests can be either individual test files or directories
19       to search for tests (see "TEST DISCOVERY").
20
21       Each specified test will be executed (potentially in parallel) and once
22       all tests have been run lit will print summary information on the
23       number of tests which passed or failed (see "TEST STATUS RESULTS"). The
24       lit program will execute with a non-zero exit code if any tests fail.
25
26       By default lit will use a succinct progress display and will only print
27       summary information for test failures. See "OUTPUT OPTIONS" for options
28       controlling the lit progress display and output.
29
30       lit also includes a number of options for controlling how tests are
31       exected (specific features may depend on the particular test format).
32       See "EXECUTION OPTIONS" for more information.
33
34       Finally, lit also supports additional options for only running a subset
35       of the options specified on the command line, see "SELECTION OPTIONS"
36       for more information.
37
38       Users interested in the lit architecture or designing a lit testing
39       implementation should see "LIT ARCHITECTURE"
40

GENERAL OPTIONS

42       -h, --help
43           Show the lit help message.
44
45       -j N, --threads=N
46           Run N tests in parallel. By default, this is automatically chosen
47           to match the number of detected available CPUs.
48
49       --config-prefix=NAME
50           Search for NAME.cfg and NAME.site.cfg when searching for test
51           suites, instead of lit.cfg and lit.site.cfg.
52
53       --param NAME, --param NAME=VALUE
54           Add a user defined parameter NAME with the given VALUE (or the
55           empty string if not given). The meaning and use of these parameters
56           is test suite dependent.
57

OUTPUT OPTIONS

59       -q, --quiet
60           Suppress any output except for test failures.
61
62       -s, --succinct
63           Show less output, for example don't show information on tests that
64           pass.
65
66       -v, --verbose
67           Show more information on test failures, for example the entire test
68           output instead of just the test result.
69
70       --no-progress-bar
71           Do not use curses based progress bar.
72

EXECUTION OPTIONS

74       --path=PATH
75           Specify an addition PATH to use when searching for executables in
76           tests.
77
78       --vg
79           Run individual tests under valgrind (using the memcheck tool). The
80           --error-exitcode argument for valgrind is used so that valgrind
81           failures will cause the program to exit with a non-zero status.
82
83       --vg-arg=ARG
84           When --vg is used, specify an additional argument to pass to
85           valgrind itself.
86
87       --time-tests
88           Track the wall time individual tests take to execute and includes
89           the results in the summary output. This is useful for determining
90           which tests in a test suite take the most time to execute. Note
91           that this option is most useful with -j 1.
92

SELECTION OPTIONS

94       --max-tests=N
95           Run at most N tests and then terminate.
96
97       --max-time=N
98           Spend at most N seconds (approximately) running tests and then
99           terminate.
100
101       --shuffle
102           Run the tests in a random order.
103

ADDITIONAL OPTIONS

105       --debug
106           Run lit in debug mode, for debugging configuration issues and lit
107           itself.
108
109       --show-suites
110           List the discovered test suites as part of the standard output.
111
112       --no-tcl-as-sh
113           Run Tcl scripts internally (instead of converting to shell
114           scripts).
115
116       --repeat=N
117           Run each test N times. Currently this is primarily useful for
118           timing tests, other results are not collated in any reasonable
119           fashion.
120

EXIT STATUS

122       lit will exit with an exit code of 1 if there are any FAIL or XPASS
123       results. Otherwise, it will exit with the status 0. Other exit codes
124       used for non-test related failures (for example a user error or an
125       internal program error).
126

TEST DISCOVERY

128       The inputs passed to lit can be either individual tests, or entire
129       directories or hierarchies of tests to run. When lit starts up, the
130       first thing it does is convert the inputs into a complete list of tests
131       to run as part of test discovery.
132
133       In the lit model, every test must exist inside some test suite. lit
134       resolves the inputs specified on the command line to test suites by
135       searching upwards from the input path until it finds a lit.cfg or
136       lit.site.cfg file. These files serve as both a marker of test suites
137       and as configuration files which lit loads in order to understand how
138       to find and run the tests inside the test suite.
139
140       Once lit has mapped the inputs into test suites it traverses the list
141       of inputs adding tests for individual files and recursively searching
142       for tests in directories.
143
144       This behavior makes it easy to specify a subset of tests to run, while
145       still allowing the test suite configuration to control exactly how
146       tests are interpreted. In addition, lit always identifies tests by the
147       test suite they are in, and their relative path inside the test suite.
148       For appropriately configured projects, this allows lit to provide
149       convenient and flexible support for out-of-tree builds.
150

TEST STATUS RESULTS

152       Each test ultimately produces one of the following six results:
153
154       PASS
155           The test succeeded.
156
157       XFAIL
158           The test failed, but that is expected. This is used for test
159           formats which allow specifying that a test does not currently work,
160           but wish to leave it in the test suite.
161
162       XPASS
163           The test succeeded, but it was expected to fail. This is used for
164           tests which were specified as expected to fail, but are now
165           succeeding (generally because the feautre they test was broken and
166           has been fixed).
167
168       FAIL
169           The test failed.
170
171       UNRESOLVED
172           The test result could not be determined. For example, this occurs
173           when the test could not be run, the test itself is invalid, or the
174           test was interrupted.
175
176       UNSUPPORTED
177           The test is not supported in this environment. This is used by test
178           formats which can report unsupported tests.
179
180       Depending on the test format tests may produce additional information
181       about their status (generally only for failures). See the Output
182       section for more information.
183

LIT INFRASTRUCTURE

185       This section describes the lit testing architecture for users
186       interested in creating a new lit testing implementation, or extending
187       an existing one.
188
189       lit proper is primarily an infrastructure for discovering and running
190       arbitrary tests, and to expose a single convenient interface to these
191       tests. lit itself doesn't know how to run tests, rather this logic is
192       defined by test suites.
193
194   TEST SUITES
195       As described in "TEST DISCOVERY", tests are always located inside a
196       test suite. Test suites serve to define the format of the tests they
197       contain, the logic for finding those tests, and any additional
198       information to run the tests.
199
200       lit identifies test suites as directories containing lit.cfg or
201       lit.site.cfg files (see also --config-prefix. Test suites are initially
202       discovered by recursively searching up the directory hierarchy for all
203       the input files passed on the command line. You can use --show-suites
204       to display the discovered test suites at startup.
205
206       Once a test suite is discovered, its config file is loaded. Config
207       files themselves are Python modules which will be executed. When the
208       config file is executed, two important global variables are predefined:
209
210       lit The global lit configuration object (a LitConfig instance), which
211           defines the builtin test formats, global configuration parameters,
212           and other helper routines for implementing test configurations.
213
214       config
215           This is the config object (a TestingConfig instance) for the test
216           suite, which the config file is expected to populate. The following
217           variables are also available on the config object, some of which
218           must be set by the config and others are optional or predefined:
219
220           name [required] The name of the test suite, for use in reports and
221           diagnostics.
222
223           test_format [required] The test format object which will be used to
224           discover and run tests in the test suite. Generally this will be a
225           builtin test format available from the lit.formats module.
226
227           test_src_root The filesystem path to the test suite root. For out-
228           of-dir builds this is the directory that will be scanned for tests.
229
230           test_exec_root For out-of-dir builds, the path to the test suite
231           root inside the object directory. This is where tests will be run
232           and temporary output files places.
233
234           environment A dictionary representing the environment to use when
235           executing tests in the suite.
236
237           suffixes For lit test formats which scan directories for tests,
238           this variable as a list of suffixes to identify test files. Used
239           by: ShTest, TclTest.
240
241           substitutions For lit test formats which substitute variables into
242           a test script, the list of substitutions to perform. Used by:
243           ShTest, TclTest.
244
245           unsupported Mark an unsupported directory, all tests within it will
246           be reported as unsupported. Used by: ShTest, TclTest.
247
248           parent The parent configuration, this is the config object for the
249           directory containing the test suite, or None.
250
251           on_clone The config is actually cloned for every subdirectory
252           inside a test suite, to allow local configuration on a per-
253           directory basis. The on_clone variable can be set to a Python
254           function which will be called whenever a configuration is cloned
255           (for a subdirectory). The function should takes three arguments:
256           (1) the parent configuration, (2) the new configuration (which the
257           on_clone function will generally modify), and (3) the test path to
258           the new directory being scanned.
259
260   TEST DISCOVERY
261       Once test suites are located, lit recursively traverses the source
262       directory (following test_src_root) looking for tests. When lit enters
263       a sub-directory, it first checks to see if a nest test suite is defined
264       in that directory. If so, it loads that test suite recursively,
265       otherwise it instantiates a local test config for the directory (see
266       "LOCAL CONFIGURATION FILES").
267
268       Tests are identified by the test suite they are contained within, and
269       the relative path inside that suite. Note that the relative path may
270       not refer to an actual file on disk; some test formats (such as
271       GoogleTest) define "virtual tests" which have a path that contains both
272       the path to the actual test file and a subpath to identify the virtual
273       test.
274
275   LOCAL CONFIGURATION FILES
276       When lit loads a subdirectory in a test suite, it instantiates a local
277       test configuration by cloning the configuration for the parent
278       direction -- the root of this configuration chain will always be a test
279       suite. Once the test configuration is cloned lit checks for a
280       lit.local.cfg file in the subdirectory. If present, this file will be
281       loaded and can be used to specialize the configuration for each
282       individual directory. This facility can be used to define
283       subdirectories of optional tests, or to change other configuration
284       parameters -- for example, to change the test format, or the suffixes
285       which identify test files.
286
287   LIT EXAMPLE TESTS
288       The lit distribution contains several example implementations of test
289       suites in the ExampleTests directory.
290

SEE ALSO

292       valgrind(1)
293

AUTHOR

295       Written by Daniel Dunbar and maintained by the LLVM Team
296       (<http://llvm.org>).
297
298
299
300CVS                               2010-05-11                            LIT(1)
Impressum