Add support to lit for build mode requirements. e.g.
authorAndrew Trick <atrick@apple.com>
Thu, 16 Jun 2011 01:33:35 +0000 (01:33 +0000)
committerAndrew Trick <atrick@apple.com>
Thu, 16 Jun 2011 01:33:35 +0000 (01:33 +0000)
REQUIRES: Asserts
REQUIRES: Debug

This required chaining test configuration properties. It seems like a
generally good thing to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133131 91177308-0d34-0410-b5e6-96231b3b80d8

test/Makefile
test/lit.site.cfg.in
utils/lit/lit/TestRunner.py
utils/lit/lit/TestingConfig.py

index 0d84186b1e871765900802e81285e7e5c19dc5c3..e38226a468dd9fd7577e9caa2a8d9cdee690d603 100644 (file)
@@ -176,6 +176,7 @@ lit.site.cfg: site.exp
        @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > lit.tmp
        @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp
        @$(ECHOPATH) s=@LLVM_TOOLS_DIR@=$(ToolDir)=g >> lit.tmp
+       @$(ECHOPATH) s=@LLVM_BUILD_MODE@=$(BuildMode)=g >> lit.tmp
        @$(ECHOPATH) s=@LLVMGCCDIR@=$(LLVMGCCDIR)=g >> lit.tmp
        @$(ECHOPATH) s=@PYTHON_EXECUTABLE@=python=g >> lit.tmp
        @$(ECHOPATH) s=@ENABLE_SHARED@=$(ENABLE_SHARED)=g >> lit.tmp
index 3588aa6245d7e7b2513a34f425708755ff2235d9..5931a1c961da868ff96f33ada4308f686bc78f83 100644 (file)
@@ -4,7 +4,7 @@ config.llvm_src_root = "@LLVM_SOURCE_DIR@"
 config.llvm_obj_root = "@LLVM_BINARY_DIR@"
 config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
 config.llvmgcc_dir = "@LLVMGCCDIR@"
-config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
+config.llvm_build_modes = "@LLVM_BUILD_MODE@".split('+')
 config.python_executable = "@PYTHON_EXECUTABLE@"
 config.enable_shared = @ENABLE_SHARED@
 
index 80d0ba118399a2a85775356488fefce78978086a..83603cc798970a95f3f15cc42315aae8cb975bdd 100644 (file)
@@ -473,9 +473,11 @@ def parseIntegratedTestScript(test, normalize_slashes=False):
     if script[-1][-1] == '\\':
         return (Test.UNRESOLVED, "Test has unterminated run lines (with '\\')")
 
-    # Check that we have the required features:
+    # Check that we have the required features or build modes:
     missing_required_features = [f for f in requires
-                                 if f not in test.config.available_features]
+                                 if f not in test.config.available_features
+                                 and f not in test.config.llvm_build_modes]
+
     if missing_required_features:
         msg = ', '.join(missing_required_features)
         return (Test.UNSUPPORTED,
index 25bb3417de43eb21fd178659f9dcedda5cedbf49..2d8d3d0165ffa44e4c0b141ab4d8635881a353d4 100644 (file)
@@ -74,6 +74,7 @@ class TestingConfig:
 
     def clone(self, path):
         # FIXME: Chain implementations?
+        # See attribute chaining in finish()
         #
         # FIXME: Allow extra parameters?
         cfg = TestingConfig(self, self.name, self.suffixes, self.test_format,
@@ -101,3 +102,9 @@ class TestingConfig:
             # files. Should we distinguish them?
             self.test_source_root = str(self.test_source_root)
         self.excludes = set(self.excludes)
+
+        # chain attributes by copying them
+        if self.parent:
+            for k,v in vars(self.parent).items():
+                if not hasattr(self, k):
+                    setattr(self, k, v)