@@ -271,5 +271,33 @@ TEST_F(TwoSubDevicesDebuggerEnabledTest, givenDebuggingEnabledWhenSubDevicesAreC
271271 EXPECT_EQ (deviceL0->getDebugSurface (), subDevice0->getDebugSurface ());
272272}
273273
274+ TEST (Debugger, GivenLegacyDebuggerAndProgramDebuggingEnabledWhenInitializingDriverThenAbortIsCalledAfterPrintingError) {
275+ DebugManagerStateRestore restorer;
276+ NEO::DebugManager.flags .PrintDebugMessages .set (1 );
277+
278+ ::testing::internal::CaptureStderr ();
279+ auto executionEnvironment = new NEO::ExecutionEnvironment ();
280+ executionEnvironment->prepareRootDeviceEnvironments (1 );
281+
282+ executionEnvironment->rootDeviceEnvironments [0 ]->debugger .reset (new MockSourceLevelDebugger ());
283+ auto hwInfo = *NEO::defaultHwInfo.get ();
284+ executionEnvironment->rootDeviceEnvironments [0 ]->setHwInfo (&hwInfo);
285+ executionEnvironment->initializeMemoryManager ();
286+
287+ executionEnvironment->setDebuggingEnabled ();
288+
289+ auto neoDevice = NEO::MockDevice::create<NEO::MockDevice>(executionEnvironment, 0u );
290+
291+ NEO::DeviceVector devices;
292+ devices.push_back (std::unique_ptr<NEO::Device>(neoDevice));
293+ auto driverHandle = std::make_unique<Mock<L0::DriverHandleImp>>();
294+ driverHandle->enableProgramDebugging = true ;
295+
296+ EXPECT_THROW (driverHandle->initialize (std::move (devices)), std::exception);
297+ std::string output = testing::internal::GetCapturedStderr ();
298+
299+ EXPECT_EQ (std::string (" Source Level Debugger cannot be used with Environment Variable enabling program debugging.\n " ), output);
300+ }
301+
274302} // namespace ult
275303} // namespace L0
0 commit comments