{"id":15144642,"url":"https://github.com/bitwalker/litcheck","last_synced_at":"2025-10-23T22:30:58.751Z","repository":{"id":218909382,"uuid":"747672646","full_name":"bitwalker/litcheck","owner":"bitwalker","description":"FileCheck and lit blended into a convenient package","archived":false,"fork":false,"pushed_at":"2024-03-13T21:38:16.000Z","size":535,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-30T21:11:50.810Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitwalker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-01-24T12:15:01.000Z","updated_at":"2024-01-25T11:48:42.000Z","dependencies_parsed_at":"2024-03-13T21:08:48.758Z","dependency_job_id":null,"html_url":"https://github.com/bitwalker/litcheck","commit_stats":null,"previous_names":["bitwalker/litcheck"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Flitcheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Flitcheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Flitcheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitwalker%2Flitcheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitwalker","download_url":"https://codeload.github.com/bitwalker/litcheck/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237890775,"owners_count":19382562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-26T11:00:25.938Z","updated_at":"2025-10-23T22:30:53.370Z","avatar_url":"https://github.com/bitwalker.png","language":"Rust","readme":"# litcheck\n\nThis project is a re-implementation of the `FileCheck` and `lit` utilities, used\nin the LLVM project and elsewhere, as a single multi-call binary containing the\nfunctionality of both while keeping them largely compatible with the exiting\ntools via symlinks, if you so require.\n\n\u003e [!WARNING]\n\u003e This is a work-in-progress/experiment, it doesn't necessarily support\n\u003e the full lit/FileCheck feature set with the exact semantics of LLVM lit/FileCheck.\n\n\u003e [!NOTE] \n\u003e This project is a playground for experimenting with various abstractions\n\u003e in the face of zero-copy (or minimal copy) processing of input. As a result, the code \n\u003e (namely in the FileCheck impl) has some duplication and some oddities in its structure \n\u003e that will be eventually factored out as I make changes. Don't look at the code as a \n\u003e model architecture for this kind of tooling, at least at this point in time.\n\n## Rationale\n\nWhy?\n\n* I wanted a small, fast, single-binary tool that I could use across projects\nto solve the problems that `FileCheck` and `lit` solve.\n* Other implementations of one or the other of these things are typically\nvery limited in scope, many features are missing. This implementation aims\nto be full fidelity in terms of the kinds of tests you can write.\n* I wanted the ability to use these tools as a library within a larger\nproject, for example, to run tests via the Rust test runner using this\nas the backend.\n* I wanted the ability to extend the feature set myself\n\n## Current Status\n\nThe initial implementation is done, albeit with a few missing items I will be\nchecking off in the near future, or which you should be aware of:\n\n* I have imported the LLVM test suite for FileCheck, but it is not yet being\nrun in CI, and several of the tests are not yet passing as I finish implementing some\nof the more subtle details.\n* (lit) I added support for a variety of target features and things used by LLVM,\nbut what I chose to support and didn't overall isn't super consistent, mostly\nwhether or not I would find it useful. If you are hoping for 100% compatiblity,\nthis is not that.\n* `lit` uses Python scripts for configuration, `litcheck` does not, it uses simple\nTOML configuration files for test suites, and you can accomplish most of what you'd\nwant this way. Until I hit a compelling reason for something more complicated, that's\nwhat exists for now.\n* You should use the upstream FileCheck/lit documentation for now, but I plan to\nwrite some of my own that provides a better on-ramp for using this with non-LLVM\nprojects and infrastructure.\n* The code is a bit of a mess, and I haven't yet gotten around to cleaning it up,\nso don't judge me too harshly.\n\n## Installation\n\nFirst, `cargo install` it:\n\n    $ cargo install litcheck\n    \nThen, you can use the tools using two different approaches:\n\n1. As subcommands of `litcheck`\n\n```\n# lit\n$ litcheck lit run path/to/test/suite\n    \n# filecheck\n$ litcheck filecheck path/to/checks \u003c path/to/verify\n```\n\n    \n2. As independent commands via symlinks\n\n```\n# lit\n$ ln -s -T /usr/local/bin/lit $(which litcheck)\n$ lit --help\n\n# filecheck\n$ ln -s -T /usr/local/bin/FileCheck $(which litcheck)\n$ filecheck --help\n```\n    \n\nThat's all there is to it!\n\n## Quickstart\n\n\u003e [!NOTE] \n\u003e See upstream [FileCheck](https://llvm.org/docs/CommandGuide/FileCheck.html) and [lit](https://www.llvm.org/docs/CommandGuide/lit.html)\n\u003e documentation for details on how to write tests with, and configure, these tools. My own documentation is forthcoming, but this\n\u003e will get you by in the near term.\n\n\n1. Create a `lit` test suite:\n\n```\n$ mkdir -p tests\n$ cat \u003c\u003cEOF \u003e tests/lit.suite.toml\nname = \"hello-world\"\npatterns = [\"*.txt\"]\n    \n[format.shtest]\nEOF\n```\n    \nThis will find tests in the `tests` directory matching `*.txt`, and run them using the `shtest` format.\n\n2. Add a test:\n\n```\n$ cat \u003c\u003cEOF \u003e tests/example.txt\n# Assumes you've symlinked `filecheck`\n# RUN: filecheck %s %s.input\n# CHECK: Hello\n# CHECK-SAME: {{\\w+}}!\nEOF\n```\n    \nTo keep things simple here, we're going to use two files, one with the patterns to match, and\none with the input text to verify/check. \n\nThe `RUN:` directive is used by `lit` (specifically the `shtest` format) to determine how to\nrun this test. In this case, it is going to run the command `filecheck %s %s.input` in the\nsystem shell. The \"variable\" `%s` is a substitution that `lit` replaces with the path to\nthe test file itself (see the `lit` docs). We use this to reference both the check file\nand a file to verify (with an extra extension for simplicity). The other directives in\nthe file are for `FileCheck`, and we'll get to those in a second.\n\n\n3. Add a file to verify (as referenced in the `RUN` directive above), containing our input:\n\n    $ cat \u003c\u003cEOF \u003e tests/example.txt.input\n    Hello Paul!\n    \nThe test file contains directives, e.g. `CHECK: Hello` consisting of patterns that can be of\na few different varieties (which can be mixed together on the same line): literals, regular\nexpressions, and match/substitution blocks. For example, `CHECK-SAME: {{\\w+}}!` contains the\nfirst two: a regular expression, followed by a literal `!`. The meaning of the various directives\nis covered in the upstream FileCheck docs for now, but this pair of rules we're using is going\nto essentially match a single line in the input with the equivalent of `^(.*)Hello(.*)\\w+!(.*)$`,\ni.e. both rules must match the same line, but it is not required that the `CHECK-SAME` pattern\nstart immediately after the `CHECK`, just that somewhere after the appearance of `Hello`, the\n`{{\\w+}}!` pattern matches.\n\nOk, so we've written our test suite config, a test file, and have some inputs to test, how\ndo we run the suite?\n\n```\n# Assuming you've symlinked `lit`\n$ lit run tests\n    \n# If you want to dump all the output\n$ lit run tests --show-all\n```\n    \nThat's the gist of it. There's a lot more to these tools, but that is the rundown on how to\nget up and running with them!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitwalker%2Flitcheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitwalker%2Flitcheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitwalker%2Flitcheck/lists"}