aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2013-08-09 00:08:56 +0000
committerDaniel Dunbar <daniel@zuster.org>2013-08-09 00:08:56 +0000
commitb963b0b51a38f6f560edf6210bc8fbba47f2abf6 (patch)
tree32c80ad112793c678baede0dc6c8f4752b8c54f6
parent5d8ab529c23cb621b5781d4a2edf49e2d3774d22 (diff)
downloadllvm-b963b0b51a38f6f560edf6210bc8fbba47f2abf6.zip
llvm-b963b0b51a38f6f560edf6210bc8fbba47f2abf6.tar.gz
llvm-b963b0b51a38f6f560edf6210bc8fbba47f2abf6.tar.bz2
[lit] Only create config copies when a local config file is present.
llvm-svn: 188033
-rw-r--r--llvm/utils/lit/lit/TestingConfig.py4
-rw-r--r--llvm/utils/lit/lit/discovery.py13
2 files changed, 12 insertions, 5 deletions
diff --git a/llvm/utils/lit/lit/TestingConfig.py b/llvm/utils/lit/lit/TestingConfig.py
index 6df84b6..ec15f38 100644
--- a/llvm/utils/lit/lit/TestingConfig.py
+++ b/llvm/utils/lit/lit/TestingConfig.py
@@ -9,7 +9,7 @@ class TestingConfig:
"""
@staticmethod
- def frompath(path, config, litConfig, mustExist):
+ def frompath(path, config, litConfig, mustExist=True):
"""
frompath(path, config, litConfig, mustExist) -> TestingConfig
@@ -112,7 +112,7 @@ class TestingConfig:
self.available_features = set(available_features)
self.pipefail = pipefail
- def clone(self, path):
+ def clone(self):
# FIXME: Chain implementations?
#
# FIXME: Allow extra parameters?
diff --git a/llvm/utils/lit/lit/discovery.py b/llvm/utils/lit/lit/discovery.py
index 35b29c6..afcee58 100644
--- a/llvm/utils/lit/lit/discovery.py
+++ b/llvm/utils/lit/lit/discovery.py
@@ -78,13 +78,20 @@ def getLocalConfig(ts, path_in_suite, litConfig, cache):
else:
parent = search(path_in_suite[:-1])
- # Load the local configuration.
+ # Check if there is a local configuration file.
source_path = ts.getSourcePath(path_in_suite)
cfgpath = os.path.join(source_path, litConfig.local_config_name)
+
+ # If not, just reuse the parent config.
+ if not os.path.exists(cfgpath):
+ return parent
+
+ # Otherwise, copy the current config and load the local configuration
+ # file into it.
+ config = parent.clone()
if litConfig.debug:
litConfig.note('loading local config %r' % cfgpath)
- return TestingConfig.frompath(cfgpath, parent.clone(cfgpath), litConfig,
- mustExist = False)
+ return TestingConfig.frompath(cfgpath, config, litConfig)
def search(path_in_suite):
key = (ts, path_in_suite)