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

Joel E. Denny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 14:23:29 PDT 2023


jdenny added a comment.

In D150856#4447771 <https://reviews.llvm.org/D150856#4447771>, @Endill wrote:

>> 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.
>
> Can you elaborate on a second half of this sentence?

I was probably overselling it.  I just meant that, if you already have something like

  // RUN: use-non-portable-feature-foo args0
  // RUN: use-non-portable-feature-foo args1
  // RUN: use-non-portable-feature-foo args2

it might be more convenient to extend it to

  // PYTHON: if lit.features('foo'):
  //    RUN:   use-non-portable-feature-foo args0
  //    RUN:   use-non-portable-feature-foo args1
  //    RUN:   use-non-portable-feature-foo args2

than to

  // PYTHON: if lit.features('foo'):
  // PYTHON:   lit.run('use-non-portable-feature-foo args0')
  // PYTHON:   lit.run('use-non-portable-feature-foo args1')
  // PYTHON:   lit.run('use-non-portable-feature-foo args2')

especially if the command lines have characters that require quoting for python.  You can imagine similar cases where you extend a test with a foreach loop.

Someone might argue that mixing RUN/PYTHON directives in that way is actually harmful in some respects, so feel free to ignore this idea for now.


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