<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/97346>97346</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            `lit` feature request: better file excludes + ability to exclude directories
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          gussmith23
      </td>
    </tr>
</table>

<pre>
    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!


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVVFz4joP_TXmRUMmGAjlIQ9t9-ss7zvf6x0nURItjs21FVL-_R0loaUtu53pUBhZ0tE5R7aJkRqHmKvtk9r-WJieWx_ypo-xI271elH46pL_JDDWKr1S6Q-VPk6fz30I6NhelH4GlaWWWGWp0rsov0rvamoSfC1tX2FUWQqDD8cIBgpiiByMa9BeEjh0piGHcIDWnBEM1GQROCCq9eNtQ6k-_Y0_GSNHpV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