blob: 74c4de0fc81e8c69f1b886bb99bb8b455271d448 [file] [log] [blame]
Johnny Chenf35a1122011-10-31 19:04:07 +00001#!/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 """Read the root dir and the path spec, invoke lldb-disasm.py on the file."""
33 test_root = sys.path[0]
34
35 parser = OptionParser(usage="""\
36Run lldb test suite using a separate process for each test file.
37""")
38 parser.add_option('-o', '--options',
39 type='string', action='store',
40 dest='dotest_options',
41 help="""The options passed to 'dotest.py' if specified.""")
42
43 opts, args = parser.parse_args()
44 dotest_options = opts.dotest_options
45
46 print "dotest.py options:", dotest_options
47
48 walk_and_invoke(test_root, dotest_options)
49
50
51if __name__ == '__main__':
52 main()