diff options
Diffstat (limited to 'runtime/contrib/heap_trace/tests/src/malloc_interception_test.cc')
-rw-r--r-- | runtime/contrib/heap_trace/tests/src/malloc_interception_test.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/runtime/contrib/heap_trace/tests/src/malloc_interception_test.cc b/runtime/contrib/heap_trace/tests/src/malloc_interception_test.cc index 7a2f5a915..ea3eb8256 100644 --- a/runtime/contrib/heap_trace/tests/src/malloc_interception_test.cc +++ b/runtime/contrib/heap_trace/tests/src/malloc_interception_test.cc @@ -18,8 +18,9 @@ #include "file_content_manipulations.h" #include "trace.h" +#include "symbol_searcher.h" +#include "memory_pool_for_symbol_searcher_internals.h" -#include <experimental/filesystem> #include <limits> extern std::unique_ptr<Trace> GlobalTrace; @@ -70,6 +71,21 @@ TEST_F(MallocStub, must_not_do_the_record_about_allocation_event_if_original_fun "GPU - Peak mem usage: 0 B, Total allocated: 0 B, Total deallocated: 0 B\n"); } +TEST_F(MallocStub, should_allocate_memory_from_pool_for_symbol_searcher_internal_usage_if_need) +{ + signalizeThatNextAllocationsWillBeForSymbolSearcherInternalUsage(); + void *p = malloc(1024); + signalizeThatSymbolSearcherEndedOfWork(); + GlobalTrace.reset(); + + MemoryPoolForSymbolSearcherInternals pool; + ASSERT_TRUE(p); + ASSERT_TRUE(pool.containsMemorySpaceStartedFromPointer(p)); + ASSERT_STREQ(getContentOfFile("./malloc_interception_test.log").c_str(), + "On CPU - Peak heap usage: 0 B, Total allocated: 0 B, Total deallocated: 0 B\nOn " + "GPU - Peak mem usage: 0 B, Total allocated: 0 B, Total deallocated: 0 B\n"); +} + TEST_F( MallocStub, should_not_influence_on_trace_results_even_if_orignal_function_return_any_not_null_ptr_when_incoming_size_is_zero) |