LIT(1)

πŸ’– lit β€” LLVM Integrated Tester πŸ’–

okay so bestie, welcome to lit(1) from the LLVM manual. this is the whole page, we're not skipping a single crumb. πŸ“


✨ NAME ✨

lit β€” the LLVM Integrated Tester πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

lit [options] [tests]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so lit is a portable tool that runs LLVM-and-Clang-style test suites, sums up what happened, and points at the failures. it's built to be a lightweight lil testing tool with the simplest user interface it can possibly get away with. πŸ’…

you run lit with one or more tests specified on the command line, fr fr. a "test" can be an individual test file, or a directory that lit searches for tests in (go look at TEST DISCOVERY for that whole situation).

each test you named gets executed β€” possibly concurrently, we love parallelism β€” and once every single one has run, lit prints summary info about how many passed and how many failed (see TEST STATUS RESULTS). and listen: if any test fails, lit exits with a non-zero exit code. no cap.

by default lit uses a succinct progress display and only prints summary info for test failures. for the options that control the progress display and output, check OUTPUT OPTIONS. ✨

lit also ships a bunch of options for controlling how tests get executed (heads up: specific features may depend on the particular test format). that's all in EXECUTION OPTIONS. 🫢

and finally, lit supports extra options for running only a subset of the options you specified on the command line β€” yes the original really says "options", we're keeping it β€” see SELECTION OPTIONS for more.

lit parses options from the environment variable LIT_OPTS after it parses options from the command line. LIT_OPTS is mainly useful for supplementing or overriding the command-line options that a project's build system hands to lit via its check targets. 🧚

lit can also read options from response files, which you specify as inputs using the @path/to/file.rsp syntax. arguments read from a file must be one per line, and they're treated as if they were sitting in the same place as the original file-referencing argument on the command line. and yes β€” a response file can reference other response files. it's response files all the way down. 😭

if you're into the lit architecture, or you're designing a lit testing implementation, go see LIT INFRASTRUCTURE. that's the section for you.


