[llvm] [lit][docs] Document %if conditional substitution in lit CommandGuide (PR #225683)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 23 03:58:25 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
Author: Ingo Müller (ingomueller-net)
<details>
<summary>Changes</summary>
`%if ... %else` conditional substitutions (implemented in `TestRunner.py` and mentioned in `TestingGuide.md`) were missing from the `SUBSTITUTIONS` table and `available_features` description in `llvm/docs/CommandGuide/lit.md`. Add `%if` to the base substitutions table and note that `available_features` can be used in `%if` conditions.
---
Full diff: https://github.com/llvm/llvm-project/pull/225683.diff
1 Files Affected:
- (modified) llvm/docs/CommandGuide/lit.rst (+4-1)
``````````diff
diff --git a/llvm/docs/CommandGuide/lit.rst b/llvm/docs/CommandGuide/lit.rst
index b52a09eb088a1d..a041d4d95faad5 100644
--- a/llvm/docs/CommandGuide/lit.rst
+++ b/llvm/docs/CommandGuide/lit.rst
@@ -619,7 +619,7 @@ executed, two important global variables are predefined:
makes the test fail only if the last command in the pipe fails.
**available_features** A set of features that can be used in `XFAIL`,
- `REQUIRES`, and `UNSUPPORTED` directives.
+ `REQUIRES`, and `UNSUPPORTED` directives and `%if` substitions.
TEST DISCOVERY
~~~~~~~~~~~~~~
@@ -700,6 +700,9 @@ TestRunner.py:
%:t On Windows, %/t but a ``:`` is removed if its the second character.
Otherwise, %t but with a single leading ``/`` removed.
%{readfile:<filename>} Reads the file specified.
+ %if \<cond> %{...%} Conditional substitution
+ (`%if <cond> %{<if-branch>%} [%else %{<else-branch>%}]`);
+ `<cond>` uses `available_features`.
======================= ==============
Other substitutions are provided that are variations on this base set and
``````````
</details>
https://github.com/llvm/llvm-project/pull/225683
More information about the llvm-commits
mailing list