summaryrefslogtreecommitdiffstats
path: root/llvm/utils/lit
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-09-15 22:10:46 +0000
committerZachary Turner <zturner@google.com>2017-09-15 22:10:46 +0000
commitce92db13ead9a24c767d60375545fa6ad6cb8ce0 (patch)
treefb503ae2b3c9ce191091cdfd88ceb73ac4c9ff72 /llvm/utils/lit
parentbcd78491ef22754d15ea4dddea2425e0e673baf9 (diff)
downloadbcm5719-llvm-ce92db13ead9a24c767d60375545fa6ad6cb8ce0.tar.gz
bcm5719-llvm-ce92db13ead9a24c767d60375545fa6ad6cb8ce0.zip
Resubmit "[lit] Force site configs to run before source-tree configs"
This is a resubmission of r313270. It broke standalone builds of compiler-rt because we were not correctly generating the llvm-lit script in the standalone build directory. The fixes incorporated here attempt to find llvm/utils/llvm-lit from the source tree returned by llvm-config. If present, it will generate llvm-lit into the output directory. Regardless, the user can specify -DLLVM_EXTERNAL_LIT to point to a specific lit.py on their file system. This supports the use case of someone installing lit via a package manager. If it cannot find a source tree, and -DLLVM_EXTERNAL_LIT is either unspecified or invalid, then we print a warning that tests will not be able to run. Differential Revision: https://reviews.llvm.org/D37756 llvm-svn: 313407
Diffstat (limited to 'llvm/utils/lit')
-rw-r--r--llvm/utils/lit/lit/discovery.py16
-rw-r--r--llvm/utils/lit/tests/lit.cfg5
2 files changed, 17 insertions, 4 deletions
diff --git a/llvm/utils/lit/lit/discovery.py b/llvm/utils/lit/lit/discovery.py
index 8876dcba8f2..3b5d0517cff 100644
--- a/llvm/utils/lit/lit/discovery.py
+++ b/llvm/utils/lit/lit/discovery.py
@@ -40,6 +40,20 @@ def getTestSuite(item, litConfig, cache):
ts, relative = search(parent)
return (ts, relative + (base,))
+ # This is a private builtin parameter which can be used to perform
+ # translation of configuration paths. Specifically, this parameter
+ # can be set to a dictionary that the discovery process will consult
+ # when it finds a configuration it is about to load. If the given
+ # path is in the map, the value of that key is a path to the
+ # configuration to load instead.
+ config_map = litConfig.params.get('config_map')
+ if config_map:
+ cfgpath = os.path.normpath(cfgpath)
+ cfgpath = os.path.normcase(cfgpath)
+ target = config_map.get(cfgpath)
+ if target:
+ cfgpath = target
+
# We found a test suite, create a new config for it and load it.
if litConfig.debug:
litConfig.note('loading suite config %r' % cfgpath)
@@ -212,7 +226,7 @@ def find_tests_for_inputs(lit_config, inputs):
f.close()
else:
actual_inputs.append(input)
-
+
# Load the tests from the inputs.
tests = []
test_suite_cache = {}
diff --git a/llvm/utils/lit/tests/lit.cfg b/llvm/utils/lit/tests/lit.cfg
index 0c98299285a..f2ecaa6d417 100644
--- a/llvm/utils/lit/tests/lit.cfg
+++ b/llvm/utils/lit/tests/lit.cfg
@@ -65,7 +65,6 @@ if sys.platform.startswith('win') or sys.platform.startswith('cygwin'):
config.available_features.add('windows')
# Add llvm tools directory if this config is being loaded indirectly
-llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
-if llvm_tools_dir != None:
- path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
+if config.llvm_tools_dir is not None:
+ path = os.path.pathsep.join((config.llvm_tools_dir, config.environment['PATH']))
config.environment['PATH'] = path
OpenPOWER on IntegriCloud