xref: /llvm-project/llvm/utils/lit/examples/many-tests/ManyTests.py (revision 5b55eb1e888430abfbcde8a84c99ca35fb3c5374)
1*5b55eb1eSLouis Dionnefrom lit import Test, TestFormat
2a250f90eSAlex Langford
3a250f90eSAlex Langford
4*5b55eb1eSLouis Dionneclass ManyTests(TestFormat):
5a250f90eSAlex Langford    def __init__(self, N=10000):
6a250f90eSAlex Langford        self.N = N
7a250f90eSAlex Langford
8a250f90eSAlex Langford    def getTestsInDirectory(self, testSuite, path_in_suite, litConfig, localConfig):
9a250f90eSAlex Langford        for i in range(self.N):
10a250f90eSAlex Langford            test_name = "test-%04d" % (i,)
11a250f90eSAlex Langford            yield Test.Test(testSuite, path_in_suite + (test_name,), localConfig)
12a250f90eSAlex Langford
13a250f90eSAlex Langford    def execute(self, test, litConfig):
14a250f90eSAlex Langford        # Do a "non-trivial" amount of Python work.
15a250f90eSAlex Langford        sum = 0
16a250f90eSAlex Langford        for i in range(10000):
17a250f90eSAlex Langford            sum += i
18a250f90eSAlex Langford        return Test.PASS, ""
19