summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r--lldb/packages/Python/lldbsuite/test/configuration.py37
-rw-r--r--lldb/packages/Python/lldbsuite/test/dosep.py13
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest.py17
3 files changed, 49 insertions, 18 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/configuration.py b/lldb/packages/Python/lldbsuite/test/configuration.py
index 94781050dc4..a1a0ced4b4f 100644
--- a/lldb/packages/Python/lldbsuite/test/configuration.py
+++ b/lldb/packages/Python/lldbsuite/test/configuration.py
@@ -110,9 +110,13 @@ lldb_platform_working_dir = None
# The base directory in which the tests are being built.
test_build_dir = None
+# The only directory to scan for tests. If multiple test directories are
+# specified, and an exclusive test subdirectory is specified, the latter option
+# takes precedence.
+exclusive_test_subdir = None
+
# Parallel execution settings
is_inferior_test_runner = False
-multiprocess_test_subdir = None
num_threads = None
no_multiprocess_test_runner = False
test_runner_name = None
@@ -144,3 +148,34 @@ def shouldSkipBecauseOfCategories(test_categories):
return True
return False
+
+
+def get_absolute_path_to_exclusive_test_subdir():
+ """
+ If an exclusive test subdirectory is specified, return its absolute path.
+ Otherwise return None.
+ """
+ test_directory = os.path.dirname(os.path.realpath(__file__))
+
+ if not exclusive_test_subdir:
+ return
+
+ if len(exclusive_test_subdir) > 0:
+ test_subdir = os.path.join(test_directory, exclusive_test_subdir)
+ if os.path.isdir(test_subdir):
+ return test_subdir
+
+ print('specified test subdirectory {} is not a valid directory\n'
+ .format(test_subdir))
+
+
+def get_absolute_path_to_root_test_dir():
+ """
+ If an exclusive test subdirectory is specified, return its absolute path.
+ Otherwise, return the absolute path of the root test directory.
+ """
+ test_subdir = get_absolute_path_to_exclusive_test_subdir()
+ if test_subdir:
+ return test_subdir
+
+ return os.path.dirname(os.path.realpath(__file__))
diff --git a/lldb/packages/Python/lldbsuite/test/dosep.py b/lldb/packages/Python/lldbsuite/test/dosep.py
index 616fbf381ed..00bfa2fa337 100644
--- a/lldb/packages/Python/lldbsuite/test/dosep.py
+++ b/lldb/packages/Python/lldbsuite/test/dosep.py
@@ -1558,7 +1558,7 @@ def rerun_tests(test_subdir, tests_for_rerun, dotest_argv, session_dir,
print("\nTest rerun complete\n")
-def main(num_threads, test_subdir, test_runner_name, results_formatter):
+def main(num_threads, test_runner_name, results_formatter):
"""Run dotest.py in inferior mode in parallel.
@param num_threads the parsed value of the num-threads command line
@@ -1600,16 +1600,7 @@ def main(num_threads, test_subdir, test_runner_name, results_formatter):
session_dir = os.path.join(os.getcwd(), dotest_options.s)
- # The root directory was specified on the command line
- test_directory = os.path.dirname(os.path.realpath(__file__))
- if test_subdir and len(test_subdir) > 0:
- test_subdir = os.path.join(test_directory, test_subdir)
- if not os.path.isdir(test_subdir):
- print(
- 'specified test subdirectory {} is not a valid directory\n'
- .format(test_subdir))
- else:
- test_subdir = test_directory
+ test_subdir = configuration.get_absolute_path_to_root_test_dir()
# clean core files in test tree from previous runs (Linux)
cores = find('core.*', test_subdir)
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 83616d1214b..f0c5844e53e 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -439,7 +439,7 @@ def parseOptionsAndInitTestdirs():
configuration.num_threads = args.num_threads
if args.test_subdir:
- configuration.multiprocess_test_subdir = args.test_subdir
+ configuration.exclusive_test_subdir = args.test_subdir
if args.test_runner_name:
configuration.test_runner_name = args.test_runner_name
@@ -895,6 +895,7 @@ def visit_file(dir, name):
unittest2.defaultTestLoader.loadTestsFromName(base))
+# TODO: This should be replaced with a call to find_test_files_in_dir_tree.
def visit(prefix, dir, names):
"""Visitor function for os.path.walk(path, visit, arg)."""
@@ -1172,7 +1173,6 @@ def run_suite():
from . import dosep
dosep.main(
configuration.num_threads,
- configuration.multiprocess_test_subdir,
configuration.test_runner_name,
configuration.results_formatter_object)
raise Exception("should never get here")
@@ -1267,10 +1267,15 @@ def run_suite():
# Don't do lldb-server (llgs) tests on anything except Linux.
configuration.dont_do_llgs_test = not ("linux" in target_platform)
- #
- # Walk through the testdirs while collecting tests.
- #
- for testdir in configuration.testdirs:
+ # Collect tests from the specified testing directories. If a test
+ # subdirectory filter is explicitly specified, limit the search to that
+ # subdirectory.
+ exclusive_test_subdir = configuration.get_absolute_path_to_exclusive_test_subdir()
+ if exclusive_test_subdir:
+ dirs_to_search = [exclusive_test_subdir]
+ else:
+ dirs_to_search = configuration.testdirs
+ for testdir in dirs_to_search:
for (dirpath, dirnames, filenames) in os.walk(testdir):
visit('Test', dirpath, filenames)
OpenPOWER on IntegriCloud