summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Unit/lit.cfg3
-rw-r--r--utils/lit/lit/Test.py9
-rw-r--r--utils/lit/lit/TestingConfig.py5
-rwxr-xr-xutils/lit/lit/main.py2
4 files changed, 17 insertions, 2 deletions
diff --git a/test/Unit/lit.cfg b/test/Unit/lit.cfg
index e481dcc6a7b..30a5d3fab82 100644
--- a/test/Unit/lit.cfg
+++ b/test/Unit/lit.cfg
@@ -12,6 +12,9 @@ config.name = 'LLVM-Unit'
# suffixes: A list of file extensions to treat as test files.
config.suffixes = []
+# is_early; Request to run this suite early.
+config.is_early = True
+
# test_source_root: The root path where tests are located.
# test_exec_root: The root path where tests should be run.
llvm_obj_root = getattr(config, 'llvm_obj_root', None)
diff --git a/utils/lit/lit/Test.py b/utils/lit/lit/Test.py
index fd02a548d9a..c7c54897f00 100644
--- a/utils/lit/lit/Test.py
+++ b/utils/lit/lit/Test.py
@@ -235,6 +235,15 @@ class Test:
return False
+ def isEarlyTest(self):
+ """
+ isEarlyTest() -> bool
+
+ Check whether this test should be executed early in a particular run.
+ This can be used for test suites with long running tests to maximize
+ parallelism or where it is desirable to surface their failures early.
+ """
+ return self.suite.config.is_early
def getJUnitXML(self):
test_name = self.path_in_suite[-1]
diff --git a/utils/lit/lit/TestingConfig.py b/utils/lit/lit/TestingConfig.py
index 7441b94b9f0..7940ebd0885 100644
--- a/utils/lit/lit/TestingConfig.py
+++ b/utils/lit/lit/TestingConfig.py
@@ -118,7 +118,8 @@ class TestingConfig:
def __init__(self, parent, name, suffixes, test_format,
environment, substitutions, unsupported,
test_exec_root, test_source_root, excludes,
- available_features, pipefail, limit_to_features = []):
+ available_features, pipefail, limit_to_features = [],
+ is_early = False):
self.parent = parent
self.name = str(name)
self.suffixes = set(suffixes)
@@ -135,6 +136,8 @@ class TestingConfig:
# require one of the features in this list if this list is non-empty.
# Configurations can set this list to restrict the set of tests to run.
self.limit_to_features = set(limit_to_features)
+ # Whether the suite should be tested early in a given run.
+ self.is_early = bool(is_early)
def finish(self, litConfig):
"""finish() - Finish this config object, after loading is complete."""
diff --git a/utils/lit/lit/main.py b/utils/lit/lit/main.py
index 4df2571da99..4debf4b10b6 100755
--- a/utils/lit/lit/main.py
+++ b/utils/lit/lit/main.py
@@ -367,7 +367,7 @@ def main(builtinParameters = {}):
elif opts.incremental:
sort_by_incremental_cache(run)
else:
- run.tests.sort(key = lambda result_test: result_test.getFullName())
+ run.tests.sort(key = lambda t: (not t.isEarlyTest(), t.getFullName()))
# Finally limit the number of tests, if desired.
if opts.maxTests is not None: