Cleanup command stream receiver tests 1/n

cmd parse tests
aub subcapture tests
aub command stream receiver tests
aub command stream receiver fixture
mock aub subcapture manager

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-12-20 18:16:04 +00:00
committed by Compute-Runtime-Automation
parent 7680331b4a
commit ab4640635d
9 changed files with 41 additions and 75 deletions

View File

@@ -22,10 +22,7 @@
#include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h" #include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h"
#include "opencl/test/unit_test/fixtures/aub_command_stream_receiver_fixture.h" #include "opencl/test/unit_test/fixtures/aub_command_stream_receiver_fixture.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/mocks/mock_aub_subcapture_manager.h" #include "opencl/test/unit_test/mocks/mock_aub_subcapture_manager.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
#include "opencl/test/unit_test/mocks/mock_mdi.h"
#include "opencl/test/unit_test/mocks/mock_os_context.h" #include "opencl/test/unit_test/mocks/mock_os_context.h"
using namespace NEO; using namespace NEO;

View File

@@ -24,16 +24,9 @@
#include "shared/test/common/test_macros/test.h" #include "shared/test/common/test_macros/test.h"
#include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h" #include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h"
#include "opencl/source/mem_obj/mem_obj_helper.h"
#include "opencl/source/platform/platform.h"
#include "opencl/test/unit_test/fixtures/aub_command_stream_receiver_fixture.h" #include "opencl/test/unit_test/fixtures/aub_command_stream_receiver_fixture.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/mocks/mock_aub_subcapture_manager.h" #include "opencl/test/unit_test/mocks/mock_aub_subcapture_manager.h"
#include "opencl/test/unit_test/mocks/mock_command_queue.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
#include "opencl/test/unit_test/mocks/mock_mdi.h"
#include "opencl/test/unit_test/mocks/mock_os_context.h" #include "opencl/test/unit_test/mocks/mock_os_context.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
#include "third_party/aub_stream/headers/aubstream.h" #include "third_party/aub_stream/headers/aubstream.h"
@@ -584,12 +577,12 @@ class OsAgnosticMemoryManagerForImagesWithNoHostPtr : public OsAgnosticMemoryMan
using AubCommandStreamReceiverNoHostPtrTests = ::testing::Test; using AubCommandStreamReceiverNoHostPtrTests = ::testing::Test;
HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledOnImageWithNoHostPtrThenResourceShouldBeLockedToGetCpuAddress) { HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledOnImageWithNoHostPtrThenResourceShouldBeLockedToGetCpuAddress) {
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment(); ExecutionEnvironment *executionEnvironment = new MockExecutionEnvironment();
auto memoryManager = new OsAgnosticMemoryManagerForImagesWithNoHostPtr(*executionEnvironment); auto memoryManager = new OsAgnosticMemoryManagerForImagesWithNoHostPtr(*executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager); executionEnvironment->memoryManager.reset(memoryManager);
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
auto engineInstance = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; auto engineInstance = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
UltDeviceFactory deviceFactory{1, 0}; UltDeviceFactory deviceFactory{1, 0, *executionEnvironment};
DeviceBitfield deviceBitfield(1); DeviceBitfield deviceBitfield(1);
MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor(engineInstance, deviceBitfield)); MockOsContext osContext(0, EngineDescriptorHelper::getDefaultDescriptor(engineInstance, deviceBitfield));
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *executionEnvironment, 0, deviceBitfield)); std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *executionEnvironment, 0, deviceBitfield));
@@ -603,8 +596,8 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh
auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr); auto imgInfo = MockGmm::initImgInfo(imgDesc, 0, nullptr);
auto memoryProperties = ClMemoryPropertiesHelper::createMemoryProperties(0, 0, 0, deviceFactory.rootDevices[0]); AllocationProperties allocProperties{0u /* rootDeviceIndex */, true /* allocateMemory */,
AllocationProperties allocProperties = MemObjHelper::getAllocationPropertiesWithImageInfo(aubCsr->getRootDeviceIndex(), imgInfo, true, memoryProperties, *hwInfo, osContext.getDeviceBitfield(), true); imgInfo, GraphicsAllocation::AllocationType::IMAGE, deviceBitfield};
auto imageAllocation = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr); auto imageAllocation = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
ASSERT_NE(nullptr, imageAllocation); ASSERT_NE(nullptr, imageAllocation);
@@ -621,7 +614,7 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh
} }
HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledOnLockedResourceThenResourceShouldNotBeUnlocked) { HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledOnLockedResourceThenResourceShouldNotBeUnlocked) {
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment(); auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
auto memoryManager = new OsAgnosticMemoryManagerForImagesWithNoHostPtr(*executionEnvironment); auto memoryManager = new OsAgnosticMemoryManagerForImagesWithNoHostPtr(*executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager); executionEnvironment->memoryManager.reset(memoryManager);
DeviceBitfield deviceBitfield(1); DeviceBitfield deviceBitfield(1);
@@ -856,7 +849,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineI
EXPECT_NE(0u, aubCsr->handle); EXPECT_NE(0u, aubCsr->handle);
} }
using InjectMmmioTest = Test<ClDeviceFixture>; using InjectMmmioTest = Test<DeviceFixture>;
HWTEST_F(InjectMmmioTest, givenAddMmioKeySetToZeroWhenInitAdditionalMmioCalledThenDoNotWriteMmio) { HWTEST_F(InjectMmmioTest, givenAddMmioKeySetToZeroWhenInitAdditionalMmioCalledThenDoNotWriteMmio) {
DebugManagerStateRestore stateRestore; DebugManagerStateRestore stateRestore;

View File

@@ -12,6 +12,7 @@
#include "shared/source/memory_manager/memory_pool.h" #include "shared/source/memory_manager/memory_pool.h"
#include "shared/source/os_interface/device_factory.h" #include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/os_context.h" #include "shared/source/os_interface/os_context.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h" #include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/helpers/hw_helper_tests.h" #include "shared/test/common/helpers/hw_helper_tests.h"
@@ -22,32 +23,27 @@
#include "shared/test/common/mocks/mock_graphics_allocation.h" #include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/test_macros/test.h" #include "shared/test/common/test_macros/test.h"
#include "opencl/source/helpers/cl_memory_properties_helpers.h"
#include "opencl/source/mem_obj/buffer.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_os_context.h" #include "opencl/test/unit_test/mocks/mock_os_context.h"
#include "opencl/test/unit_test/mocks/mock_platform.h"
#include <set> #include <set>
#include <vector> #include <vector>
using namespace NEO; using namespace NEO;
struct XeHPAndLaterAubCommandStreamReceiverTests : ClDeviceFixture, ::testing::Test { struct XeHPAndLaterAubCommandStreamReceiverTests : DeviceFixture, ::testing::Test {
template <typename FamilyType> template <typename FamilyType>
void setUpImpl() { void setUpImpl() {
hardwareInfo = *defaultHwInfo; hardwareInfo = *defaultHwInfo;
hardwareInfoSetup[hardwareInfo.platform.eProductFamily](&hardwareInfo, true, 0); hardwareInfoSetup[hardwareInfo.platform.eProductFamily](&hardwareInfo, true, 0);
hardwareInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true; hardwareInfo.gtSystemInfo.MultiTileArchInfo.IsValid = true;
ClDeviceFixture::SetUpImpl(&hardwareInfo); DeviceFixture::SetUpImpl(&hardwareInfo);
} }
void SetUp() override { void SetUp() override {
} }
void TearDown() override { void TearDown() override {
ClDeviceFixture::TearDown(); DeviceFixture::TearDown();
} }
}; };
@@ -378,4 +374,4 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterAubCommandStreamReceiverTests2, givenLo
AubGTTData data = {false, false}; AubGTTData data = {false, false};
aubCsr->getGTTData(nullptr, data); aubCsr->getGTTData(nullptr, data);
EXPECT_TRUE(data.localMemory); EXPECT_TRUE(data.localMemory);
} }

