What is FileCheck.py

FileCheck.py is a Python port of LLVM’s FileCheck, “flexible pattern matching file verifier” [1].

LLVM’s FileCheck is a command-line tool written in C++ which is developed and maintained as part of LLVM source code [2].

FileCheck is most often used in a combination with another tool called LIT (LLVM Integrated Tester) [3]. LIT is a test runner that runs commands from the test files, FileCheck is used as a test matcher tool that checks output of the commands run by LIT.

Why Python port?

There are software projects that would benefit from having a suite of LIT-based integration tests. Mull mutation testing system is one example [4].

The problem is that you have to build FileCheck from LLVM sources which is not a trivial task for 1) people who are not familiar with the LLVM infrastructure and 2) Python-based projects which would prefer to not depend on anything C or C++-related including building dependencies from LLVM sources.

The option of having pre-compiled binaries is a workaround, but it is not always possible to keep third-party binary artifacts in source code (see https://github.com/doorstop-dev/doorstop/pull/431#issuecomment-549237579).

Note: FileCheck.py is not intended to be a replacement for LLVM’s FileCheck in any way. See Roadmap.

What’s next?

If you are new to FileCheck and integration testing using LIT, we recommend you to read the tutorials: Tutorial: Hello World and Tutorial: LIT and FileCheck.

If you know how FileCheck and LIT work, you can check out the status of the port on the Roadmap page.