# 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](https://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-pseudo-numeric-variables) and
parts of [numeric substitution](https://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-numeric-substitution-blocks)
).
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:**
- [X] `CHECK`
- [X] `CHECK-NEXT`
- [X] `CHECK-NOT` (Bug: [#10](https://github.com/AntonLydike/filecheck/issues/10))
- [X] `CHECK-LABEL` (Bug: [#8](https://github.com/AntonLydike/filecheck/issues/8))
- [X] `CHECK-EMPTY`
- [X] `CHECK-SAME`
- [X] `CHECK-DAG`
- [X] `CHECK-COUNT`
- **Flags:**
- [X] `--check-prefix`
- [ ] `--check-prefixes` (Tracking: [#13](https://github.com/AntonLydike/filecheck/issues/13))
- [X] `--comment-prefixes`
- [ ] `--allow-unused-prefixes`
- [X] `--input-file`
- [X] `--match-full-lines`
- [X] `--strict-whitespace` (Bug: [#6](https://github.com/AntonLydike/filecheck/issues/6))
- [ ] `--ignore-case`
- [ ] `--implicit-check-not`
- [ ] `--dump-input`
- [ ] `--dump-input-context`
- [ ] `--dump-input-filter`
- [X] `--enable-var-scope`
- [X] `-D<VAR=VALUE>`
- [ ] `-D#<FMT>,<NUMVAR>=<NUMERIC EXPRESSION>`
- [ ] `-version`
- [ ] `-v`
- [ ] `-vv`
- [ ] `--allow-deprecated-dag-overlap` Not sure what this means yet.
- [X] `--allow-empty`
- [ ] `--color` No color support yet
- **Base Features:**
- [X] Regex patterns (Bugs: [#3](https://github.com/AntonLydike/filecheck/issues/3), [#7](https://github.com/AntonLydike/filecheck/issues/7), [#9](https://github.com/AntonLydike/filecheck/issues/9))
- [X] Captures and Capture Matches (Diverges: [#5](https://github.com/AntonLydike/filecheck/issues/5), [#12](https://github.com/AntonLydike/filecheck/issues/12) Bug: [#11](https://github.com/AntonLydike/filecheck/issues/11))
- [X] Numeric Captures
- [ ] Numeric Substitutions (jesus christ, wtf man)
- [X] Literal matching (`CHECK{LITERAL}`)
- [X] Weird regex features (`[:xdigits:]` and friends) (Bug: [#4](https://github.com/AntonLydike/filecheck/issues/4))
- [X] Correct(?) handling of matching check lines
- **Testing:**
- [X] 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
- [X] Parse errors
- [ ] Matching errors
- [ ] Malformed regexes
- **Infrastructure:**
- [X] Formatting: black
- [X] Pyright
- [X] `pre-commit`
- [X] 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](https://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-numeric-substitution-blocks)
(`[[#%.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
Raw data
{
"_id": null,
"home_page": "https://github.com/AntonLydike/filecheck",
"name": "filecheck-ng",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "tests, filecheck, llvm",
"author": "Anton Lydike",
"author_email": "me@antonlydike.de",
"download_url": "https://files.pythonhosted.org/packages/96/c0/cf5bff1cfed124888732dfc1876e65b6204b3c4dd797d926ece91b68ca49/filecheck_ng-0.1.2.tar.gz",
"platform": null,
"description": "# filecheck - A Python-native clone of LLVMs FileCheck tool\n\nThis tries to be as close a clone of LLVMs FileCheck as possible, without going crazy. It currently passes 1530 out of\n1645 (93%) of LLVMs MLIR filecheck tests.\n\nThere are some features that are left out for now (e.g.a\n[pseudo-numeric variables](https://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-pseudo-numeric-variables) and\nparts of [numeric substitution](https://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-numeric-substitution-blocks)\n).\n\nThe codebase is fully type checked by `pyright`, and automatically formatted using `black`. We aim to have tests\ncovering everything from normal matching down to error messages.\n\n## Features:\nHere's an overview of all FileCheck features and their implementation status.\n\n- **Checks:**\n - [X] `CHECK`\n - [X] `CHECK-NEXT`\n - [X] `CHECK-NOT` (Bug: [#10](https://github.com/AntonLydike/filecheck/issues/10))\n - [X] `CHECK-LABEL` (Bug: [#8](https://github.com/AntonLydike/filecheck/issues/8))\n - [X] `CHECK-EMPTY`\n - [X] `CHECK-SAME`\n - [X] `CHECK-DAG`\n - [X] `CHECK-COUNT`\n- **Flags:**\n - [X] `--check-prefix`\n - [ ] `--check-prefixes` (Tracking: [#13](https://github.com/AntonLydike/filecheck/issues/13))\n - [X] `--comment-prefixes`\n - [ ] `--allow-unused-prefixes`\n - [X] `--input-file`\n - [X] `--match-full-lines`\n - [X] `--strict-whitespace` (Bug: [#6](https://github.com/AntonLydike/filecheck/issues/6))\n - [ ] `--ignore-case`\n - [ ] `--implicit-check-not`\n - [ ] `--dump-input`\n - [ ] `--dump-input-context`\n - [ ] `--dump-input-filter`\n - [X] `--enable-var-scope`\n - [X] `-D<VAR=VALUE>`\n - [ ] `-D#<FMT>,<NUMVAR>=<NUMERIC EXPRESSION>`\n - [ ] `-version`\n - [ ] `-v`\n - [ ] `-vv`\n - [ ] `--allow-deprecated-dag-overlap` Not sure what this means yet.\n - [X] `--allow-empty`\n - [ ] `--color` No color support yet\n- **Base Features:**\n - [X] Regex patterns (Bugs: [#3](https://github.com/AntonLydike/filecheck/issues/3), [#7](https://github.com/AntonLydike/filecheck/issues/7), [#9](https://github.com/AntonLydike/filecheck/issues/9))\n - [X] Captures and Capture Matches (Diverges: [#5](https://github.com/AntonLydike/filecheck/issues/5), [#12](https://github.com/AntonLydike/filecheck/issues/12) Bug: [#11](https://github.com/AntonLydike/filecheck/issues/11))\n - [X] Numeric Captures\n - [ ] Numeric Substitutions (jesus christ, wtf man)\n - [X] Literal matching (`CHECK{LITERAL}`)\n - [X] Weird regex features (`[:xdigits:]` and friends) (Bug: [#4](https://github.com/AntonLydike/filecheck/issues/4))\n - [X] Correct(?) handling of matching check lines\n- **Testing:**\n - [X] Base cases\n - [ ] Negative tests\n - [ ] Error messages (started)\n - [ ] Lots of edge cases\n - [ ] MLIR/xDSL integration tests\n- **UX:**\n - Good error messages: I have some error messages, but could be a lot better\n - [X] Parse errors\n - [ ] Matching errors\n - [ ] Malformed regexes\n- **Infrastructure:**\n - [X] Formatting: black\n - [X] Pyright\n - [X] `pre-commit`\n - [X] CI for everything\n\nWe are open to PRs for bugfixes or any features listed here.\n\n## Differences to LLVMs FileCheck:\nWe want to be as close as possible to the original FileCheck, and document our differences very clearly.\n\nIf you encounter a difference that is not documented here, feel free to file a bug report.\n\n### Better Regexes\nWe use pythons regex library, which is a flavour of a Perl compatible regular expression (PCRE), instead of FileChecks\nPOSIX regex falvour.\n\n**Example:**\n```\n// LLVM filecheck:\n// CHECK: %{{[:alnum:]+}}, %{{[:digit:]+}}\n\n// our fileheck:\n// CHECK: %{{[a-zA-Z0-9]+}}, %{{\\d+}}\n```\n\nSome effort is made to translate character classes from POSIX to PCRE, although it might be wrong in edge cases.\n\n### Relaxed Matchings:\n\nWe relax some of the matching rules, like:\n\n- Allow a file to start with `CHECK-NEXT`\n\n\n### No Numerical Substitution\n\nWhile our filecheck supports [numeric capture](https://llvm.org/docs/CommandGuide/FileCheck.html#filecheck-numeric-substitution-blocks)\n(`[[#%.3x,VAR:]]` will capture a three-digit hex number), we don't support arithmetic expressions on these captured\nvalues at the moment. We also don't support the \"Pseudo Numeric Variable\" `@LINE`.\n\n### Special Feature Flags:\n\nThis version of filecheck implements some non-standard extensions to LLVMs filecheck. These are disabled by default but\ncan be enabled through the environment variable `FILECHECK_FEATURE_ENABLE=...`. Avialable extensions are documented here:\n\n- `MLIR_REGEX_CLS`: Add additional special regex matchers to match MLIR/LLVM constructs:\n - `\\V` will match any SSA value name\n\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "A Python-native clone of LLVMs FileCheck tool",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/AntonLydike/filecheck",
"Repository": "https://github.com/AntonLydike/filecheck"
},
"split_keywords": [
"tests",
" filecheck",
" llvm"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "da5362eea79af90f3096736fa45cdd40222f6605a5e5adfa77f2b58064cb55bb",
"md5": "6ad1d6b4ca2faff7ec29b9b96f7a368b",
"sha256": "0e14a561834314011066852e944c7b4c76f74462c938790d46ea59f3607717d3"
},
"downloads": -1,
"filename": "filecheck_ng-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6ad1d6b4ca2faff7ec29b9b96f7a368b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 31509,
"upload_time": "2024-07-09T09:38:26",
"upload_time_iso_8601": "2024-07-09T09:38:26.196105Z",
"url": "https://files.pythonhosted.org/packages/da/53/62eea79af90f3096736fa45cdd40222f6605a5e5adfa77f2b58064cb55bb/filecheck_ng-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "96c0cf5bff1cfed124888732dfc1876e65b6204b3c4dd797d926ece91b68ca49",
"md5": "b0a6fa5309b13ed826dc37d37828103b",
"sha256": "419ae1d319d0f51bb4de22b2601af62bf5683751e2f54f445da4955edaad3993"
},
"downloads": -1,
"filename": "filecheck_ng-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "b0a6fa5309b13ed826dc37d37828103b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 28502,
"upload_time": "2024-07-09T09:38:27",
"upload_time_iso_8601": "2024-07-09T09:38:27.792207Z",
"url": "https://files.pythonhosted.org/packages/96/c0/cf5bff1cfed124888732dfc1876e65b6204b3c4dd797d926ece91b68ca49/filecheck_ng-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-09 09:38:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AntonLydike",
"github_project": "filecheck",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "filecheck-ng"
}