✨ GENERAL OPTIONS ✨

  • -h, --help β€” show the lit help message and dip out.
  • --version β€” show lit's version number and exit.
  • -j N, --workers=N β€” run N tests in parallel. by default this is automatically chosen to match the number of detected available CPUs. iconic, honestly. πŸ”₯
  • --config-prefix=NAME β€” when searching for test suites, look for NAME.cfg and NAME.site.cfg instead of lit.cfg and lit.site.cfg.
  • -D NAME[=VALUE], --param NAME[=VALUE] β€” add a user defined parameter NAME with the given VALUE (or the empty string if you don't give one). what these parameters mean and how they're used is entirely up to the test suite. iykyk.

🌸 OUTPUT OPTIONS 🌸

  • -q, --quiet β€” suppress literally any output except for test failures. 🀫
  • -s, --succinct β€” show less output, like, don't show info on tests that pass. also shows a progress bar, unless --no-progress-bar is specified.
  • -v, --verbose β€” show way more info on test failures, for example the entire test output instead of just the test result.

each command is printed before it's executed. this is genuinely valuable for debugging test failures, because the last printed command is the one that failed. on top of that, lit inserts RUN: at line N before each command pipeline in the output, so you can locate the source line of the failed command. πŸ•΅οΈ

  • -vv, --echo-all-commands β€” deprecated alias for -v. it's giving old news, bestie.
  • -a, --show-all β€” enables -v, but for all tests, not just the failed ones.
  • -o PATH, --output PATH β€” write test results to the provided path.
  • --no-progress-bar β€” do not use the curses based progress bar.
  • --show-excluded β€” show excluded tests.
  • --show-skipped β€” show skipped tests.
  • --show-unsupported β€” show unsupported tests.
  • --show-pass β€” show passed tests.
  • --show-flakypass β€” show passed with retry tests.
  • --show-xfail β€” show expectedly failed tests.

πŸ’… EXECUTION OPTIONS πŸ’…

  • --gtest-sharding β€” enable sharding for the GoogleTest format.
  • --no-gtest-sharding β€” disable sharding for the GoogleTest format.
  • --path=PATH β€” specify an additional PATH to use when searching for executables in tests.
  • --vg β€” run individual tests under valgrind (using the memcheck tool). the --error-exitcode argument for valgrind is used so that valgrind failures make the program exit with a non-zero status.

when this option is enabled, lit also automatically provides a "valgrind" feature that you can use to conditionally disable (or expect failure in) certain tests. 🧚

  • --vg-leak β€” when --vg is used, enable memory leak checks. when this option is enabled, lit also automatically provides a "vg_leak" feature that you can use to conditionally disable (or expect failure in) certain tests.
  • --vg-arg=ARG β€” when --vg is used, specify an additional argument to pass to valgrind itself.
  • --no-execute β€” don't execute any tests (assume that they pass). manifesting, basically. ✨
  • --xunit-xml-output XUNIT_XML_OUTPUT β€” write XUnit-compatible XML test reports to the specified file.
  • --report-failures-only β€” only include unresolved, timed out, failed and unexpectedly passed tests in the report.
  • --resultdb-output RESULTDB_OUTPUT β€” write LuCI ResultDB compatible JSON to the specified file.
  • --time-trace-output TIME_TRACE_OUTPUT β€” write Chrome tracing compatible JSON to the specified file
  • --timeout MAXINDIVIDUALTESTTIME β€” maximum time to spend running a single test (in seconds). 0 means no time limit. [Default: 0]
  • --timeout=N β€” spend at most N seconds (approximately) running each individual test. 0 means no time limit, and 0 is the default. note that this is not an alias for --max-time; the two are different kinds of maximums. don't get it twisted. πŸ’€
  • --max-failures MAX_FAILURES β€” stop execution after the given number of failures.
  • --allow-empty-runs β€” do not fail the run if all tests are filtered out.
  • --per-test-coverage β€” emit the necessary test coverage data, divided per test case (this involves setting a unique value to LLVM_PROFILE_FILE for each RUN). the coverage data files will be emitted in the directory specified by config.test_exec_root.
  • --ignore-fail β€” exit with status zero even if some tests fail. delulu but valid. πŸ™ˆ
  • --skip-test-time-recording β€” do not track elapsed wall time for each test.
  • --time-tests β€” track the wall time individual tests take to execute and include the results in the summary output. this is useful for determining which tests in a test suite take the most time to execute.

okay that's part one bestie, more is coming, don't go anywhere πŸ’–

✨ SELECTION OPTIONS ✨

okay so bestie, by default lit is gonna run the failing tests first, and then run the rest in descending execution time order β€” like, slowest stuff first β€” because that's what optimizes concurrency. it's giving strategic. if you wanna switch up the execution order you use the --order option, easy.

the timing data lives in the test_exec_root in a file called .lit_test_times.txt. and if that file doesn't exist? lit goes and checks the test_source_root for it, so it can optionally speed up clean builds. thoughtful queen behavior fr. πŸ’…

  • --max-tests=N β€” run at most N tests, then terminate. that's it, that's the whole vibe.
  • --max-time=N β€” spend at most N seconds (approximately, so like, don't come for it) running tests, then terminate. ⚠️ note: this is not an alias for --timeout, the two are different kinds of maximums, okay? different girlies entirely.
  • --order={lexical,random,smart} β€” defines the order tests get run in. the supported values are:
    • lexical β€” tests run in lexical order according to the test file path. this one's for you if you want predictable test order, like a little control freak (affectionate). πŸŽ€
    • random β€” tests run in random order. chaos. we love her. πŸ¦‹
    • smart β€” tests that failed previously run first, then the remaining tests, all in descending execution time order. this is the default because it optimizes concurrency. she's the main character, obviously. πŸ‘‘
  • --shuffle β€” run the tests in a random order, not failing/slowest first. 🚨 Deprecated, use --order instead. the old way, bestie, we've moved on.
  • -i, --incremental β€” run failed tests first. 🚨 DEPRECATED: use --order=smart. same deal.
  • --filter=REGEXP β€” only run those tests whose name matches the regular expression in REGEXP. the environment variable LIT_FILTER can also be used instead of this option, which is especially useful in environments where the call to lit is issued indirectly (iykyk). 🫢
  • --filter-out=REGEXP β€” filter OUT those tests whose name matches the regular expression in REGEXP. env var LIT_FILTER_OUT can also be used in place of this option, again super useful when lit gets called indirectly.
  • --xfail=LIST β€” treat those tests whose name is in the semicolon separated list LIST as XFAIL. handy when you don't wanna go modify the test suite itself. env var LIT_XFAIL can also be used in place of this option, especially useful in indirect-call environments.

a test name can be specified as a file name relative to the test suite directory. for example:

LIT_XFAIL="affinity/kmp-hw-subset.c;offloading/memory_manager.cpp"

in this case, all of the following tests are treated as XFAIL:

libomp :: affinity/kmp-hw-subset.c
libomptarget :: nvptx64-nvidia-cuda :: offloading/memory_manager.cpp
libomptarget :: x86_64-pc-linux-gnu :: offloading/memory_manager.cpp

alternatively, a test name can be specified as the full test name reported in LIT output. for example, we can adjust the previous example so we DON'T treat the nvptx64-nvidia-cuda version of offloading/memory_manager.cpp as XFAIL:

LIT_XFAIL="affinity/kmp-hw-subset.c;libomptarget :: x86_64-pc-linux-gnu :: offloading/memory_manager.cpp"
  • --xfail-not=LIST β€” do NOT treat the specified tests as XFAIL. env var LIT_XFAIL_NOT can also be used in place of this option. syntax is the same as for --xfail and LIT_XFAIL. ⚠️ and listen: --xfail-not and LIT_XFAIL_NOT always override all other XFAIL specifications β€” including an --xfail that shows up later on the command line. yes, even later. the primary purpose is to suppress an XPASS result without modifying a test case that uses the XFAIL directive. so she's the final boss of XFAIL rules, periodt. πŸ’€
  • --num-shards=M β€” divide the set of selected tests into M equal-sized subsets or "shards", and run only one of them. must be used with the --run-shard=N option, which selects the shard to run. env var LIT_NUM_SHARDS can also be used in place of this option. these two options give you a coarse mechanism for partitioning large testsuites, for parallel execution on separate machines (say, in a big ol' testing farm). 🌈
  • --run-shard=N β€” select which shard to run, assuming --num-shards=M was provided. the two options must be used together, and the value of N must be in the range 1..M. env var LIT_RUN_SHARD can also be used in place of this option.

πŸ› οΈ ADDITIONAL OPTIONS πŸ› οΈ

  • --debug β€” run lit in debug mode, for debugging configuration issues and lit itself. for when you gotta get in there and figure out what's going on. πŸ™ˆ
  • --show-suites β€” list the discovered test suites and exit.
  • --show-tests β€” list all of the discovered tests and exit.
  • --show-used-features β€” show all features used in the test suite (in XFAIL, UNSUPPORTED and REQUIRES) and exit. ✨

πŸšͺ EXIT STATUS πŸšͺ

lit will exit with an exit code of 1 if there are any FAIL or XPASS results. otherwise, it exits with the status 0. other exit codes are used for non-test related failures β€” like a user error, or an internal program error. so basically: 1 = the tests said no, 0 = we're good, anything else = something else went sideways. πŸ’€


πŸ” TEST DISCOVERY πŸ”

the inputs you pass to lit can be either individual tests, or entire directories, or whole hierarchies of tests to run. when lit starts up, the very first thing it does is convert those inputs into a complete list of tests to run β€” that's the whole test discovery process. bestie's got a plan. πŸ“‹

in the lit model, every test must exist inside some test suite. lit resolves the inputs specified on the command line to test suites by searching upwards from the input path until it finds a lit.cfg or lit.site.cfg file. these files serve double duty: they're both a marker of test suites AND configuration files that lit loads so it can understand how to find and run the tests inside the suite. iconic multitasking. πŸ’…

once lit has mapped the inputs into test suites, it traverses the list of inputs, adding tests for individual files and recursively searching for tests in directories.

this behavior makes it super easy to specify a subset of tests to run, while still letting the test suite configuration control exactly how tests are interpreted. plus, lit always identifies tests by the test suite they're in AND their relative path inside the test suite. for appropriately configured projects, this lets lit provide convenient and flexible support for out-of-tree builds. slay. πŸŽ€


πŸ† TEST STATUS RESULTS πŸ†

each test ultimately produces one of the following eight results:

  • PASS β€” the test succeeded. we love to see it. βœ…
  • FLAKYPASS β€” the test succeeded after being re-run more than once. this only applies to tests containing an ALLOW_RETRIES: annotation. she's a little unpredictable but she came through. πŸ¦‹
  • XFAIL β€” the test failed, but that's expected. used for test formats which allow specifying that a test doesn't currently work, but you still wanna leave it in the test suite. not a problem, just a known thing.
  • XPASS β€” the test succeeded, but it was expected to fail. used for tests which were specified as expected to fail but are now succeeding β€” generally because the feature they test was broken and has been fixed. surprise! 😭
  • FAIL β€” the test failed. πŸ’€
  • UNRESOLVED β€” the test result could not be determined. for example, this happens when the test couldn't be run, the test itself is invalid, or the test was interrupted. we don't know, nobody knows. πŸ™ˆ
  • UNSUPPORTED β€” the test is not supported in this environment. used by test formats which can report unsupported tests. not her moment, not her environment.
  • TIMEOUT β€” the test was run, but it timed out before it was able to complete. 🚨 this is considered a failure. so like, don't ignore it.

depending on the test format, tests may produce additional information about their status (generally only for failures). check the OUTPUT OPTIONS section for more info. ⭐


πŸ—οΈ LIT INFRASTRUCTURE πŸ—οΈ

this section describes the lit testing architecture, for users who are interested in creating a new lit testing implementation, or extending an existing one. so like, if you're building your own thing, this part's for you bestie. 🫢

lit proper is primarily an infrastructure for discovering and running arbitrary tests, and to expose a single convenient interface to these tests. lit itself doesn't actually know how to run tests β€” that logic is defined by test suites. she's the framework, not the doer. ✨

πŸ§ͺ TEST SUITES πŸ§ͺ

as described in TEST DISCOVERY, tests are always located inside a test suite. test suites serve to define the format of the tests they contain, the logic for finding those tests, and any additional information needed to run the tests.

lit identifies test suites as directories containing lit.cfg or lit.site.cfg files (see also --config-prefix). test suites are initially discovered by recursively searching up the directory hierarchy for all the input files passed on the command line. you can use --show-suites to display the discovered test suites at startup. πŸ‘‘

once a test suite is discovered, its config file is loaded. config files themselves are Python modules which will be executed. when the config file is executed, two important global variables are predefined:

  • lit_config β€” the global lit configuration object (a LitConfig instance), which defines the builtin test formats, global configuration parameters, and other helper routines for implementing test configurations.
  • config β€” this is the config object (a TestingConfig instance) for the test suite, which the config file is expected to populate. the following variables are also available on the config object β€” some of them must be set by the config, others are optional or predefined:
    • name [required] β€” the name of the test suite, for use in reports and diagnostics.
    • test_format [required] β€” the test format object which will be used to discover and run tests in the test suite. generally this will be a builtin test format available from the lit.formats module.
    • test_source_root β€” the filesystem path to the test suite root. for out-of-dir builds this is the directory that will be scanned for tests.
    • test_exec_root β€” for out-of-dir builds, the path to the test suite root inside the object directory. this is where tests will be run and temporary output files placed.
    • environment β€” a dictionary representing the environment to use when executing tests in the suite.
    • standalone_tests β€” when true, mark a directory with tests expected to be run standalone. test discovery is disabled for that directory. ⚠️ lit.suffixes and lit.excludes must be empty when this variable is true.
    • suffixes β€” for lit test formats which scan directories for tests, this variable is a list of suffixes to identify test files. used by: ShTest.
    • substitutions β€” for lit test formats which substitute variables into a test script, the list of substitutions to perform. used by: ShTest.
    • unsupported β€” mark an unsupported directory, all tests within it will be reported as unsupported. used by: ShTest.
  • parent β€” the parent configuration, i.e. the config object for the directory that contains the test suite. No parent? Then it's None. Simple. ✨
  • root β€” the root configuration. Like, the top-most lit configuration in the entire project. main character config energy πŸ‘‘
  • pipefail β€” okay so normally, a test that uses a shell pipe fails if any of the commands on the pipe fail. If that's not the vibe you want, set this variable to false and then the test only fails if the last command in the pipe fails. πŸ’…
  • available_features β€” a set of features that can be used in the XFAIL, REQUIRES, and UNSUPPORTED directives. πŸŽ€

🌈 TEST DISCOVERY 🌈

So once the test suites are located, lit recursively traverses the source directory (following test_source_root, bestie, keep up πŸ¦‹) looking for tests.

When lit enters a sub-directory, it first checks to see if a nested test suite is defined in that directory. If yes β†’ it loads that test suite recursively. If no β†’ it instantiates a local test config for that directory instead (see LOCAL CONFIGURATION FILES).

Tests are identified by the test suite they're contained within, plus the relative path inside that suite. But wait β€” that relative path may not actually refer to a real file on disk πŸ‘€. Some test formats (looking at you, GoogleTest) define "virtual tests", which have a path containing both the path to the actual test file and a subpath that identifies the virtual test.


πŸŽ€ LOCAL CONFIGURATION FILES πŸŽ€

When lit loads a subdirectory in a test suite, it instantiates a local test configuration by cloning the configuration for the parent directory. And the root of this configuration chain will always be a test suite. No cap.

Once the test configuration is cloned, lit checks for a lit.local.cfg file in the subdirectory. If it's present, that file gets loaded and you can use it to specialize the configuration for each individual directory. 🫢

This facility is literally made for defining subdirectories of optional tests, or for changing other configuration parameters β€” for example, to change the test format, or the suffixes which identify test files. Obsessed. πŸ’–

✨ SUBSTITUTIONS ✨

okay so this is the part where things get spicy 🌢️ β€” lit lets you do pattern substitutions right inside your RUN commands. And on top of whatever you define yourself, it ships with this whole base set of macros, all defined in TestRunner.py. Bestie. There are so many. Let's go πŸ’…

  • %s β€” the source path, aka the path to the file you're literally running right now
  • %S β€” the source dir, aka the directory that file lives in
  • %p β€” same thing as %S, no cap
  • %{pathsep} β€” the path separator
  • %{fs-src-root} β€” the root component of file system paths that point at the LLVM checkout
  • %{fs-tmp-root} β€” the root component of file system paths that point at the test's temporary directory
  • %{fs-sep} β€” the file system path separator
  • %t β€” a temporary file name that's unique to the test πŸŽ€
  • %basename_t β€” the last path component of %t, but with the .tmp extension stripped off. deprecated, so use %{t:stem} instead πŸ™ˆ
  • %T β€” the parent directory of %t. heads up: it is not unique, it's deprecated, and like... do not use it πŸ’€
  • %% β€” just a %
  • %/s β€” %s but every \ gets replaced by /
  • %/S β€” %S but every \ gets replaced by /
  • %/p β€” %p but every \ gets replaced by /
  • %/t β€” %t but every \ gets replaced by /
  • %/T β€” %T but every \ gets replaced by /
  • %{s:basename} β€” the last path component of %s
  • %{t:stem} β€” the last path component of %t but without the .tmp extension. it's an alias for %basename_t, they're the same girlie 🫢
  • %{s:real} β€” %s after expanding all symbolic links and substitute drives
  • %{S:real} β€” %S after expanding all symbolic links and substitute drives
  • %{p:real} β€” %p after expanding all symbolic links and substitute drives
  • %{t:real} β€” %t after expanding all symbolic links and substitute drives
  • %{T:real} β€” %T after expanding all symbolic links and substitute drives
  • %{/s:real} β€” %/s after expanding all symbolic links and substitute drives
  • %{/S:real} β€” %/S after expanding all symbolic links and substitute drives
  • %{/p:real} β€” %/p after expanding all symbolic links and substitute drives
  • %{/t:real} β€” %/t after expanding all symbolic links and substitute drives
  • %{/T:real} β€” %/T after expanding all symbolic links and substitute drives
  • %{/s:regex_replacement} β€” %/s but escaped so you can drop it into the replacement of a s@@@ command in sed
  • %{/S:regex_replacement} β€” %/S but escaped so you can drop it into the replacement of a s@@@ command in sed
  • %{/p:regex_replacement} β€” %/p but escaped so you can drop it into the replacement of a s@@@ command in sed

β”‚ %{/t:regex_replacement} β”‚ %/t but escaped for use in β”‚ β”‚ β”‚ the replacement of a s@@@ β”‚ β”‚ β”‚ command in sed β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ %{/T:regex_replacement} β”‚ %/T but escaped for use in β”‚ β”‚ β”‚ the replacement of a s@@@ β”‚ β”‚ β”‚ command in sed β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ %:s β”‚ On Windows, %/s but a : is β”‚ β”‚ β”‚ removed if its the second β”‚ β”‚ β”‚ character. Otherwise, %s β”‚ β”‚ β”‚ but with a single leading β”‚ β”‚ β”‚ / removed. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ %:S β”‚ On Windows, %/S but a : is β”‚ β”‚ β”‚ removed if its the second β”‚ β”‚ β”‚ character. Otherwise, %S β”‚ β”‚ β”‚ but with a single leading β”‚ β”‚ β”‚ / removed. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ %:p β”‚ On Windows, %/p but a : is β”‚ β”‚ β”‚ removed if its the second β”‚ β”‚ β”‚ character. Otherwise, %p β”‚ β”‚ β”‚ but with a single leading β”‚ β”‚ β”‚ / removed. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ %:t β”‚ On Windows, %/t but a : is β”‚ β”‚ β”‚ removed if its the second β”‚ β”‚ β”‚ character. Otherwise, %t β”‚ β”‚ β”‚ but with a single leading β”‚ β”‚ β”‚ / removed. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ %:T β”‚ On Windows, %/T but a : is β”‚ β”‚ β”‚ removed if its the second β”‚ β”‚ β”‚ character. Otherwise, %T β”‚ β”‚ β”‚ but with a single leading β”‚ β”‚ β”‚ / removed. β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


<lavender>okay so those `%:` girlies are literally just the slash versions but with the slash (or the colon, on Windows) yeeted. so relatable tbh.</lavender>

Other substitutions are provided that are variations on this base set and further substitution patterns can be defined by each test module. See the modules <pink>LOCAL CONFIGURATION FILES</pink>.

More detailed information on substitutions can be found in the <purple>LLVM Testing Infrastructure Guide</purple>.

## 🌈 TEST RUN OUTPUT FORMAT 🌈

The <cyan>lit</cyan> output for a test run conforms to the following schema, in both short and verbose modes (although in short mode no `PASS` lines will be shown). This schema has been chosen to be relatively easy to reliably parse by a machine (for example in buildbot log scraping), and for other tools to generate.

Each test result is expected to appear on a line that matches:

<result code>: <test name> (<progress info>)


where `<result-code>` is a standard test result such as `PASS`, `FAIL`, `XFAIL`, `XPASS`, `UNRESOLVED`, or `UNSUPPORTED`. The performance result codes of `IMPROVED` and `REGRESSED` are also allowed.

The `<test name>` field can consist of an arbitrary string containing no newline.

The `<progress info>` field can be used to report progress information such as `(1/300)` or can be empty, but even when empty the parentheses are <hotpink>required</hotpink>. no cap, you cannot skip the parens, they're the moment.

Each test result may include additional (multiline) log information in the following format:

<log delineator> TEST '(<test name>)' <trailing delineator> ... log message ... <log delineator>


where `<test name>` should be the name of a preceding reported test, `<log delineator>` is a string of `*` characters at least four characters long (the recommended length is `20`), and `<trailing delineator>` is an arbitrary (unparsed) string.

The following is an example of a test run output which consists of four tests `A`, `B`, `C`, and `D`, and a log message for the failing test `C`:

PASS: A (1 of 4) PASS: B (2 of 4) FAIL: C (3 of 4) TEST 'C' FAILED Test 'C' failed as a result of exit code 1.


PASS: D (4 of 4)


<yellow>rip C honestly, but the format ate πŸ’…</yellow>

## ✨ DEFAULT FEATURES ✨

For convenience <cyan>lit</cyan> automatically adds `available_features` for some common use cases.

<cyan>lit</cyan> adds a feature based on the operating system being built on, for example: `system-darwin`, `system-linux`, etc. <cyan>lit</cyan> also automatically adds a feature based on the current architecture, for example `target-x86_64`, `target-aarch64`, etc.

When building with sanitizers enabled, <cyan>lit</cyan> automatically adds the short name of the sanitizer, for example: `asan`, `tsan`, etc.

To see the full list of features that can be added, see `llvm/utils/lit/lit/llvm/config.py`.

## 🧚 LIT EXAMPLE TESTS 🧚

The <cyan>lit</cyan> distribution contains several example implementations of test suites in the `ExampleTests` directory. <pink>go peek bestie, they're giving tutorial energy and they're free</pink> πŸ“

---

## πŸ‘€ SEE ALSO πŸ‘€

- `valgrind(1)`

## πŸŽ€ AUTHOR πŸŽ€

Maintained by the LLVM Team (`https://llvm.org/`).

## πŸ’– COPYRIGHT πŸ’–

`2003-2025, LLVM Project`

---

<rainbow>and that's the whole page bestie, you made it, i'm so proud of you, go write some tests and slay πŸ‘‘βœ¨</rainbow>

<lavender>this lil manual page is from the LLVM Project β€” source and version line, dated `2025-09-03`, page `LIT(1)` β€” mwah, go forth and test πŸ¦‹</lavender>
πŸ“¦ where this page comes from