Skip to content

Use lit to test LLVM IR files

作者:Lee 等
最后更新:

Term Match

  • lit: LLVM Integrated Tester
  • .ll: LLVM IR file

Prerequisites

llvm installed

Test Process

yaml
float.ll
  |
  v
lit executes RUN command -> llc generates output
  |
  v
FileCheck verifies output
  |
  +--✔️ All match: PASS
  |
  +--❌ Error: FAIL

Execution Statement

You can specify a single file or a directory.

bash
llvm-lit llvm/test/CodeGen/RISCV/VentusGPGPU/float.ll

Output

bash
-- Testing: 1 tests, 1 workers --
PASS: LLVM :: CodeGen/RISCV/VentusGPGPU/float.ll (1 of 1)

Testing Time: 0.07s
  Passed: 1

Common Commands

CommandDescriptionExample
llvm-lit <test_dir>Run all test cases in the specified directoryllvm-lit ./test
-v or --verboseShow detailed test outputllvm-lit -v ./test
-j <N> or --jobs=<N>Specify the number of tests to run in parallelllvm-lit -j 4 ./test
--max-tests <N>Limit the maximum number of tests to runllvm-lit --max-tests=100 ./test
--filter=<pattern>Run tests that match the given pattern (filter by test name)llvm-lit --filter=xyz ./test
--show-unsupportedDisplay unsupported testsllvm-lit --show-unsupported ./test
--test-messagesShow detailed output of each test (includes stdout and stderr)llvm-lit --test-messages ./test
--helpShow the help documentation of llvm-lit , listing all supported options and parametersllvm-lit --help
--dump-input=helpIf the test fails, display the input to help debug the failurellvm-lit --dump-input=help ./test
--continue-on-errorContinue running other tests without stopping if a test failsllvm-lit --continue-on-error ./test
--output=<file>Output test results to the specified filellvm-lit --output=result.txt ./test
--no-filecheckDisable the generation of FileCheck outputllvm-lit --no-filecheck ./test

页面历史