ULTs cleanup

- remove unused MemoryManagementFixture.
  MemoryLeaks are tracked using MemoryLeakListener no need to duplicate
  with Fixure.
  MMF should be used when you need to inject memory allocation failure

Change-Id: I95bcaa7051acf540c5b015c5489ed6a6fc38ee8e
This commit is contained in:
Artur Harasimiuk
2018-03-29 00:38:41 +02:00
committed by sys_ocldev
parent 9e509f302a
commit 7e6432a207
22 changed files with 52 additions and 152 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -23,7 +23,6 @@
#pragma once #pragma once
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "runtime/helpers/ptr_math.h" #include "runtime/helpers/ptr_math.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "gen_cmd_parse.h" #include "gen_cmd_parse.h"
#include "unit_tests/command_queue/command_enqueue_fixture.h" #include "unit_tests/command_queue/command_enqueue_fixture.h"
#include "unit_tests/fixtures/buffer_fixture.h" #include "unit_tests/fixtures/buffer_fixture.h"
@@ -65,7 +64,6 @@ struct EnqueueCopyBufferRectHelper {
struct EnqueueCopyBufferRectTest : public CommandEnqueueFixture, struct EnqueueCopyBufferRectTest : public CommandEnqueueFixture,
public EnqueueCopyBufferRectHelper, public EnqueueCopyBufferRectHelper,
public MemoryManagementFixture,
public ::testing::Test { public ::testing::Test {
EnqueueCopyBufferRectTest(void) : srcBuffer(nullptr), EnqueueCopyBufferRectTest(void) : srcBuffer(nullptr),
@@ -77,7 +75,6 @@ struct EnqueueCopyBufferRectTest : public CommandEnqueueFixture,
}; };
virtual void SetUp(void) override { virtual void SetUp(void) override {
MemoryManagementFixture::SetUp();
CommandEnqueueFixture::SetUp(); CommandEnqueueFixture::SetUp();
BufferDefaults::context = new MockContext; BufferDefaults::context = new MockContext;
@@ -90,7 +87,6 @@ struct EnqueueCopyBufferRectTest : public CommandEnqueueFixture,
delete dstBuffer; delete dstBuffer;
delete BufferDefaults::context; delete BufferDefaults::context;
CommandEnqueueFixture::TearDown(); CommandEnqueueFixture::TearDown();
MemoryManagementFixture::TearDown();
} }
protected: protected:

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -33,7 +33,6 @@
#include "runtime/sampler/sampler.h" #include "runtime/sampler/sampler.h"
#include "unit_tests/fixtures/buffer_fixture.h" #include "unit_tests/fixtures/buffer_fixture.h"
#include "unit_tests/fixtures/image_fixture.h" #include "unit_tests/fixtures/image_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/mocks/mock_buffer.h" #include "unit_tests/mocks/mock_buffer.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "runtime/api/api.h" #include "runtime/api/api.h"
@@ -59,15 +58,7 @@ struct ObjectForTest2 : public OCLRT::BaseObject<_cl_object_for_test2> {
}; };
template <typename TypeParam> template <typename TypeParam>
struct BaseObjectTests : public MemoryManagementFixture, struct BaseObjectTests : public ::testing::Test {
public ::testing::Test {
void SetUp() override {
MemoryManagementFixture::SetUp();
}
void TearDown() override {
MemoryManagementFixture::TearDown();
}
}; };
template <typename BaseType> template <typename BaseType>
@@ -161,7 +152,7 @@ TYPED_TEST(BaseObjectTests, retain) {
object->release(); object->release();
// MemoryManagementFixture will detect a leak // MemoryLeakListener will detect a leak
// if release doesn't delete memory. // if release doesn't delete memory.
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -23,21 +23,12 @@
#include "runtime/command_queue/command_queue.h" #include "runtime/command_queue/command_queue.h"
#include "runtime/platform/platform.h" #include "runtime/platform/platform.h"
#include "runtime/accelerators/intel_accelerator.h" #include "runtime/accelerators/intel_accelerator.h"
#include "unit_tests/fixtures/memory_management_fixture.h" #include "gtest/gtest.h"
namespace OCLRT { namespace OCLRT {
template <typename TypeParam> template <typename TypeParam>
struct BaseObjectTestsMt : public MemoryManagementFixture, struct BaseObjectTestsMt : public ::testing::Test {
public ::testing::Test {
void SetUp() override {
MemoryManagementFixture::SetUp();
}
void TearDown() override {
MemoryManagementFixture::TearDown();
}
static void takeOwnerFailThreadFunc(TypeParam *obj) { static void takeOwnerFailThreadFunc(TypeParam *obj) {
auto ret = obj->takeOwnership(false); auto ret = obj->takeOwnership(false);
EXPECT_EQ(false, ret); EXPECT_EQ(false, ret);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -24,7 +24,6 @@
#include "unit_tests/fixtures/context_fixture.h" #include "unit_tests/fixtures/context_fixture.h"
#include "unit_tests/mocks/mock_kernel.h" #include "unit_tests/mocks/mock_kernel.h"
#include "unit_tests/mocks/mock_buffer.h" #include "unit_tests/mocks/mock_buffer.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "test.h" #include "test.h"
@@ -32,7 +31,7 @@ namespace OCLRT {
using namespace SplitDispatch; using namespace SplitDispatch;
class DispatchInfoBuilderFixture : public ContextFixture, public DeviceFixture, public MemoryManagementFixture { class DispatchInfoBuilderFixture : public ContextFixture, public DeviceFixture {
using ContextFixture::SetUp; using ContextFixture::SetUp;
public: public:
@@ -42,8 +41,7 @@ class DispatchInfoBuilderFixture : public ContextFixture, public DeviceFixture,
} }
protected: protected:
void SetUp() override { void SetUp() {
MemoryManagementFixture::SetUp();
DeviceFixture::SetUp(); DeviceFixture::SetUp();
cl_device_id device = pDevice; cl_device_id device = pDevice;
ContextFixture::SetUp(1, &device); ContextFixture::SetUp(1, &device);
@@ -102,7 +100,6 @@ class DispatchInfoBuilderFixture : public ContextFixture, public DeviceFixture,
ContextFixture::TearDown(); ContextFixture::TearDown();
DeviceFixture::TearDown(); DeviceFixture::TearDown();
MemoryManagementFixture::TearDown();
} }
KernelInfo *pKernelInfo = nullptr; KernelInfo *pKernelInfo = nullptr;

View File

@@ -24,7 +24,6 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "unit_tests/mocks/mock_kernel.h" #include "unit_tests/mocks/mock_kernel.h"
#include "unit_tests/fixtures/context_fixture.h" #include "unit_tests/fixtures/context_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/image_fixture.h" #include "unit_tests/fixtures/image_fixture.h"
#include <type_traits> #include <type_traits>
@@ -33,15 +32,14 @@
using namespace OCLRT; using namespace OCLRT;
class DispatchInfoFixture : public ContextFixture, public DeviceFixture, public MemoryManagementFixture { class DispatchInfoFixture : public ContextFixture, public DeviceFixture {
using ContextFixture::SetUp; using ContextFixture::SetUp;
public: public:
DispatchInfoFixture() {} DispatchInfoFixture() {}
protected: protected:
void SetUp() override { void SetUp() {
MemoryManagementFixture::SetUp();
DeviceFixture::SetUp(); DeviceFixture::SetUp();
cl_device_id device = pDevice; cl_device_id device = pDevice;
ContextFixture::SetUp(1, &device); ContextFixture::SetUp(1, &device);
@@ -67,7 +65,6 @@ class DispatchInfoFixture : public ContextFixture, public DeviceFixture, public
ContextFixture::TearDown(); ContextFixture::TearDown();
DeviceFixture::TearDown(); DeviceFixture::TearDown();
MemoryManagementFixture::TearDown();
} }
KernelInfo *pKernelInfo = nullptr; KernelInfo *pKernelInfo = nullptr;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -30,7 +30,6 @@
#include "runtime/memory_manager/svm_memory_manager.h" #include "runtime/memory_manager/svm_memory_manager.h"
#include "unit_tests/fixtures/context_fixture.h" #include "unit_tests/fixtures/context_fixture.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/fixtures/image_fixture.h" #include "unit_tests/fixtures/image_fixture.h"
#include "test.h" #include "test.h"
#include "unit_tests/mocks/mock_sampler.h" #include "unit_tests/mocks/mock_sampler.h"
@@ -45,7 +44,7 @@
using namespace OCLRT; using namespace OCLRT;
class CloneKernelFixture : public ContextFixture, public DeviceFixture, public MemoryManagementFixture { class CloneKernelFixture : public ContextFixture, public DeviceFixture {
using ContextFixture::SetUp; using ContextFixture::SetUp;
public: public:
@@ -53,8 +52,7 @@ class CloneKernelFixture : public ContextFixture, public DeviceFixture, public M
} }
protected: protected:
void SetUp() override { void SetUp() {
MemoryManagementFixture::SetUp();
DeviceFixture::SetUp(); DeviceFixture::SetUp();
cl_device_id device = pDevice; cl_device_id device = pDevice;
ContextFixture::SetUp(1, &device); ContextFixture::SetUp(1, &device);
@@ -117,7 +115,6 @@ class CloneKernelFixture : public ContextFixture, public DeviceFixture, public M
delete pProgram; delete pProgram;
ContextFixture::TearDown(); ContextFixture::TearDown();
DeviceFixture::TearDown(); DeviceFixture::TearDown();
MemoryManagementFixture::TearDown();
} }
cl_int retVal = CL_SUCCESS; cl_int retVal = CL_SUCCESS;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -26,7 +26,6 @@
#include "runtime/mem_obj/buffer.h" #include "runtime/mem_obj/buffer.h"
#include "unit_tests/fixtures/context_fixture.h" #include "unit_tests/fixtures/context_fixture.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "test.h" #include "test.h"
#include "unit_tests/mocks/mock_buffer.h" #include "unit_tests/mocks/mock_buffer.h"
#include "unit_tests/mocks/mock_context.h" #include "unit_tests/mocks/mock_context.h"
@@ -40,7 +39,6 @@
using namespace OCLRT; using namespace OCLRT;
void KernelArgBufferFixture::SetUp() { void KernelArgBufferFixture::SetUp() {
MemoryManagementFixture::SetUp();
DeviceFixture::SetUp(); DeviceFixture::SetUp();
cl_device_id device = pDevice; cl_device_id device = pDevice;
ContextFixture::SetUp(1, &device); ContextFixture::SetUp(1, &device);
@@ -78,5 +76,4 @@ void KernelArgBufferFixture::TearDown() {
delete pProgram; delete pProgram;
ContextFixture::TearDown(); ContextFixture::TearDown();
DeviceFixture::TearDown(); DeviceFixture::TearDown();
MemoryManagementFixture::TearDown();
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -26,7 +26,6 @@
#include "runtime/mem_obj/buffer.h" #include "runtime/mem_obj/buffer.h"
#include "unit_tests/fixtures/context_fixture.h" #include "unit_tests/fixtures/context_fixture.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "test.h" #include "test.h"
#include "unit_tests/mocks/mock_buffer.h" #include "unit_tests/mocks/mock_buffer.h"
#include "unit_tests/mocks/mock_context.h" #include "unit_tests/mocks/mock_context.h"
@@ -38,7 +37,7 @@
using namespace OCLRT; using namespace OCLRT;
class KernelArgBufferFixture : public ContextFixture, public DeviceFixture, public MemoryManagementFixture { class KernelArgBufferFixture : public ContextFixture, public DeviceFixture {
using ContextFixture::SetUp; using ContextFixture::SetUp;
@@ -48,8 +47,8 @@ class KernelArgBufferFixture : public ContextFixture, public DeviceFixture, publ
} }
protected: protected:
void SetUp() override; void SetUp();
void TearDown() override; void TearDown();
cl_int retVal; cl_int retVal;
MockProgram *pProgram; MockProgram *pProgram;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -26,7 +26,6 @@
#include "runtime/mem_obj/buffer.h" #include "runtime/mem_obj/buffer.h"
#include "unit_tests/fixtures/context_fixture.h" #include "unit_tests/fixtures/context_fixture.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/mocks/mock_buffer.h" #include "unit_tests/mocks/mock_buffer.h"
#include "unit_tests/mocks/mock_context.h" #include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_kernel.h" #include "unit_tests/mocks/mock_kernel.h"
@@ -38,7 +37,7 @@
using namespace OCLRT; using namespace OCLRT;
class KernelArgSvmFixture_ : public ContextFixture, public DeviceFixture, public MemoryManagementFixture { class KernelArgSvmFixture_ : public ContextFixture, public DeviceFixture {
using ContextFixture::SetUp; using ContextFixture::SetUp;
@@ -47,8 +46,7 @@ class KernelArgSvmFixture_ : public ContextFixture, public DeviceFixture, public
} }
protected: protected:
void SetUp() override { void SetUp() {
MemoryManagementFixture::SetUp();
DeviceFixture::SetUp(); DeviceFixture::SetUp();
cl_device_id device = pDevice; cl_device_id device = pDevice;
ContextFixture::SetUp(1, &device); ContextFixture::SetUp(1, &device);
@@ -84,7 +82,6 @@ class KernelArgSvmFixture_ : public ContextFixture, public DeviceFixture, public
delete pProgram; delete pProgram;
ContextFixture::TearDown(); ContextFixture::TearDown();
DeviceFixture::TearDown(); DeviceFixture::TearDown();
MemoryManagementFixture::TearDown();
} }
cl_int retVal = CL_SUCCESS; cl_int retVal = CL_SUCCESS;

View File

@@ -286,16 +286,13 @@ INSTANTIATE_TEST_CASE_P(KernelTests,
::testing::ValuesIn(BinaryFileNames), ::testing::ValuesIn(BinaryFileNames),
::testing::ValuesIn(KernelNames))); ::testing::ValuesIn(KernelNames)));
class KernelFromBinaryTest : public ProgramSimpleFixture, class KernelFromBinaryTest : public ProgramSimpleFixture {
public MemoryManagementFixture {
public: public:
void SetUp() override { void SetUp() override {
MemoryManagementFixture::SetUp();
ProgramSimpleFixture::SetUp(); ProgramSimpleFixture::SetUp();
} }
void TearDown() override { void TearDown() override {
ProgramSimpleFixture::TearDown(); ProgramSimpleFixture::TearDown();
MemoryManagementFixture::TearDown();
} }
}; };
typedef Test<KernelFromBinaryTest> KernelFromBinaryTests; typedef Test<KernelFromBinaryTest> KernelFromBinaryTests;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -23,8 +23,6 @@
#include "runtime/helpers/ptr_math.h" #include "runtime/helpers/ptr_math.h"
#include "runtime/mem_obj/buffer.h" #include "runtime/mem_obj/buffer.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/helpers/memory_management.h"
#include "unit_tests/mocks/mock_buffer.h" #include "unit_tests/mocks/mock_buffer.h"
#include "unit_tests/mocks/mock_context.h" #include "unit_tests/mocks/mock_context.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@@ -36,7 +34,6 @@ namespace ULT {
static const unsigned int sizeTestBufferInBytes = 32; static const unsigned int sizeTestBufferInBytes = 32;
class SubBufferTest : public DeviceFixture, class SubBufferTest : public DeviceFixture,
public MemoryManagementFixture,
public ::testing::Test { public ::testing::Test {
public: public:
SubBufferTest() { SubBufferTest() {

View File

@@ -25,7 +25,6 @@
#include "runtime/os_interface/device_factory.h" #include "runtime/os_interface/device_factory.h"
#include "runtime/os_interface/os_library.h" #include "runtime/os_interface/os_library.h"
#include "runtime/memory_manager/memory_constants.h" #include "runtime/memory_manager/memory_constants.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/helpers/debug_manager_state_restore.h" #include "unit_tests/helpers/debug_manager_state_restore.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@@ -33,17 +32,14 @@ using namespace OCLRT;
OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSystemInfo); OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSystemInfo);
struct DeviceFactoryTest : public MemoryManagementFixture, struct DeviceFactoryTest : public ::testing::Test {
public ::testing::Test {
public: public:
void SetUp() override { void SetUp() override {
const HardwareInfo hwInfo = *platformDevices[0]; const HardwareInfo hwInfo = *platformDevices[0];
mockGdiDll = setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo); mockGdiDll = setAdapterInfo(hwInfo.pPlatform, hwInfo.pSysInfo);
MemoryManagementFixture::SetUp();
} }
void TearDown() override { void TearDown() override {
MemoryManagementFixture::TearDown();
delete mockGdiDll; delete mockGdiDll;
} }

View File

@@ -30,28 +30,13 @@
#include "runtime/os_interface/linux/drm_command_stream.h" #include "runtime/os_interface/linux/drm_command_stream.h"
#include "hw_cmds.h" #include "hw_cmds.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "test.h" #include "test.h"
#include "unit_tests/os_interface/linux/device_command_stream_fixture.h" #include "unit_tests/os_interface/linux/device_command_stream_fixture.h"
using namespace OCLRT; using namespace OCLRT;
class DeviceCommandStreamLeaksFixture : public DeviceFixture, typedef Test<DeviceFixture> DeviceCommandStreamLeaksTest;
public MemoryManagementFixture {
public:
void SetUp() override {
DeviceFixture::SetUp();
MemoryManagementFixture::SetUp();
}
void TearDown() override {
MemoryManagementFixture::TearDown();
DeviceFixture::TearDown();
}
};
typedef Test<DeviceCommandStreamLeaksFixture> DeviceCommandStreamLeaksTest;
HWTEST_F(DeviceCommandStreamLeaksTest, Create) { HWTEST_F(DeviceCommandStreamLeaksTest, Create) {
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false)); std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(*platformDevices[0], false));

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -27,7 +27,6 @@
#include "runtime/os_interface/device_factory.h" #include "runtime/os_interface/device_factory.h"
#include "unit_tests/mocks/mock_device_factory.h" #include "unit_tests/mocks/mock_device_factory.h"
#include "unit_tests/os_interface/linux/drm_mock.h" #include "unit_tests/os_interface/linux/drm_mock.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/gen_common/test.h" #include "unit_tests/gen_common/test.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
@@ -38,11 +37,8 @@ void popDrmMock();
using namespace OCLRT; using namespace OCLRT;
struct DeviceFactoryLinuxTest : public MemoryManagementFixture, struct DeviceFactoryLinuxTest : public ::testing::Test {
public ::testing::Test {
void SetUp() override { void SetUp() override {
MemoryManagementFixture::SetUp();
pDrm = new Drm2; pDrm = new Drm2;
pDrm->setGtType(GTTYPE_GT2); pDrm->setGtType(GTTYPE_GT2);
pushDrmMock(pDrm); pushDrmMock(pDrm);
@@ -51,8 +47,6 @@ struct DeviceFactoryLinuxTest : public MemoryManagementFixture,
void TearDown() override { void TearDown() override {
popDrmMock(); popDrmMock();
delete pDrm; delete pDrm;
MemoryManagementFixture::TearDown();
} }
Drm2 *pDrm; Drm2 *pDrm;

View File

@@ -22,7 +22,6 @@
#include "runtime/os_interface/32bit_memory.h" #include "runtime/os_interface/32bit_memory.h"
#include "runtime/os_interface/linux/drm_buffer_object.h" #include "runtime/os_interface/linux/drm_buffer_object.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/os_interface/linux/device_command_stream_fixture.h" #include "unit_tests/os_interface/linux/device_command_stream_fixture.h"
#include "drm/i915_drm.h" #include "drm/i915_drm.h"
#include "test.h" #include "test.h"
@@ -48,14 +47,13 @@ class TestedBufferObject : public BufferObject {
drm_i915_gem_exec_object2 *execObjectPointerFilled = nullptr; drm_i915_gem_exec_object2 *execObjectPointerFilled = nullptr;
}; };
class DrmBufferObjectFixture : public MemoryManagementFixture { class DrmBufferObjectFixture {
public: public:
DrmMockCustom *mock; DrmMockCustom *mock;
TestedBufferObject *bo; TestedBufferObject *bo;
drm_i915_gem_exec_object2 execObjectsStorage[256]; drm_i915_gem_exec_object2 execObjectsStorage[256];
void SetUp() override { void SetUp() {
MemoryManagementFixture::SetUp();
this->mock = new DrmMockCustom; this->mock = new DrmMockCustom;
ASSERT_NE(nullptr, this->mock); ASSERT_NE(nullptr, this->mock);
bo = new TestedBufferObject(this->mock); bo = new TestedBufferObject(this->mock);
@@ -63,7 +61,7 @@ class DrmBufferObjectFixture : public MemoryManagementFixture {
bo->setExecObjectsStorage(execObjectsStorage); bo->setExecObjectsStorage(execObjectsStorage);
} }
void TearDown() override { void TearDown() {
delete bo; delete bo;
if (this->mock->ioctl_expected.total >= 0) { if (this->mock->ioctl_expected.total >= 0) {
EXPECT_EQ(this->mock->ioctl_expected.total, this->mock->ioctl_cnt.total); EXPECT_EQ(this->mock->ioctl_expected.total, this->mock->ioctl_cnt.total);
@@ -71,7 +69,6 @@ class DrmBufferObjectFixture : public MemoryManagementFixture {
delete this->mock; delete this->mock;
this->mock = nullptr; this->mock = nullptr;
MemoryManagementFixture::TearDown();
} }
}; };

View File

@@ -32,10 +32,8 @@
#include "runtime/os_interface/linux/drm_command_stream.h" #include "runtime/os_interface/linux/drm_command_stream.h"
#include "runtime/os_interface/linux/drm_memory_manager.h" #include "runtime/os_interface/linux/drm_memory_manager.h"
#include "runtime/os_interface/linux/os_interface.h" #include "runtime/os_interface/linux/os_interface.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/fixtures/device_fixture.h" #include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/helpers/debug_manager_state_restore.h" #include "unit_tests/helpers/debug_manager_state_restore.h"
#include "unit_tests/helpers/memory_management.h"
#include "unit_tests/gen_common/gen_cmd_parse_base.h" #include "unit_tests/gen_common/gen_cmd_parse_base.h"
#include "unit_tests/helpers/hw_parse.h" #include "unit_tests/helpers/hw_parse.h"
#include "unit_tests/mocks/mock_submissions_aggregator.h" #include "unit_tests/mocks/mock_submissions_aggregator.h"
@@ -696,7 +694,7 @@ HWTEST_F(DrmCsrVfeTests, givenNonDirtyVfeForBothPriorityContextWhenFlushedDefaul
/* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** /* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** ****
* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** * **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** ****
* **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */ * **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** */
class DrmCommandStreamEnhancedFixture : public MemoryManagementFixture class DrmCommandStreamEnhancedFixture
{ {
public: public:
@@ -705,8 +703,7 @@ class DrmCommandStreamEnhancedFixture : public MemoryManagementFixture
DrmMemoryManager *mm = nullptr; DrmMemoryManager *mm = nullptr;
DebugManagerStateRestore *dbgState; DebugManagerStateRestore *dbgState;
void SetUp() override { void SetUp() {
MemoryManagementFixture::SetUp();
this->dbgState = new DebugManagerStateRestore(); this->dbgState = new DebugManagerStateRestore();
//make sure this is disabled, we don't want test this now //make sure this is disabled, we don't want test this now
@@ -720,14 +717,12 @@ class DrmCommandStreamEnhancedFixture : public MemoryManagementFixture
ASSERT_NE(nullptr, mm); ASSERT_NE(nullptr, mm);
} }
void TearDown() override { void TearDown() {
//And close at destruction //And close at destruction
delete csr; delete csr;
delete mm; delete mm;
delete mock; delete mock;
delete dbgState; delete dbgState;
MemoryManagementFixture::TearDown();
} }
bool isResident(BufferObject *bo) { bool isResident(BufferObject *bo) {

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -36,8 +36,6 @@
#include "runtime/os_interface/linux/drm_command_stream.h" #include "runtime/os_interface/linux/drm_command_stream.h"
#include "runtime/os_interface/linux/drm_gem_close_worker.h" #include "runtime/os_interface/linux/drm_gem_close_worker.h"
#include "runtime/os_interface/linux/drm_memory_manager.h" #include "runtime/os_interface/linux/drm_memory_manager.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/helpers/memory_management.h"
#include "test.h" #include "test.h"
#include "unit_tests/os_interface/linux/device_command_stream_fixture.h" #include "unit_tests/os_interface/linux/device_command_stream_fixture.h"
@@ -66,7 +64,7 @@ class DrmMockForWorker : public Drm {
}; };
}; };
class DrmGemCloseWorkerFixture : public MemoryManagementFixture { class DrmGemCloseWorkerFixture {
public: public:
//max loop count for while //max loop count for while
static const uint32_t deadCntInit = 10 * 1000 * 1000; static const uint32_t deadCntInit = 10 * 1000 * 1000;
@@ -75,8 +73,7 @@ class DrmGemCloseWorkerFixture : public MemoryManagementFixture {
DrmMockForWorker *drmMock; DrmMockForWorker *drmMock;
uint32_t deadCnt = deadCntInit; uint32_t deadCnt = deadCntInit;
void SetUp() override { void SetUp() {
MemoryManagementFixture::SetUp();
this->drmMock = new DrmMockForWorker; this->drmMock = new DrmMockForWorker;
this->drmMock->gem_close_cnt = 0; this->drmMock->gem_close_cnt = 0;
@@ -85,7 +82,7 @@ class DrmGemCloseWorkerFixture : public MemoryManagementFixture {
this->mm = new DrmMemoryManager(this->drmMock, gemCloseWorkerMode::gemCloseWorkerConsumingCommandBuffers, false, false); this->mm = new DrmMemoryManager(this->drmMock, gemCloseWorkerMode::gemCloseWorkerConsumingCommandBuffers, false, false);
} }
void TearDown() override { void TearDown() {
if (this->drmMock->gem_close_expected >= 0) { if (this->drmMock->gem_close_expected >= 0) {
EXPECT_EQ(this->drmMock->gem_close_expected, this->drmMock->gem_close_cnt); EXPECT_EQ(this->drmMock->gem_close_expected, this->drmMock->gem_close_cnt);
} }
@@ -93,7 +90,6 @@ class DrmGemCloseWorkerFixture : public MemoryManagementFixture {
delete this->mm; delete this->mm;
delete this->drmMock; delete this->drmMock;
this->drmMock = nullptr; this->drmMock = nullptr;
MemoryManagementFixture::TearDown();
} }
protected: protected:

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -103,7 +103,6 @@ TEST_F(OSLibraryTest, testFailNew) {
// Make sure that we only have 1 buffer allocated at a time // Make sure that we only have 1 buffer allocated at a time
delete library; delete library;
library = nullptr;
}; };
injectFailures(method); injectFailures(method);
} }

View File

@@ -33,7 +33,6 @@ using namespace OCLRT;
using namespace ::testing; using namespace ::testing;
void WddmMemoryManagerFixture::SetUp() { void WddmMemoryManagerFixture::SetUp() {
MemoryManagementFixture::SetUp();
WddmFixture::SetUp(); WddmFixture::SetUp();
ASSERT_NE(nullptr, wddm); ASSERT_NE(nullptr, wddm);
if (platformDevices[0]->capabilityTable.ftrCompression) { if (platformDevices[0]->capabilityTable.ftrCompression) {

View File

@@ -26,7 +26,6 @@
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "test.h" #include "test.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/mocks/mock_context.h" #include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_gmm_page_table_mngr.h" #include "unit_tests/mocks/mock_gmm_page_table_mngr.h"
#include "unit_tests/mocks/mock_gmm.h" #include "unit_tests/mocks/mock_gmm.h"
@@ -37,7 +36,7 @@
using namespace OCLRT; using namespace OCLRT;
using namespace ::testing; using namespace ::testing;
class WddmMemoryManagerFixture : public MemoryManagementFixture, public WddmFixture { class WddmMemoryManagerFixture : public WddmFixture {
public: public:
WddmMemoryManager *memoryManager = nullptr; WddmMemoryManager *memoryManager = nullptr;
@@ -63,7 +62,6 @@ class WddmMemoryManagerFixture : public MemoryManagementFixture, public WddmFixt
delete memoryManager; delete memoryManager;
this->wddm = nullptr; this->wddm = nullptr;
WddmFixture::TearDown(); WddmFixture::TearDown();
MemoryManagementFixture::TearDown();
} }
}; };

View File

@@ -1310,16 +1310,13 @@ TEST_P(ProgramFromSourceTest, CreateWithSource_CreateLibrary) {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Program:: (PatchToken) // Program:: (PatchToken)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class PatchTokenFromBinaryTest : public ProgramSimpleFixture, class PatchTokenFromBinaryTest : public ProgramSimpleFixture {
public MemoryManagementFixture {
public: public:
void SetUp() override { void SetUp() override {
MemoryManagementFixture::SetUp();
ProgramSimpleFixture::SetUp(); ProgramSimpleFixture::SetUp();
} }
void TearDown() override { void TearDown() override {
ProgramSimpleFixture::TearDown(); ProgramSimpleFixture::TearDown();
MemoryManagementFixture::TearDown();
} }
}; };
typedef Test<PatchTokenFromBinaryTest> PatchTokenTests; typedef Test<PatchTokenFromBinaryTest> PatchTokenTests;
@@ -1548,16 +1545,13 @@ TEST_F(PatchTokenTests, VmeKernelArg) {
delete pKernel; delete pKernel;
} }
class ProgramPatchTokenFromBinaryTest : public ProgramSimpleFixture, class ProgramPatchTokenFromBinaryTest : public ProgramSimpleFixture {
public MemoryManagementFixture {
public: public:
void SetUp() override { void SetUp() override {
MemoryManagementFixture::SetUp();
ProgramSimpleFixture::SetUp(); ProgramSimpleFixture::SetUp();
} }
void TearDown() override { void TearDown() override {
ProgramSimpleFixture::TearDown(); ProgramSimpleFixture::TearDown();
MemoryManagementFixture::TearDown();
} }
}; };
typedef Test<ProgramPatchTokenFromBinaryTest> ProgramPatchTokenTests; typedef Test<ProgramPatchTokenFromBinaryTest> ProgramPatchTokenTests;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, Intel Corporation * Copyright (c) 2017 - 2018, Intel Corporation
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -23,38 +23,31 @@
#include "runtime/sampler/sampler.h" #include "runtime/sampler/sampler.h"
#include "unit_tests/mocks/mock_context.h" #include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_sampler.h" #include "unit_tests/mocks/mock_sampler.h"
#include "unit_tests/fixtures/device_fixture.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "patch_list.h" #include "patch_list.h"
#include <tuple> #include <tuple>
using namespace OCLRT; using namespace OCLRT;
struct CreateSampler : public MemoryManagementFixture, struct CreateSampler : public ::testing::TestWithParam<
public ::testing::TestWithParam<
std::tuple<uint32_t /*cl_bool*/, uint32_t /*cl_addressing_mode*/, uint32_t /*cl_filter_mode*/>> { std::tuple<uint32_t /*cl_bool*/, uint32_t /*cl_addressing_mode*/, uint32_t /*cl_filter_mode*/>> {
CreateSampler() { CreateSampler() {
} }
void SetUp() override { void SetUp() override {
MemoryManagementFixture::SetUp();
std::tie(normalizedCoords, addressingMode, filterMode) = GetParam(); std::tie(normalizedCoords, addressingMode, filterMode) = GetParam();
context = new MockContext(); context = new MockContext();
} }
void TearDown() override { void TearDown() override {
delete context; delete context;
MemoryManagementFixture::TearDown();
} }
// clang-format off MockContext *context;
MockContext * context; cl_int retVal = CL_INVALID_VALUE;
cl_int retVal = CL_INVALID_VALUE; cl_bool normalizedCoords;
cl_bool normalizedCoords;
cl_addressing_mode addressingMode; cl_addressing_mode addressingMode;
cl_filter_mode filterMode; cl_filter_mode filterMode;
// clang-format on
}; };
TEST_P(CreateSampler, shouldReturnSuccess) { TEST_P(CreateSampler, shouldReturnSuccess) {
@@ -77,12 +70,10 @@ TEST_P(CreateSampler, shouldPropagateSamplerState) {
filterMode); filterMode);
ASSERT_NE(nullptr, sampler); ASSERT_NE(nullptr, sampler);
// clang-format off EXPECT_EQ(context, sampler->getContext());
EXPECT_EQ(context, sampler->getContext());
EXPECT_EQ(normalizedCoords, sampler->getNormalizedCoordinates()); EXPECT_EQ(normalizedCoords, sampler->getNormalizedCoordinates());
EXPECT_EQ(addressingMode, sampler->getAddressingMode()); EXPECT_EQ(addressingMode, sampler->getAddressingMode());
EXPECT_EQ(filterMode, sampler->getFilterMode()); EXPECT_EQ(filterMode, sampler->getFilterMode());
// clang-format on
//check for SnapWA //check for SnapWA
bool snapWaNeeded = addressingMode == CL_ADDRESS_CLAMP && filterMode == CL_FILTER_NEAREST; bool snapWaNeeded = addressingMode == CL_ADDRESS_CLAMP && filterMode == CL_FILTER_NEAREST;