r300392 - Do not run tests for crash recovery if libstdc++ safe mode is enabled

Serge Pavlov via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 14 22:53:50 PDT 2017


Author: sepavloff
Date: Sat Apr 15 00:53:49 2017
New Revision: 300392

URL: http://llvm.org/viewvc/llvm-project?rev=300392&view=rev
Log:
Do not run tests for crash recovery if libstdc++ safe mode is enabled

If expensive checks are enabled, safe mode of libstdc++ is enabled too.
In this mode the library uses more complex data that allow additional
checks, for instance, a container may keep list of iterators that points
to it. If a code crashes it can leave these complex library objects in
inconsistent state. It occurs in a few tests that check error recovery
if compiler crashes. These test hang in expensive check mode, as the
library tries to synchronize access to the iterators pointing to some
container, but corresponding mutex remains locked after the crash.

This fix marks these tests as unsupported if clang is built with
libstdc++ safe mode enabled.

Differential Revision: https://reviews.llvm.org/D31126

Modified:
    cfe/trunk/test/Index/crash-recovery-code-complete.c
    cfe/trunk/test/Index/crash-recovery-modules.m
    cfe/trunk/test/Index/crash-recovery-reparse.c
    cfe/trunk/test/Index/crash-recovery.c
    cfe/trunk/test/lit.cfg

Modified: cfe/trunk/test/Index/crash-recovery-code-complete.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/crash-recovery-code-complete.c?rev=300392&r1=300391&r2=300392&view=diff
==============================================================================
--- cfe/trunk/test/Index/crash-recovery-code-complete.c (original)
+++ cfe/trunk/test/Index/crash-recovery-code-complete.c Sat Apr 15 00:53:49 2017
@@ -10,5 +10,6 @@
 
 // FIXME: Please investigate abnormal path in MemoryBuffer.
 // REQUIRES: can-remove-opened-file
+// UNSUPPORTED: libstdcxx-safe-mode
 
 #warning parsing original file

Modified: cfe/trunk/test/Index/crash-recovery-modules.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/crash-recovery-modules.m?rev=300392&r1=300391&r2=300392&view=diff
==============================================================================
--- cfe/trunk/test/Index/crash-recovery-modules.m (original)
+++ cfe/trunk/test/Index/crash-recovery-modules.m Sat Apr 15 00:53:49 2017
@@ -4,7 +4,7 @@
 // Parse the file, such that building the module will cause Clang to crash.
 // RUN: not env CINDEXTEST_FAILONERROR=1 c-index-test -test-load-source all -fmodules -fmodules-cache-path=%t -Xclang -fdisable-module-hash -I %S/Inputs/Headers -DCRASH %s > /dev/null 2> %t.err
 // RUN: FileCheck < %t.err -check-prefix=CHECK-CRASH %s
-// CHECK-CRASH: crash-recovery-modules.m:16:9:{16:2-16:14}: fatal error: could not build module 'Crash'
+// CHECK-CRASH: crash-recovery-modules.m:17:9:{17:2-17:14}: fatal error: could not build module 'Crash'
 
 // Parse the file again, without crashing, to make sure that
 // subsequent parses do the right thing.
@@ -12,6 +12,7 @@
 
 // REQUIRES: crash-recovery
 // REQUIRES: shell
+// UNSUPPORTED: libstdcxx-safe-mode
 
 @import Crash;
 

Modified: cfe/trunk/test/Index/crash-recovery-reparse.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/crash-recovery-reparse.c?rev=300392&r1=300391&r2=300392&view=diff
==============================================================================
--- cfe/trunk/test/Index/crash-recovery-reparse.c (original)
+++ cfe/trunk/test/Index/crash-recovery-reparse.c Sat Apr 15 00:53:49 2017
@@ -7,5 +7,6 @@
 // CHECK-REPARSE-SOURCE-CRASH: Unable to reparse translation unit
 //
 // REQUIRES: crash-recovery
+// UNSUPPORTED: libstdcxx-safe-mode
 
 #warning parsing original file

Modified: cfe/trunk/test/Index/crash-recovery.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/crash-recovery.c?rev=300392&r1=300391&r2=300392&view=diff
==============================================================================
--- cfe/trunk/test/Index/crash-recovery.c (original)
+++ cfe/trunk/test/Index/crash-recovery.c Sat Apr 15 00:53:49 2017
@@ -4,5 +4,6 @@
 // RUN: env LIBCLANG_DISABLE_CRASH_RECOVERY=1 not --crash c-index-test -test-load-source all %s
 //
 // REQUIRES: crash-recovery
+// UNSUPPORTED: libstdcxx-safe-mode
 
 #pragma clang __debug crash

Modified: cfe/trunk/test/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/lit.cfg?rev=300392&r1=300391&r2=300392&view=diff
==============================================================================
--- cfe/trunk/test/lit.cfg (original)
+++ cfe/trunk/test/lit.cfg Sat Apr 15 00:53:49 2017
@@ -440,7 +440,8 @@ if not re.match(r'.*-(cygwin)$', config.
 if platform.system() not in ['Windows']:
     config.available_features.add('can-remove-opened-file')
 
-# Returns set of available features, registered-target(s) and asserts.
+# Returns set of available features, registered-target(s), asserts and
+# compile definitions.
 def get_llvm_config_props():
     set_of_features = set()
 
@@ -449,6 +450,7 @@ def get_llvm_config_props():
             os.path.join(llvm_tools_dir, 'llvm-config'),
             '--assertion-mode',
             '--targets-built',
+            '--cxxflags'
             ],
         stdout=subprocess.PIPE,
         env=config.environment
@@ -463,6 +465,11 @@ def get_llvm_config_props():
     for arch in cmd.stdout.readline().decode('ascii').split():
         set_of_features.add(arch.lower() + '-registered-target')
 
+    # 3rd line contains compile definitions, search it to define if
+    # libstdc++ safe mode is set.
+    if re.search(r'-D_GLIBCXX_DEBUG\b', cmd.stdout.readline().decode('ascii')):
+        set_of_features.add('libstdcxx-safe-mode')
+
     return set_of_features
 
 config.available_features.update(get_llvm_config_props())




More information about the cfe-commits mailing list