Registry / testing / lit
library23.1.0pypypi✓ verified 24d ago

lit (LLVM Integrated Tester) is a portable command-line tool for executing LLVM and Clang style test suites, summarizing their results, and providing indication of failures. It is designed to be lightweight and flexible, supporting parallel test execution and various test formats. The current version is 18.1.8 and is actively maintained as part of the LLVM project.

pip install lit
INSTALL
IMPORT
SIG · LIT
L
lit
testingpythonv23.1.0
Install
1.6s avg
Import
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v23.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

lit_config
This is a global object implicitly available within lit.cfg.py / lit.site.cfg.py files.
lit is primarily a command-line tool that executes Python configuration files (lit.cfg.py). Direct import statements of 'lit' as a Python library for programmatic API calls are uncommon in application code. Configuration relies on predefined global objects like `lit_config` and `config` within these specific config files.
config
This is a global object implicitly available within lit.cfg.py / lit.site.cfg.py files.
Similar to `lit_config`, the `config` object is exposed globally within `lit`'s Python configuration files (`lit.cfg.py`), allowing users to define test suite behavior without explicit Python imports from the 'lit' package itself.

This quickstart demonstrates how to set up a basic `lit` test suite. It involves creating a `lit.cfg.py` configuration file that `lit` uses to understand how to find and run tests, and a simple test file with `RUN` and `CHECK` directives. `lit` is then invoked from the command line against the test directory.

# 1. Create a test directory and a lit configuration file: # my_project/ # ├── lit.cfg.py # └── tests/ # └── my_test.txt # --- lit.cfg.py --- # This file is executed by lit to configure the test suite. # Define standard test formats. import lit.formats config.name = 'MyProject' config.test_format = lit.formats.ShTest(not_tool='/usr/bin/not') config.suffixes = ['.txt'] # Add an optional path to tools if they are not in PATH # config.substitutions = [('%my_tool', '/path/to/my_tool')] # --- tests/my_test.txt --- # RUN: echo "Hello, lit!" | FileCheck %s # CHECK: Hello, lit! # --- Run lit from the project root --- # In your terminal: # cd my_project # lit tests/
lit --version
Debug
Known issues
gotchalit is primarily a command-line testing tool. While written in Python, its main usage involves running the `lit` executable and configuring test suites via `lit.cfg.py` or `lit.site.cfg.py` files, rather than through direct Python API imports for general application logic. The Python files define test execution logic, not library functions to be called.
fix
Focus on command-line invocation and Python configuration files (`lit.cfg.py`) for defining test behavior, rather than looking for a traditional Python API to import and call.
affects: All versions
gotchaThe `lit` command expects a `lit.cfg.py` or `lit.site.cfg.py` file to be present in the root of each test suite or discovered by searching upwards from the input path. Without these configuration files, `lit` cannot properly discover or execute tests.
fix
Ensure that your test directory hierarchy includes the necessary `lit.cfg.py` (or `lit.site.cfg.py`) files to define test suite parameters like `config.test_format` and `config.suffixes`.
affects: All versions
gotchaThe `lit` tool, especially for certain test formats, often relies on external LLVM utilities like `FileCheck` and `not`. If these are not available in the system's PATH, or explicitly configured in `lit.cfg.py`, tests that use them will fail.
fix
Ensure that required LLVM tools (like `FileCheck` and `not`) are installed and accessible in your system's PATH, or specify their full paths using `config.substitutions` or directly in `config.test_format` (e.g., `not_tool='/usr/bin/not'`) within your `lit.cfg.py` file.
affects: All versions
Upgrade
Version history
23.1.0latest on PyPI · released Aug 25, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
5 hits · last 30 days
node
4
Resources
lit — pip install lit · libregistry