diff options
author | Arnstein Ressem <aressem@gmail.com> | 2022-02-09 13:51:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-09 13:51:24 +0100 |
commit | 75a5214373176d0d79a172b67683c1017a95113c (patch) | |
tree | f2a3f18303f613de3ec708cb9524360d021bca8d /vespamalloc/src/tests/test1/new_test.cpp | |
parent | 3840c3a1265610492cd8adf92a188d5e1862efd5 (diff) |
Revert "Wire in mallopt(in param, int value) interface in vespamalloc and ver…"
Diffstat (limited to 'vespamalloc/src/tests/test1/new_test.cpp')
-rw-r--r-- | vespamalloc/src/tests/test1/new_test.cpp | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/vespamalloc/src/tests/test1/new_test.cpp b/vespamalloc/src/tests/test1/new_test.cpp index 6f84f7c0f63..5230869145d 100644 --- a/vespamalloc/src/tests/test1/new_test.cpp +++ b/vespamalloc/src/tests/test1/new_test.cpp @@ -3,6 +3,7 @@ #include <vespa/log/log.h> #include <malloc.h> #include <dlfcn.h> +#include <functional> LOG_SETUP("new_test"); @@ -133,28 +134,14 @@ void verify_vespamalloc_usable_size() { } } -enum class MallocLibrary { UNKNOWN, VESPA_MALLOC, VESPA_MALLOC_D}; - -MallocLibrary -detectLibrary() { - if (dlsym(RTLD_NEXT, "is_vespamallocd") != nullptr) { - // Debug variants will never have more memory available as there is pre/postamble for error detection. - return MallocLibrary::VESPA_MALLOC_D; - } else if (dlsym(RTLD_NEXT, "is_vespamalloc") != nullptr) { - return MallocLibrary::VESPA_MALLOC; - } - return MallocLibrary::UNKNOWN; -} - TEST("verify malloc_usable_size is sane") { constexpr size_t SZ = 33; std::unique_ptr<char[]> buf = std::make_unique<char[]>(SZ); size_t usable_size = malloc_usable_size(buf.get()); - MallocLibrary env = detectLibrary(); - if (env == MallocLibrary::VESPA_MALLOC_D) { + if (dlsym(RTLD_NEXT, "is_vespamallocd") != nullptr) { // Debug variants will never have more memory available as there is pre/postamble for error detection. EXPECT_EQUAL(SZ, usable_size); - } else if (env == MallocLibrary::VESPA_MALLOC) { + } else if (dlsym(RTLD_NEXT, "is_vespamalloc") != nullptr) { // Normal production vespamalloc will round up EXPECT_EQUAL(64u, usable_size); verify_vespamalloc_usable_size(); @@ -164,13 +151,5 @@ TEST("verify malloc_usable_size is sane") { } } -TEST("verify mallopt") { - MallocLibrary env = detectLibrary(); - if (env == MallocLibrary::UNKNOWN) return; - EXPECT_EQUAL(0, mallopt(M_MMAP_MAX, 0x1000000)); - EXPECT_EQUAL(1, mallopt(M_MMAP_THRESHOLD, 0x1000000)); - EXPECT_EQUAL(1, mallopt(M_MMAP_THRESHOLD, -1)); -} - TEST_MAIN() { TEST_RUN_ALL(); } |