diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-06-10 13:44:32 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-06-10 13:44:32 +0000 |
commit | 7edd24de96f22ad70fd3ca16a3c51723383cd58b (patch) | |
tree | 1bd9c96401fc2098358ab3ab9f14255e2eabd1ac /test/asan | |
parent | 25091d6bd042c6bf2709eaab2bd1a88f3f2d9fda (diff) | |
download | src-7edd24de96f22ad70fd3ca16a3c51723383cd58b.tar.gz src-7edd24de96f22ad70fd3ca16a3c51723383cd58b.zip |
Vendor import of compiler-rt trunk r305145:vendor/compiler-rt/compiler-rt-trunk-r305145
Notes
Notes:
svn path=/vendor/compiler-rt/dist/; revision=319784
svn path=/vendor/compiler-rt/compiler-rt-trunk-r305145/; revision=319785; tag=vendor/compiler-rt/compiler-rt-trunk-r305145
Diffstat (limited to 'test/asan')
-rw-r--r-- | test/asan/TestCases/Darwin/atos-symbolizer.cc | 2 | ||||
-rw-r--r-- | test/asan/TestCases/Linux/asan_preload_test-3.cc | 33 | ||||
-rw-r--r-- | test/asan/TestCases/Posix/halt_on_error-torture.cc | 6 |
3 files changed, 37 insertions, 4 deletions
diff --git a/test/asan/TestCases/Darwin/atos-symbolizer.cc b/test/asan/TestCases/Darwin/atos-symbolizer.cc index 7b091c4d681c..e7d7e7a17fb7 100644 --- a/test/asan/TestCases/Darwin/atos-symbolizer.cc +++ b/test/asan/TestCases/Darwin/atos-symbolizer.cc @@ -4,7 +4,7 @@ // RUN: %env_asan_opts=verbosity=2 ASAN_SYMBOLIZER_PATH=$(which atos) not %run %t 2>&1 | FileCheck %s // Path returned by `which atos` is invalid on iOS. -// UNSUPPORTED: ios +// UNSUPPORTED: ios, i386-darwin #include <stdlib.h> #include <string.h> diff --git a/test/asan/TestCases/Linux/asan_preload_test-3.cc b/test/asan/TestCases/Linux/asan_preload_test-3.cc new file mode 100644 index 000000000000..041669b56a45 --- /dev/null +++ b/test/asan/TestCases/Linux/asan_preload_test-3.cc @@ -0,0 +1,33 @@ +// Regression test for PR33206 +// +// RUN: %clang -DDYN=1 -DMALLOC=1 -fPIC -shared %s -o %t-dso1.so +// RUN: %clang -DDYN=1 -DMALLOC=1 -fPIC -shared %s -o %t-dso2.so %t-dso1.so +// RUN: %clang %s -o %t-1 %t-dso2.so +// RUN: env LD_PRELOAD=%shared_libasan %run %t-1 2>&1 | FileCheck %s +// RUN: %clang -DDYN=1 -DREALLOC=1 -fPIC -shared %s -o %t-dso3.so +// RUN: %clang -DDYN=1 -DREALLOC=1 -fPIC -shared %s -o %t-dso4.so %t-dso3.so +// RUN: %clang %s -o %t-2 %t-dso4.so +// RUN: env LD_PRELOAD=%shared_libasan %run %t-2 2>&1 | FileCheck %s +// REQUIRES: asan-dynamic-runtime + +#include <stdlib.h> +#include <stdio.h> + +#ifdef DYN +__attribute__((constructor)) void foo() { + void *p; +#ifdef MALLOC + p = malloc(1 << 20); +#endif +#ifdef REALLOC + p = realloc (0, 1 << 20); +#endif + free(p); +} +#else +int main() { + // CHECK: Success + printf("Success\n"); + return 0; +} +#endif diff --git a/test/asan/TestCases/Posix/halt_on_error-torture.cc b/test/asan/TestCases/Posix/halt_on_error-torture.cc index 1b26173d713f..829568e2682b 100644 --- a/test/asan/TestCases/Posix/halt_on_error-torture.cc +++ b/test/asan/TestCases/Posix/halt_on_error-torture.cc @@ -10,12 +10,12 @@ // // Collisions are unlikely but still possible so we need the ||. // RUN: rm -f 10.txt -// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false %run %t 10 20 >>10.txt 2>&1 || true +// RUN: %env_asan_opts=halt_on_error=false:suppress_equal_pcs=false:exitcode=0 %run %t 10 20 2>&1 | cat > 10.txt // RUN: FileCheck --check-prefix=CHECK-COLLISION %s < 10.txt || FileCheck --check-prefix=CHECK-NO-COLLISION %s < 10.txt // // Collisions are unlikely but still possible so we need the ||. // RUN: rm -f 20.txt -// RUN: %env_asan_opts=halt_on_error=false %run %t 10 20 >>20.txt 2>&1 || true +// RUN: %env_asan_opts=halt_on_error=false:exitcode=0 %run %t 10 20 2>&1 | cat > 20.txt // RUN: FileCheck --check-prefix=CHECK-COLLISION %s < 20.txt || FileCheck --check-prefix=CHECK-NO-COLLISION %s < 20.txt #include <stdio.h> @@ -38,7 +38,7 @@ void *run(void *arg) { unsigned seed = (unsigned)(size_t)arg; volatile char tmp[2]; - __asan_poison_memory_region(&tmp, sizeof(tmp)); + __asan_poison_memory_region(&tmp, sizeof(tmp)); for (size_t i = 0; i < niter; ++i) { random_delay(&seed); |