fix: Correct debugger and SIP init logic

Initialize debugger and SIP kernel explicitly once during root-device init.

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski
2024-07-05 03:26:37 +00:00
committed by Compute-Runtime-Automation
parent 783ceec1c8
commit 922286633b
4 changed files with 54 additions and 6 deletions

View File

@@ -1541,9 +1541,9 @@ TEST_F(DeviceTests, GivenDebuggingEnabledWhenDeviceIsInitializedThenL0DebuggerIs
EXPECT_NE(nullptr, device->getL0Debugger());
}
extern bool forceCreateNullptrDebugger;
TEST_F(DeviceTests, givenDebuggerRequestedByUserAndNotAvailableWhenDeviceIsInitializedThenErrorIsPrintedButNotReturned) {
extern bool forceCreateNullptrDebugger;
VariableBackup backupForceCreateNullptrDebugger{&forceCreateNullptrDebugger, true};
DebugManagerStateRestore restorer;
@@ -1558,3 +1558,15 @@ TEST_F(DeviceTests, givenDebuggerRequestedByUserAndNotAvailableWhenDeviceIsIniti
EXPECT_EQ(std::string("Debug mode is not enabled in the system.\n"), output);
EXPECT_EQ(nullptr, device->getL0Debugger());
}
TEST_F(DeviceTests, givenDebuggerRequestedByUserWhenDeviceWithSubDevicesCreatedThenInitializeDebuggerOncePerRootDevice) {
extern size_t createDebuggerCallCount;
createDebuggerCallCount = 0;
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(defaultHwInfo.get(), 0u);
executionEnvironment->setDebuggingMode(DebuggingMode::online);
UltDeviceFactory deviceFactory{1, 4, *executionEnvironment};
EXPECT_EQ(1u, createDebuggerCallCount);
EXPECT_NE(nullptr, deviceFactory.rootDevices[0]->getL0Debugger());
}