@@ -644,6 +644,48 @@ HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinWhenModuleIsInitializedAndD
644
644
EXPECT_EQ (6u , getMockDebuggerL0Hw<FamilyType>()->removedZebinModuleHandle );
645
645
}
646
646
647
+ HWTEST_F (ModuleWithZebinAndL0DebuggerTest, GivenModuleDebugHandleZeroWhenInitializingAndDestoryingModuleThenHandleIsNotPassedToDebugger) {
648
+ NEO::MockCompilerEnableGuard mock (true );
649
+ auto cip = new NEO::MockCompilerInterfaceCaptureBuildOptions ();
650
+ neoDevice->getExecutionEnvironment ()->rootDeviceEnvironments [neoDevice->getRootDeviceIndex ()]->compilerInterface .reset (cip);
651
+ uint8_t binary[10 ];
652
+ ze_module_desc_t moduleDesc = {};
653
+ moduleDesc.format = ZE_MODULE_FORMAT_IL_SPIRV;
654
+ moduleDesc.pInputModule = binary;
655
+ moduleDesc.inputSize = 10 ;
656
+
657
+ uint32_t kernelHeap = 0 ;
658
+ auto kernelInfo = std::make_unique<KernelInfo>();
659
+ kernelInfo->heapInfo .KernelHeapSize = 1 ;
660
+ kernelInfo->heapInfo .pKernelHeap = &kernelHeap;
661
+
662
+ auto kernelImmutableData = ::std::make_unique<KernelImmutableData>(device);
663
+ kernelImmutableData->initialize (kernelInfo.get (), device, 0 , nullptr , nullptr , false );
664
+ std::unique_ptr<MockModule> moduleMock = std::make_unique<MockModule>(device, nullptr , ModuleType::User);
665
+ moduleMock->translationUnit = std::make_unique<MockModuleTranslationUnit>(device);
666
+ moduleMock->kernelImmDatas .push_back (std::move (kernelImmutableData));
667
+
668
+ auto zebin = ZebinTestData::ValidEmptyProgram ();
669
+ moduleMock->translationUnit = std::make_unique<MockModuleTranslationUnit>(device);
670
+ moduleMock->translationUnit ->unpackedDeviceBinarySize = zebin.storage .size ();
671
+ moduleMock->translationUnit ->unpackedDeviceBinary .reset (new char [zebin.storage .size ()]);
672
+ memcpy_s (moduleMock->translationUnit ->unpackedDeviceBinary .get (), moduleMock->translationUnit ->unpackedDeviceBinarySize ,
673
+ zebin.storage .data (), zebin.storage .size ());
674
+
675
+ getMockDebuggerL0Hw<FamilyType>()->moduleHandleToReturn = 0u ;
676
+ EXPECT_TRUE (moduleMock->initialize (&moduleDesc, neoDevice));
677
+
678
+ EXPECT_EQ (1u , getMockDebuggerL0Hw<FamilyType>()->segmentCountWithAttachedModuleHandle );
679
+ EXPECT_EQ (getMockDebuggerL0Hw<FamilyType>()->moduleHandleToReturn , moduleMock->debugModuleHandle );
680
+
681
+ getMockDebuggerL0Hw<FamilyType>()->removedZebinModuleHandle = std::numeric_limits<uint32_t >::max ();
682
+
683
+ moduleMock->destroy ();
684
+ moduleMock.release ();
685
+
686
+ EXPECT_EQ (std::numeric_limits<uint32_t >::max (), getMockDebuggerL0Hw<FamilyType>()->removedZebinModuleHandle );
687
+ }
688
+
647
689
using NotifyModuleLoadTest = Test<ModuleFixture>;
648
690
649
691
HWTEST_F (NotifyModuleLoadTest, givenDebuggingEnabledWhenModuleIsCreatedAndFullyLinkedThenIsaAllocationsAreCopiedAndResident) {
0 commit comments