Move debugger to root device environment

Resolves: NEO-3857

Change-Id: I216ef0cfc4ed7e1ab67261378905c6c0ec40a17f
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2020-03-11 08:56:55 +01:00
committed by sys_ocldev
parent 7ded3e9906
commit 9cc4d6fba1
13 changed files with 36 additions and 42 deletions

View File

@ -40,7 +40,8 @@ class MockDeviceWithDebuggerActive : public MockDevice {
TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhenDeviceIsDestructedThenSourceLevelDebuggerIsNotified) {
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
auto gmock = new ::testing::NiceMock<GMockSourceLevelDebugger>(new MockOsLibrary);
executionEnvironment->debugger.reset(gmock);
executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(gmock);
auto device = std::make_unique<MockClDevice>(MockDevice::create<MockDeviceWithDebuggerActive>(executionEnvironment, 0u));
EXPECT_CALL(*gmock, notifyDeviceDestruction()).Times(1);
@ -48,7 +49,7 @@ TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhen
TEST(DeviceWithSourceLevelDebugger, givenDeviceWithSourceLevelDebuggerActiveWhenDeviceIsCreatedThenPreemptionIsDisabled) {
ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment();
executionEnvironment->debugger.reset(new MockActiveSourceLevelDebugger(new MockOsLibrary));
executionEnvironment->rootDeviceEnvironments[0]->debugger.reset(new MockActiveSourceLevelDebugger(new MockOsLibrary));
auto device = std::unique_ptr<MockDevice>(MockDevice::create<MockDeviceWithDebuggerActive>(executionEnvironment, 0u));
EXPECT_EQ(PreemptionMode::Disabled, device->getPreemptionMode());

View File

@ -53,7 +53,7 @@ TEST(SourceLevelDebugger, givenPlatformWhenItIsCreatedThenSourceLevelDebuggerIsC
MockPlatform platform(*executionEnvironment);
platform.initializeWithNewDevices();
EXPECT_NE(nullptr, executionEnvironment->debugger);
EXPECT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->debugger);
}
}
@ -527,7 +527,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryNotActiveWhenDeviceIsCreated
EXPECT_FALSE(interceptor.newDeviceCalled);
}
TEST(SourceLevelDebugger, givenTwoRootDevicesWhenSecondIsCreatedThenNotCreatingNewSourceLevelDebugger) {
TEST(SourceLevelDebugger, givenTwoRootDevicesWhenSecondIsCreatedThenCreatingNewSourceLevelDebugger) {
DebuggerLibraryRestorer restorer;
if (platformDevices[0]->capabilityTable.debuggerSupported) {
@ -548,11 +548,11 @@ TEST(SourceLevelDebugger, givenTwoRootDevicesWhenSecondIsCreatedThenNotCreatingN
interceptor.initCalled = false;
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
EXPECT_NE(nullptr, executionEnvironment->memoryManager);
EXPECT_FALSE(interceptor.initCalled);
EXPECT_TRUE(interceptor.initCalled);
}
}
TEST(SourceLevelDebugger, givenMultipleRootDevicesWhenTheyAreCreatedTheyAllReuseTheSameSourceLevelDebugger) {
TEST(SourceLevelDebugger, givenMultipleRootDevicesWhenTheyAreCreatedTheyUseDedicatedSourceLevelDebugger) {
DebuggerLibraryRestorer restorer;
if (platformDevices[0]->capabilityTable.debuggerSupported) {
@ -567,6 +567,6 @@ TEST(SourceLevelDebugger, givenMultipleRootDevicesWhenTheyAreCreatedTheyAllReuse
auto device1 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 0u));
auto sourceLevelDebugger = device1->getDebugger();
auto device2 = std::make_unique<MockClDevice>(Device::create<MockDevice>(executionEnvironment, 1u));
EXPECT_EQ(sourceLevelDebugger, device2->getDebugger());
EXPECT_NE(sourceLevelDebugger, device2->getDebugger());
}
}