[compiler-rt] r276454 - Try to fix more Windows portability issues in sanitizer tests
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 22 11:41:23 PDT 2016
Author: rnk
Date: Fri Jul 22 13:41:22 2016
New Revision: 276454
URL: http://llvm.org/viewvc/llvm-project?rev=276454&view=rev
Log:
Try to fix more Windows portability issues in sanitizer tests
Add a %stdcxx11 lit substitution for -std=c++11. Windows defaults to
-std=c++14 when VS 2015 is used because the STL requires it. Harcoding
-std=c++11 in the ASan tests actually downgrades the C++ standard level,
leading to test failures.
Relax a FileCheck pattern in use-after-scope-types.cc.
Disable the sanitizer_common OOM tests. They fail on bots with low swap,
and cause other concurrently running tests to OOM.
Modified:
compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
compiler-rt/trunk/test/asan/TestCases/use-after-scope-capture.cc
compiler-rt/trunk/test/asan/TestCases/use-after-scope-types.cc
compiler-rt/trunk/test/asan/lit.cfg
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc?rev=276454&r1=276453&r2=276454&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_allocator_test.cc Fri Jul 22 13:41:22 2016
@@ -335,7 +335,9 @@ void FailInAssertionOnOOM() {
a.TestOnlyUnmap();
}
-#if SANITIZER_CAN_USE_ALLOCATOR64
+// Don't test OOM conditions on Win64 because it causes other tests on the same
+// machine to OOM.
+#if SANITIZER_CAN_USE_ALLOCATOR64 && !SANITIZER_WINDOWS64
TEST(SanitizerCommon, SizeClassAllocator64Overflow) {
EXPECT_DEATH(FailInAssertionOnOOM<Allocator64>(), "Out of memory");
}
@@ -777,7 +779,9 @@ TEST(SanitizerCommon, LargeMmapAllocator
}
-#if SANITIZER_CAN_USE_ALLOCATOR64
+// Don't test OOM conditions on Win64 because it causes other tests on the same
+// machine to OOM.
+#if SANITIZER_CAN_USE_ALLOCATOR64 && !SANITIZER_WINDOWS64
// Regression test for out-of-memory condition in PopulateFreeList().
TEST(SanitizerCommon, SizeClassAllocator64PopulateFreeListOOM) {
// In a world where regions are small and chunks are huge...
Modified: compiler-rt/trunk/test/asan/TestCases/use-after-scope-capture.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/use-after-scope-capture.cc?rev=276454&r1=276453&r2=276454&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/use-after-scope-capture.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/use-after-scope-capture.cc Fri Jul 22 13:41:22 2016
@@ -1,4 +1,4 @@
-// RUN: %clangxx_asan -std=c++11 -O1 -fsanitize-address-use-after-scope %s -o %t && \
+// RUN: %clangxx_asan %stdcxx11 -O1 -fsanitize-address-use-after-scope %s -o %t && \
// RUN: not %run %t 2>&1 | FileCheck %s
#include <functional>
Modified: compiler-rt/trunk/test/asan/TestCases/use-after-scope-types.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/use-after-scope-types.cc?rev=276454&r1=276453&r2=276454&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/use-after-scope-types.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/use-after-scope-types.cc Fri Jul 22 13:41:22 2016
@@ -1,4 +1,4 @@
-// RUN: %clangxx_asan -std=c++11 -O0 -fsanitize-address-use-after-scope %s -o %t
+// RUN: %clangxx_asan %stdcxx11 -O0 -fsanitize-address-use-after-scope %s -o %t
// RUN: %env_asan_opts=detect_stack_use_after_scope=1 not %run %t 0 2>&1 | FileCheck %s
// RUN: %env_asan_opts=detect_stack_use_after_scope=1 not %run %t 1 2>&1 | FileCheck %s
// RUN: %env_asan_opts=detect_stack_use_after_scope=1 not %run %t 2 2>&1 | FileCheck %s
@@ -43,7 +43,7 @@ template <class T> void test() {
ptr.Access();
// CHECK: ERROR: AddressSanitizer: stack-use-after-scope
- // CHECK: #{{[0-9]+}} 0x{{.*}} in void test{{.*}}(){{.*}}use-after-scope-types.cc
+ // CHECK: #{{[0-9]+}} 0x{{.*}} in {{(void )?test.*\((void)?\) .*}}use-after-scope-types.cc
// CHECK: Address 0x{{.*}} is located in stack of thread T{{.*}} at offset [[OFFSET:[^ ]+]] in frame
// {{\[}}[[OFFSET]], {{[0-9]+}}) 'x'
}
Modified: compiler-rt/trunk/test/asan/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/lit.cfg?rev=276454&r1=276453&r2=276454&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/lit.cfg (original)
+++ compiler-rt/trunk/test/asan/lit.cfg Fri Jul 22 13:41:22 2016
@@ -124,6 +124,14 @@ if platform.system() == 'Windows':
config.substitutions.append( ("%asan_cxx_lib", base_lib % "_cxx") )
config.substitutions.append( ("%asan_dll_thunk", base_lib % "_dll_thunk") )
+if platform.system() == 'Windows':
+ # Don't use -std=c++11 on Windows, as the driver will detect the appropriate
+ # default needed to use with the STL.
+ config.substitutions.append(("%stdcxx11 ", ""))
+else:
+ # Some tests uses C++11 features such as lambdas and need to pass -std=c++11.
+ config.substitutions.append(("%stdcxx11 ", "-std=c++11 "))
+
# FIXME: De-hardcode this path.
asan_source_dir = os.path.join(
get_required_attr(config, "compiler_rt_src_root"), "lib", "asan")
More information about the llvm-commits
mailing list