diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2011-10-31 19:04:07 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2011-10-31 19:04:07 +0000 |
| commit | e8d9dc60be5b31b5bd25cffd08ff5a09248fd852 (patch) | |
| tree | 9e0116aa81acf629e8d73d3b3e5410090152d7be | |
| parent | d01ddd1d07e78ea0b0487a8f9b622385ccfb71b9 (diff) | |
| download | bcm5719-llvm-e8d9dc60be5b31b5bd25cffd08ff5a09248fd852.tar.gz bcm5719-llvm-e8d9dc60be5b31b5bd25cffd08ff5a09248fd852.zip | |
Add a Python script to invoke each test file under the test root using a separate process.
Example:
[11:33:09] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dosep.ty -o "-v -n"
dotest.py options: -v -n
Running /Volumes/data/lldb/svn/trunk/test/dotest.py -v -n -p TestPublicAPIHeaders.py /Volumes/data/lldb/svn/trunk/test/api/check_public_api_headers
1: test_sb_api_directory (TestPublicAPIHeaders.SBDirCheckerCase)
Test the SB API directory and make sure there's no unwanted stuff. ... ok
----------------------------------------------------------------------
Ran 1 test in 4.404s
OK
Running /Volumes/data/lldb/svn/trunk/test/dotest.py -v -n -p TestEmulations.py /Volumes/data/lldb/svn/trunk/test/arm_emulation
1: test_arm_emulations (TestEmulations.ARMEmulationTestCase) ... ok
2: test_thumb_emulations (TestEmulations.ARMEmulationTestCase) ... ok
----------------------------------------------------------------------
Ran 2 tests in 1.399s
OK
...
llvm-svn: 143355
| -rwxr-xr-x | lldb/test/dosep.ty | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/lldb/test/dosep.ty b/lldb/test/dosep.ty new file mode 100755 index 00000000000..74c4de0fc81 --- /dev/null +++ b/lldb/test/dosep.ty @@ -0,0 +1,52 @@ +#!/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/dotest.py %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"): + continue + + # Neither a symbolically linked file. + if os.path.islink(path): + continue + + command = template % (test_root, dotest_options if dotest_options else "", name, root) + print "Running %s" % (command) + os.system(command) + +def main(): + """Read the root dir and the path spec, invoke lldb-disasm.py on the file.""" + 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 + + print "dotest.py options:", dotest_options + + walk_and_invoke(test_root, dotest_options) + + +if __name__ == '__main__': + main() |

