Skip to main content

filecheck - A Python-native clone of LLVMs FileCheck tool

This tries to be as close a clone of LLVMs FileCheck as possible, without going crazy. It currently passes 1530 out of 1645 (93%) of LLVMs MLIR filecheck tests.

There are some features that are left out for now (e.g.a pseudo-numeric variables and parts of numeric substitution ).

The codebase is fully type checked by pyright, and automatically formatted using black. We aim to have tests covering everything from normal matching down to error messages.

Features:

Here's an overview of all FileCheck features and their implementation status.

  • Checks:
    • CHECK
    • CHECK-NEXT
    • CHECK-NOT (Bug: #10)
    • CHECK-LABEL (Bug: #8)
    • CHECK-EMPTY
    • CHECK-SAME
    • CHECK-DAG
    • CHECK-COUNT
  • Flags:
    • --check-prefix
    • --check-prefixes (Tracking: #13)
    • --comment-prefixes
    • --allow-unused-prefixes
    • --input-file
    • --match-full-lines
    • --strict-whitespace (Bug: #6)
    • --ignore-case
    • --implicit-check-not
    • --dump-input
    • --dump-input-context
    • --dump-input-filter
    • --enable-var-scope
    • -D<VAR=VALUE>
    • -D#<FMT>,<NUMVAR>=<NUMERIC EXPRESSION>
    • -version
    • -v
    • -vv
    • --allow-deprecated-dag-overlap Not sure what this means yet.
    • --allow-empty
    • --color No color support yet
  • Base Features:
    • Regex patterns (Bugs: #3, #7, #9)
    • Captures and Capture Matches (Diverges: #5, #12 Bug: #11)
    • Numeric Captures
    • Numeric Substitutions (jesus christ, wtf man)
    • Literal matching (CHECK{LITERAL})
    • Weird regex features ([:xdigits:] and friends) (Bug: #4)
    • Correct(?) handling of matching check lines
  • Testing:
    • Base cases
    • Negative tests
    • Error messages (started)
    • Lots of edge cases
    • MLIR/xDSL integration tests
  • UX:
    • Good error messages: I have some error messages, but could be a lot better
      • Parse errors
      • Matching errors
      • Malformed regexes
  • Infrastructure:
    • Formatting: black
    • Pyright
    • pre-commit
    • CI for everything

We are open to PRs for bugfixes or any features listed here.

Differences to LLVMs FileCheck:

We want to be as close as possible to the original FileCheck, and document our differences very clearly.

If you encounter a difference that is not documented here, feel free to file a bug report.

Better Regexes

We use pythons regex library, which is a flavour of a Perl compatible regular expression (PCRE), instead of FileChecks POSIX regex falvour.

Example:

// LLVM filecheck:
// CHECK: %{{[:alnum:]+}}, %{{[:digit:]+}}

// our fileheck:
// CHECK: %{{[a-zA-Z0-9]+}}, %{{\d+}}

Some effort is made to translate character classes from POSIX to PCRE, although it might be wrong in edge cases.

Relaxed Matchings:

We relax some of the matching rules, like:

  • Allow a file to start with CHECK-NEXT

No Numerical Substitution

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. We also don't support the "Pseudo Numeric Variable" @LINE.

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

Metadata

Release files for filecheck-ng 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for filecheck-ng 0.1.2
File Size Uploaded Provenance
filecheck_ng-0.1.2.tar.gz 28.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for filecheck-ng 0.1.2
File Interpreter ABI Platform
filecheck_ng-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 60.0 kB

Release files / filecheck_ng-0.1.2.tar.gz

Download URL filecheck_ng-0.1.2.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
419ae1d319d0f51bb4de22b2601af62bf5683751e2f54f445da4955edaad3993
BLAKE2b-256 checksum
How to use checksums
96c0cf5bff1cfed124888732dfc1876e65b6204b3c4dd797d926ece91b68ca49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Release files / filecheck_ng-0.1.2-py3-none-any.whl

Download URL filecheck_ng-0.1.2-py3-none-any.whl
Size 31.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e14a561834314011066852e944c7b4c76f74462c938790d46ea59f3607717d3
BLAKE2b-256 checksum
How to use checksums
da5362eea79af90f3096736fa45cdd40222f6605a5e5adfa77f2b58064cb55bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.0 CPython/3.12.4

Security for filecheck-ng 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page