From 43d42640473f33db5e47e0deeedef74fbd3253a3 Mon Sep 17 00:00:00 2001 From: "Kindracki, Jakub Tomasz" Date: Mon, 18 Aug 2025 16:11:45 +0000 Subject: [PATCH] test: Fix minor compiler errors in ULTs with optimizations enabled Related-To: NEO-8116 Signed-off-by: Kindracki, Jakub Tomasz --- opencl/test/unit_test/mocks/mock_context.cpp | 1 - .../program/printf_handler_tests.cpp | 4 +- .../test/unit_test/program/program_tests.cpp | 2 +- shared/test/common/helpers/stream_capture.h | 4 +- .../command_stream/aub_file_stream_tests.cpp | 66 +++++++++---------- .../yaml/yaml_parser_tests.cpp | 2 +- .../hw_cmds_generated_xe2_hpg_core_tests.cpp | 8 +-- .../hw_cmds_generated_xe3_core_tests.cpp | 8 +-- .../hw_cmds_generated_xe_hpc_core_tests.cpp | 4 +- .../hw_cmds_generated_xe_hpg_core_tests.cpp | 4 +- .../memory_manager/memory_manager_tests.cpp | 11 +++- .../unified_memory_pooling_tests.cpp | 5 +- .../linux/xe/ioctl_helper_xe_tests.cpp | 9 ++- .../cpu_page_fault_manager_linux_tests.cpp | 3 +- .../program_info_from_patchtokens_tests.cpp | 4 +- 15 files changed, 70 insertions(+), 65 deletions(-) diff --git a/opencl/test/unit_test/mocks/mock_context.cpp b/opencl/test/unit_test/mocks/mock_context.cpp index 321b569f26..fbf984d76f 100644 --- a/opencl/test/unit_test/mocks/mock_context.cpp +++ b/opencl/test/unit_test/mocks/mock_context.cpp @@ -40,7 +40,6 @@ MockContext::MockContext( userData = data; memoryManager = nullptr; driverDiagnostics = nullptr; - rootDeviceIndices = {}; maxRootDeviceIndex = std::numeric_limits::max(); deviceBitfields = {}; } diff --git a/opencl/test/unit_test/program/printf_handler_tests.cpp b/opencl/test/unit_test/program/printf_handler_tests.cpp index 2b23e7faf3..1b10781416 100644 --- a/opencl/test/unit_test/program/printf_handler_tests.cpp +++ b/opencl/test/unit_test/program/printf_handler_tests.cpp @@ -97,9 +97,9 @@ TEST_F(PrintfHandlerTests, givenKernelWithImplicitArgsWhenPreparingPrintfHandler MockProgram program{&context, false, toClDeviceVector(*device)}; - uint64_t crossThread[10]; + uint64_t crossThread[10] = {}; MockKernel kernel{&program, *pKernelInfo, *device}; - kernel.setCrossThreadData(&crossThread, sizeof(uint64_t) * 10); + kernel.setCrossThreadData(crossThread, sizeof(uint64_t) * 10); kernel.initialize(); MockMultiDispatchInfo multiDispatchInfo(device.get(), &kernel); diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index 0ad4984b2a..7b52080634 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -1095,7 +1095,7 @@ TEST_F(ProgramFromSourceTest, GivenEmptyProgramWhenCreatingProgramThenInvalidVal } TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenCompilingProgramThenSuccessOrCorrectErrorCodeIsReturned) { - cl_program inputHeaders; + cl_program inputHeaders = nullptr; const char *headerIncludeNames = ""; cl_program nullprogram = nullptr; cl_program invprogram = (cl_program)pContext; diff --git a/shared/test/common/helpers/stream_capture.h b/shared/test/common/helpers/stream_capture.h index 3e328191cf..b56b631ca6 100644 --- a/shared/test/common/helpers/stream_capture.h +++ b/shared/test/common/helpers/stream_capture.h @@ -62,7 +62,9 @@ class StreamCapture { pipefd[1] = -1; #else fflush(stream); - pipe(pipefd); + if (pipe(pipefd) == -1) { + return; + } fcntl(pipefd[0], F_SETPIPE_SZ, bufferSize); savedFd = dup(fileno(stream)); dup2(pipefd[1], fileno(stream)); diff --git a/shared/test/unit_test/command_stream/aub_file_stream_tests.cpp b/shared/test/unit_test/command_stream/aub_file_stream_tests.cpp index 70bbe6b571..ae24e07dfb 100644 --- a/shared/test/unit_test/command_stream/aub_file_stream_tests.cpp +++ b/shared/test/unit_test/command_stream/aub_file_stream_tests.cpp @@ -41,69 +41,69 @@ using AubFileStreamWithoutAubStreamTests = Test; HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenInitFileIsCalledWithInvalidFileNameThenFileIsNotOpened) { - auto aubCsr = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); + AUBCommandStreamReceiverHw aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); std::string invalidFileName = ""; - EXPECT_THROW(aubCsr->initFile(invalidFileName), std::exception); + EXPECT_THROW(aubCsr.initFile(invalidFileName), std::exception); } HWTEST_F(AubCsrTests, givenAubCommandStreamReceiverWhenInitFileIsCalledThenFileIsOpenedAndFileNameIsStored) { - auto aubCsr = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); + AUBCommandStreamReceiverHw aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); std::string fileName = "file_name.aub"; - aubCsr->initFile(fileName); - EXPECT_TRUE(aubCsr->isFileOpen()); - EXPECT_STREQ(fileName.c_str(), aubCsr->getFileName().c_str()); + aubCsr.initFile(fileName); + EXPECT_TRUE(aubCsr.isFileOpen()); + EXPECT_STREQ(fileName.c_str(), aubCsr.getFileName().c_str()); - aubCsr->closeFile(); - EXPECT_FALSE(aubCsr->isFileOpen()); - EXPECT_TRUE(aubCsr->getFileName().empty()); + aubCsr.closeFile(); + EXPECT_FALSE(aubCsr.isFileOpen()); + EXPECT_TRUE(aubCsr.getFileName().empty()); } HWTEST_F(AubCsrTests, givenAubCommandStreamReceiverWhenReopenFileIsCalledThenFileWithSpecifiedNameIsReopened) { - auto aubCsr = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); + AUBCommandStreamReceiverHw aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); std::string fileName = "file_name.aub"; std::string newFileName = "new_file_name.aub"; - aubCsr->reopenFile(fileName); - EXPECT_TRUE(aubCsr->isFileOpen()); - EXPECT_STREQ(fileName.c_str(), aubCsr->getFileName().c_str()); + aubCsr.reopenFile(fileName); + EXPECT_TRUE(aubCsr.isFileOpen()); + EXPECT_STREQ(fileName.c_str(), aubCsr.getFileName().c_str()); - aubCsr->reopenFile(newFileName); - EXPECT_TRUE(aubCsr->isFileOpen()); - EXPECT_STREQ(newFileName.c_str(), aubCsr->getFileName().c_str()); + aubCsr.reopenFile(newFileName); + EXPECT_TRUE(aubCsr.isFileOpen()); + EXPECT_STREQ(newFileName.c_str(), aubCsr.getFileName().c_str()); } HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenInitFileIsCalledThenFileShouldBeInitializedOnce) { auto mockAubManager = std::make_unique(); - auto aubCsr = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); + AUBCommandStreamReceiverHw aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); std::string fileName = "file_name.aub"; - aubCsr->aubManager = mockAubManager.get(); + aubCsr.aubManager = mockAubManager.get(); - aubCsr->initFile(fileName); - aubCsr->initFile(fileName); + aubCsr.initFile(fileName); + aubCsr.initFile(fileName); EXPECT_EQ(1u, mockAubManager->openCalledCnt); } HWTEST_F(AubCsrTests, givenAubCommandStreamReceiverWithAubManagerWhenFileFunctionsAreCalledThenTheyShouldCallTheExpectedAubManagerFunctions) { auto mockAubManager = std::make_unique(); - auto aubCsr = std::make_unique>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); + AUBCommandStreamReceiverHw aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); std::string fileName = "file_name.aub"; - aubCsr->aubManager = mockAubManager.get(); + aubCsr.aubManager = mockAubManager.get(); - aubCsr->initFile(fileName); + aubCsr.initFile(fileName); EXPECT_EQ(1u, mockAubManager->openCalledCnt); - EXPECT_TRUE(aubCsr->isFileOpen()); + EXPECT_TRUE(aubCsr.isFileOpen()); EXPECT_TRUE(mockAubManager->isOpenCalled); - EXPECT_STREQ(fileName.c_str(), aubCsr->getFileName().c_str()); + EXPECT_STREQ(fileName.c_str(), aubCsr.getFileName().c_str()); EXPECT_TRUE(mockAubManager->getFileNameCalled); - aubCsr->closeFile(); - EXPECT_FALSE(aubCsr->isFileOpen()); - EXPECT_TRUE(aubCsr->getFileName().empty()); + aubCsr.closeFile(); + EXPECT_FALSE(aubCsr.isFileOpen()); + EXPECT_TRUE(aubCsr.getFileName().empty()); EXPECT_TRUE(mockAubManager->closeCalled); } @@ -418,18 +418,18 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenInit executionEnvironment.initializeMemoryManager(); DeviceBitfield deviceBitfield(1); - auto aubCsr = std::make_unique>("", true, executionEnvironment, 0, deviceBitfield); + AUBCommandStreamReceiverHw aubCsr("", true, executionEnvironment, 0, deviceBitfield); - aubCsr->aubManager = mockAubManager.get(); - ASSERT_NE(nullptr, aubCsr->aubManager); + aubCsr.aubManager = mockAubManager.get(); + ASSERT_NE(nullptr, aubCsr.aubManager); std::string fileName = "file_name.aub"; - aubCsr->initFile(fileName); + aubCsr.initFile(fileName); std::string commentWithDriverVersion = "driver version: " + std::string(driverVersion); EXPECT_EQ(mockAubManager->receivedComments, commentWithDriverVersion); - aubCsr->aubManager = nullptr; + aubCsr.aubManager = nullptr; } HWTEST2_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenCreateFullFilePathIsCalledForMultipleDevicesThenFileNameIsExtendedWithSuffixToIndicateMultipleDevices, IsAtMostXeCore) { diff --git a/shared/test/unit_test/device_binary_format/yaml/yaml_parser_tests.cpp b/shared/test/unit_test/device_binary_format/yaml/yaml_parser_tests.cpp index 8cd82751ea..5513db293a 100644 --- a/shared/test/unit_test/device_binary_format/yaml/yaml_parser_tests.cpp +++ b/shared/test/unit_test/device_binary_format/yaml/yaml_parser_tests.cpp @@ -212,7 +212,7 @@ TEST(YamlConsumeNumberOrSign, GivenInvalidCharacterThenReturnCurrentParsePositio for (int c = std::numeric_limits::min(); c <= std::numeric_limits::max(); ++c) { bool isSignOrNumber = NEO::Yaml::isSign(static_cast(c)) || NEO::Yaml::isNumber(static_cast(c)); - char numberStr[] = {static_cast(c), '\0'}; + char numberStr[2] = {static_cast(c), '\0'}; auto expected = numberStr + (isSignOrNumber ? 1 : 0); EXPECT_EQ(expected, NEO::Yaml::consumeNumberOrSign(ConstStringRef::fromArray(numberStr), numberStr)) << c; } diff --git a/shared/test/unit_test/generated/xe2_hpg_core/hw_cmds_generated_xe2_hpg_core_tests.cpp b/shared/test/unit_test/generated/xe2_hpg_core/hw_cmds_generated_xe2_hpg_core_tests.cpp index 6bb45dba45..4715f545fb 100644 --- a/shared/test/unit_test/generated/xe2_hpg_core/hw_cmds_generated_xe2_hpg_core_tests.cpp +++ b/shared/test/unit_test/generated/xe2_hpg_core/hw_cmds_generated_xe2_hpg_core_tests.cpp @@ -2433,8 +2433,8 @@ XE2_HPG_CORETEST_F(CommandsXe2HpgCoreTest, GivenPostsyncDataWhenInitCalledThenFi EXPECT_EQ(0x0u, cmd.TheStructure.Common.MocsIndexToMocsTables); EXPECT_EQ(0x0u, cmd.TheStructure.Common.SystemMemoryFenceRequest); EXPECT_EQ(0x0u, cmd.TheStructure.Common.DataportSubsliceCacheFlush); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.DestinationAddress); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.ImmediateData); + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.DestinationAddress); // patched + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.ImmediateData); // patched } XE2_HPG_CORETEST_F(CommandsXe2HpgCoreTest, GivenPostsyncDataWhenSetterUsedThenGetterReturnsValidValue) { @@ -4360,8 +4360,8 @@ XE2_HPG_CORETEST_F(CommandsXe2HpgCoreTest, GivenMiFlushDwWhenInitCalledThenField EXPECT_EQ(MI_FLUSH_DW::MI_COMMAND_OPCODE_MI_FLUSH_DW, cmd.TheStructure.Common.MiCommandOpcode); EXPECT_EQ(MI_FLUSH_DW::COMMAND_TYPE_MI_COMMAND, cmd.TheStructure.Common.CommandType); EXPECT_EQ(MI_FLUSH_DW::DESTINATION_ADDRESS_TYPE_PPGTT, cmd.TheStructure.Common.DestinationAddressType); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.DestinationAddress); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.ImmediateData); + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.DestinationAddress); // patched + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.ImmediateData); // patched } XE2_HPG_CORETEST_F(CommandsXe2HpgCoreTest, GivenMiFlushDwWhenSetterUsedThenGetterReturnsValidValue) { diff --git a/shared/test/unit_test/generated/xe3_core/hw_cmds_generated_xe3_core_tests.cpp b/shared/test/unit_test/generated/xe3_core/hw_cmds_generated_xe3_core_tests.cpp index 8fa6197764..98e5df0156 100644 --- a/shared/test/unit_test/generated/xe3_core/hw_cmds_generated_xe3_core_tests.cpp +++ b/shared/test/unit_test/generated/xe3_core/hw_cmds_generated_xe3_core_tests.cpp @@ -2408,8 +2408,8 @@ XE3_CORETEST_F(CommandsXe3CoreTest, GivenPostsyncDataWhenInitCalledThenFieldsSet EXPECT_EQ(0x0u, cmd.TheStructure.Common.MocsIndexToMocsTables); EXPECT_EQ(0x0u, cmd.TheStructure.Common.SystemMemoryFenceRequest); EXPECT_EQ(0x0u, cmd.TheStructure.Common.DataportSubsliceCacheFlush); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.DestinationAddress); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.ImmediateData); + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.DestinationAddress); // patched + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.ImmediateData); // patched } XE3_CORETEST_F(CommandsXe3CoreTest, GivenPostsyncDataWhenSetterUsedThenGetterReturnsValidValue) { @@ -4559,8 +4559,8 @@ XE3_CORETEST_F(CommandsXe3CoreTest, GivenMiFlushDwWhenInitCalledThenFieldsSetToD EXPECT_EQ(MI_FLUSH_DW::MI_COMMAND_OPCODE_MI_FLUSH_DW, cmd.TheStructure.Common.MiCommandOpcode); EXPECT_EQ(MI_FLUSH_DW::COMMAND_TYPE_MI_COMMAND, cmd.TheStructure.Common.CommandType); EXPECT_EQ(MI_FLUSH_DW::DESTINATION_ADDRESS_TYPE_PPGTT, cmd.TheStructure.Common.DestinationAddressType); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.DestinationAddress); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.ImmediateData); + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.DestinationAddress); + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.ImmediateData); } XE3_CORETEST_F(CommandsXe3CoreTest, GivenMiFlushDwWhenSetterUsedThenGetterReturnsValidValue) { diff --git a/shared/test/unit_test/generated/xe_hpc_core/hw_cmds_generated_xe_hpc_core_tests.cpp b/shared/test/unit_test/generated/xe_hpc_core/hw_cmds_generated_xe_hpc_core_tests.cpp index 0092313793..b45ca595a2 100644 --- a/shared/test/unit_test/generated/xe_hpc_core/hw_cmds_generated_xe_hpc_core_tests.cpp +++ b/shared/test/unit_test/generated/xe_hpc_core/hw_cmds_generated_xe_hpc_core_tests.cpp @@ -2129,8 +2129,8 @@ XE_HPC_CORETEST_F(CommandsXeHpcCoreTest, GivenPostsyncDataWhenInitCalledThenFiel EXPECT_EQ(0x0u, cmd.TheStructure.Common.MocsIndexToMocsTables); EXPECT_EQ(0x0u, cmd.TheStructure.Common.SystemMemoryFenceRequest); EXPECT_EQ(0x0u, cmd.TheStructure.Common.DataportSubsliceCacheFlush); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.DestinationAddress); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.ImmediateData); + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.DestinationAddress); // patched + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.ImmediateData); // patched } XE_HPC_CORETEST_F(CommandsXeHpcCoreTest, GivenPostsyncDataWhenSetterUsedThenGetterReturnsValidValue) { diff --git a/shared/test/unit_test/generated/xe_hpg_core/hw_cmds_generated_xe_hpg_core_tests.cpp b/shared/test/unit_test/generated/xe_hpg_core/hw_cmds_generated_xe_hpg_core_tests.cpp index 32dce90717..82b571a72f 100644 --- a/shared/test/unit_test/generated/xe_hpg_core/hw_cmds_generated_xe_hpg_core_tests.cpp +++ b/shared/test/unit_test/generated/xe_hpg_core/hw_cmds_generated_xe_hpg_core_tests.cpp @@ -2423,8 +2423,8 @@ XE_HPG_CORETEST_F(CommandsXeHpgCoreTest, GivenPostsyncDataWhenInitCalledThenFiel EXPECT_EQ(POSTSYNC_DATA::OPERATION_NO_WRITE, cmd.TheStructure.Common.Operation); EXPECT_EQ(0x0u, cmd.TheStructure.Common.MocsIndexToMocsTables); EXPECT_EQ(0x0u, cmd.TheStructure.Common.DataportSubsliceCacheFlush); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.DestinationAddress); - EXPECT_EQ(0x0ull, cmd.TheStructure.Common.ImmediateData); + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.DestinationAddress); // patched + EXPECT_EQ_VAL(0x0ull, cmd.TheStructure.Common.ImmediateData); // patched } XE_HPG_CORETEST_F(CommandsXeHpgCoreTest, GivenPostsyncDataWhenSetterUsedThenGetterReturnsValidValue) { diff --git a/shared/test/unit_test/memory_manager/memory_manager_tests.cpp b/shared/test/unit_test/memory_manager/memory_manager_tests.cpp index a55e282124..aecfd457da 100644 --- a/shared/test/unit_test/memory_manager/memory_manager_tests.cpp +++ b/shared/test/unit_test/memory_manager/memory_manager_tests.cpp @@ -2964,11 +2964,16 @@ HWTEST_F(PageTableManagerTest, givenPageTableManagerWhenMapAuxGpuVaThenForAllEng EXPECT_TRUE(result); EXPECT_EQ(1u, mockMngr->updateAuxTableCalled); - EXPECT_TRUE(memcmp(&expectedDdiUpdateAuxTable, &mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable, sizeof(GMM_DDI_UPDATEAUXTABLE)) == 0); + EXPECT_EQ(expectedDdiUpdateAuxTable.BaseGpuVA, mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseGpuVA); + EXPECT_EQ(expectedDdiUpdateAuxTable.BaseResInfo, mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseResInfo); + EXPECT_EQ(expectedDdiUpdateAuxTable.DoNotWait, mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.DoNotWait); + EXPECT_EQ(expectedDdiUpdateAuxTable.Map, mockMngr->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.Map); EXPECT_EQ(1u, mockMngr2->updateAuxTableCalled); - - EXPECT_TRUE(memcmp(&expectedDdiUpdateAuxTable, &mockMngr2->updateAuxTableParamsPassed[0].ddiUpdateAuxTable, sizeof(GMM_DDI_UPDATEAUXTABLE)) == 0); + EXPECT_EQ(expectedDdiUpdateAuxTable.BaseGpuVA, mockMngr2->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseGpuVA); + EXPECT_EQ(expectedDdiUpdateAuxTable.BaseResInfo, mockMngr2->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.BaseResInfo); + EXPECT_EQ(expectedDdiUpdateAuxTable.DoNotWait, mockMngr2->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.DoNotWait); + EXPECT_EQ(expectedDdiUpdateAuxTable.Map, mockMngr2->updateAuxTableParamsPassed[0].ddiUpdateAuxTable.Map); } HWTEST_F(PageTableManagerTest, givenPageTableManagerWhenUpdateAuxTableGmmErrorThenMapAuxGpuVaReturnFalse) { MockExecutionEnvironment executionEnvironment{}; diff --git a/shared/test/unit_test/memory_manager/unified_memory_pooling_tests.cpp b/shared/test/unit_test/memory_manager/unified_memory_pooling_tests.cpp index 0c011eb368..d1aea7e8da 100644 --- a/shared/test/unit_test/memory_manager/unified_memory_pooling_tests.cpp +++ b/shared/test/unit_test/memory_manager/unified_memory_pooling_tests.cpp @@ -47,7 +47,7 @@ TEST_F(UnifiedMemoryPoolingStaticTest, givenUsmAllocPoolWhenCallingStaticMethods using UnifiedMemoryPoolingTest = Test>; TEST_F(UnifiedMemoryPoolingTest, givenUsmAllocPoolWhenCallingIsInitializedThenReturnCorrectValue) { - UsmMemAllocPool usmMemAllocPool; + MockUsmMemAllocPool usmMemAllocPool; EXPECT_FALSE(usmMemAllocPool.isInitialized()); EXPECT_EQ(0u, usmMemAllocPool.getPoolAddress()); @@ -56,10 +56,9 @@ TEST_F(UnifiedMemoryPoolingTest, givenUsmAllocPoolWhenCallingIsInitializedThenRe auto svmManager = std::make_unique(device->getMemoryManager()); SVMAllocsManager::UnifiedMemoryProperties unifiedMemoryProperties(InternalMemoryType::hostUnifiedMemory, MemoryConstants::pageSize2M, rootDeviceIndices, deviceBitfields); - auto mockPool = reinterpret_cast(&usmMemAllocPool); EXPECT_TRUE(usmMemAllocPool.initialize(svmManager.get(), unifiedMemoryProperties, 1 * MemoryConstants::megaByte, 0u, 1 * MemoryConstants::megaByte)); EXPECT_TRUE(usmMemAllocPool.isInitialized()); - EXPECT_EQ(castToUint64(mockPool->pool), usmMemAllocPool.getPoolAddress()); + EXPECT_EQ(castToUint64(usmMemAllocPool.pool), usmMemAllocPool.getPoolAddress()); usmMemAllocPool.cleanup(); EXPECT_FALSE(usmMemAllocPool.isInitialized()); diff --git a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp index 4fadf14ff2..04c188af8a 100644 --- a/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_tests.cpp @@ -623,8 +623,7 @@ TEST_F(IoctlHelperXeTest, verifyPublicFunctions) { auto executionEnvironment = std::make_unique(); DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]}; - auto xeIoctlHelper = std::make_unique(drm); - auto mockXeIoctlHelper = static_cast(xeIoctlHelper.get()); + auto mockXeIoctlHelper = std::make_unique(drm); auto verifyXeClassName = [&mockXeIoctlHelper](const char *name, auto xeClass) { EXPECT_STREQ(name, mockXeIoctlHelper->xeGetClassName(xeClass)); @@ -684,17 +683,17 @@ TEST_F(IoctlHelperXeTest, verifyPublicFunctions) { query.numItems = 1; EXPECT_EQ(-1, mockXeIoctlHelper->ioctl(DrmIoctl::query, &query)); - queryItem.queryId = xeIoctlHelper->getDrmParamValue(DrmParam::queryHwconfigTable); + queryItem.queryId = mockXeIoctlHelper->getDrmParamValue(DrmParam::queryHwconfigTable); mockXeIoctlHelper->ioctl(DrmIoctl::query, &query); EXPECT_EQ(0, queryItem.length); memset(&queryItem, 0, sizeof(queryItem)); - queryItem.queryId = xeIoctlHelper->getDrmParamValue(DrmParam::queryEngineInfo); + queryItem.queryId = mockXeIoctlHelper->getDrmParamValue(DrmParam::queryEngineInfo); mockXeIoctlHelper->ioctl(DrmIoctl::query, &query); EXPECT_EQ(0, queryItem.length); memset(&queryItem, 0, sizeof(queryItem)); - queryItem.queryId = xeIoctlHelper->getDrmParamValue(DrmParam::queryTopologyInfo); + queryItem.queryId = mockXeIoctlHelper->getDrmParamValue(DrmParam::queryTopologyInfo); mockXeIoctlHelper->ioctl(DrmIoctl::query, &query); EXPECT_EQ(0, queryItem.length); } diff --git a/shared/test/unit_test/page_fault_manager/linux/cpu_page_fault_manager_linux_tests.cpp b/shared/test/unit_test/page_fault_manager/linux/cpu_page_fault_manager_linux_tests.cpp index f5e8846797..c4cd274755 100644 --- a/shared/test/unit_test/page_fault_manager/linux/cpu_page_fault_manager_linux_tests.cpp +++ b/shared/test/unit_test/page_fault_manager/linux/cpu_page_fault_manager_linux_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -115,6 +115,7 @@ TEST_F(PageFaultManagerLinuxTest, givenProtectedMemoryWithFaultHandlerRegistered EXPECT_FALSE(pageFaultManager->handlerInvoked); ptr[0] = 10; + std::atomic_thread_fence(std::memory_order_seq_cst); EXPECT_TRUE(pageFaultManager->handlerInvoked); EXPECT_EQ(ptr[0], 10); } diff --git a/shared/test/unit_test/program/program_info_from_patchtokens_tests.cpp b/shared/test/unit_test/program/program_info_from_patchtokens_tests.cpp index 2ffca27f54..882569d476 100644 --- a/shared/test/unit_test/program/program_info_from_patchtokens_tests.cpp +++ b/shared/test/unit_test/program/program_info_from_patchtokens_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2023 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -102,7 +102,7 @@ TEST(PopulateProgramInfoFromPatchtokensTests, WhenProgramRequiresMixedGlobalVarA EXPECT_TRUE(programInfo.kernelInfos.empty()); ASSERT_NE(nullptr, programInfo.linkerInput); - const NEO::LinkerInput::RelocationInfo *relocationGlobalConst, *relocationGlobalVar; + const NEO::LinkerInput::RelocationInfo *relocationGlobalConst = nullptr, *relocationGlobalVar = nullptr; ASSERT_EQ(2U, programInfo.linkerInput->getDataRelocations().size()); for (const auto &reloc : programInfo.linkerInput->getDataRelocations()) { switch (reloc.relocationSegment) {