[lit] Add a method to lit.TestFormat to get the list of tests associated to a path
authorLouis Dionne <ldionne.2@gmail.com>
Mon, 29 May 2023 20:49:33 +0000 (13:49 -0700)
committerLouis Dionne <ldionne.2@gmail.com>
Tue, 27 Jun 2023 20:27:08 +0000 (16:27 -0400)
commit5b55eb1e888430abfbcde8a84c99ca35fb3c5374
treefcee75863c768396b62852b66c84f97f8c25701b
parenta42ce094d90341f88a845740b2e5783060f23e3e
[lit] Add a method to lit.TestFormat to get the list of tests associated to a path

Lit TestFormat classes already needed to implement the getTestsInDirectory
method. However, some test formats may want to expand a single test path
to multiple Lit tests, for example in the case of a test that actually
generates other Lit tests.

To accommodate that, this commit adds the getTestsForPath method to
TestFormat. This method can be used to turn a single path in a Lit
test suite into a list of tests associated to that path.

Differential Revision: https://reviews.llvm.org/D151664
libcxx/utils/libcxx/test/format.py
llvm/utils/lit/examples/many-tests/ManyTests.py
llvm/utils/lit/lit/discovery.py
llvm/utils/lit/lit/formats/base.py
llvm/utils/lit/tests/Inputs/discovery-getTestsForPath/custom_format.py [new file with mode: 0644]
llvm/utils/lit/tests/Inputs/discovery-getTestsForPath/lit.cfg [new file with mode: 0644]
llvm/utils/lit/tests/Inputs/discovery-getTestsForPath/x.test [new file with mode: 0644]
llvm/utils/lit/tests/discovery.py