[llvm] r189885 - [lit] Allow config files to pass arbitrary values to child configs.
Daniel Dunbar
daniel at zuster.org
Tue Sep 3 16:32:56 PDT 2013
Author: ddunbar
Date: Tue Sep 3 18:32:55 2013
New Revision: 189885
URL: http://llvm.org/viewvc/llvm-project?rev=189885&view=rev
Log:
[lit] Allow config files to pass arbitrary values to child configs.
- This aligns with how existing test suites end up wanting to use the local
config files, conceptually it makes sense to consider them to be inherited.
Modified:
llvm/trunk/utils/lit/lit/TestingConfig.py
llvm/trunk/utils/lit/lit/discovery.py
llvm/trunk/utils/lit/tests/Inputs/discovery/lit.cfg
llvm/trunk/utils/lit/tests/Inputs/discovery/subdir/lit.local.cfg
Modified: llvm/trunk/utils/lit/lit/TestingConfig.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/TestingConfig.py?rev=189885&r1=189884&r2=189885&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/TestingConfig.py (original)
+++ llvm/trunk/utils/lit/lit/TestingConfig.py Tue Sep 3 18:32:55 2013
@@ -114,17 +114,6 @@ class TestingConfig:
self.available_features = set(available_features)
self.pipefail = pipefail
- def clone(self):
- # FIXME: Chain implementations?
- #
- # FIXME: Allow extra parameters?
- return TestingConfig(self, self.name, self.suffixes, self.test_format,
- self.environment, self.substitutions,
- self.unsupported,
- self.test_exec_root, self.test_source_root,
- self.excludes, self.available_features,
- self.pipefail)
-
def finish(self, litConfig):
"""finish() - Finish this config object, after loading is complete."""
Modified: llvm/trunk/utils/lit/lit/discovery.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/discovery.py?rev=189885&r1=189884&r2=189885&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/discovery.py (original)
+++ llvm/trunk/utils/lit/lit/discovery.py Tue Sep 3 18:32:55 2013
@@ -2,6 +2,7 @@
Test discovery functions.
"""
+import copy
import os
import sys
@@ -90,7 +91,7 @@ def getLocalConfig(ts, path_in_suite, li
# Otherwise, copy the current config and load the local configuration
# file into it.
- config = parent.clone()
+ config = copy.copy(parent)
if litConfig.debug:
litConfig.note('loading local config %r' % cfgpath)
config.load_from_path(cfgpath, litConfig)
Modified: llvm/trunk/utils/lit/tests/Inputs/discovery/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/discovery/lit.cfg?rev=189885&r1=189884&r2=189885&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/discovery/lit.cfg (original)
+++ llvm/trunk/utils/lit/tests/Inputs/discovery/lit.cfg Tue Sep 3 18:32:55 2013
@@ -9,3 +9,6 @@ config.test_format = lit.formats.ShTest(
#
#config.test_source_root = None
#config.test_exec_root = None
+
+# Check that arbitrary config values are copied (tested by subdir/lit.local.cfg).
+config.an_extra_variable = False
Modified: llvm/trunk/utils/lit/tests/Inputs/discovery/subdir/lit.local.cfg
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/tests/Inputs/discovery/subdir/lit.local.cfg?rev=189885&r1=189884&r2=189885&view=diff
==============================================================================
--- llvm/trunk/utils/lit/tests/Inputs/discovery/subdir/lit.local.cfg (original)
+++ llvm/trunk/utils/lit/tests/Inputs/discovery/subdir/lit.local.cfg Tue Sep 3 18:32:55 2013
@@ -1 +1,4 @@
config.suffixes = ['.py']
+
+# Check that the arbitrary config values in our parent was inherited.
+assert hasattr(config, 'an_extra_variable')
More information about the llvm-commits
mailing list