Expand description
Lit and FileCheck for Cargo test targets.
§Test target
Add a harness-free integration test to Cargo.toml:
[dev-dependencies]
litnik = "0.2"
[[test]]
name = "lit"
path = "tests/lit.rs"
harness = falsePut the suite entry point in tests/lit.rs:
fn main() {
litnik::Suite::new(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/lit"))
.suffix("mlir")
.run_from_args();
}tests/lit/smoke.mlir:
// RUN: echo "answer = 42" | FileCheck %s
// CHECK: answer = 42Run it with cargo test --test lit. Arguments after -- are handled by the
test harness, including --list and name filters.
§Choosing an entry point
Use Suite in a harness-free Cargo test target. Suite::tool() binds a
compiler executable to the command name used in RUN: lines.
Suite::exec_root() places test working directories and Output trees
outside the source tree.
If another harness owns listing or reporting, build a LitConfig, discover
Test values through discovery, and execute them through formats.
That path preserves the exact ResultCode in each TestResult.
§Compatibility
Suite configuration is expressed through Suite or LitConfig; Python
lit.cfg files are not evaluated. RUN: lines use Litnik’s shell, and the
command name FileCheck selects the embedded checker.
The compatibility guide documents supported directives, substitutions, shell syntax, FileCheck options, and known differences from LLVM’s tools.
Re-exports§
pub use config::LitConfig;pub use test::ResultCode;pub use test::Test;pub use test::TestResult;
Modules§
- config
- Complete suite configuration for low-level discovery and execution.
- discovery
- Recursive, deterministic discovery of integrated shell tests.
- formats
- Low-level execution entry points for discovered tests.
- test
- Discovered test identities and exact Lit results.
Structs§
- Arguments
- Command line arguments.
- Conclusion
- Contains information about the entire test run. Is returned by
run. - Suite
- A Lit suite configured and run from one Rust test entry point.