summaryrefslogtreecommitdiff
path: root/test/asan
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2016-07-22 18:41:22 +0000
committerReid Kleckner <rnk@google.com>2016-07-22 18:41:22 +0000
commit29ebba12cf19d91edbf78acd09ae97ae1a65f180 (patch)
treeb06caa05368716f77de4d5c208b41f1d16972770 /test/asan
parent1f1a9f3d249713817cd953848ce8b892d763c1be (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/asan')
-rw-r--r--test/asan/TestCases/use-after-scope-capture.cc2
-rw-r--r--test/asan/TestCases/use-after-scope-types.cc4
-rw-r--r--test/asan/lit.cfg8
3 files changed, 11 insertions, 3 deletions
diff --git a/test/asan/TestCases/use-after-scope-capture.cc b/test/asan/TestCases/use-after-scope-capture.cc
index 07aab672e..113ce3536 100644
--- a/test/asan/TestCases/use-after-scope-capture.cc
+++ b/test/asan/TestCases/use-after-scope-capture.cc
@@ -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>
diff --git a/test/asan/TestCases/use-after-scope-types.cc b/test/asan/TestCases/use-after-scope-types.cc
index 93049ffd8..b21368164 100644
--- a/test/asan/TestCases/use-after-scope-types.cc
+++ b/test/asan/TestCases/use-after-scope-types.cc
@@ -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'
}
diff --git a/test/asan/lit.cfg b/test/asan/lit.cfg
index 894c3f859..f2c0c872e 100644
--- a/test/asan/lit.cfg
+++ b/test/asan/lit.cfg
@@ -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")