lit support for REQUIRES: asserts.
authorAndrew Trick <atrick@apple.com>
Wed, 22 Jun 2011 23:23:19 +0000 (23:23 +0000)
committerAndrew Trick <atrick@apple.com>
Wed, 22 Jun 2011 23:23:19 +0000 (23:23 +0000)
Take #2. Don't piggyback on the existing config.build_mode. Instead,
define a new lit feature for each build feature we need (currently
just "asserts"). Teach both autoconf'd and cmake'd Makefiles to define
this feature within test/lit.site.cfg. This doesn't require any lit
harness changes and should be more robust across build systems.

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

cmake/modules/HandleLLVMOptions.cmake
test/CodeGen/X86/2011-06-14-PreschedRegalias.ll
test/Makefile
test/lit.cfg
test/lit.site.cfg.in
utils/lit/lit/TestRunner.py
utils/lit/lit/TestingConfig.py

index e72568426178851c449d517be49b9921aa659b6d..d0427acbd5dc0959a03c141ba9e6c615d860dc0e 100644 (file)
@@ -36,13 +36,8 @@ if( LLVM_ENABLE_ASSERTIONS )
   # explicitly undefine it:
   if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
     add_definitions( -UNDEBUG )
-    set(LLVM_BUILD_MODE "Release")
-  else()
-    set(LLVM_BUILD_MODE "Debug")
   endif()
-  set(LLVM_BUILD_MODE "${LLVM_BUILD_MODE}+Asserts")
 else()
-  set(LLVM_BUILD_MODE "Release")
   if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
     if( NOT MSVC_IDE AND NOT XCODE )
       add_definitions( -DNDEBUG )
index 053237596c853c5829435697956054d37a771f91..114b985f71d44268a60de9af2e0da12fcf07cf5d 100644 (file)
@@ -1,5 +1,5 @@
 ; RUN: llc < %s -march=x86-64 -stress-sched | FileCheck %s
-; REQUIRES: Asserts
+; REQUIRES: asserts
 ; Test interference between physreg aliases during preRAsched.
 ; mul wants an operand in AL, but call clobbers it.
 
index e38226a468dd9fd7577e9caa2a8d9cdee690d603..4e34e7222e58fba73aa4de197ed9005801515d05 100644 (file)
@@ -171,15 +171,21 @@ site.exp: FORCE
        @test ! -f site.exp || mv site.exp site.bak
        @mv site.tmp site.exp
 
+ifeq ($(DISABLE_ASSERTIONS),1)
+ENABLE_ASSERTIONS=0
+else
+ENABLE_ASSERTIONS=1
+endif
+
 lit.site.cfg: site.exp
        @echo "Making LLVM 'lit.site.cfg' file..."
        @$(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
+       @$(ECHOPATH) s=@LLVM_ENABLE_ASSERTIONS@=$(ENABLE_ASSERTIONS)=g >> lit.tmp
        @sed -f lit.tmp $(PROJ_SRC_DIR)/lit.site.cfg.in > $@
        @-rm -f lit.tmp
 
index 9a2f74c21c93f368feffef976de0427ef8b97045..ef56473af5874ec7bd4ba98c9e6268bd2a8c8b84 100644 (file)
@@ -306,3 +306,6 @@ else:
 
 if loadable_module:
     config.available_features.add('loadable_module')
+
+if config.enable_assertions:
+    config.available_features.add('asserts')
index a61920f229bc09cc3c71254cbd0cf278ecd820a4..6c33831124a94a62a5a7a6bc74f98f1464e3952d 100644 (file)
@@ -5,9 +5,9 @@ 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@
+config.enable_assertions = @LLVM_ENABLE_ASSERTIONS@
 
 # Support substitution of the tools_dir with user parameters. This is
 # used when we can't determine the tool dir at configuration time.
index 83603cc798970a95f3f15cc42315aae8cb975bdd..80d0ba118399a2a85775356488fefce78978086a 100644 (file)
@@ -473,11 +473,9 @@ 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 or build modes:
+    # Check that we have the required features:
     missing_required_features = [f for f in requires
-                                 if f not in test.config.available_features
-                                 and f not in test.config.llvm_build_modes]
-
+                                 if f not in test.config.available_features]
     if missing_required_features:
         msg = ', '.join(missing_required_features)
         return (Test.UNSUPPORTED,
index 2d8d3d0165ffa44e4c0b141ab4d8635881a353d4..25bb3417de43eb21fd178659f9dcedda5cedbf49 100644 (file)
@@ -74,7 +74,6 @@ 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,
@@ -102,9 +101,3 @@ 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)