[PATCH] D122569: [lit] Support %if ... %else syntax for RUN lines

Andrew Savonichev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 04:08:59 PDT 2022


asavonic created this revision.
asavonic added reviewers: mstorsjo, jdenny, probinson, jhenderson, tra.
Herald added a subscriber: delcypher.
Herald added a project: All.
asavonic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This syntax allows to modify RUN lines based on features
available. For example:

  RUN: ... | FileCheck %s --check-prefix={%if windows {W} else {NON-W}}
  CHECK-W: ...
  CHECK-NON-W: ...

The whole command can be put under %if ... %else:

  RUN: %if tool_available { %tool } else { true }

Multi-line expressions are also supported:

  RUN: %if tool_available { \
  RUN:   %tool              \
  RUN: } else {             \
  RUN:   true               \
  RUN: }

Background and motivation:
D121727 <https://reviews.llvm.org/D121727> [NVPTX] Integrate ptxas to LIT tests
https://reviews.llvm.org/D121727


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D122569

Files:
  llvm/docs/TestingGuide.rst
  llvm/utils/lit/lit/TestRunner.py
  llvm/utils/lit/tests/Inputs/shtest-if-else/lit.cfg
  llvm/utils/lit/tests/Inputs/shtest-if-else/test.txt
  llvm/utils/lit/tests/shtest-if-else.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122569.418531.patch
Type: text/x-patch
Size: 4559 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220328/8ccb111a/attachment-0001.bin>


More information about the llvm-commits mailing list