This tries to be as close a clone of LLVMs FileCheck as possible, without going crazy. It currently passes 1576 out of
1645 (95.8%) of LLVMs MLIR filecheck tests. We are tracking all 69 remaining test failures in GitHub issues.
There are some features that are left out for now (e.g. parts of
numeric substitution
).
The codebase is fully type checked by pyright, and automatically formatted using ruff format. We aim to have tests
covering everything from normal matching down to error messages.
Install by running pip install filecheck.
Features:
Here's an overview of all FileCheck features and their implementation status.
Some effort is made to translate character classes from POSIX to PCRE, although it might be wrong in edge cases.
Relaxed Matching:
We relax some of the matching rules, like:
Allow a file to start with CHECK-NEXT
No Numerical Substitution:
This is used in 2 out of 1645 tests in our benchmark (upstream MLIR tests).
While our filecheck supports numeric capture
([[#%.3x,VAR:]] will capture a three-digit hex number), we don't support arithmetic expressions on these captured
values at the moment.
Special Feature Flags:
This version of filecheck implements some non-standard extensions to LLVMs filecheck. These are disabled by default but
can be enabled through the environment variable FILECHECK_FEATURE_ENABLE=.... Avialable extensions are documented here:
MLIR_REGEX_CLS: Add additional special regex matchers to match MLIR/LLVM constructs:
\V will match any SSA value name
Reject Empty Captures:
We introduce a new flag called reject-empty-vars that throws an error when a capture expression captures an empty
string.
Works well with
Use together with filecheck: extensions, drivers, servers and companion tools.