Skip to content

Commit

Permalink
Fix false positive memory leak in buffer tests
Browse files Browse the repository at this point in the history
Remove platform fixture from buffer tests

Change-Id: Iea0e40c31c2a7ea9e7eab9e60b9d06ba56f0effe
  • Loading branch information
JablonskiMateusz authored and Compute-Runtime-Automation committed Aug 3, 2018
1 parent f61f72b commit 1bc7275
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions unit_tests/mem_obj/buffer_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "test.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/fixtures/platform_fixture.h"
#include "unit_tests/gen_common/matchers.h"
#include "unit_tests/helpers/debug_manager_state_restore.h"
#include "unit_tests/helpers/memory_management.h"
Expand Down Expand Up @@ -613,30 +612,25 @@ INSTANTIATE_TEST_CASE_P(

struct ValidHostPtr
: public BufferTest,
public MemoryManagementFixture,
public PlatformFixture {
public MemoryManagementFixture {
typedef BufferTest BaseClass;

using BufferTest::SetUp;
using MemoryManagementFixture::SetUp;
using PlatformFixture::SetUp;

ValidHostPtr() {
}

void SetUp() override {
MemoryManagementFixture::SetUp();
PlatformFixture::SetUp();
BaseClass::SetUp();

auto pDevice = pPlatform->getDevice(0);
ASSERT_NE(nullptr, pDevice);
}

void TearDown() override {
delete buffer;
BaseClass::TearDown();
PlatformFixture::TearDown();
MemoryManagementFixture::TearDown();
}

Expand Down Expand Up @@ -809,17 +803,17 @@ TEST_P(ValidHostPtr, failedAllocationInjection) {
}

TEST_P(ValidHostPtr, SvmHostPtr) {
const DeviceInfo &devInfo = pPlatform->getDevice(0)->getDeviceInfo();
const DeviceInfo &devInfo = pDevice->getDeviceInfo();
if (devInfo.svmCapabilities != 0) {
auto ptr = clSVMAlloc(context.get(), CL_MEM_READ_WRITE, 64, 64);
auto ptr = context->getSVMAllocsManager()->createSVMAlloc(64, false);

auto bufferSvm = Buffer::create(context.get(), CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR, 64, ptr, retVal);
EXPECT_NE(nullptr, bufferSvm);
EXPECT_TRUE(bufferSvm->isMemObjWithHostPtrSVM());
EXPECT_EQ(context->getSVMAllocsManager()->getSVMAlloc(ptr), bufferSvm->getGraphicsAllocation());
EXPECT_EQ(CL_SUCCESS, retVal);

clSVMFree(context.get(), ptr);
context->getSVMAllocsManager()->freeSVMAlloc(ptr);
delete bufferSvm;
}
}
Expand Down

0 comments on commit 1bc7275

Please sign in to comment.