summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/tests/unit
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2015-11-24 13:27:33 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2015-11-24 13:27:33 +0000
commit377cafbbbcc98f2cf19c72605b7bcc5fa3fcf0f3 (patch)
tree8959b164e82e2feb9a2df1de9af8b95f5647d06d /compiler-rt/lib/tsan/tests/unit
parentd4b566d50b5940f491484890e709a50355d05e1c (diff)
downloadbcm5719-llvm-377cafbbbcc98f2cf19c72605b7bcc5fa3fcf0f3.tar.gz
bcm5719-llvm-377cafbbbcc98f2cf19c72605b7bcc5fa3fcf0f3.zip
[tsan] Fix CallocOverflow unit test on OS X
On OS X, interceptors don't work in unit tests, so calloc() calls the system allocator. We need to use user_calloc() instead. Differential Revision: http://reviews.llvm.org/D14918 llvm-svn: 253979
Diffstat (limited to 'compiler-rt/lib/tsan/tests/unit')
-rw-r--r--compiler-rt/lib/tsan/tests/unit/tsan_mman_test.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler-rt/lib/tsan/tests/unit/tsan_mman_test.cc b/compiler-rt/lib/tsan/tests/unit/tsan_mman_test.cc
index bfaefe64870..609141c5929 100644
--- a/compiler-rt/lib/tsan/tests/unit/tsan_mman_test.cc
+++ b/compiler-rt/lib/tsan/tests/unit/tsan_mman_test.cc
@@ -141,11 +141,13 @@ TEST(Mman, CallocOverflow) {
// which is overflown by tsan memory accesses functions in debug mode.
return;
#endif
+ ThreadState *thr = cur_thread();
+ uptr pc = 0;
size_t kArraySize = 4096;
volatile size_t kMaxSizeT = std::numeric_limits<size_t>::max();
volatile size_t kArraySize2 = kMaxSizeT / kArraySize + 10;
volatile void *p = NULL;
- EXPECT_DEATH(p = calloc(kArraySize, kArraySize2),
+ EXPECT_DEATH(p = user_calloc(thr, pc, kArraySize, kArraySize2),
"allocator is terminating the process instead of returning 0");
EXPECT_EQ(0L, p);
}
OpenPOWER on IntegriCloud