[libcxx] r237700 - Add compiler flag test support to LIT. Fix new/delete tests on apple-clang.

Eric Fiselier eric at efcs.ca
Tue May 19 08:15:55 PDT 2015


Author: ericwf
Date: Tue May 19 10:15:53 2015
New Revision: 237700

URL: http://llvm.org/viewvc/llvm-project?rev=237700&view=rev
Log:
Add compiler flag test support to LIT. Fix new/delete tests on apple-clang.

Modified:
    libcxx/trunk/test/libcxx/compiler.py
    libcxx/trunk/test/libcxx/test/config.py
    libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
    libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp

Modified: libcxx/trunk/test/libcxx/compiler.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/compiler.py?rev=237700&r1=237699&r2=237700&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/compiler.py (original)
+++ libcxx/trunk/test/libcxx/compiler.py Tue May 19 10:15:53 2015
@@ -137,3 +137,13 @@ class CXXCompiler(object):
     def getTriple(self):
         cmd = [self.path] + self.flags + ['-dumpmachine']
         return lit.util.capture(cmd).strip()
+
+    def hasCompileFlag(self, flag):
+        flags = [flag]
+        # Add -Werror to ensure that an unrecognized flag causes a non-zero
+        # exit code. -Werror is supported on all known compiler types.
+        if self.type is not None:
+            flags += ['-Werror']
+        cmd, out, err, rc = self.compile(os.devnull, out=os.devnull,
+                                         flags=flags)
+        return rc == 0

Modified: libcxx/trunk/test/libcxx/test/config.py
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/test/config.py?rev=237700&r1=237699&r2=237700&view=diff
==============================================================================
--- libcxx/trunk/test/libcxx/test/config.py (original)
+++ libcxx/trunk/test/libcxx/test/config.py Tue May 19 10:15:53 2015
@@ -325,6 +325,11 @@ class Configuration(object):
         if self.long_tests:
             self.config.available_features.add('long_tests')
 
+        # Run a compile test for the -fsized-deallocation flag. This is needed
+        # in test/std/language.support/support.dynamic/new.delete
+        if self.cxx.hasCompileFlag('-fsized-deallocation'):
+            self.config.available_features.add('fsized-deallocation')
+
     def configure_compile_flags(self):
         no_default_flags = self.get_lit_bool('no_default_flags', False)
         if not no_default_flags:
@@ -530,7 +535,15 @@ class Configuration(object):
         if use_color != '':
             self.lit_config.fatal('Invalid value for color_diagnostics "%s".'
                                   % use_color)
-        self.cxx.flags += ['-fdiagnostics-color=always']
+        color_flag = '-fdiagnostics-color=always'
+        # Check if the compiler support the color diagnostics flag. Issue a
+        # warning if it does not since color diagnostics have been requested.
+        if not self.cxx.hasCompileFlag(color_flag):
+            self.lit_config.warning(
+                'color diagnostics have been requested but are not supported '
+                'by the compiler')
+        else:
+            self.cxx.flags += [color_flag]
 
     def configure_debug_mode(self):
         debug_level = self.get_lit_conf('debug_level', None)

Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp?rev=237700&r1=237699&r2=237700&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp Tue May 19 10:15:53 2015
@@ -14,11 +14,8 @@
 
 // UNSUPPORTED: sanitizer-new-delete
 
-// NOTE: -fsized-deallocation was only added in clang 3.7
-// XFAIL: clang-3.4, clang-3.5, clang-3.6
-
-// NOTE: -fsized-deallocation was only added to GCC in 5.1.
-// XFAIL: gcc-4.7, gcc-4.8, gcc-4.9
+// NOTE: Require that the compiler supports the -fsized-deallocation flag.
+// REQUIRES: fsized-deallocation
 
 // RUN: %build -fsized-deallocation
 // RUN: %run

Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp?rev=237700&r1=237699&r2=237700&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp Tue May 19 10:15:53 2015
@@ -14,11 +14,8 @@
 
 // UNSUPPORTED: sanitizer-new-delete
 
-// NOTE: -fsized-deallocation was only added in clang 3.7
-// XFAIL: clang-3.4, clang-3.5, clang-3.6
-
-// NOTE: -fsized-deallocation was only added to GCC in 5.1.
-// XFAIL: gcc-4.7, gcc-4.8, gcc-4.9
+// NOTE: Require that the compiler supports the -fsized-deallocation flag.
+// REQUIRES: fsized-deallocation
 
 // RUN: %build -fsized-deallocation
 // RUN: %run





More information about the cfe-commits mailing list