[llvm] [lit] Fix substitutions containing backslashes (PR #103042)
Joel E. Denny via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 08:53:17 PDT 2024
jdenny-ornl wrote:
Please update the first bullet under "Test-specific substitutions" in <https://llvm.org/docs/TestingGuide.html#substitutions> as it advertises `re.sub` behavior:
> Lit configuration files (e.g., lit.cfg or lit.local.cfg) can define substitutions for all tests in a test directory. They do so by extending the substitution list, config.substitutions. Each item in the list is a tuple consisting of a pattern and its replacement, which lit applies using python’s re.sub function.
The following text comes later and specifies the different behavior for (RE)DEFINE:
> Substitution value: The value includes all text from the first non-whitespace character after = to the last non-whitespace character. If there is no non-whitespace character after =, the value is the empty string. Escape sequences that can appear in python re.sub replacement strings are treated as plain text in the value.
It might also be good to have a test case showing that lit config script substitutions properly handle escape sequences. You're already updating the one for (RE)DEFINE.
https://github.com/llvm/llvm-project/pull/103042
More information about the llvm-commits
mailing list