[llvm] r263329 - [lit] Hack lit to allow a test suite to request that it is run "early".
Chandler Carruth via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 11 19:03:31 PST 2016
Author: chandlerc
Date: Fri Mar 11 21:03:31 2016
New Revision: 263329
URL: http://llvm.org/viewvc/llvm-project?rev=263329&view=rev
Log:
[lit] Hack lit to allow a test suite to request that it is run "early".
This lets us for example start running the unit test suite early. For
'check-llvm' on my machine, this drops the tim e from 44s to 32s!!!!!
It's pretty ugly. I barely know how to write Python, so feel free to
just tell me how I should write it instead. =D Thanks to Filipe and
others for help.
Differential Revision: http://reviews.llvm.org/D18089
Modified:
llvm/trunk/test/Unit/lit.cfg
llvm/trunk/utils/lit/lit/Test.py
llvm/trunk/utils/lit/lit/TestingConfig.py
llvm/trunk/utils/lit/lit/main.py
Modified: llvm/trunk/test/Unit/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Unit/lit.cfg?rev=263329&r1=263328&r2=263329&view=diff
==============================================================================
--- llvm/trunk/test/Unit/lit.cfg (original)
+++ llvm/trunk/test/Unit/lit.cfg Fri Mar 11 21:03:31 2016
@@ -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)
Modified: llvm/trunk/utils/lit/lit/Test.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/Test.py?rev=263329&r1=263328&r2=263329&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/Test.py (original)
+++ llvm/trunk/utils/lit/lit/Test.py Fri Mar 11 21:03:31 2016
@@ -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]
Modified: llvm/trunk/utils/lit/lit/TestingConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestingConfig.py?rev=263329&r1=263328&r2=263329&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestingConfig.py (original)
+++ llvm/trunk/utils/lit/lit/TestingConfig.py Fri Mar 11 21:03:31 2016
@@ -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."""
Modified: llvm/trunk/utils/lit/lit/main.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/main.py?rev=263329&r1=263328&r2=263329&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/main.py (original)
+++ llvm/trunk/utils/lit/lit/main.py Fri Mar 11 21:03:31 2016
@@ -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:
More information about the llvm-commits
mailing list