summaryrefslogtreecommitdiff
path: root/lib/tsan/tests
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2013-09-06 11:04:14 +0000
committerKostya Serebryany <kcc@google.com>2013-09-06 11:04:14 +0000
commitbd33d3ab168fcbcfe09a3fd6a971994b481e89d0 (patch)
treeaa936c5384774f2b762ef34a360a58bc4f1c840c /lib/tsan/tests
parent967e07eccfec5e013df5f77b7dd906abfa6b60d9 (diff)
downloadcompiler-rt-bd33d3ab168fcbcfe09a3fd6a971994b481e89d0.tar.gz
compiler-rt-bd33d3ab168fcbcfe09a3fd6a971994b481e89d0.tar.bz2
compiler-rt-bd33d3ab168fcbcfe09a3fd6a971994b481e89d0.tar.xz
[tsan] make calloc crash instead of returning 0 on overflow (controlled by the allocator_may_return_null flag)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@190135 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/tests')
-rw-r--r--lib/tsan/tests/unit/tsan_mman_test.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/tsan/tests/unit/tsan_mman_test.cc b/lib/tsan/tests/unit/tsan_mman_test.cc
index 0961d2b7..e1ad7ac5 100644
--- a/lib/tsan/tests/unit/tsan_mman_test.cc
+++ b/lib/tsan/tests/unit/tsan_mman_test.cc
@@ -164,7 +164,9 @@ TEST(Mman, CallocOverflow) {
size_t kArraySize = 4096;
volatile size_t kMaxSizeT = std::numeric_limits<size_t>::max();
volatile size_t kArraySize2 = kMaxSizeT / kArraySize + 10;
- volatile void *p = calloc(kArraySize, kArraySize2); // Should return 0.
+ volatile void *p = NULL;
+ EXPECT_DEATH(p = calloc(kArraySize, kArraySize2),
+ "allocator is terminating the process instead of returning 0");
EXPECT_EQ(0L, p);
}