summaryrefslogtreecommitdiff
path: root/utils
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
commit3279653eb85d2f09175f6a2deb0a12b93fed9ecf (patch)
treeceba43c22630a3483def9048ad10f2dd46c34b21 /utils
parentb3c0c58ca4ecd21566899b369eb70742e44cc8ea (diff)
downloadllvm-3279653eb85d2f09175f6a2deb0a12b93fed9ecf.tar.gz
llvm-3279653eb85d2f09175f6a2deb0a12b93fed9ecf.tar.bz2
llvm-3279653eb85d2f09175f6a2deb0a12b93fed9ecf.tar.xz
[lit] Only create config copies when a local config file is present.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/lit/lit/TestingConfig.py4
-rw-r--r--utils/lit/lit/discovery.py13
2 files changed, 12 insertions, 5 deletions
diff --git a/utils/lit/lit/TestingConfig.py b/utils/lit/lit/TestingConfig.py
index 6df84b6815..ec15f38fc9 100644
--- a/utils/lit/lit/TestingConfig.py
+++ b/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/utils/lit/lit/discovery.py b/utils/lit/lit/discovery.py
index 35b29c62d5..afcee58fba 100644
--- a/utils/lit/lit/discovery.py
+++ b/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)