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

Artem Belevich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 11:40:28 PDT 2022


tra added inline comments.


================
Comment at: llvm/docs/TestingGuide.rst:615
 
+``%if feature {<if branch>} %else {<else branch>}``
+
----------------
Would any of the following be expected to work?
- `%if feature {do_something} | FileCheck %s`   -- this will probably fail as empty substitution would produce no output to check
- `%if feature {do_something | FileCheck %s}` -- this would probably work.
- `%if featureA { %if featureB {do_AB} %else {do_A_notB}} %else {do_notA}` -- I suspect we'll fail to parse it correctly.

I'd document that we currently can't nest those `%if/%else` and, maybe add the `%if feature {do_something | FileCheck %s}` as a canonical example of how to use it for conditional output-checking tests.



================
Comment at: llvm/utils/lit/tests/shtest-if-else.py:1-2
+# RUN: %{lit} -v --show-all %{inputs}/shtest-if-else > %t.out
+# RUN: FileCheck --input-file %t.out %s
+# END.
----------------
Why not just pipe the output straight to FileCheck and avoid the temp file.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122569



More information about the llvm-commits mailing list