[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
This commit is contained in:
Daniel Dunbar 2013-08-09 00:08:56 +00:00
parent b3c0c58ca4
commit 3279653eb8
2 changed files with 12 additions and 5 deletions

View File

@ -9,7 +9,7 @@ class TestingConfig:
""" """
@staticmethod @staticmethod
def frompath(path, config, litConfig, mustExist): def frompath(path, config, litConfig, mustExist=True):
""" """
frompath(path, config, litConfig, mustExist) -> TestingConfig frompath(path, config, litConfig, mustExist) -> TestingConfig
@ -112,7 +112,7 @@ class TestingConfig:
self.available_features = set(available_features) self.available_features = set(available_features)
self.pipefail = pipefail self.pipefail = pipefail
def clone(self, path): def clone(self):
# FIXME: Chain implementations? # FIXME: Chain implementations?
# #
# FIXME: Allow extra parameters? # FIXME: Allow extra parameters?

View File

@ -78,13 +78,20 @@ def getLocalConfig(ts, path_in_suite, litConfig, cache):
else: else:
parent = search(path_in_suite[:-1]) 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) source_path = ts.getSourcePath(path_in_suite)
cfgpath = os.path.join(source_path, litConfig.local_config_name) 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: if litConfig.debug:
litConfig.note('loading local config %r' % cfgpath) litConfig.note('loading local config %r' % cfgpath)
return TestingConfig.frompath(cfgpath, parent.clone(cfgpath), litConfig, return TestingConfig.frompath(cfgpath, config, litConfig)
mustExist = False)
def search(path_in_suite): def search(path_in_suite):
key = (ts, path_in_suite) key = (ts, path_in_suite)