diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-05-22 19:43:56 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-05-22 19:43:56 +0000 |
commit | 99ea5e489fa5765bf0eb50ca4261ab5cc20abeeb (patch) | |
tree | 4c90812321bc8c987ef756cc5d05af608f7192a2 /test | |
parent | 834763c1a4849df24fd4f9b466d0c160cf7ed44b (diff) | |
download | src-99ea5e489fa5765bf0eb50ca4261ab5cc20abeeb.tar.gz src-99ea5e489fa5765bf0eb50ca4261ab5cc20abeeb.zip |
Vendor import of compiler-rt trunk r303571:vendor/compiler-rt/compiler-rt-trunk-r303571
Notes
Notes:
svn path=/vendor/compiler-rt/dist/; revision=318667
svn path=/vendor/compiler-rt/compiler-rt-trunk-r303571/; revision=318668; tag=vendor/compiler-rt/compiler-rt-trunk-r303571
Diffstat (limited to 'test')
-rw-r--r-- | test/asan/TestCases/Posix/asan-sigbus.cpp | 2 | ||||
-rw-r--r-- | test/asan/TestCases/Posix/strndup_oob_test.cc | 27 | ||||
-rw-r--r-- | test/msan/strndup.cc | 28 | ||||
-rw-r--r-- | test/xray/TestCases/Linux/custom-event-logging.cc | 2 | ||||
-rw-r--r-- | test/xray/TestCases/Linux/func-id-utils.cc | 16 |
5 files changed, 6 insertions, 69 deletions
diff --git a/test/asan/TestCases/Posix/asan-sigbus.cpp b/test/asan/TestCases/Posix/asan-sigbus.cpp index a7d032acec03..d02ebbd9d8b0 100644 --- a/test/asan/TestCases/Posix/asan-sigbus.cpp +++ b/test/asan/TestCases/Posix/asan-sigbus.cpp @@ -2,7 +2,7 @@ // Defaults to true // RUN: %clangxx_asan -std=c++11 %s -o %t // RUN: not %run %t %T/file 2>&1 | FileCheck %s -check-prefix=CHECK-BUS -// RUN: %env_asan_opts=handle_sigbus=false not --crash %run %t %T/file 2>&1 | FileCheck %s +// RUN: %env_asan_opts=handle_sigbus=0 not --crash %run %t %T/file 2>&1 | FileCheck %s // UNSUPPORTED: ios diff --git a/test/asan/TestCases/Posix/strndup_oob_test.cc b/test/asan/TestCases/Posix/strndup_oob_test.cc deleted file mode 100644 index 7ea0b7a33400..000000000000 --- a/test/asan/TestCases/Posix/strndup_oob_test.cc +++ /dev/null @@ -1,27 +0,0 @@ -// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s -// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s - -// When built as C on Linux, strndup is transformed to __strndup. -// RUN: %clangxx_asan -O3 -xc %s -o %t && not %run %t 2>&1 | FileCheck %s - -// Unwind problem on arm: "main" is missing from the allocation stack trace. -// UNSUPPORTED: win32,s390,armv7l-unknown-linux-gnueabihf - -#include <string.h> - -char kString[] = "foo"; - -int main(int argc, char **argv) { - char *copy = strndup(kString, 2); - int x = copy[2 + argc]; // BOOM - // CHECK: AddressSanitizer: heap-buffer-overflow - // CHECK: #0 {{.*}}main {{.*}}strndup_oob_test.cc:[[@LINE-2]] - // CHECK-LABEL: allocated by thread T{{.*}} here: - // CHECK: #{{[01]}} {{.*}}strndup - // CHECK: #{{.*}}main {{.*}}strndup_oob_test.cc:[[@LINE-6]] - // CHECK-LABEL: SUMMARY - // CHECK: strndup_oob_test.cc:[[@LINE-7]] - return x; -} diff --git a/test/msan/strndup.cc b/test/msan/strndup.cc deleted file mode 100644 index d4b9af1a9a6e..000000000000 --- a/test/msan/strndup.cc +++ /dev/null @@ -1,28 +0,0 @@ -// RUN: %clangxx_msan %s -o %t && not %run %t 2>&1 | FileCheck --check-prefix=ON %s -// RUN: %clangxx_msan %s -o %t && MSAN_OPTIONS=intercept_strndup=0 %run %t 2>&1 | FileCheck --check-prefix=OFF --allow-empty %s - -// When built as C on Linux, strndup is transformed to __strndup. -// RUN: %clangxx_msan -O3 -xc %s -o %t && not %run %t 2>&1 | FileCheck --check-prefix=ON %s - -// UNSUPPORTED: win32 - -#include <assert.h> -#include <stdlib.h> -#include <string.h> -#include <sanitizer/msan_interface.h> - -int main(int argc, char **argv) { - char kString[4] = "abc"; - __msan_poison(kString + 2, 1); - char *copy = strndup(kString, 4); // BOOM - assert(__msan_test_shadow(copy, 4) == 2); // Poisoning is preserved. - free(copy); - return 0; - // ON: Uninitialized bytes in __interceptor_{{(__)?}}strndup at offset 2 inside [{{.*}}, 4) - // ON: MemorySanitizer: use-of-uninitialized-value - // ON: #0 {{.*}}main {{.*}}strndup.cc:[[@LINE-6]] - // ON-LABEL: SUMMARY - // ON: {{.*}}strndup.cc:[[@LINE-8]] - // OFF-NOT: MemorySanitizer -} - diff --git a/test/xray/TestCases/Linux/custom-event-logging.cc b/test/xray/TestCases/Linux/custom-event-logging.cc index b1a766d46045..9bb5d44e1111 100644 --- a/test/xray/TestCases/Linux/custom-event-logging.cc +++ b/test/xray/TestCases/Linux/custom-event-logging.cc @@ -33,7 +33,7 @@ int main() { // CHECK-NEXT: after calling the custom logging... printf("removing custom event handler...\n"); // CHECK-NEXT: removing custom event handler... - __xray_set_customevent_handler(nullptr); + __xray_remove_customevent_handler(); foo(); // CHECK-NEXT: before calling the custom logging... // CHECK-NEXT: after calling the custom logging... diff --git a/test/xray/TestCases/Linux/func-id-utils.cc b/test/xray/TestCases/Linux/func-id-utils.cc index c9a2952c695d..17185c34c01e 100644 --- a/test/xray/TestCases/Linux/func-id-utils.cc +++ b/test/xray/TestCases/Linux/func-id-utils.cc @@ -31,18 +31,10 @@ "each function id must be assigned to a unique function"); std::set<void *> not_instrumented; - const auto comp = [](void *lhs, void *rhs) { -#ifdef __PPC__ - return reinterpret_cast<uintptr_t>(lhs) + 8 < - reinterpret_cast<uintptr_t>(rhs); -#else - return lhs < rhs; -#endif - }; - std::set_difference(must_be_instrumented.begin(), must_be_instrumented.end(), - all_instrumented.begin(), all_instrumented.end(), - std::inserter(not_instrumented, not_instrumented.begin()), - comp); + std::set_difference( + must_be_instrumented.begin(), must_be_instrumented.end(), + all_instrumented.begin(), all_instrumented.end(), + std::inserter(not_instrumented, not_instrumented.begin())); assert( not_instrumented.empty() && "we should see all explicitly instrumented functions with function ids"); |