2011-11-01 03:04:07 +08:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
"""
|
|
|
|
Run the test suite using a separate process for each test file.
|
|
|
|
"""
|
|
|
|
|
2013-04-20 02:32:53 +08:00
|
|
|
import os, sys, platform
|
2011-11-01 03:04:07 +08:00
|
|
|
from optparse import OptionParser
|
|
|
|
|
|
|
|
# Command template of the invocation of the test driver.
|
|
|
|
template = '%s/dotest.py %s -p %s %s'
|
|
|
|
|
|
|
|
def walk_and_invoke(test_root, dotest_options):
|
|
|
|
"""Look for matched file and invoke test driver on it."""
|
2013-02-16 05:31:37 +08:00
|
|
|
failed = []
|
|
|
|
passed = []
|
2011-11-01 03:04:07 +08:00
|
|
|
for root, dirs, files in os.walk(test_root, topdown=False):
|
|
|
|
for name in files:
|
|
|
|
path = os.path.join(root, name)
|
|
|
|
|
|
|
|
# We're only interested in the test file with the "Test*.py" naming pattern.
|
|
|
|
if not name.startswith("Test") or not name.endswith(".py"):
|
|
|
|
continue
|
|
|
|
|
|
|
|
# Neither a symbolically linked file.
|
|
|
|
if os.path.islink(path):
|
|
|
|
continue
|
|
|
|
|
|
|
|
command = template % (test_root, dotest_options if dotest_options else "", name, root)
|
2013-02-16 05:31:37 +08:00
|
|
|
if 0 != os.system(command):
|
|
|
|
failed.append(name)
|
|
|
|
else:
|
|
|
|
passed.append(name)
|
|
|
|
return (failed, passed)
|
2011-11-01 03:04:07 +08:00
|
|
|
|
|
|
|
def main():
|
|
|
|
test_root = sys.path[0]
|
|
|
|
|
|
|
|
parser = OptionParser(usage="""\
|
|
|
|
Run lldb test suite using a separate process for each test file.
|
|
|
|
""")
|
|
|
|
parser.add_option('-o', '--options',
|
|
|
|
type='string', action='store',
|
|
|
|
dest='dotest_options',
|
|
|
|
help="""The options passed to 'dotest.py' if specified.""")
|
|
|
|
|
|
|
|
opts, args = parser.parse_args()
|
|
|
|
dotest_options = opts.dotest_options
|
|
|
|
|
2013-04-20 02:32:53 +08:00
|
|
|
system_info = " ".join(platform.uname())
|
2013-02-16 05:31:37 +08:00
|
|
|
(failed, passed) = walk_and_invoke(test_root, dotest_options)
|
|
|
|
num_tests = len(failed) + len(passed)
|
2013-04-20 02:32:53 +08:00
|
|
|
|
2013-02-16 05:31:37 +08:00
|
|
|
print "Ran %d tests." % num_tests
|
|
|
|
if len(failed) > 0:
|
|
|
|
print "Failing Tests (%d)" % len(failed)
|
|
|
|
for f in failed:
|
2013-04-20 02:32:53 +08:00
|
|
|
print "FAIL: LLDB (suite) :: %s (%s)" % (f, system_info)
|
2013-02-16 05:31:37 +08:00
|
|
|
sys.exit(1)
|
|
|
|
sys.exit(0)
|
2011-11-01 03:04:07 +08:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|