[llvm] r188033 - [lit] Only create config copies when a local config file is present.

Daniel Dunbar daniel at zuster.org
Thu Aug 8 17:08:57 PDT 2013


Author: ddunbar
Date: Thu Aug  8 19:08:56 2013
New Revision: 188033

URL: http://llvm.org/viewvc/llvm-project?rev=188033&view=rev
Log:
[lit] Only create config copies when a local config file is present.

Modified:
    llvm/trunk/utils/lit/lit/TestingConfig.py
    llvm/trunk/utils/lit/lit/discovery.py

Modified: llvm/trunk/utils/lit/lit/TestingConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestingConfig.py?rev=188033&r1=188032&r2=188033&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestingConfig.py (original)
+++ llvm/trunk/utils/lit/lit/TestingConfig.py Thu Aug  8 19:08:56 2013
@@ -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?

Modified: llvm/trunk/utils/lit/lit/discovery.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/discovery.py?rev=188033&r1=188032&r2=188033&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/discovery.py (original)
+++ llvm/trunk/utils/lit/lit/discovery.py Thu Aug  8 19:08:56 2013
@@ -78,13 +78,20 @@ def getLocalConfig(ts, path_in_suite, li
         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)





More information about the llvm-commits mailing list