dosep.ty revision 1da1f2e5ca93a91ee62c8397d910cb3f3cc2ab7c
1#!/usr/bin/env python
2
3"""
4Run the test suite using a separate process for each test file.
5"""
6
7import os, sys
8from optparse import OptionParser
9
10# Command template of the invocation of the test driver.
11template = '%s/dotest.py %s -p %s %s'
12
13def walk_and_invoke(test_root, dotest_options):
14    """Look for matched file and invoke test driver on it."""
15    for root, dirs, files in os.walk(test_root, topdown=False):
16        for name in files:
17            path = os.path.join(root, name)
18
19            # We're only interested in the test file with the "Test*.py" naming pattern.
20            if not name.startswith("Test") or not name.endswith(".py"):
21                continue
22
23            # Neither a symbolically linked file.
24            if os.path.islink(path):
25                continue
26
27            command = template % (test_root, dotest_options if dotest_options else "", name, root)
28            print "Running %s" % (command)
29            os.system(command)
30
31def main():
32    test_root = sys.path[0]
33
34    parser = OptionParser(usage="""\
35Run lldb test suite using a separate process for each test file.
36""")
37    parser.add_option('-o', '--options',
38                      type='string', action='store',
39                      dest='dotest_options',
40                      help="""The options passed to 'dotest.py' if specified.""")
41
42    opts, args = parser.parse_args()
43    dotest_options = opts.dotest_options
44
45    print "dotest.py options:", dotest_options
46
47    walk_and_invoke(test_root, dotest_options)
48
49
50if __name__ == '__main__':
51    main()
52