xref: /aosp_15_r20/external/llvm/utils/lit/examples/many-tests/lit.cfg (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# -*- Python -*-
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workerfrom lit import Test
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workerclass ManyTests(object):
6*9880d681SAndroid Build Coastguard Worker    def __init__(self, N=10000):
7*9880d681SAndroid Build Coastguard Worker        self.N = N
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker    def getTestsInDirectory(self, testSuite, path_in_suite,
10*9880d681SAndroid Build Coastguard Worker                            litConfig, localConfig):
11*9880d681SAndroid Build Coastguard Worker        for i in range(self.N):
12*9880d681SAndroid Build Coastguard Worker            test_name = 'test-%04d' % (i,)
13*9880d681SAndroid Build Coastguard Worker            yield Test.Test(testSuite, path_in_suite + (test_name,),
14*9880d681SAndroid Build Coastguard Worker                            localConfig)
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker    def execute(self, test, litConfig):
17*9880d681SAndroid Build Coastguard Worker        # Do a "non-trivial" amount of Python work.
18*9880d681SAndroid Build Coastguard Worker        sum = 0
19*9880d681SAndroid Build Coastguard Worker        for i in range(10000):
20*9880d681SAndroid Build Coastguard Worker            sum += i
21*9880d681SAndroid Build Coastguard Worker        return Test.PASS,''
22*9880d681SAndroid Build Coastguard Worker
23*9880d681SAndroid Build Coastguard Workerconfig.test_format = ManyTests()
24