summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/libcxx/compiler.py10
-rw-r--r--libcxx/test/libcxx/test/config.py15
-rw-r--r--libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp7
-rw-r--r--libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp7
4 files changed, 28 insertions, 11 deletions
diff --git a/libcxx/test/libcxx/compiler.py b/libcxx/test/libcxx/compiler.py
index 995d61d58af..fa5fdcdd9c3 100644
--- a/libcxx/test/libcxx/compiler.py
+++ b/libcxx/test/libcxx/compiler.py
@@ -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
diff --git a/libcxx/test/libcxx/test/config.py b/libcxx/test/libcxx/test/config.py
index c1f7489b5d7..a0bd1ea5e8e 100644
--- a/libcxx/test/libcxx/test/config.py
+++ b/libcxx/test/libcxx/test/config.py
@@ -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)
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
index ba500b511cf..b80c36af723 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array_fsizeddeallocation.sh.cpp
@@ -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
diff --git a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
index b3de907170a..223d75a9e92 100644
--- a/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
+++ b/libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete_fsizeddeallocation.sh.cpp
@@ -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
OpenPOWER on IntegriCloud