diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-02-25 08:43:10 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-02-25 08:43:10 +0000 |
commit | 8a6b5e551ab8a331f7e7bc4bfcd74926fbffa3f6 (patch) | |
tree | 41d035ff1adc2bf63f537d5410d001667b1e72d2 /lib/tsan/tests | |
parent | 55249d128eb72e58e102057751a8271310768b4c (diff) | |
download | compiler-rt-8a6b5e551ab8a331f7e7bc4bfcd74926fbffa3f6.tar.gz compiler-rt-8a6b5e551ab8a331f7e7bc4bfcd74926fbffa3f6.tar.bz2 compiler-rt-8a6b5e551ab8a331f7e7bc4bfcd74926fbffa3f6.tar.xz |
[TSan] Add interceptor for malloc_usable_size()
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@176013 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/tests')
-rw-r--r-- | lib/tsan/tests/unit/tsan_mman_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/tsan/tests/unit/tsan_mman_test.cc b/lib/tsan/tests/unit/tsan_mman_test.cc index af813a2c..ecbe874a 100644 --- a/lib/tsan/tests/unit/tsan_mman_test.cc +++ b/lib/tsan/tests/unit/tsan_mman_test.cc @@ -117,6 +117,19 @@ TEST(Mman, UserRealloc) { } } +TEST(Mman, UsableSize) { + ScopedInRtl in_rtl; + ThreadState *thr = cur_thread(); + uptr pc = 0; + char *p = (char*)user_alloc(thr, pc, 10); + char *p2 = (char*)user_alloc(thr, pc, 20); + EXPECT_EQ(0U, user_alloc_usable_size(thr, pc, NULL)); + EXPECT_EQ(10U, user_alloc_usable_size(thr, pc, p)); + EXPECT_EQ(20U, user_alloc_usable_size(thr, pc, p2)); + user_free(thr, pc, p); + user_free(thr, pc, p2); +} + TEST(Mman, Stats) { ScopedInRtl in_rtl; ThreadState *thr = cur_thread(); |