[PATCH] D14918: [tsan] Fix CallocOverflow unit test on OS X
Kuba Brecka via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 23 05:05:05 PST 2015
kubabrecka created this revision.
kubabrecka added reviewers: dvyukov, kcc, glider, samsonov.
kubabrecka added subscribers: llvm-commits, zaks.anna, ismailp.
On OS X, interceptors don't work in unit tests, so `calloc()` calls the system allocator. We need to use `user_calloc()` instead.
http://reviews.llvm.org/D14918
Files:
lib/tsan/tests/unit/tsan_mman_test.cc
Index: lib/tsan/tests/unit/tsan_mman_test.cc
===================================================================
--- lib/tsan/tests/unit/tsan_mman_test.cc
+++ lib/tsan/tests/unit/tsan_mman_test.cc
@@ -141,11 +141,13 @@
// 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);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14918.40914.patch
Type: text/x-patch
Size: 774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151123/a5f7f426/attachment.bin>
More information about the llvm-commits
mailing list