dosep.ty   [plain text]

#!/usr/bin/env python

Run the test suite using a separate process for each test file.

import os, sys
from optparse import OptionParser

# Command template of the invocation of the test driver.
template = '%s/ %s -p %s %s'

def walk_and_invoke(test_root, dotest_options):
    """Look for matched file and invoke test driver on it."""
    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"):

            # Neither a symbolically linked file.
            if os.path.islink(path):

            command = template % (test_root, dotest_options if dotest_options else "", name, root)
            print "Running %s" % (command)

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',
                      help="""The options passed to '' if specified.""")

    opts, args = parser.parse_args()
    dotest_options = opts.dotest_options

    print " options:", dotest_options

    walk_and_invoke(test_root, dotest_options)

if __name__ == '__main__':