[llvm-lit] llvm-lit RUN line specific REQUIRES clause?

Can I add a REQUIRES clause to a specific RUN line?

I want to run a specific RUN line only if a given requirement satisfied (eg. REQUIRES: z3).
Even if the requirement would not met, all the rest of the RUN lines should still run.

If there is no way of achieving this, I can of course copy-paste the test file, but I would seek a better solution.

Thanks, Balazs.

There isn’t a way to achieve this in a single test file. What you can do, though, is create a second file that has the necessary REQUIRES and RUN lines, and just names the first file instead of %s on the RUN lines. For example:


// Note, also used by special-case.cpp

// RUN: %clang_cc1 -c -whatever %s | FileCheck %s



// RUN: %clang_cc1 -c -whatever %S/most-cases.cpp | FileCheck %S/most-cases.cpp

I’ve seen this tactic used a number of times in the codebase. Sometimes a shared source file will be put into an “Inputs” subdirectory, sometimes not.


Awesome, thanks!

Robinson, Paul <paul.robinson@sony.com> ezt írta (időpont: 2020. júl. 8., Sze, 13:28):