[Lldb-commits] [lldb] r213555 - Rename dosep.ty to dosep.py
Zachary Turner
zturner at google.com
Mon Jul 21 09:16:31 PDT 2014
Author: zturner
Date: Mon Jul 21 11:16:31 2014
New Revision: 213555
URL: http://llvm.org/viewvc/llvm-project?rev=213555&view=rev
Log:
Rename dosep.ty to dosep.py
Added:
lldb/trunk/test/dosep.py
- copied, changed from r213553, lldb/trunk/test/dosep.ty
Removed:
lldb/trunk/test/dosep.ty
Modified:
lldb/trunk/test/CMakeLists.txt
lldb/trunk/test/Makefile
Modified: lldb/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=213555&r1=213554&r2=213555&view=diff
==============================================================================
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Mon Jul 21 11:16:31 2014
@@ -49,7 +49,7 @@ set(LLDB_DOSEP_ARGS
# If tests crash cause LLDB to crash, or things are otherwise unstable, or if machine-parsable
# output is desired (i.e. in continuous integration contexts) check-lldb-sep is a better target.
add_python_test_target(check-lldb
- ${LLDB_SOURCE_DIR}/test/dosep.ty
+ ${LLDB_SOURCE_DIR}/test/dosep.py
"${LLDB_DOSEP_ARGS}"
"Testing LLDB (with a separate subprocess per test)"
)
Modified: lldb/trunk/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/Makefile?rev=213555&r1=213554&r2=213555&view=diff
==============================================================================
--- lldb/trunk/test/Makefile (original)
+++ lldb/trunk/test/Makefile Mon Jul 21 11:16:31 2014
@@ -30,4 +30,4 @@ clean::
#----------------------------------------------------------------------
check-local::
rm -rf lldb-test-traces
- python $(PROJ_SRC_DIR)/dosep.ty -o "--executable $(ToolDir)/lldb -q -s lldb-test-traces -u CXXFLAGS -u CFLAGS -C $(subst ccache,,$(CC))"
+ python $(PROJ_SRC_DIR)/dosep.py -o "--executable $(ToolDir)/lldb -q -s lldb-test-traces -u CXXFLAGS -u CFLAGS -C $(subst ccache,,$(CC))"
Copied: lldb/trunk/test/dosep.py (from r213553, lldb/trunk/test/dosep.ty)
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.py?p2=lldb/trunk/test/dosep.py&p1=lldb/trunk/test/dosep.ty&r1=213553&r2=213555&rev=213555&view=diff
==============================================================================
(empty)
Removed: lldb/trunk/test/dosep.ty
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/dosep.ty?rev=213554&view=auto
==============================================================================
--- lldb/trunk/test/dosep.ty (original)
+++ lldb/trunk/test/dosep.ty (removed)
@@ -1,121 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Run the test suite using a separate process for each test file.
-"""
-
-import multiprocessing
-import os
-import platform
-import sys
-
-from optparse import OptionParser
-
-# Command template of the invocation of the test driver.
-template = '%s %s/dotest.py %s -p %s %s'
-
-def process_dir(root, files, test_root, dotest_options):
- """Examine a directory for tests, and invoke any found within it."""
- failed = []
- passed = []
- 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 % (sys.executable, test_root, dotest_options if dotest_options else "", name, root)
- if 0 != os.system(command):
- failed.append(name)
- else:
- passed.append(name)
- return (failed, passed)
-
-in_q = None
-out_q = None
-
-def process_dir_worker(arg_tuple):
- """Worker thread main loop when in multithreaded mode.
- Takes one directory specification at a time and works on it."""
- (root, files, test_root, dotest_options) = arg_tuple
- return process_dir(root, files, test_root, dotest_options)
-
-def walk_and_invoke(test_root, dotest_options, num_threads):
- """Look for matched files and invoke test driver on each one.
- In single-threaded mode, each test driver is invoked directly.
- In multi-threaded mode, submit each test driver to a worker
- queue, and then wait for all to complete."""
-
- # Collect the test files that we'll run.
- test_work_items = []
- for root, dirs, files in os.walk(test_root, topdown=False):
- test_work_items.append((root, files, test_root, dotest_options))
-
- # Run the items, either in a pool (for multicore speedup) or
- # calling each individually.
- if num_threads > 1:
- pool = multiprocessing.Pool(num_threads)
- test_results = pool.map(process_dir_worker, test_work_items)
- else:
- test_results = []
- for work_item in test_work_items:
- test_results.append(process_dir_worker(work_item))
-
- failed = []
- passed = []
-
- for test_result in test_results:
- (dir_failed, dir_passed) = test_result
- failed += dir_failed
- passed += dir_passed
-
- return (failed, passed)
-
-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.""")
-
- parser.add_option('-t', '--threads',
- type='int',
- dest='num_threads',
- help="""The number of threads to use when running tests separately.""",
- default=multiprocessing.cpu_count())
-
- opts, args = parser.parse_args()
- dotest_options = opts.dotest_options
- num_threads = opts.num_threads
- if num_threads < 1:
- num_threads_str = os.environ.get("LLDB_TEST_THREADS")
- if num_threads_str:
- num_threads = int(num_threads_str)
- if num_threads < 1:
- num_threads = 1
- else:
- num_threads = 1
-
- system_info = " ".join(platform.uname())
- (failed, passed) = walk_and_invoke(test_root, dotest_options, num_threads)
- num_tests = len(failed) + len(passed)
-
- print "Ran %d tests." % num_tests
- if len(failed) > 0:
- print "Failing Tests (%d)" % len(failed)
- for f in failed:
- print "FAIL: LLDB (suite) :: %s (%s)" % (f, system_info)
- sys.exit(1)
- sys.exit(0)
-
-if __name__ == '__main__':
- main()
More information about the lldb-commits
mailing list