View File

@@ -6,33 +6,26 @@
*/ */
#include "shared/source/aub/aub_subcapture.h" #include "shared/source/aub/aub_subcapture.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/test.h" #include "shared/test/common/test_macros/test.h"
#include "opencl/source/helpers/dispatch_info.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
#include "opencl/test/unit_test/mocks/mock_aub_subcapture_manager.h" #include "opencl/test/unit_test/mocks/mock_aub_subcapture_manager.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
#include "opencl/test/unit_test/mocks/mock_program.h"
using namespace NEO; using namespace NEO;
struct AubSubCaptureTest : public ClDeviceFixture, struct AubSubCaptureTest : public DeviceFixture,
public ::testing::Test { public ::testing::Test {
void SetUp() override { void SetUp() override {
ClDeviceFixture::SetUp(); DeviceFixture::SetUp();
program = std::make_unique<MockProgram>(toClDeviceVector(*pClDevice));
kernelInfo.kernelDescriptor.kernelMetadata.kernelName = "kernel_name";
dbgRestore = new DebugManagerStateRestore(); dbgRestore = new DebugManagerStateRestore();
} }
void TearDown() override { void TearDown() override {
ClDeviceFixture::TearDown(); DeviceFixture::TearDown();
delete dbgRestore; delete dbgRestore;
} }
static constexpr const char *kernelName = "kernel_name";
std::unique_ptr<MockProgram> program;
KernelInfo kernelInfo;
DebugManagerStateRestore *dbgRestore; DebugManagerStateRestore *dbgRestore;
AubSubCaptureCommon subCaptureCommon; AubSubCaptureCommon subCaptureCommon;
}; };
@@ -41,7 +34,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureToggleCaptureOnOff
struct AubSubCaptureManagerWithToggleActiveMock : public AubSubCaptureManager { struct AubSubCaptureManagerWithToggleActiveMock : public AubSubCaptureManager {
using AubSubCaptureManager::AubSubCaptureManager; using AubSubCaptureManager::AubSubCaptureManager;
using AubSubCaptureManager::isSubCaptureToggleActive; using AubSubCaptureManager::isSubCaptureToggleActive;
} aubSubCaptureManagerWithToggleActiveMock("", subCaptureCommon, oclRegPath); } aubSubCaptureManagerWithToggleActiveMock("", subCaptureCommon, "");
EXPECT_FALSE(aubSubCaptureManagerWithToggleActiveMock.isSubCaptureToggleActive()); EXPECT_FALSE(aubSubCaptureManagerWithToggleActiveMock.isSubCaptureToggleActive());
} }
@@ -50,7 +43,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerWhenSubCaptureToggleFileNameIsUn
struct AubSubCaptureManagerWithToggleFileNameMock : public AubSubCaptureManager { struct AubSubCaptureManagerWithToggleFileNameMock : public AubSubCaptureManager {
using AubSubCaptureManager::AubSubCaptureManager; using AubSubCaptureManager::AubSubCaptureManager;
using AubSubCaptureManager::getToggleFileName; using AubSubCaptureManager::getToggleFileName;
} aubSubCaptureManagerWithToggleFileNameMock("", subCaptureCommon, oclRegPath); } aubSubCaptureManagerWithToggleFileNameMock("", subCaptureCommon, "");
EXPECT_STREQ("", aubSubCaptureManagerWithToggleFileNameMock.getToggleFileName().c_str()); EXPECT_STREQ("", aubSubCaptureManagerWithToggleFileNameMock.getToggleFileName().c_str());
} }
@@ -156,7 +149,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate
AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon); AubSubCaptureManagerMock aubSubCaptureManager("", subCaptureCommon);
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter; subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelInfo.kernelDescriptor.kernelMetadata.kernelName); auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
EXPECT_TRUE(status.isActive); EXPECT_TRUE(status.isActive);
EXPECT_TRUE(aubSubCaptureManager.isSubCaptureActive()); EXPECT_TRUE(aubSubCaptureManager.isSubCaptureActive());
} }
@@ -166,7 +159,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter; subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
subCaptureCommon.subCaptureFilter.dumpKernelStartIdx = 0; subCaptureCommon.subCaptureFilter.dumpKernelStartIdx = 0;
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelInfo.kernelDescriptor.kernelMetadata.kernelName); auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
EXPECT_TRUE(status.isActive); EXPECT_TRUE(status.isActive);
EXPECT_FALSE(status.wasActiveInPreviousEnqueue); EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
} }
@@ -176,7 +169,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter; subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
subCaptureCommon.subCaptureFilter.dumpKernelStartIdx = 1; subCaptureCommon.subCaptureFilter.dumpKernelStartIdx = 1;
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelInfo.kernelDescriptor.kernelMetadata.kernelName); auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
EXPECT_FALSE(status.isActive); EXPECT_FALSE(status.isActive);
EXPECT_FALSE(status.wasActiveInPreviousEnqueue); EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
} }
@@ -187,7 +180,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter; subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
subCaptureCommon.subCaptureFilter.dumpKernelEndIdx = 0; subCaptureCommon.subCaptureFilter.dumpKernelEndIdx = 0;
subCaptureCommon.getKernelCurrentIndexAndIncrement(); subCaptureCommon.getKernelCurrentIndexAndIncrement();
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelInfo.kernelDescriptor.kernelMetadata.kernelName); auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
EXPECT_FALSE(status.isActive); EXPECT_FALSE(status.isActive);
EXPECT_FALSE(status.wasActiveInPreviousEnqueue); EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
} }
@@ -197,7 +190,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter; subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
subCaptureCommon.subCaptureFilter.dumpKernelName = "kernel_name"; subCaptureCommon.subCaptureFilter.dumpKernelName = "kernel_name";
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelInfo.kernelDescriptor.kernelMetadata.kernelName); auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
EXPECT_TRUE(status.isActive); EXPECT_TRUE(status.isActive);
EXPECT_FALSE(status.wasActiveInPreviousEnqueue); EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
} }
@@ -207,7 +200,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenCheckAndActivate
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter; subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
subCaptureCommon.subCaptureFilter.dumpKernelName = "invalid_kernel_name"; subCaptureCommon.subCaptureFilter.dumpKernelName = "invalid_kernel_name";
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelInfo.kernelDescriptor.kernelMetadata.kernelName); auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
EXPECT_FALSE(status.isActive); EXPECT_FALSE(status.isActive);
EXPECT_FALSE(status.wasActiveInPreviousEnqueue); EXPECT_FALSE(status.wasActiveInPreviousEnqueue);
} }
@@ -334,8 +327,8 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGetSubCaptureFil
aubSubCaptureManager.setToggleFileName(""); aubSubCaptureManager.setToggleFileName("");
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle; subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
std::string toggleFileName = aubSubCaptureManager.generateToggleFileName(kernelInfo.kernelDescriptor.kernelMetadata.kernelName); std::string toggleFileName = aubSubCaptureManager.generateToggleFileName(kernelName);
EXPECT_STREQ(toggleFileName.c_str(), aubSubCaptureManager.getSubCaptureFileName(kernelInfo.kernelDescriptor.kernelMetadata.kernelName).c_str()); EXPECT_STREQ(toggleFileName.c_str(), aubSubCaptureManager.getSubCaptureFileName(kernelName).c_str());
} }
TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGetSubCaptureFileNameIsCalledForEmptyDispatchInfoThenGenerateToggleFileNameWithoutKernelName) { TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGetSubCaptureFileNameIsCalledForEmptyDispatchInfoThenGenerateToggleFileNameWithoutKernelName) {
@@ -354,7 +347,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenGetSubCaptureFil
return "aubfile_filter.aub"; return "aubfile_filter.aub";
} }
mutable uint32_t generateFilterFileNameCount = 0; mutable uint32_t generateFilterFileNameCount = 0;
} aubSubCaptureManager("", subCaptureCommon, oclRegPath); } aubSubCaptureManager("", subCaptureCommon, "");
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter; subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
aubSubCaptureManager.getSubCaptureFileName("kernelName"); aubSubCaptureManager.getSubCaptureFileName("kernelName");
@@ -371,7 +364,7 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInToggleModeWhenGetSubCaptureFil
return "aubfile_toggle.aub"; return "aubfile_toggle.aub";
} }
mutable uint32_t generateToggleFileNameCount = 0; mutable uint32_t generateToggleFileNameCount = 0;
} aubSubCaptureManager("", subCaptureCommon, oclRegPath); } aubSubCaptureManager("", subCaptureCommon, "");
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle; subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Toggle;
aubSubCaptureManager.getSubCaptureFileName("kernelName"); aubSubCaptureManager.getSubCaptureFileName("kernelName");
@@ -435,15 +428,15 @@ TEST_F(AubSubCaptureTest, givenSubCaptureManagerInFilterModeWhenKernelNameIsSpec
subCaptureCommon.subCaptureFilter.dumpKernelName = kernelName; subCaptureCommon.subCaptureFilter.dumpKernelName = kernelName;
subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter; subCaptureCommon.subCaptureMode = AubSubCaptureManager::SubCaptureMode::Filter;
auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelInfo.kernelDescriptor.kernelMetadata.kernelName); auto status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
EXPECT_FALSE(status.isActive); EXPECT_FALSE(status.isActive);
EXPECT_FALSE(aubSubCaptureManager.isSubCaptureActive()); EXPECT_FALSE(aubSubCaptureManager.isSubCaptureActive());
status = aubSubCaptureManager.checkAndActivateSubCapture(kernelInfo.kernelDescriptor.kernelMetadata.kernelName); status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
EXPECT_TRUE(status.isActive); EXPECT_TRUE(status.isActive);
EXPECT_TRUE(aubSubCaptureManager.isSubCaptureActive()); EXPECT_TRUE(aubSubCaptureManager.isSubCaptureActive());
status = aubSubCaptureManager.checkAndActivateSubCapture(kernelInfo.kernelDescriptor.kernelMetadata.kernelName); status = aubSubCaptureManager.checkAndActivateSubCapture(kernelName);
EXPECT_FALSE(status.isActive); EXPECT_FALSE(status.isActive);
EXPECT_FALSE(aubSubCaptureManager.isSubCaptureActive()); EXPECT_FALSE(aubSubCaptureManager.isSubCaptureActive());
} }

View File

@@ -6,23 +6,12 @@
*/ */
#include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/test_macros/test.h" #include "shared/test/common/test_macros/test.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
using namespace NEO; using namespace NEO;
struct CommandParse using CommandParse = Test<DeviceFixture>;
: public ClDeviceFixture,
public ::testing::Test {
void SetUp() override {
ClDeviceFixture::SetUp();
}
void TearDown() override {
ClDeviceFixture::TearDown();
}
};
HWTEST_F(CommandParse, WhenGeneratingCommandBufferThenIsNotNull) { HWTEST_F(CommandParse, WhenGeneratingCommandBufferThenIsNotNull) {
typedef typename FamilyType::PARSE PARSE; typedef typename FamilyType::PARSE PARSE;

View File

@@ -7,20 +7,19 @@
#pragma once #pragma once
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h" #include "shared/test/unit_test/fixtures/mock_aub_center_fixture.h"
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
namespace NEO { namespace NEO {
struct AubCommandStreamReceiverFixture : public ClDeviceFixture, MockAubCenterFixture { struct AubCommandStreamReceiverFixture : public DeviceFixture, MockAubCenterFixture {
void SetUp() { void SetUp() {
ClDeviceFixture::SetUp(); DeviceFixture::SetUp();
MockAubCenterFixture::SetUp(); MockAubCenterFixture::SetUp();
setMockAubCenter(*pDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]); setMockAubCenter(*pDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]);
} }
void TearDown() { void TearDown() {
MockAubCenterFixture::TearDown(); MockAubCenterFixture::TearDown();
ClDeviceFixture::TearDown(); DeviceFixture::TearDown();
} }
}; };
} // namespace NEO } // namespace NEO

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2018-2020 Intel Corporation * Copyright (C) 2018-2021 Intel Corporation
* *
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
* *
@@ -8,14 +8,12 @@
#pragma once #pragma once
#include "shared/source/aub/aub_subcapture.h" #include "shared/source/aub/aub_subcapture.h"
#include "opencl/source/os_interface/ocl_reg_path.h"
using namespace NEO; using namespace NEO;
class AubSubCaptureManagerMock : public AubSubCaptureManager { class AubSubCaptureManagerMock : public AubSubCaptureManager {
public: public:
AubSubCaptureManagerMock(const std::string &fileName, AubSubCaptureCommon &subCaptureCommon) AubSubCaptureManagerMock(const std::string &fileName, AubSubCaptureCommon &subCaptureCommon)
: AubSubCaptureManager(fileName, subCaptureCommon, oclRegPath) {} : AubSubCaptureManager(fileName, subCaptureCommon, "") {}
void setSubCaptureIsActive(bool on) { void setSubCaptureIsActive(bool on) {
subCaptureIsActive = on; subCaptureIsActive = on;

View File

@@ -18,7 +18,7 @@ void DeviceFixture::SetUp() {
} }
void DeviceFixture::SetUpImpl(const NEO::HardwareInfo *hardwareInfo) { void DeviceFixture::SetUpImpl(const NEO::HardwareInfo *hardwareInfo) {
pDevice = MockDevice::createWithNewExecutionEnvironment<MockDevice>(hardwareInfo); pDevice = MockDevice::createWithNewExecutionEnvironment<MockDevice>(hardwareInfo, rootDeviceIndex);
ASSERT_NE(nullptr, pDevice); ASSERT_NE(nullptr, pDevice);
auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver(); auto &commandStreamReceiver = pDevice->getGpgpuCommandStreamReceiver();

View File

@@ -22,5 +22,6 @@ struct DeviceFixture {
volatile uint32_t *pTagMemory = nullptr; volatile uint32_t *pTagMemory = nullptr;
HardwareInfo hardwareInfo = {}; HardwareInfo hardwareInfo = {};
PLATFORM platformHelper = {}; PLATFORM platformHelper = {};
const uint32_t rootDeviceIndex = 0u;
}; };
} // namespace NEO } // namespace NEO