[PATCH] D122569: [lit] Support %if ... %else syntax for RUN lines
Artem Belevich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 29 13:04:50 PDT 2022
tra added inline comments.
================
Comment at: llvm/utils/lit/tests/shtest-if-else.py:1
+# RUN: %{lit} -v --show-all %{inputs}/shtest-if-else | FileCheck %s
+# END.
----------------
I'd use the full name `%{inputs}/shtest-if-else/test.txt`.
This way it's obvious how the input file is used and it avoids accidentally picking up some other file we may eventually have in that directory.
Perhaps it would make sense to incorporate the test.txt into this file. E.g add another RUN line to generate the test input file and then run lit on it.
This would allow interleaving the RUN/check directives in the same source. Right now it's a bit of a pain to follow what we're exacuting and which output it's supposed to generate.
E.g. we could do something like this:
```
RUN: grep LITRUN %s | sed -e 's/LITRUN/RUN/' > %t/test.txt
RUN: grep LITCFG %s | sed -e 's/# LITCFG://' > %t/lit.cfg
RUN: %{lit} -v --show-all %t.txt | FileCheck %s
# LITCFG: lit config lines go here.
# LITRUN: echo XX %if feature {YY} ZZ
# CHECK-NEXT: 'RUN: at line 32'; echo XX YY ZZ
# LITRUN: ...
# CHECK-NEXT: ...
```
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