return (ePassed if subprocess.call(command, stdin=subprocess.PIPE) == 0
else eFailed)
-def process_dir(root, files, test_root, dotest_options):
+def process_dir(root, files, test_root, dotest_argv):
"""Examine a directory for tests, and invoke any found within it."""
timed_out = []
failed = []
continue
script_file = os.path.join(test_root, "dotest.py")
- is_posix = (os.name == "posix")
- split_args = shlex.split(dotest_options, posix=is_posix) if dotest_options else []
command = ([sys.executable, script_file] +
- split_args +
+ dotest_argv +
["-p", name, root])
timeout_name = os.path.basename(os.path.splitext(name)[0]).upper()
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)
+ (root, files, test_root, dotest_argv) = arg_tuple
+ return process_dir(root, files, test_root, dotest_argv)
-def walk_and_invoke(test_directory, test_subdir, dotest_options, num_threads):
+def walk_and_invoke(test_directory, test_subdir, dotest_argv, 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
# Collect the test files that we'll run.
test_work_items = []
for root, dirs, files in os.walk(test_subdir, topdown=False):
- test_work_items.append((root, files, test_directory, dotest_options))
+ test_work_items.append((root, files, test_directory, dotest_argv))
# Run the items, either in a pool (for multicore speedup) or
# calling each individually.
opts, args = parser.parse_args()
dotest_option_string = opts.dotest_options
- dotest_argv = shlex.split(dotest_option_string)
+ is_posix = (os.name == "posix")
+ dotest_argv = shlex.split(dotest_option_string, posix=is_posix) if dotest_option_string else []
dotest_options = dotest_args.getArguments(dotest_argv)
+ if not dotest_options.s:
+ # no session log directory, we need to add this to prevent
+ # every dotest invocation from creating its own directory
+ import datetime
+ # The windows platforms don't like ':' in the pathname.
+ timestamp_started = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S")
+ dotest_argv.append('-s')
+ dotest_argv.append(timestamp_started)
# The root directory was specified on the command line
if len(args) == 0:
num_threads = 1
system_info = " ".join(platform.uname())
- (timed_out, failed, passed) = walk_and_invoke(test_directory, test_subdir, dotest_option_string,
+ (timed_out, failed, passed) = walk_and_invoke(test_directory, test_subdir, dotest_argv,
num_threads)
timed_out = set(timed_out)
num_tests = len(failed) + len(passed)