This turned out to be way easier than I feared:
For LLVM:
diff --git i/llvm/utils/lit/lit/Test.py w/llvm/utils/lit/lit/Test.py
index 59fefbc7f08919ad4a509855b3890f065323ae08..228a387f580ccaf7adfdb66a37a1ad92f93a10aa 100644
--- i/llvm/utils/lit/lit/Test.py
+++ w/llvm/utils/lit/lit/Test.py
@@ -404,4 +404,6 @@ class Test:
This can be used for test suites with long running tests to maximize
parallelism or where it is desirable to surface their failures early.
"""
+ if '/'.join(self.path_in_suite) in self.suite.config.slowest_tests:
+ return True
return self.suite.config.is_early
diff --git i/llvm/utils/lit/lit/TestingConfig.py w/llvm/utils/lit/lit/TestingConfig.py
index 38d05066a2b090cf9ed4e03b29ae15aae5e3bb82..592aaefc77692bd7f8d55aa75ad5a6da69aeb83b 100644
--- i/llvm/utils/lit/lit/TestingConfig.py
+++ w/llvm/utils/lit/lit/TestingConfig.py
@@ -124,6 +124,8 @@ class TestingConfig(object):
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)
+ # List of slowest tests (to run early)
+ self.slowest_tests = {}
self.parallelism_group = parallelism_group
self._recursiveExpansionLimit = None
And for Swift:
diff --git i/test/Unit/lit.cfg w/test/Unit/lit.cfg
index 99713d42a7e95ccc8070d24df18792628ac7acf6..efe3218aeaaf607a4fc5516bf808894e0a76f125 100644
--- i/test/Unit/lit.cfg
+++ w/test/Unit/lit.cfg
@@ -48,6 +48,9 @@ config.suffixes = []
# See http://reviews.llvm.org/D18647 for details.
config.excludes = ['DWARF']
+# Unit tests tend to be needlessly serial. Run them early.
+config.is_early = True
+
# Exclude LongTests directories when not executing long tests.
swift_test_subset = lit_config.params.get('swift_test_subset', 'validation')
if swift_test_subset in ['primary', 'validation', 'only_validation']:
diff --git i/test/lit.cfg w/test/lit.cfg
index 7e4038e687c9892f976a3b43a2f4d80e5d771ae1..774f05114eaf9ede87509af131f986d78775f0f2 100644
--- i/test/lit.cfg
+++ w/test/lit.cfg
@@ -322,6 +322,30 @@ config.round_trip_syntax_test = make_path(config.swift_utils, 'round-trip-syntax
config.link = lit.util.which('link', config.environment.get('PATH', '')) or \
lit.util.which('lld-link', config.environment.get('PATH', ''))
+config.slowest_tests = {
+ "Casting/BoxingCasts-4.test",
+ "Casting/BoxingCasts-5.test",
+ "Constraints/casts.swift",
+ "Driver/response-file.swift",
+ "Generics/validate_stdlib_generic_signatures.swift",
+ "IDE/complete_ambiguous.swift",
+ "IDE/complete_operators.swift",
+ "IDE/complete_unresolved_members.swift",
+ "IDE/complete_value_expr.swift",
+ "Interpreter/dynamic_replacement.swift",
+ "Interpreter/multi_payload_extra_inhabitant.swift",
+ "IRGen/pre_specialize.swift",
+ "Prototypes/DoubleWidth.swift.gyb",
+ "Python/build_swift.swift",
+ "Sema/type_checker_perf/slow/rdar19612086.swift",
+ "Sema/type_checker_perf/slow/rdar32998180.swift",
+ "stdlib/CharacterPropertiesLong.swift",
+ "stdlib/FixedPoint.swift.gyb",
+ "stdlib/NumericParsing.swift.gyb",
+ "stdlib/UnicodeTrieGenerator.gyb",
+ "Syntax/round_trip_stdlib.swift"
+}
+
# Find the resource directory. Assume it's near the swift compiler if not set.
test_resource_dir = lit_config.params.get('test_resource_dir')
if test_resource_dir: