Index: utils/lit/lit/main.py =================================================================== --- utils/lit/lit/main.py +++ utils/lit/lit/main.py @@ -278,15 +278,6 @@ debug_group.add_argument("--show-tests", dest="showTests", help="Show all discovered tests", action="store_true", default=False) - debug_group.add_argument("--use-process-pool", dest="executionStrategy", - help="Run tests in parallel with a process pool", - action="store_const", const="PROCESS_POOL") - debug_group.add_argument("--use-processes", dest="executionStrategy", - help="Run tests in parallel with processes (not threads)", - action="store_const", const="PROCESSES") - debug_group.add_argument("--use-threads", dest="executionStrategy", - help="Run tests in parallel with threads (not processes)", - action="store_const", const="THREADS") opts = parser.parse_args() args = opts.test_paths @@ -301,9 +292,6 @@ if opts.numThreads is None: opts.numThreads = lit.util.detectCPUs() - if opts.executionStrategy is None: - opts.executionStrategy = 'PROCESS_POOL' - if opts.maxFailures == 0: parser.error("Setting --max-failures to 0 does not have any effect.") @@ -486,8 +474,7 @@ startTime = time.time() display = TestingProgressDisplay(opts, len(run.tests), progressBar) try: - run.execute_tests(display, opts.numThreads, opts.maxTime, - opts.executionStrategy) + run.execute_tests(display, opts.numThreads, opts.maxTime) except KeyboardInterrupt: sys.exit(2) display.finish() Index: utils/lit/lit/run.py =================================================================== --- utils/lit/lit/run.py +++ utils/lit/lit/run.py @@ -13,11 +13,7 @@ except ImportError: win32api = None -try: - import multiprocessing -except ImportError: - multiprocessing = None - +import multiprocessing import lit.Test ### @@ -220,8 +216,7 @@ def execute_test(self, test): return execute_test(test, self.lit_config, self.parallelism_semaphores) - def execute_tests(self, display, jobs, max_time=None, - execution_strategy=None): + def execute_tests(self, display, jobs, max_time=None): """ execute_tests(display, jobs, [max_time]) @@ -242,100 +237,6 @@ computed. Tests which were not actually executed (for any reason) will be given an UNRESOLVED result. """ - - if execution_strategy == 'PROCESS_POOL': - self.execute_tests_with_mp_pool(display, jobs, max_time) - return - # FIXME: Standardize on the PROCESS_POOL execution strategy and remove - # the other two strategies. - - use_processes = execution_strategy == 'PROCESSES' - - # Choose the appropriate parallel execution implementation. - consumer = None - if jobs != 1 and use_processes and multiprocessing: - try: - task_impl = multiprocessing.Process - queue_impl = multiprocessing.Queue - sem_impl = multiprocessing.Semaphore - canceled_flag = multiprocessing.Value('i', 0) - consumer = MultiprocessResultsConsumer(self, display, jobs) - except: - # multiprocessing fails to initialize with certain OpenBSD and - # FreeBSD Python versions: http://bugs.python.org/issue3770 - # Unfortunately the error raised also varies by platform. - self.lit_config.note('failed to initialize multiprocessing') - consumer = None - if not consumer: - task_impl = threading.Thread - queue_impl = queue.Queue - sem_impl = threading.Semaphore - canceled_flag = LockedValue(0) - consumer = ThreadResultsConsumer(display) - - self.parallelism_semaphores = {k: sem_impl(v) - for k, v in self.lit_config.parallelism_groups.items()} - - # Create the test provider. - provider = TestProvider(queue_impl, canceled_flag) - handleFailures(provider, consumer, self.lit_config.maxFailures) - - # Putting tasks into the threading or multiprocessing Queue may block, - # so do it in a separate thread. - # https://docs.python.org/2/library/multiprocessing.html - # e.g: On Mac OS X, we will hang if we put 2^15 elements in the queue - # without taking any out. - queuer = task_impl(target=provider.queue_tests, args=(self.tests, jobs)) - queuer.start() - - # Install a console-control signal handler on Windows. - if win32api is not None: - def console_ctrl_handler(type): - provider.cancel() - return True - win32api.SetConsoleCtrlHandler(console_ctrl_handler, True) - - # Install a timeout handler, if requested. - if max_time is not None: - def timeout_handler(): - provider.cancel() - timeout_timer = threading.Timer(max_time, timeout_handler) - timeout_timer.start() - - # If not using multiple tasks, just run the tests directly. - if jobs == 1: - run_one_tester(self, provider, consumer) - else: - # Otherwise, execute the tests in parallel - self._execute_tests_in_parallel(task_impl, provider, consumer, jobs) - - queuer.join() - - # Cancel the timeout handler. - if max_time is not None: - timeout_timer.cancel() - - # Update results for any tests which weren't run. - for test in self.tests: - if test.result is None: - test.setResult(lit.Test.Result(lit.Test.UNRESOLVED, '', 0.0)) - - def _execute_tests_in_parallel(self, task_impl, provider, consumer, jobs): - # Start all of the tasks. - tasks = [task_impl(target=run_one_tester, - args=(self, provider, consumer)) - for i in range(jobs)] - for t in tasks: - t.start() - - # Allow the consumer to handle results, if necessary. - consumer.handle_results() - - # Wait for all the tasks to complete. - for t in tasks: - t.join() - - def execute_tests_with_mp_pool(self, display, jobs, max_time=None): # Don't do anything if we aren't going to run any tests. if not self.tests or jobs == 0: return