[dotest] Remove multiprocessing

Now that the Xcode project is removed, I want to focus on dotest as a
test framework, and remove its driver capabilities for which we already
rely on llvm's lit. Removing multiprocessing is the first step in that
direction.

Differential revision: https://reviews.llvm.org/D65311

llvm-svn: 367331
This commit is contained in:
Jonas Devlieghere 2019-07-30 16:42:47 +00:00
parent 8990516869
commit d3ae0bc310
6 changed files with 5 additions and 1913 deletions

View File

@ -88,22 +88,6 @@ Many more options that are available. To see a list of all of them, run:
> python dotest.py -h
The ``dotest.py`` script runs tests in parallel by default. To disable the
parallel test running feature, use the ``--no-multiprocess`` flag. The number
of concurrent tests is controlled by the ``LLDB_TEST_THREADS`` environment
variable or the ``--threads command`` line parameter. The default value is the
number of CPU cores on your system.
The parallel test running feature will handle an additional ``--test-subdir
SUBDIR`` arg. When specified, ``SUBDIR`` is relative to the root test directory
and will limit all parallel test running to that subdirectory's tree of tests.
The parallel test runner will run all tests within a given directory serially,
but will run multiple directories concurrently. Thus, as a test writer, we
provide serialized test run semantics within a directory. Note child
directories are considered entirely separate, so two child directories could be
running in parallel with a parent directory.
Running the Test Suite Remotely
-------------------------------
@ -157,7 +141,7 @@ A quick guide to getting started with PTVS is as follows:
#. If you want to enabled mixed mode debugging, check Enable native code debugging (this slows down debugging, so enable it only on an as-needed basis.)
#. Set the command line for the test suite to run.
#. Right click the project in solution explorer and choose the Debug tab.
#. Enter the arguments to dotest.py. Note you must add --no-multiprocess
#. Enter the arguments to dotest.py.
#. Example command options:
::
@ -178,8 +162,6 @@ A quick guide to getting started with PTVS is as follows:
-p TestPaths.py
# Root of test tree
D:\src\llvm\tools\lldb\packages\Python\lldbsuite\test
# Required in order to be able to debug the test.
--no-multiprocess
::

View File

@ -117,12 +117,6 @@ test_build_dir = None
# takes precedence.
exclusive_test_subdir = None
# Parallel execution settings
is_inferior_test_runner = False
num_threads = None
no_multiprocess_test_runner = False
test_runner_name = None
# Test results handling globals
results_filename = None
results_port = None

File diff suppressed because it is too large Load Diff

View File

