llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

`lit` feature request: better file excludes + ability to exclude directories

Open gussmith23 opened this issue 2 years ago • 2 comments

Hi all!

Currently, lit's config.excludes works a bit strangely. Imagine I have a file tree:

tests/
├─ test0.v
├─ test1.v
├─ test1_includes/
│  ├─ include.v
├─ lit.cfg

(.v here because I'm using lit for Verilog-based tests)

test1.v here uses test1_includes/include.v. However, I don't want lit to attempt to run include.v as a test -- I want it to be ignored.

Currently, to get lit to ignore include.v, I need to add 'include.v' to config.excludes in lit.cfg. But this is strange! It's not test1_includes/include.v, which would make more sense. Instead, it has to just be the filename itself, not the path leading up to the file.

The problem with this is that now include.v will be ignored everywhere in my test suite, which is not the intention.

There are a few ways I think this could be fixed:

  • The easiest way would be to just allow for directory excludes -- then I could exclude test1_includes as a whole.
  • The next way would be to check for relative paths when looking at excludes. Then,config.excludes would include test1_includes/include.v instead of include.v, and include.v wouldn't be excluded from the suite wherever else it appears.

In the short term I can get around this by just not having name collisions, but it seems like weird behavior in lit.

Thank you all!

gussmith23 avatar Jul 01 '24 20:07 gussmith23

You can already limit the scope of excludes by using test1_includes/lit.local.cfg which has just config.excludes = ["include.v"]

jprotze avatar Mar 25 '25 14:03 jprotze

it would be good to have a command line argument support as well like llvm-lit . --exclude <subdir>

edit: My bad, there is an option called --filter-out for this

msolk avatar Sep 17 '26 05:09 msolk