[PATCH] D150856: [lit] Add %{for-each-file} substitution

Vlad Serebrennikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 25 23:07:37 PDT 2023


Endill added a comment.

In D150856#4447419 <https://reviews.llvm.org/D150856#4447419>, @jdenny wrote:

> In D150856#4436942 <https://reviews.llvm.org/D150856#4436942>, @jhenderson wrote:
>
>> I've been watching on the discussion a bit over the last few days, and soemthing along these lines is what I'm inclined to think would make sense.
>
>
>
> In D150856#4442045 <https://reviews.llvm.org/D150856#4442045>, @Endill wrote:
>
>> That's an excellent suggestion!
>
> Great, we're converging!
>
>> Is any aspect of it a real lit API?
>
> Not that I'm aware of.  Someone would have to implement it.  Until then, the external/split-file python ideas that you and @jhenderson are discussing seem like a reasonable direction for the C++ DR testing.

Honestly, I'd rather start implementing PYTHON directive rather than spend efforts on a stop-gap measure that requires reinventing test runners.

> I don't yet understand what your `%lit-generate-directives` does, but I don't have time to investigate right now.



> A few more thoughts on the `PYTHON:` directive in case someone pursues it....
>
> I imagine it could eventually replace some other existing and proposed lit features as well.  Lit's existing `%if x` could become `PYTHON: if lit.features('x'):`.  Python functions could replace parameterized substitutions (discussed in the DEFINE/REDEFINE documentation <https://llvm.org/docs/TestingGuide.html#substitutions>) and function-like substitutions (which I started working on previously <https://reviews.llvm.org/D133172>).  In general, I think using python instead of lit features in this way would lower the learning curve for lit users, increase the flexibility, and lower the maintenance burden for lit developers.
>
> Also, if `RUN: cmd` is treated as an alias for `PYTHON: lit.run(cmd_escaped_for_python)`, then it should be easier to annotate existing lit tests with `PYTHON: if cond:` directives and similar.




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150856/new/

https://reviews.llvm.org/D150856



More information about the llvm-commits mailing list