Skip to content

Fix standalone Lit discovery - #568

Open
shin4141 wants to merge 1 commit into
root-project:masterfrom
shin4141:fix/cling-432-lit-discovery
Open

Fix standalone Lit discovery#568
shin4141 wants to merge 1 commit into
root-project:masterfrom
shin4141:fix/cling-432-lit-discovery

Conversation

@shin4141

Copy link
Copy Markdown

Fixes #432

Summary

Cling's standalone CMake configuration currently decides whether to enable tests using LLVM_LIT, but modern LLVM's AddLLVM test helpers execute LLVM_EXTERNAL_LIT / LLVM_DEFAULT_EXTERNAL_LIT.

That creates two problems:

  • a valid explicit or LLVM-provided Lit executable can be ignored by Cling's availability gate;
  • the fallback search only looks for an installed executable literally named lit.py, while current Lit installations commonly provide lit or LLVM's platform launcher.

This change keeps LLVM-provided Lit configuration authoritative, preserves source-tree Lit discovery, and only falls back to platform-appropriate installed executables when LLVM has not already supplied one. A fallback discovered by Cling is forwarded through LLVM_EXTERNAL_LIT so the same executable is used by AddLLVM.

If no valid Lit executable is available, standalone tests remain disabled as before.

Verification

I exercised standalone CMake configuration with isolated cases for:

  • explicit LLVM_EXTERNAL_LIT
  • LLVM-provided LLVM_DEFAULT_EXTERNAL_LIT
  • source-tree utils/lit/lit.py
  • installed llvm-lit
  • installed lit
  • native-Windows llvm-lit.py selection logic
  • no Lit available

The precedence is:

  1. explicit LLVM_EXTERNAL_LIT
  2. LLVM-provided LLVM_DEFAULT_EXTERNAL_LIT
  3. source-tree Lit
  4. platform LLVM Lit executable
  5. installed lit

A negative-control run restoring the old lit.py-only fallback reproduced the original failure: CMake configured successfully but disabled Cling tests when only a valid installed lit executable was available.

git diff --check also passes.

I did not run a full Cling build or check-cling locally because this environment does not contain a real built LLVM/Clang installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build system should check for 'lit' installed command, not 'lit.py'

1 participant