diff options
author | Christopher Ferris <cferris@google.com> | 2018-11-07 15:28:16 -0800 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2018-11-07 17:11:42 -0800 |
commit | af1b8ddaa976bc95007353bc46f59cf5959af7ad (patch) | |
tree | 3c4e707580da50ac0a61aa8b7ad45a51b3642c90 /tests/malloc_test.cpp | |
parent | e691069366401dc385943cb1702beb9d4feecb85 (diff) |
Add smoke tests for mallopt options.
Test: Unit tests pass.
Change-Id: If213f4338078011ff12996c1b2a6f6858b51d824
Diffstat (limited to 'tests/malloc_test.cpp')
-rw-r--r-- | tests/malloc_test.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/malloc_test.cpp b/tests/malloc_test.cpp index d585d8cc3..8b670f0e5 100644 --- a/tests/malloc_test.cpp +++ b/tests/malloc_test.cpp @@ -512,6 +512,27 @@ TEST(malloc, mallopt_smoke) { ASSERT_EQ(0, errno); } +TEST(malloc, mallopt_decay) { +#if defined(__BIONIC__) + errno = 0; + ASSERT_EQ(1, mallopt(M_DECAY_TIME, 1)); + ASSERT_EQ(1, mallopt(M_DECAY_TIME, 0)); + ASSERT_EQ(1, mallopt(M_DECAY_TIME, 1)); + ASSERT_EQ(1, mallopt(M_DECAY_TIME, 0)); +#else + GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n"; +#endif +} + +TEST(malloc, mallopt_purge) { +#if defined(__BIONIC__) + errno = 0; + ASSERT_EQ(1, mallopt(M_PURGE, 0)); +#else + GTEST_LOG_(INFO) << "This tests a bionic implementation detail.\n"; +#endif +} + TEST(malloc, reallocarray_overflow) { #if HAVE_REALLOCARRAY // Values that cause overflow to a result small enough (8 on LP64) that malloc would "succeed". |