diff --git a/core/unit_tests/helpers/memory_management.cpp b/core/unit_tests/helpers/memory_management.cpp index 9c3f17ed59..da28b283b5 100644 --- a/core/unit_tests/helpers/memory_management.cpp +++ b/core/unit_tests/helpers/memory_management.cpp @@ -242,6 +242,64 @@ int detectLeaks() { } return indexLeak; } + +size_t enumerateLeak(size_t indexAllocationTop, size_t indexDeallocationTop, bool lookFromBack, bool requireCallStack) { + using MemoryManagement::AllocationEvent; + using MemoryManagement::eventsAllocated; + using MemoryManagement::eventsDeallocated; + + static auto start = MemoryManagement::invalidLeakIndex; + auto newIndex = start == MemoryManagement::invalidLeakIndex ? 0 : start; + bool potentialLeak = false; + auto potentialLeakIndex = newIndex; + + for (; newIndex < indexAllocationTop; ++newIndex) { + auto currentIndex = lookFromBack ? indexAllocationTop - newIndex - 1 : newIndex; + auto &eventAllocation = eventsAllocated[currentIndex]; + + if (requireCallStack && eventAllocation.frames == 0) { + continue; + } + + if (eventAllocation.event != AllocationEvent::EVENT_UNKNOWN) { + // Should be some sort of allocation + size_t deleteIndex = 0; + for (; deleteIndex < indexDeallocationTop; ++deleteIndex) { + auto &eventDeallocation = eventsDeallocated[deleteIndex]; + + if (eventDeallocation.address == eventAllocation.address && + eventDeallocation.event != AllocationEvent::EVENT_UNKNOWN) { + + //this memory was once freed, now it is allocated but not freed + if (requireCallStack && eventDeallocation.frames == 0) { + potentialLeak = true; + potentialLeakIndex = currentIndex; + continue; + } + + // Clear the NEW and DELETE event. + eventAllocation.event = AllocationEvent::EVENT_UNKNOWN; + eventDeallocation.event = AllocationEvent::EVENT_UNKNOWN; + potentialLeak = false; + // Found a corresponding match + break; + } + } + + if (potentialLeak) { + return potentialLeakIndex; + } + + if (deleteIndex == indexDeallocationTop) { + start = newIndex + 1; + return currentIndex; + } + } + } + start = MemoryManagement::invalidLeakIndex; + return start; +} + } // namespace MemoryManagement using MemoryManagement::allocate; diff --git a/core/unit_tests/helpers/memory_management.h b/core/unit_tests/helpers/memory_management.h index d02aaf3cda..4ca90b19cc 100644 --- a/core/unit_tests/helpers/memory_management.h +++ b/core/unit_tests/helpers/memory_management.h @@ -74,5 +74,10 @@ extern bool detailedAllocationLoggingActive; extern bool fastLeakDetectionEnabled; extern void (*deleteCallback)(void *); +constexpr auto nonfailingAllocation = static_cast(-1); +constexpr auto invalidLeakIndex = static_cast(-1); + int detectLeaks(); +size_t enumerateLeak(size_t indexAllocationTop, size_t indexDeallocationTop, bool lookFromEnd, bool requireCallStack); + } // namespace MemoryManagement diff --git a/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp b/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp index fc15bb712c..4f156aff50 100644 --- a/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp +++ b/unit_tests/api/cl_create_command_queue_with_properties_tests.cpp @@ -286,7 +286,7 @@ TEST_F(clCreateCommandQueueWithPropertiesApi, GivenFailedAllocationWhenCreatingC auto cmdq = clCreateCommandQueueWithProperties(pContext, devices[0], ooq, &retVal); - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, cmdq); clReleaseCommandQueue(cmdq); diff --git a/unit_tests/command_queue/command_queue_tests.cpp b/unit_tests/command_queue/command_queue_tests.cpp index e14f838cc0..4d0261004c 100644 --- a/unit_tests/command_queue/command_queue_tests.cpp +++ b/unit_tests/command_queue/command_queue_tests.cpp @@ -94,7 +94,7 @@ TEST_P(CommandQueueTest, createDeleteCommandQueue_Properties) { nullptr, retVal); - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, pCmdQ); } else { diff --git a/unit_tests/context/context_negative_tests.cpp b/unit_tests/context/context_negative_tests.cpp index 06471f072e..e7e4e89432 100644 --- a/unit_tests/context/context_negative_tests.cpp +++ b/unit_tests/context/context_negative_tests.cpp @@ -31,7 +31,7 @@ TEST_F(ContextFailureInjection, failedAllocationInjection) { auto context = Context::create(nullptr, DeviceVector(&deviceID, 1), nullptr, nullptr, retVal); - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, context); } else { diff --git a/unit_tests/fixtures/memory_management_fixture.cpp b/unit_tests/fixtures/memory_management_fixture.cpp index a16fe8ead6..a7dcc97ed3 100644 --- a/unit_tests/fixtures/memory_management_fixture.cpp +++ b/unit_tests/fixtures/memory_management_fixture.cpp @@ -57,72 +57,6 @@ void MemoryManagementFixture::clearFailingAllocation() { MemoryManagement::failingAllocation = -1; } -size_t MemoryManagementFixture::enumerateLeak(size_t indexAllocationTop, size_t indexDeallocationTop, bool lookFromBack, bool requireCallStack, bool fastLookup) { - using MemoryManagement::AllocationEvent; - using MemoryManagement::eventsAllocated; - using MemoryManagement::eventsDeallocated; - - static auto start = invalidLeakIndex; - auto newIndex = start == invalidLeakIndex ? 0 : start; - bool potentialLeak = false; - auto potentialLeakIndex = newIndex; - - for (; newIndex < indexAllocationTop; ++newIndex) { - auto currentIndex = lookFromBack ? indexAllocationTop - newIndex - 1 : newIndex; - auto &eventAllocation = eventsAllocated[currentIndex]; - - if (requireCallStack && eventAllocation.frames == 0) { - continue; - } - - if (fastLookup && !eventAllocation.fastLeakDetectionEnabled) { - continue; - } - - if (eventAllocation.event != AllocationEvent::EVENT_UNKNOWN) { - // Should be some sort of allocation - size_t deleteIndex = 0; - for (; deleteIndex < indexDeallocationTop; ++deleteIndex) { - auto &eventDeallocation = eventsDeallocated[deleteIndex]; - - if (eventDeallocation.address == eventAllocation.address && - eventDeallocation.event != AllocationEvent::EVENT_UNKNOWN) { - - //this memory was once freed, now it is allocated but not freed - if (requireCallStack && eventDeallocation.frames == 0) { - potentialLeak = true; - potentialLeakIndex = currentIndex; - continue; - } - - //allocated with fast lookup, but deallocated other way, not a match - if (fastLookup && !eventDeallocation.fastLeakDetectionEnabled) { - continue; - } - - // Clear the NEW and DELETE event. - eventAllocation.event = AllocationEvent::EVENT_UNKNOWN; - eventDeallocation.event = AllocationEvent::EVENT_UNKNOWN; - potentialLeak = false; - // Found a corresponding match - break; - } - } - - if (potentialLeak) { - return potentialLeakIndex; - } - - if (deleteIndex == indexDeallocationTop) { - start = newIndex + 1; - return currentIndex; - } - } - } - start = invalidLeakIndex; - return start; -} - std::string printCallStack(const MemoryManagement::AllocationEvent &event) { std::string result = ""; @@ -188,7 +122,7 @@ std::string printCallStack(const MemoryManagement::AllocationEvent &event) { using MemoryManagement::AllocationEvent; using MemoryManagement::eventsAllocated; - if (leakIndex == invalidLeakIndex) { + if (leakIndex == MemoryManagement::invalidLeakIndex) { return ::testing::AssertionSuccess(); } auto &event = eventsAllocated[leakIndex]; @@ -254,11 +188,11 @@ void MemoryManagementFixture::checkForLeaks() { //EXPECT_EQ(previousAllocations, currentAllocations); size_t leakEventIndex; do { - leakEventIndex = enumerateLeak(indexAllocationTop, indexDellocationTop); + leakEventIndex = MemoryManagement::enumerateLeak(indexAllocationTop, indexDellocationTop, false, false); EXPECT_PRED_FORMAT1(assertLeak, leakEventIndex); - auto invalidLeakIndexValues = invalidLeakIndex; + auto invalidLeakIndexValues = MemoryManagement::invalidLeakIndex; EXPECT_EQ(leakEventIndex, invalidLeakIndexValues); - } while (leakEventIndex != invalidLeakIndex); + } while (leakEventIndex != MemoryManagement::invalidLeakIndex); } else { printf("*** WARNING: Leaks found but dumping disabled during test failure ***\n"); } diff --git a/unit_tests/fixtures/memory_management_fixture.h b/unit_tests/fixtures/memory_management_fixture.h index a27f37d34d..a80be80333 100644 --- a/unit_tests/fixtures/memory_management_fixture.h +++ b/unit_tests/fixtures/memory_management_fixture.h @@ -16,9 +16,6 @@ struct MemoryManagementFixture { MemoryManagementFixture() { MemoryManagement::detailedAllocationLoggingActive = true; }; - static const auto nonfailingAllocation = static_cast(-1); - static const auto invalidLeakIndex = static_cast(-1); - virtual ~MemoryManagementFixture() { MemoryManagement::detailedAllocationLoggingActive = false; }; // Typical Fixture methods @@ -29,8 +26,6 @@ struct MemoryManagementFixture { void setFailingAllocation(size_t allocation); void clearFailingAllocation(void); - static size_t enumerateLeak(size_t indexAllocationTop, size_t indexDeallocationTop, bool lookFromEnd = false, bool requireCallStack = false, bool fastLookup = false); - ::testing::AssertionResult assertLeak( const char *leak_expr, size_t leakIndex); diff --git a/unit_tests/gtpin/gtpin_tests.cpp b/unit_tests/gtpin/gtpin_tests.cpp index 8e9bd776c7..e93b8292d6 100644 --- a/unit_tests/gtpin/gtpin_tests.cpp +++ b/unit_tests/gtpin/gtpin_tests.cpp @@ -399,7 +399,7 @@ TEST_F(GTPinTests, givenValidRequestForHugeMemoryAllocationThenBufferAllocateFai cl_context ctxt = (cl_context)((Context *)pContext); uint32_t hugeSize = 400u; // Will be handled as huge memory allocation retFromGtPin = (*driverServices.bufferAllocate)((gtpin::context_handle_t)ctxt, hugeSize, &res); - if (nonfailingAllocation != failureIndex) { + if (MemoryManagement::nonfailingAllocation != failureIndex) { EXPECT_EQ(GTPIN_DI_ERROR_ALLOCATION_FAILED, retFromGtPin); } else { EXPECT_EQ(GTPIN_DI_SUCCESS, retFromGtPin); @@ -1986,7 +1986,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenLowMemoryConditionOccursThe pProgram->storeGenBinary(&binary[0], binSize); retVal = pProgram->processGenBinary(); if (retVal == CL_OUT_OF_HOST_MEMORY) { - auto nonFailingAlloc = nonfailingAllocation; + auto nonFailingAlloc = MemoryManagement::nonfailingAllocation; EXPECT_NE(nonFailingAlloc, failureIndex); } else { EXPECT_EQ(CL_SUCCESS, retVal); @@ -1994,12 +1994,12 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenLowMemoryConditionOccursThe cl_kernel kernels[2] = {0}; cl_uint numCreatedKernels = 0; - if (nonfailingAllocation != failureIndex) { + if (MemoryManagement::nonfailingAllocation != failureIndex) { memoryManager->failAllAllocationsInDevicePool = true; } retVal = clCreateKernelsInProgram(pProgram, 2, kernels, &numCreatedKernels); - if (nonfailingAllocation != failureIndex) { + if (MemoryManagement::nonfailingAllocation != failureIndex) { if (retVal != CL_SUCCESS) { EXPECT_EQ(nullptr, kernels[0]); EXPECT_EQ(1u, numCreatedKernels); diff --git a/unit_tests/helpers/memory_management_tests.cpp b/unit_tests/helpers/memory_management_tests.cpp index 1e520f44c9..2ef70ffa4b 100644 --- a/unit_tests/helpers/memory_management_tests.cpp +++ b/unit_tests/helpers/memory_management_tests.cpp @@ -71,7 +71,7 @@ TEST_F(MemoryManagementTest, nothrow_injectingAFailure) { TEST_F(MemoryManagementTest, NoLeaks) { auto indexAllocationTop = indexAllocation.load(); auto indexDellocationTop = indexDeallocation.load(); - EXPECT_EQ(static_cast(-1), enumerateLeak(indexAllocationTop, indexDellocationTop)); + EXPECT_EQ(static_cast(-1), MemoryManagement::enumerateLeak(indexAllocationTop, indexDellocationTop, false, false)); } TEST_F(MemoryManagementTest, OneLeak) { @@ -79,13 +79,13 @@ TEST_F(MemoryManagementTest, OneLeak) { auto ptr = new (std::nothrow) char[sizeBuffer]; auto indexAllocationTop = indexAllocation.load(); auto indexDeallocationTop = indexDeallocation.load(); - auto leakIndex = enumerateLeak(indexAllocationTop, indexDeallocationTop); + auto leakIndex = MemoryManagement::enumerateLeak(indexAllocationTop, indexDeallocationTop, false, false); ASSERT_NE(static_cast(-1), leakIndex); EXPECT_EQ(ptr, eventsAllocated[leakIndex].address); EXPECT_EQ(sizeBuffer, eventsAllocated[leakIndex].size); // Not expecting any more failures - EXPECT_EQ(static_cast(-1), enumerateLeak(indexAllocationTop, indexDeallocationTop)); + EXPECT_EQ(static_cast(-1), MemoryManagement::enumerateLeak(indexAllocationTop, indexDeallocationTop, false, false)); delete[] ptr; } @@ -97,13 +97,13 @@ TEST_F(MemoryManagementTest, OneLeakBetweenFourEvents) { delete new (std::nothrow) char; auto indexAllocationTop = indexAllocation.load(); auto indexDeallocationTop = indexDeallocation.load(); - auto leakIndex = enumerateLeak(indexAllocationTop, indexDeallocationTop); + auto leakIndex = MemoryManagement::enumerateLeak(indexAllocationTop, indexDeallocationTop, false, false); ASSERT_NE(static_cast(-1), leakIndex); EXPECT_EQ(ptr, eventsAllocated[leakIndex].address); EXPECT_EQ(sizeBuffer, eventsAllocated[leakIndex].size); // Not expecting any more failures - EXPECT_EQ(static_cast(-1), enumerateLeak(indexAllocationTop, indexDeallocationTop)); + EXPECT_EQ(static_cast(-1), MemoryManagement::enumerateLeak(indexAllocationTop, indexDeallocationTop, false, false)); delete[] ptr; } @@ -114,8 +114,8 @@ TEST_F(MemoryManagementTest, TwoLeaks) { auto ptr2 = new (std::nothrow) char[sizeBuffer]; auto indexAllocationTop = indexAllocation.load(); auto indexDeallocationTop = indexDeallocation.load(); - auto leakIndex1 = enumerateLeak(indexAllocationTop, indexDeallocationTop); - auto leakIndex2 = enumerateLeak(indexAllocationTop, indexDeallocationTop); + auto leakIndex1 = MemoryManagement::enumerateLeak(indexAllocationTop, indexDeallocationTop, false, false); + auto leakIndex2 = MemoryManagement::enumerateLeak(indexAllocationTop, indexDeallocationTop, false, false); ASSERT_NE(static_cast(-1), leakIndex1); EXPECT_EQ(ptr1, eventsAllocated[leakIndex1].address); EXPECT_EQ(sizeBuffer, eventsAllocated[leakIndex1].size); @@ -125,7 +125,7 @@ TEST_F(MemoryManagementTest, TwoLeaks) { EXPECT_EQ(sizeBuffer, eventsAllocated[leakIndex2].size); // Not expecting any more failures - EXPECT_EQ(static_cast(-1), enumerateLeak(indexAllocationTop, indexDeallocationTop)); + EXPECT_EQ(static_cast(-1), MemoryManagement::enumerateLeak(indexAllocationTop, indexDeallocationTop, false, false)); delete[] ptr1; delete[] ptr2; diff --git a/unit_tests/kernel/kernel_tests.cpp b/unit_tests/kernel/kernel_tests.cpp index 07ad466e5c..68c0e1a2e9 100644 --- a/unit_tests/kernel/kernel_tests.cpp +++ b/unit_tests/kernel/kernel_tests.cpp @@ -601,7 +601,7 @@ TEST_F(KernelPrivateSurfaceTest, testPrivateSurfaceAllocationFailure) { MemoryManagementFixture::InjectedFunction method = [&](size_t failureIndex) { MockKernel *pKernel = new MockKernel(&program, *pKernelInfo, *pDevice); - if (MemoryManagementFixture::nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_EQ(CL_SUCCESS, pKernel->initialize()); } else { EXPECT_EQ(CL_OUT_OF_RESOURCES, pKernel->initialize()); diff --git a/unit_tests/mem_obj/buffer_tests.cpp b/unit_tests/mem_obj/buffer_tests.cpp index e5b91e2d5a..f474c1baff 100644 --- a/unit_tests/mem_obj/buffer_tests.cpp +++ b/unit_tests/mem_obj/buffer_tests.cpp @@ -1276,7 +1276,7 @@ TEST_P(ValidHostPtr, failedAllocationInjection) { // System under test buffer = createBuffer(); - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, buffer); } diff --git a/unit_tests/mem_obj/destructor_callback_tests.cpp b/unit_tests/mem_obj/destructor_callback_tests.cpp index bb26ac5136..3f850e5f33 100644 --- a/unit_tests/mem_obj/destructor_callback_tests.cpp +++ b/unit_tests/mem_obj/destructor_callback_tests.cpp @@ -90,7 +90,7 @@ TEST_F(DestructorCallbackTest, doFailAllocations) { retVal = buffer->setDestructorCallback(callBack1, nullptr); - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_EQ(CL_SUCCESS, retVal); } else { EXPECT_EQ(CL_OUT_OF_HOST_MEMORY, retVal) << "for allocation " << failureIndex; @@ -98,7 +98,7 @@ TEST_F(DestructorCallbackTest, doFailAllocations) { delete buffer; - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_EQ(1u, calls.size()); } else { EXPECT_EQ(0u, calls.size()); diff --git a/unit_tests/mem_obj/image_tests.cpp b/unit_tests/mem_obj/image_tests.cpp index 50353fd809..fdc7afce67 100644 --- a/unit_tests/mem_obj/image_tests.cpp +++ b/unit_tests/mem_obj/image_tests.cpp @@ -630,7 +630,7 @@ TEST_P(CreateImageHostPtr, failedAllocationInjection) { // System under test image = createImage(retVal); - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, image); } else { diff --git a/unit_tests/mem_obj/pipe_tests.cpp b/unit_tests/mem_obj/pipe_tests.cpp index 8bb7cc1c26..4d92cd7d12 100644 --- a/unit_tests/mem_obj/pipe_tests.cpp +++ b/unit_tests/mem_obj/pipe_tests.cpp @@ -71,7 +71,7 @@ TEST_F(PipeTest, FailedAllocationInjection) { auto retVal = CL_INVALID_VALUE; auto pipe = Pipe::create(&context, CL_MEM_READ_ONLY, 1, 20, nullptr, retVal); - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_NE(nullptr, pipe); delete pipe; diff --git a/unit_tests/memory_leak_listener.cpp b/unit_tests/memory_leak_listener.cpp index ff8e603692..c3d4e72902 100644 --- a/unit_tests/memory_leak_listener.cpp +++ b/unit_tests/memory_leak_listener.cpp @@ -32,7 +32,7 @@ void MemoryLeakListener::OnTestEnd(const TestInfo &testInfo) { } MemoryManagement::fastLeaksDetectionMode = MemoryManagement::LeakDetectionMode::STANDARD; } else if (NEO::captureCallStacks && (MemoryManagement::fastEventsAllocatedCount != MemoryManagement::fastEventsDeallocatedCount)) { - auto leak = MemoryManagementFixture::enumerateLeak(MemoryManagement::indexAllocation.load(), MemoryManagement::indexDeallocation.load(), true, true); + auto leak = MemoryManagement::enumerateLeak(MemoryManagement::indexAllocation.load(), MemoryManagement::indexDeallocation.load(), true, true); if (leak != MemoryManagement::failingAllocation) { printf("\n %s ", printCallStack(MemoryManagement::eventsAllocated[leak]).c_str()); } diff --git a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp index 3da2a7131f..07760086e4 100644 --- a/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/linux/drm_memory_manager_tests.cpp @@ -342,7 +342,7 @@ TEST_F(DrmMemoryManagerTest, AllocateNewFail) { InjectedFunction method = [this](size_t failureIndex) { auto ptr = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); - if (nonfailingAllocation != failureIndex) { + if (MemoryManagement::nonfailingAllocation != failureIndex) { EXPECT_EQ(nullptr, ptr); } else { EXPECT_NE(nullptr, ptr); @@ -1310,7 +1310,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerWhenTiledImageIsBeingCreatedAn cl_mem_flags flags = CL_MEM_WRITE_ONLY; auto surfaceFormat = Image::getSurfaceFormatFromTable(flags, &imageFormat); std::unique_ptr dstImage(Image::create(&context, flags, surfaceFormat, &imageDesc, nullptr, retVal)); - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_NE(nullptr, dstImage.get()); } else { EXPECT_EQ(nullptr, dstImage.get()); @@ -1704,7 +1704,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmMemoryManagerAndOsHandleWhenAllocationFails AllocationProperties properties(false, MemoryConstants::pageSize, GraphicsAllocation::AllocationType::SHARED_BUFFER, false); auto graphicsAllocation = memoryManager->createGraphicsAllocationFromSharedHandle(handle, properties, false); - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_NE(nullptr, graphicsAllocation); memoryManager->freeGraphicsMemory(graphicsAllocation); } else { diff --git a/unit_tests/os_interface/os_library_tests.cpp b/unit_tests/os_interface/os_library_tests.cpp index ecf40ae4d6..0d4fa8a0fe 100644 --- a/unit_tests/os_interface/os_library_tests.cpp +++ b/unit_tests/os_interface/os_library_tests.cpp @@ -81,7 +81,7 @@ TEST_F(OSLibraryTest, testFailNew) { // System under test OsLibrary *library = OsLibrary::load(libName); - if (nonfailingAllocation == failureIndex) { + if (MemoryManagement::nonfailingAllocation == failureIndex) { EXPECT_NE(nullptr, library); } else { EXPECT_EQ(nullptr, library);