@ -148,9 +148,6 @@ Option 1:
Writing logs into different files per test case::
This option is particularly useful when multiple dotest instances are created
by dosep.py
$ ./dotest.py --channel "lldb all"
$ ./dotest.py --channel "lldb all" --channel "gdb-remote packets"
@ -360,17 +357,6 @@ def parseOptionsAndInitTestdirs():
if any([x.startswith('-') for x in args.f]):
usage(parser)
configuration.filters.extend(args.f)
# Shut off multiprocessing mode when additional filters are specified.
# The rational is that the user is probably going after a very specific
# test and doesn't need a bunch of parallel test runners all looking for
# it in a frenzy. Also, '-v' now spits out all test run output even
# on success, so the standard recipe for redoing a failing test (with -v
# and a -f to filter to the specific test) now causes all test scanning
# (in parallel) to print results for do-nothing runs in a very distracting
# manner. If we really need filtered parallel runs in the future, consider
# adding a --no-output-on-success that prevents -v from setting
# output-on-success.
configuration.no_multiprocess_test_runner = True
if args.l:
configuration.skip_long_running_test = False
@ -428,23 +414,8 @@ def parseOptionsAndInitTestdirs():
if do_help:
usage(parser)
if args.no_multiprocess:
configuration.no_multiprocess_test_runner = True
if args.inferior:
configuration.is_inferior_test_runner = True
if args.num_threads:
configuration.num_threads = args.num_threads
if args.test_subdir:
configuration.exclusive_test_subdir = args.test_subdir
if args.test_runner_name:
configuration.test_runner_name = args.test_runner_name
# Capture test results-related args.
if args.curses and not args.inferior:
if args.curses:
# Act as if the following args were set.
args.results_formatter = "lldbsuite.test_event.formatter.curses.Curses"
args.results_file = "stdout"
@ -466,9 +437,8 @@ def parseOptionsAndInitTestdirs():
if args.results_formatter_options:
configuration.results_formatter_options = args.results_formatter_options
# Default to using the BasicResultsFormatter if no formatter is specified
# and we're not a test inferior.
if not args.inferior and configuration.results_formatter_name is None:
# Default to using the BasicResultsFormatter if no formatter is specified.
if configuration.results_formatter_name is None:
configuration.results_formatter_name = (
"lldbsuite.test_event.formatter.results_formatter.ResultsFormatter")
@ -506,13 +476,9 @@ def parseOptionsAndInitTestdirs():
# Gather all the dirs passed on the command line.
if len(args.args) > 0:
configuration.testdirs = [os.path.realpath(os.path.abspath(x)) for x in args.args]
# Shut off multiprocessing mode when test directories are specified.
configuration.no_multiprocess_test_runner = True
lldbtest_config.codesign_identity = args.codesign_identity
#print("testdirs:", testdirs)
def getXcodeOutputPaths(lldbRootDirectory):
result = []
@ -554,17 +520,7 @@ def setupTestResults():
# Send an initialize message to the formatter.
initialize_event = EventBuilder.bare_event("initialize")
if isMultiprocessTestRunner():
if (configuration.test_runner_name is not None and
configuration.test_runner_name == "serial"):
# Only one worker queue here.
worker_count = 1
else:
# Workers will be the number of threads specified.
worker_count = configuration.num_threads
else:
worker_count = 1
initialize_event["worker_count"] = worker_count
initialize_event["worker_count"] = 1
formatter_spec.formatter.handle_event(initialize_event)
@ -1038,15 +994,6 @@ def exitTestSuite(exitCode=None):
sys.exit(exitCode)
def isMultiprocessTestRunner():
# We're not multiprocess when we're either explicitly
# the inferior (as specified by the multiprocess test
# runner) OR we've been told to skip using the multiprocess
# test runner
return not (
configuration.is_inferior_test_runner or configuration.no_multiprocess_test_runner)
def getVersionForSDK(sdk):
sdk = str.lower(sdk)
full_path = seven.get_command_output('xcrun -sdk %s --show-sdk-path' % sdk)
@ -1176,7 +1123,6 @@ def run_suite():
if sys.platform.startswith("darwin"):
checkDsymForUUIDIsNotOn()
#
# Start the actions by first parsing the options while setting up the test
# directories, followed by setting up the search paths for lldb utilities;
# then, we walk the directory trees and collect the tests into our test suite.
@ -1186,20 +1132,6 @@ def run_suite():
# Setup test results (test results formatter and output handling).
setupTestResults()
# If we are running as the multiprocess test runner, kick off the
# multiprocess test runner here.
if isMultiprocessTestRunner():
from . import dosep
dosep.main(
configuration.num_threads,
configuration.test_runner_name,
configuration.results_formatter_object)
raise Exception("should never get here")
elif configuration.is_inferior_test_runner:
# Shut off Ctrl-C processing in inferiors. The parallel
# test runner handles this more holistically.
signal.signal(signal.SIGINT, signal.SIG_IGN)
setupSysPath()
#

View File

@ -4,7 +4,6 @@ from __future__ import absolute_import
# System modules
import argparse
import sys
import multiprocessing
import os
import textwrap
@ -34,15 +33,6 @@ def parse_args(parser, argv):
return parser.parse_args(args=argv, namespace=args)
def default_thread_count():
# Check if specified in the environment
num_threads_str = os.environ.get("LLDB_TEST_THREADS")
if num_threads_str:
return int(num_threads_str)
else:
return multiprocessing.cpu_count()
def create_parser():
parser = argparse.ArgumentParser(
description='description',
@ -224,35 +214,6 @@ def create_parser():
help='(Windows only) When LLDB crashes, display the Windows crash dialog.')
group.set_defaults(disable_crash_dialog=True)
group = parser.add_argument_group('Parallel execution options')
group.add_argument(
'--inferior',
action='store_true',
help=('specify this invocation is a multiprocess inferior, '
'used internally'))
group.add_argument(
'--no-multiprocess',
action='store_true',
help='skip running the multiprocess test runner')
group.add_argument(
'--threads',
type=int,
dest='num_threads',
default=default_thread_count(),
help=('The number of threads/processes to use when running tests '
'separately, defaults to the number of CPU cores available'))
group.add_argument(
'--test-subdir',
action='store',
help='Specify a test subdirectory to use relative to the test root dir'
)
group.add_argument(
'--test-runner-name',
action='store',
help=('Specify a test runner strategy. Valid values: multiprocessing,'
' multiprocessing-pool, serial, threading, threading-pool')
)
# Test results support.
group = parser.add_argument_group('Test results options')
group.add_argument(

View File

@ -119,13 +119,6 @@ endif()
set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS})
set_property(GLOBAL PROPERTY LLDB_DOTEST_ARGS_PROPERTY ${LLDB_DOTEST_ARGS})
add_python_test_target(check-lldb-single
${LLDB_SOURCE_DIR}/test/dotest.py
"--no-multiprocess;${LLDB_DOTEST_ARGS}"
"Testing LLDB with args: ${LLDB_DOTEST_ARGS}"
)
set_target_properties(check-lldb-single PROPERTIES FOLDER "lldb misc")
# 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-single is a better target.
add_custom_target(check-lldb)