diff --git a/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp b/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp index 73104fecdb..914221763b 100644 --- a/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp +++ b/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp @@ -109,6 +109,8 @@ void AUBFixtureL0::tearDown() { } ze_module_handle_t AUBFixtureL0::createModuleFromFile(const std::string &fileName, ze_context_handle_t context, ze_device_handle_t device, const std::string &buildFlags, bool useSharedFile) { + USE_REAL_FILE_SYSTEM(); + ze_module_handle_t moduleHandle; std::string testFile; if (useSharedFile) { @@ -137,4 +139,4 @@ ze_module_handle_t AUBFixtureL0::createModuleFromFile(const std::string &fileNam return moduleHandle; } -} // namespace L0 +} // namespace L0 \ No newline at end of file diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp index d6f2de6f40..8206aadf25 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp @@ -6,6 +6,7 @@ */ #include "shared/source/helpers/aligned_memory.h" +#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/state_base_address_helper.h" #include "shared/source/indirect_heap/indirect_heap.h" @@ -58,6 +59,8 @@ HWTEST_F(CommandListCreate, givenCommandListWithInvalidWaitEventArgWhenAppendQue using AppendQueryKernelTimestamps = CommandListCreate; HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTimestampsWithoutOffsetsThenProperBuiltinWasAdded, MatchAny) { + USE_REAL_FILE_SYSTEM(); + std::unique_ptr> testDevice = std::unique_ptr>(new MockDeviceForSpv(device->getNEODevice(), device->getNEODevice()->getExecutionEnvironment(), driverHandle.get())); testDevice->builtins.reset(new MockBuiltinFunctionsLibImplTimestamps(testDevice.get(), testDevice->getNEODevice()->getBuiltIns())); testDevice->getBuiltinFunctionsLib()->initBuiltinKernel(L0::Builtin::queryKernelTimestamps); @@ -121,6 +124,8 @@ HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTime } HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTimestampsWithOffsetsThenProperBuiltinWasAdded, MatchAny) { + USE_REAL_FILE_SYSTEM(); + std::unique_ptr> testDevice = std::unique_ptr>(new MockDeviceForSpv(device->getNEODevice(), device->getNEODevice()->getExecutionEnvironment(), driverHandle.get())); testDevice->builtins.reset(new MockBuiltinFunctionsLibImplTimestamps(testDevice.get(), testDevice->getNEODevice()->getBuiltIns())); testDevice->getBuiltinFunctionsLib()->initBuiltinKernel(L0::Builtin::queryKernelTimestamps); @@ -185,8 +190,9 @@ HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTime context->freeMem(offsetAlloc); } -HWTEST2_F(AppendQueryKernelTimestamps, - givenCommandListWhenAppendQueryKernelTimestampsInUsmHostMemoryWithEventsNumberBiggerThanMaxWorkItemSizeThenProperGroupSizeAndGroupCountIsSet, MatchAny) { +HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTimestampsInUsmHostMemoryWithEventsNumberBiggerThanMaxWorkItemSizeThenProperGroupSizeAndGroupCountIsSet, MatchAny) { + USE_REAL_FILE_SYSTEM(); + std::unique_ptr> testDevice = std::unique_ptr>(new MockDeviceForSpv(device->getNEODevice(), device->getNEODevice()->getExecutionEnvironment(), driverHandle.get())); testDevice->builtins.reset(new MockBuiltinFunctionsLibImplTimestamps(testDevice.get(), testDevice->getNEODevice()->getBuiltIns())); testDevice->getBuiltinFunctionsLib()->initBuiltinKernel(L0::Builtin::queryKernelTimestamps); @@ -245,6 +251,8 @@ HWTEST2_F(AppendQueryKernelTimestamps, HWTEST2_F(AppendQueryKernelTimestamps, givenCommandListWhenAppendQueryKernelTimestampsInExternalHostMemoryWithEventsNumberBiggerThanMaxWorkItemSizeThenProperGroupSizeAndGroupCountIsSet, MatchAny) { + USE_REAL_FILE_SYSTEM(); + std::unique_ptr> testDevice = std::unique_ptr>(new MockDeviceForSpv(device->getNEODevice(), device->getNEODevice()->getExecutionEnvironment(), driverHandle.get())); testDevice->builtins.reset(new MockBuiltinFunctionsLibImplTimestamps(testDevice.get(), testDevice->getNEODevice()->getBuiltIns())); testDevice->getBuiltinFunctionsLib()->initBuiltinKernel(L0::Builtin::queryKernelTimestamps); @@ -3434,4 +3442,4 @@ HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest, } } // namespace ult -} // namespace L0 +} // namespace L0 \ No newline at end of file diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp index 396db50f13..4d6596c3ab 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -354,6 +354,7 @@ HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenZebinDebugDataWhenInitializingMo } HWTEST_F(ModuleWithZebinAndL0DebuggerTest, GivenDumpElfFlagAndZebinWhenInitializingModuleThenDebugElfIsDumpedToFile) { + USE_REAL_FILE_SYSTEM(); DebugManagerStateRestore stateRestore; debugManager.flags.DebuggerLogBitmask.set(NEO::DebugVariables::DEBUGGER_LOG_BITMASK::DUMP_ELF); diff --git a/level_zero/core/test/unit_tests/sources/module/test_module.cpp b/level_zero/core/test/unit_tests/sources/module/test_module.cpp index 2de1a0d455..17da2bbf45 100644 --- a/level_zero/core/test/unit_tests/sources/module/test_module.cpp +++ b/level_zero/core/test/unit_tests/sources/module/test_module.cpp @@ -724,6 +724,7 @@ struct DerivedModuleImp : public L0::ModuleImp { }; HWTEST_F(ModuleTest, whenMultipleModulesCreatedThenModulesShareIsaAllocation) { + USE_REAL_FILE_SYSTEM(); DebugManagerStateRestore restorer; debugManager.flags.EnableLocalMemory.set(1); uint8_t binary[10]; @@ -3623,6 +3624,7 @@ HWTEST2_F(ModuleTranslationUnitTest, givenDebugFlagSetToWbWhenGetInternalOptions } HWTEST_F(ModuleTranslationUnitTest, givenDumpZebinWhenBuildingFromSpirvThenZebinElfDumped) { + USE_REAL_FILE_SYSTEM(); DebugManagerStateRestore restorer; debugManager.flags.DumpZEBin.set(1); diff --git a/opencl/test/unit_test/api/cl_api_tests.h b/opencl/test/unit_test/api/cl_api_tests.h index 3b0039afe9..c0eefe46a3 100644 --- a/opencl/test/unit_test/api/cl_api_tests.h +++ b/opencl/test/unit_test/api/cl_api_tests.h @@ -7,6 +7,7 @@ #pragma once #include "shared/source/execution_environment/root_device_environment.h" +#include "shared/source/helpers/file_io.h" #include "shared/source/os_interface/device_factory.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/default_hw_info.h" @@ -29,6 +30,7 @@ template struct ApiFixture { void setUp() { + USE_REAL_FILE_SYSTEM(); debugManager.flags.CreateMultipleRootDevices.set(numRootDevices); debugManager.flags.EnableCpuCacheForResources.set(true); debugManager.flags.ContextGroupSize.set(0); diff --git a/opencl/test/unit_test/api/cl_build_program_tests.inl b/opencl/test/unit_test/api/cl_build_program_tests.inl index 1c5347d2a8..da5908ccba 100644 --- a/opencl/test/unit_test/api/cl_build_program_tests.inl +++ b/opencl/test/unit_test/api/cl_build_program_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -36,6 +36,7 @@ struct ClBuildProgramTests : public ApiTests { namespace ULT { TEST_F(ClBuildProgramTests, GivenSourceAsInputWhenCreatingProgramWithSourceThenProgramBuildSucceeds) { + USE_REAL_FILE_SYSTEM(); cl_program pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -366,6 +367,7 @@ TEST_F(ClBuildProgramTests, GivenNullAsInputWhenCreatingProgramThenInvalidProgra } TEST_F(ClBuildProgramTests, GivenInvalidCallbackInputWhenBuildProgramThenInvalidValueErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); cl_program pProgram = nullptr; cl_int binaryStatus = CL_SUCCESS; size_t binarySize = 0; @@ -449,6 +451,7 @@ TEST_F(ClBuildProgramTests, GivenValidCallbackInputWhenBuildProgramThenCallbackI } TEST_F(ClBuildProgramTests, givenProgramWhenBuildingForInvalidDevicesInputThenInvalidDeviceErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; @@ -523,7 +526,7 @@ TEST_F(ClBuildProgramTests, givenProgramWhenBuildingForInvalidDevicesInputThenIn } TEST(clBuildProgramTest, givenMultiDeviceProgramWithCreatedKernelWhenBuildingThenInvalidOperationErrorIsReturned) { - + USE_REAL_FILE_SYSTEM(); MockSpecializedContext context; cl_program pProgram = nullptr; size_t sourceSize = 0; @@ -595,7 +598,7 @@ TEST(clBuildProgramTest, givenMultiDeviceProgramWithCreatedKernelWhenBuildingThe } TEST(clBuildProgramTest, givenMultiDeviceProgramWithCreatedKernelsWhenBuildingThenInvalidOperationErrorIsReturned) { - + USE_REAL_FILE_SYSTEM(); MockSpecializedContext context; cl_program pProgram = nullptr; size_t sourceSize = 0; @@ -674,6 +677,7 @@ TEST(clBuildProgramTest, givenMultiDeviceProgramWithCreatedKernelsWhenBuildingTh } TEST(clBuildProgramTest, givenMultiDeviceProgramWithProgramBuiltForSingleDeviceWhenCreatingKernelThenProgramAndKernelDevicesMatchAndSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); MockUnrestrictiveContextMultiGPU context; cl_program pProgram = nullptr; size_t sourceSize = 0; @@ -729,6 +733,7 @@ TEST(clBuildProgramTest, givenMultiDeviceProgramWithProgramBuiltForSingleDeviceW } TEST(clBuildProgramTest, givenMultiDeviceProgramWithProgramBuiltForSingleDeviceWithCreatedKernelWhenBuildingProgramForSecondDeviceThenInvalidOperationReturned) { + USE_REAL_FILE_SYSTEM(); MockUnrestrictiveContextMultiGPU context; cl_program pProgram = nullptr; size_t sourceSize = 0; @@ -801,6 +806,7 @@ TEST(clBuildProgramTest, givenMultiDeviceProgramWithProgramBuiltForSingleDeviceW } TEST(clBuildProgramTest, givenMultiDeviceProgramWithProgramBuiltForMultipleDevicesSeparatelyWithCreatedKernelThenProgramAndKernelDevicesMatch) { + USE_REAL_FILE_SYSTEM(); MockUnrestrictiveContextMultiGPU context; cl_program pProgram = nullptr; size_t sourceSize = 0; diff --git a/opencl/test/unit_test/api/cl_clone_kernel_tests.inl b/opencl/test/unit_test/api/cl_clone_kernel_tests.inl index 2900aeaaa6..145fd5eb24 100644 --- a/opencl/test/unit_test/api/cl_clone_kernel_tests.inl +++ b/opencl/test/unit_test/api/cl_clone_kernel_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -29,6 +29,7 @@ TEST_F(ClCloneKernelTests, GivenNullKernelWhenCloningKernelThenInvalidKernelErro } TEST_F(ClCloneKernelTests, GivenValidKernelWhenCloningKernelThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); cl_kernel pSourceKernel = nullptr; cl_kernel pClonedKernel = nullptr; cl_program pProgram = nullptr; diff --git a/opencl/test/unit_test/api/cl_compile_program_tests.inl b/opencl/test/unit_test/api/cl_compile_program_tests.inl index bee5bd9017..81107ae187 100644 --- a/opencl/test/unit_test/api/cl_compile_program_tests.inl +++ b/opencl/test/unit_test/api/cl_compile_program_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,6 +20,8 @@ using ClCompileProgramTests = ApiTests; namespace ULT { TEST_F(ClCompileProgramTests, GivenKernelAsSingleSourceWhenCompilingProgramThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; @@ -64,19 +66,21 @@ TEST_F(ClCompileProgramTests, GivenKernelAsSingleSourceWhenCompilingProgramThenS } TEST_F(ClCompileProgramTests, GivenKernelAsSourceWithHeaderWhenCompilingProgramThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; cl_program pHeader = nullptr; auto copyBufferWithHeader = R"===( #include "simple_header.h" __kernel void CopyBuffer(){} - )==="; + )==="; auto copyBufferWithHeaderSize = sizeof(copyBufferWithHeader); auto header = R"===( extenr __kernel void AddBuffer(); - )==="; + )==="; auto headerSize = sizeof(header); auto headerName = "simple_header.h"; @@ -135,6 +139,8 @@ TEST_F(ClCompileProgramTests, GivenNullProgramWhenCompilingProgramThenInvalidPro } TEST_F(ClCompileProgramTests, GivenInvalidCallbackInputWhenCompileProgramThenInvalidValueErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; @@ -177,6 +183,8 @@ TEST_F(ClCompileProgramTests, GivenInvalidCallbackInputWhenCompileProgramThenInv } TEST_F(ClCompileProgramTests, GivenValidCallbackInputWhenLinkProgramThenCallbackIsInvoked) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; @@ -223,6 +231,8 @@ TEST_F(ClCompileProgramTests, GivenValidCallbackInputWhenLinkProgramThenCallback } TEST(clCompileProgramTest, givenProgramWhenCompilingForInvalidDevicesInputThenInvalidDeviceErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -317,6 +327,7 @@ TEST(clCompileProgramTest, givenProgramWhenCompilingForInvalidDevicesInputThenIn } TEST(clCompileProgramTest, givenMultiDeviceProgramWithCreatedKernelWhenCompilingThenInvalidOperationErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); MockSpecializedContext context; cl_program pProgram = nullptr; @@ -395,6 +406,7 @@ TEST(clCompileProgramTest, givenMultiDeviceProgramWithCreatedKernelWhenCompiling } TEST(clCompileProgramTest, givenMultiDeviceProgramWithCreatedKernelsWhenCompilingThenInvalidOperationErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); MockSpecializedContext context; cl_program pProgram = nullptr; @@ -478,4 +490,4 @@ TEST(clCompileProgramTest, givenMultiDeviceProgramWithCreatedKernelsWhenCompilin retVal = clReleaseProgram(pProgram); EXPECT_EQ(CL_SUCCESS, retVal); } -} // namespace ULT +} // namespace ULT \ No newline at end of file diff --git a/opencl/test/unit_test/api/cl_create_kernel_tests.inl b/opencl/test/unit_test/api/cl_create_kernel_tests.inl index 9a7cd23859..389dea2641 100644 --- a/opencl/test/unit_test/api/cl_create_kernel_tests.inl +++ b/opencl/test/unit_test/api/cl_create_kernel_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -21,6 +21,7 @@ using ClCreateKernelTests = ApiTests; namespace ULT { TEST_F(ClCreateKernelTests, GivenCorrectKernelInProgramWhenCreatingNewKernelThenKernelIsCreatedAndSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); cl_kernel kernel = nullptr; cl_program pProgram = nullptr; cl_int binaryStatus = CL_SUCCESS; @@ -75,6 +76,7 @@ TEST_F(ClCreateKernelTests, GivenCorrectKernelInProgramWhenCreatingNewKernelThen } TEST_F(ClCreateKernelTests, GivenInvalidKernelNameWhenCreatingNewKernelThenInvalidKernelNameErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); cl_kernel kernel = nullptr; cl_program pProgram = nullptr; cl_int binaryStatus = CL_SUCCESS; diff --git a/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl b/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl index 73d9a18c22..eaf113a4d6 100644 --- a/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl +++ b/opencl/test/unit_test/api/cl_create_program_with_binary_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,6 +22,8 @@ using ClCreateProgramWithILKHRTests = ApiTests; namespace ULT { TEST_F(ClCreateProgramWithBinaryTests, GivenCorrectParametersWhenCreatingProgramWithBinaryThenProgramIsCreatedAndSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; cl_int binaryStatus = CL_INVALID_VALUE; size_t binarySize = 0; @@ -67,6 +69,8 @@ TEST_F(ClCreateProgramWithBinaryTests, GivenCorrectParametersWhenCreatingProgram } TEST_F(ClCreateProgramWithBinaryTests, GivenInvalidInputWhenCreatingProgramWithBinaryThenInvalidValueErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; cl_int binaryStatus = CL_INVALID_VALUE; size_t binarySize = 0; @@ -128,6 +132,8 @@ TEST_F(ClCreateProgramWithBinaryTests, GivenInvalidInputWhenCreatingProgramWithB } TEST_F(ClCreateProgramWithBinaryTests, GivenDeviceNotAssociatedWithContextWhenCreatingProgramWithBinaryThenInvalidDeviceErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; cl_int binaryStatus = CL_INVALID_VALUE; size_t binarySize = 0; @@ -229,6 +235,8 @@ TEST_F(ClCreateProgramWithILKHRTests, GivenCorrectParametersWhenCreatingProgramW } TEST_F(ClCreateProgramWithILKHRTests, GivenProgramCreatedWithILWhenBuildAfterBuildIsCalledThenReturnSuccess) { + USE_REAL_FILE_SYSTEM(); + const uint32_t spirv[16] = {0x03022307}; cl_int err = CL_INVALID_VALUE; cl_program program = clCreateProgramWithIL(pContext, spirv, sizeof(spirv), &err); @@ -288,4 +296,4 @@ TEST_F(ClCreateProgramWithILKHRTests, GivenBothFunctionVariantsWhenCreatingProgr EXPECT_EQ(sizeof(spirv), receivedLength); } -} // namespace ULT +} // namespace ULT \ No newline at end of file diff --git a/opencl/test/unit_test/api/cl_get_kernel_arg_info_tests.inl b/opencl/test/unit_test/api/cl_get_kernel_arg_info_tests.inl index a14d69f741..6c6899b8d8 100644 --- a/opencl/test/unit_test/api/cl_get_kernel_arg_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_kernel_arg_info_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -23,6 +23,7 @@ using ClGetKernelArgInfoTests = ApiTests; namespace ULT { TEST_F(ClGetKernelArgInfoTests, GivenValidParamsWhenGettingKernelArgInfoThenSuccessAndCorrectSizeAreReturned) { + USE_REAL_FILE_SYSTEM(); cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; diff --git a/opencl/test/unit_test/api/cl_get_kernel_info_tests.inl b/opencl/test/unit_test/api/cl_get_kernel_info_tests.inl index d694a3df5a..7327e0d01b 100644 --- a/opencl/test/unit_test/api/cl_get_kernel_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_kernel_info_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,6 +22,7 @@ using ClGetKernelInfoTests = ApiTests; namespace ULT { TEST_F(ClGetKernelInfoTests, GivenValidParamsWhenGettingKernelInfoThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; diff --git a/opencl/test/unit_test/api/cl_get_kernel_work_group_info_tests.inl b/opencl/test/unit_test/api/cl_get_kernel_work_group_info_tests.inl index 63da56c6b9..39ba0b4e49 100644 --- a/opencl/test/unit_test/api/cl_get_kernel_work_group_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_kernel_work_group_info_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -14,6 +14,7 @@ using namespace NEO; namespace ULT { TEST_P(ClGetKernelWorkGroupInfoTests, GivenValidParametersWhenGettingKernelWorkGroupInfoThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); size_t paramValueSizeRet; auto retVal = clGetKernelWorkGroupInfo( @@ -57,6 +58,7 @@ TEST_F(ClGetKernelWorkGroupInfoTest, GivenNullDeviceWhenGettingWorkGroupInfoFrom } TEST_F(ClGetKernelWorkGroupInfoTest, GivenNullDeviceWhenGettingWorkGroupInfoFromMultiDeviceKernelThenInvalidDeviceErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); size_t paramValueSizeRet; MockUnrestrictiveContext context; diff --git a/opencl/test/unit_test/api/cl_get_program_build_info_tests.inl b/opencl/test/unit_test/api/cl_get_program_build_info_tests.inl index e1ab606bb0..351d9958b4 100644 --- a/opencl/test/unit_test/api/cl_get_program_build_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_program_build_info_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,6 +24,8 @@ namespace ULT { void verifyDevices(cl_program pProgram, size_t expectedNumDevices, cl_device_id *expectedDevices); TEST_F(ClGetProgramBuildInfoTests, givenSourceWhenclGetProgramBuildInfoIsCalledThenReturnClBuildNone) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -97,6 +99,8 @@ TEST_F(ClGetProgramBuildInfoTests, givenSourceWhenclGetProgramBuildInfoIsCalledT } TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenCompilingForSpecificDevicesThenOnlySpecificDevicesAndTheirSubDevicesReportBuildStatus) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -174,6 +178,8 @@ TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenCompilingForSpecificD } TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenCompilingWithoutInputDevicesThenAllDevicesReportBuildStatus) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -284,6 +290,8 @@ TEST_F(ClGetProgramBuildInfoTests, givenInvalidDeviceInputWhenGetProgramBuildInf } TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenLinkingForSpecificDevicesThenOnlySpecificDevicesReportBuildStatus) { + USE_REAL_FILE_SYSTEM(); + MockProgram *pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -370,6 +378,8 @@ TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenLinkingForSpecificDev } TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenLinkingWithoutInputDevicesThenAllDevicesReportBuildStatus) { + USE_REAL_FILE_SYSTEM(); + MockProgram *pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -457,6 +467,8 @@ TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenLinkingWithoutInputDe } TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenBuildingForSpecificDevicesThenOnlySpecificDevicesAndTheirSubDevicesReportBuildStatus) { + USE_REAL_FILE_SYSTEM(); + MockProgram *pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -539,6 +551,8 @@ TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenBuildingForSpecificDe } TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenBuildingWithoutInputDevicesThenAllDevicesReportBuildStatus) { + USE_REAL_FILE_SYSTEM(); + MockProgram *pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -603,4 +617,4 @@ TEST(clGetProgramBuildInfoTest, givenMultiDeviceProgramWhenBuildingWithoutInputD EXPECT_EQ(CL_SUCCESS, retVal); } -} // namespace ULT +} // namespace ULT \ No newline at end of file diff --git a/opencl/test/unit_test/api/cl_get_program_info_tests.inl b/opencl/test/unit_test/api/cl_get_program_info_tests.inl index 50d3ffa80c..c5997381e1 100644 --- a/opencl/test/unit_test/api/cl_get_program_info_tests.inl +++ b/opencl/test/unit_test/api/cl_get_program_info_tests.inl @@ -43,6 +43,8 @@ void verifyDevices(cl_program pProgram, size_t expectedNumDevices, cl_device_id } TEST_F(ClGetProgramInfoTests, GivenSourceWhenBuildingProgramThenGetProgramInfoReturnsCorrectInfo) { + USE_REAL_FILE_SYSTEM(); + cl_program pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -172,6 +174,8 @@ TEST_F(ClGetProgramInfoTests, GivenIlWhenBuildingProgramThenGetProgramInfoReturn } TEST(clGetProgramInfoTest, GivenMultiDeviceProgramCreatedWithBinaryWhenGettingDevicesThenCorrectDevicesAreReturned) { + USE_REAL_FILE_SYSTEM(); + MockUnrestrictiveContextMultiGPU context; auto numDevicesForProgram = 2u; @@ -227,6 +231,8 @@ TEST(clGetProgramInfoTest, GivenMultiDeviceProgramCreatedWithBinaryWhenGettingDe } TEST(clGetProgramInfoTest, GivenMultiDeviceProgramCreatedWithBinaryWhenGettingBinariesThenCorrectBinariesAreReturned) { + USE_REAL_FILE_SYSTEM(); + MockUnrestrictiveContextMultiGPU context; auto numDevicesForProgram = 2u; @@ -369,6 +375,8 @@ TEST(clGetProgramInfoTest, GivenMultiDeviceProgramCreatedWithILWhenGettingDevice } TEST(clGetProgramInfoTest, GivenMultiDeviceBuiltInProgramCreatedWithGenBinaryWhenGettingDevicesThenCorrectDevicesAreReturned) { + USE_REAL_FILE_SYSTEM(); + MockUnrestrictiveContextMultiGPU context; auto expectedNumDevices = context.getNumDevices(); @@ -406,6 +414,8 @@ TEST(clGetProgramInfoTest, GivenMultiDeviceBuiltInProgramCreatedWithGenBinaryWhe } TEST(clGetProgramInfoTest, GivenMultiDeviceBuiltInProgramCreatedWithGenBinaryWhenGettingDevicesThenCorrectBinariesAreReturned) { + USE_REAL_FILE_SYSTEM(); + MockUnrestrictiveContextMultiGPU context; auto expectedNumDevices = context.getNumDevices(); @@ -463,4 +473,4 @@ TEST(clGetProgramInfoTest, GivenMultiDeviceBuiltInProgramCreatedWithGenBinaryWhe retVal = clReleaseProgram(pProgram); EXPECT_EQ(CL_SUCCESS, retVal); } -} // namespace ULT +} // namespace ULT \ No newline at end of file diff --git a/opencl/test/unit_test/api/cl_intel_tracing_tests.inl b/opencl/test/unit_test/api/cl_intel_tracing_tests.inl index a343ef3e34..55ace3a89c 100644 --- a/opencl/test/unit_test/api/cl_intel_tracing_tests.inl +++ b/opencl/test/unit_test/api/cl_intel_tracing_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -1217,6 +1217,8 @@ struct IntelClLinkProgramTracingTest : public IntelTracingTest, PlatformFixture }; TEST_F(IntelClLinkProgramTracingTest, givenLinkProgramCallTracingWhenInvokingCallbackThenPointersFromCallAndCallbackPointToTheSameAddress) { + USE_REAL_FILE_SYSTEM(); + call(); EXPECT_EQ(1u, enterCount); EXPECT_EQ(1u, exitCount); diff --git a/opencl/test/unit_test/api/cl_link_program_tests.inl b/opencl/test/unit_test/api/cl_link_program_tests.inl index 76fad4e2de..4bb7d89361 100644 --- a/opencl/test/unit_test/api/cl_link_program_tests.inl +++ b/opencl/test/unit_test/api/cl_link_program_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,6 +22,7 @@ namespace ULT { using ClLinkProgramTests = ApiTests; TEST_F(ClLinkProgramTests, GivenValidParamsWhenLinkingProgramThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; @@ -82,6 +83,7 @@ TEST_F(ClLinkProgramTests, GivenValidParamsWhenLinkingProgramThenSuccessIsReturn } TEST_F(ClLinkProgramTests, GivenCreateLibraryOptionWhenLinkingProgramThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; @@ -249,6 +251,7 @@ TEST_F(ClLinkProgramTests, GivenProgramsWithSpecConstantsThenSpecConstantsAreEmb } TEST_F(ClLinkProgramTests, GivenInvalidCallbackInputWhenLinkProgramThenInvalidValueErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; @@ -307,6 +310,7 @@ TEST_F(ClLinkProgramTests, GivenInvalidCallbackInputWhenLinkProgramThenInvalidVa } TEST_F(ClLinkProgramTests, GivenValidCallbackInputWhenLinkProgramThenCallbackIsInvoked) { + USE_REAL_FILE_SYSTEM(); cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; @@ -370,6 +374,7 @@ TEST_F(ClLinkProgramTests, GivenValidCallbackInputWhenLinkProgramThenCallbackIsI } TEST_F(ClLinkProgramTests, givenMultiDeviceProgramWhenLinkingForInvalidDevicesInputThenInvalidDeviceErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); cl_program pProgram = nullptr; size_t sourceSize = 0; std::string testFile; diff --git a/opencl/test/unit_test/api/cl_release_kernel_tests.inl b/opencl/test/unit_test/api/cl_release_kernel_tests.inl index 7962caf2cf..9e49ba543f 100644 --- a/opencl/test/unit_test/api/cl_release_kernel_tests.inl +++ b/opencl/test/unit_test/api/cl_release_kernel_tests.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -24,6 +24,7 @@ TEST_F(ClReleaseKernelTests, GivenNullKernelWhenReleasingKernelThenClInvalidKern } TEST_F(ClReleaseKernelTests, GivenRetainedKernelWhenReleasingKernelThenKernelIsCorrectlyReleased) { + USE_REAL_FILE_SYSTEM(); cl_kernel kernel = nullptr; cl_program program = nullptr; cl_int binaryStatus = CL_SUCCESS; diff --git a/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp b/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp index af7f840cd1..53f6ec536b 100644 --- a/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp +++ b/opencl/test/unit_test/aub_tests/command_queue/enqueue_kernel_aub_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -330,6 +330,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, AUBSimpleArg, WhenEnqueingKernelThenAddressesAreA } HWTEST_F(AUBSimpleArg, givenAubCommandStreamerReceiverWhenBatchBufferFlateningIsForcedThenDumpedAubIsStillValid) { + USE_REAL_FILE_SYSTEM(); cl_uint workDim = 1; size_t globalWorkOffset[3] = {0, 0, 0}; size_t globalWorkSize[3] = {1, 1, 1}; @@ -519,6 +520,7 @@ struct AUBSimpleArgNonUniformFixture : public KernelAUBFixture>; HWTEST_F(AUBSimpleKernelStatelessTest, givenSimpleKernelWhenStatelessPathIsUsedThenExpectCorrectBuffer) { + USE_REAL_FILE_SYSTEM(); constexpr size_t bufferSize = MemoryConstants::pageSize; cl_uint workDim = 1; diff --git a/opencl/test/unit_test/aub_tests/xe_hpc_core/enqueue_kernel_aub_tests_xe_hpc_core.cpp b/opencl/test/unit_test/aub_tests/xe_hpc_core/enqueue_kernel_aub_tests_xe_hpc_core.cpp index 4b9831d1a9..4ae8634826 100644 --- a/opencl/test/unit_test/aub_tests/xe_hpc_core/enqueue_kernel_aub_tests_xe_hpc_core.cpp +++ b/opencl/test/unit_test/aub_tests/xe_hpc_core/enqueue_kernel_aub_tests_xe_hpc_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -20,6 +20,7 @@ extern const HardwareInfo *defaultHwInfo; using AUBSimpleKernelStatelessTest = Test>; HWTEST_F(AUBSimpleKernelStatelessTest, givenPrefetchEnabledWhenEnqueuedKernelThenDataIsCorrect) { + USE_REAL_FILE_SYSTEM(); DebugManagerStateRestore restore; debugManager.flags.EnableMemoryPrefetch.set(1); diff --git a/opencl/test/unit_test/built_ins/built_in_tests.cpp b/opencl/test/unit_test/built_ins/built_in_tests.cpp index 4f57c42878..ffbe53c7ff 100644 --- a/opencl/test/unit_test/built_ins/built_in_tests.cpp +++ b/opencl/test/unit_test/built_ins/built_in_tests.cpp @@ -70,6 +70,8 @@ class BuiltInTests } void SetUp() override { + USE_REAL_FILE_SYSTEM(); + debugManager.flags.ForceAuxTranslationMode.set(static_cast(AuxTranslationMode::builtin)); ClDeviceFixture::setUp(); cl_device_id device = pClDevice; @@ -233,6 +235,7 @@ HWCMDTEST_P(IGFX_XE_HP_CORE, AuxBuiltInTests, givenXeHpCoreCommandsAndAuxTransla } TEST_F(BuiltInTests, WhenBuildingListOfBuiltinsThenBuiltinsHaveBeenGenerated) { + USE_REAL_FILE_SYSTEM(); for (auto supportsImages : ::testing::Bool()) { allBuiltIns.clear(); size_t size = 0; @@ -271,6 +274,7 @@ TEST_F(BuiltInTests, WhenBuildingListOfBuiltinsThenBuiltinsHaveBeenGenerated) { } TEST_F(BuiltInTests, GivenCopyBufferToSystemMemoryBufferWhenDispatchInfoIsCreatedThenParamsAreCorrect) { + USE_REAL_FILE_SYSTEM(); BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice); MockBuffer *srcPtr = new MockBuffer(); @@ -338,6 +342,7 @@ TEST_F(BuiltInTests, GivenCopyBufferToSystemMemoryBufferWhenDispatchInfoIsCreate } TEST_F(BuiltInTests, GivenCopyBufferToLocalMemoryBufferWhenDispatchInfoIsCreatedThenParamsAreCorrect) { + USE_REAL_FILE_SYSTEM(); BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice); MockBuffer *srcPtr = new MockBuffer(); @@ -560,6 +565,7 @@ HWTEST2_P(AuxBuiltInTests, givenInvalidAuxTranslationDirectionWhenBuildingDispat } TEST_F(BuiltInTests, whenAuxBuiltInIsConstructedThenResizeKernelInstancedTo5) { + USE_REAL_FILE_SYSTEM(); MockAuxBuilInOp mockAuxBuiltInOp(*pBuiltIns, *pClDevice); EXPECT_EQ(5u, mockAuxBuiltInOp.convertToAuxKernel.size()); EXPECT_EQ(5u, mockAuxBuiltInOp.convertToNonAuxKernel.size()); @@ -591,6 +597,7 @@ HWTEST2_P(AuxBuiltInTests, givenMoreKernelObjectsForAuxTranslationThanKernelInst } TEST_F(BuiltInTests, givenkAuxBuiltInWhenResizeIsCalledThenCloneAllNewInstancesFromBaseKernel) { + USE_REAL_FILE_SYSTEM(); MockAuxBuilInOp mockAuxBuiltInOp(*pBuiltIns, *pClDevice); size_t newSize = mockAuxBuiltInOp.convertToAuxKernel.size() + 3; mockAuxBuiltInOp.resizeKernelInstances(newSize); @@ -832,6 +839,7 @@ HWTEST2_P(AuxBuiltInTests, givenNonAuxToAuxTranslationWhenSettingSurfaceStateThe } TEST_F(BuiltInTests, GivenCopyBufferToBufferWhenDispatchInfoIsCreatedThenSizeIsAlignedToCachLineSize) { + USE_REAL_FILE_SYSTEM(); BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice); AlignedBuffer src; @@ -1198,6 +1206,7 @@ HWTEST_F(BuiltInTests, givenHeaplessWhenBuilderCopyImageToImageHeaplessIsUsedThe } HWTEST_F(BuiltInTests, WhenBuilderCopyImageToImageIsUsedThenParamsAreCorrect) { + USE_REAL_FILE_SYSTEM(); REQUIRE_IMAGES_OR_SKIP(defaultHwInfo); std ::unique_ptr srcImage(Image2dHelper<>::create(pContext)); @@ -1250,7 +1259,7 @@ HWTEST_F(BuiltInTests, givenHeaplessWhenBuilderFillImageHeaplessIsUsedThenParams HWTEST_F(BuiltInTests, WhenBuilderFillImageIsUsedThenParamsAreCorrect) { REQUIRE_IMAGES_OR_SKIP(defaultHwInfo); - + USE_REAL_FILE_SYSTEM(); MockBuffer fillColor; std ::unique_ptr image(Image2dHelper<>::create(pContext)); ASSERT_NE(nullptr, image.get()); @@ -1346,6 +1355,7 @@ HWTEST_F(BuiltInTests, givenBigOffsetAndSizeWhenBuilderCopyImageToLocalBufferSta } TEST_F(BuiltInTests, GivenUnalignedCopyBufferToBufferWhenDispatchInfoIsCreatedThenParamsAreCorrect) { + USE_REAL_FILE_SYSTEM(); BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice); AlignedBuffer src; @@ -1375,6 +1385,7 @@ TEST_F(BuiltInTests, GivenUnalignedCopyBufferToBufferWhenDispatchInfoIsCreatedTh } TEST_F(BuiltInTests, GivenReadBufferAlignedWhenDispatchInfoIsCreatedThenParamsAreCorrect) { + USE_REAL_FILE_SYSTEM(); BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice); AlignedBuffer srcMemObj; @@ -1414,6 +1425,7 @@ TEST_F(BuiltInTests, GivenReadBufferAlignedWhenDispatchInfoIsCreatedThenParamsAr } TEST_F(BuiltInTests, GivenWriteBufferAlignedWhenDispatchInfoIsCreatedThenParamsAreCorrect) { + USE_REAL_FILE_SYSTEM(); BuiltinDispatchInfoBuilder &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice); auto size = 10 * MemoryConstants::cacheLineSize; @@ -1449,6 +1461,7 @@ TEST_F(BuiltInTests, GivenWriteBufferAlignedWhenDispatchInfoIsCreatedThenParamsA } TEST_F(BuiltInTests, WhenGettingBuilderInfoTwiceThenPointerIsSame) { + USE_REAL_FILE_SYSTEM(); BuiltinDispatchInfoBuilder &builder1 = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice); BuiltinDispatchInfoBuilder &builder2 = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, *pClDevice); @@ -1456,6 +1469,7 @@ TEST_F(BuiltInTests, WhenGettingBuilderInfoTwiceThenPointerIsSame) { } HWTEST_F(BuiltInTests, GivenBuiltInOperationWhenGettingBuilderThenCorrectBuiltInBuilderIsReturned) { + USE_REAL_FILE_SYSTEM(); auto clExecutionEnvironment = static_cast(pClDevice->getExecutionEnvironment()); bool heaplessAllowed = UnitTestHelper::isHeaplessAllowed(); @@ -1916,6 +1930,7 @@ TEST_F(BuiltInTests, givenDebugFlagForceUseSourceWhenArgIsAnyThenReturnBuiltinCo using BuiltInOwnershipWrapperTests = BuiltInTests; TEST_F(BuiltInOwnershipWrapperTests, givenBuiltinWhenConstructedThenLockAndUnlockOnDestruction) { + USE_REAL_FILE_SYSTEM(); MockAuxBuilInOp mockAuxBuiltInOp(*pBuiltIns, *pClDevice); MockContext context(pClDevice); { @@ -1931,6 +1946,7 @@ TEST_F(BuiltInOwnershipWrapperTests, givenBuiltinWhenConstructedThenLockAndUnloc } TEST_F(BuiltInOwnershipWrapperTests, givenLockWithoutParametersWhenConstructingThenLockOnlyWhenRequested) { + USE_REAL_FILE_SYSTEM(); MockAuxBuilInOp mockAuxBuiltInOp(*pBuiltIns, *pClDevice); MockContext context(pClDevice); { @@ -1947,6 +1963,7 @@ TEST_F(BuiltInOwnershipWrapperTests, givenLockWithoutParametersWhenConstructingT } TEST_F(BuiltInOwnershipWrapperTests, givenLockWithAcquiredOwnershipWhenTakeOwnershipCalledThenAbort) { + USE_REAL_FILE_SYSTEM(); MockAuxBuilInOp mockAuxBuiltInOp1(*pBuiltIns, *pClDevice); MockAuxBuilInOp mockAuxBuiltInOp2(*pBuiltIns, *pClDevice); MockContext context(pClDevice); @@ -2140,4 +2157,4 @@ HWTEST2_F(BuiltInTests, whenBuilderFillLocalBufferStatelessHeaplessIsUsedThenPar for (auto &dispatchInfo : multiDispatchInfo) { EXPECT_FALSE(dispatchInfo.getKernel()->getDestinationAllocationInSystemMemory()); } -} +} \ No newline at end of file diff --git a/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp b/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp index b227aae58b..ff833eb283 100644 --- a/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp +++ b/opencl/test/unit_test/command_queue/dispatch_walker_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,7 @@ #include "shared/source/command_container/encode_surface_state.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/basic_math.h" +#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/local_work_size.h" #include "shared/source/kernel/implicit_args_helper.h" @@ -1104,6 +1105,7 @@ TEST(DispatchWalker, WhenCalculatingDispatchDimensionsThenCorrectValuesAreReturn } HWTEST_P(DispatchWalkerTestForAuxTranslation, givenKernelWhenAuxToNonAuxWhenTranslationRequiredThenPipeControlWithStallAndDCFlushAdded) { + USE_REAL_FILE_SYSTEM(); BuiltinDispatchInfoBuilder &baseBuilder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::auxTranslation, *pClDevice); auto &builder = static_cast &>(baseBuilder); @@ -1152,6 +1154,7 @@ HWTEST_P(DispatchWalkerTestForAuxTranslation, givenKernelWhenAuxToNonAuxWhenTran } HWTEST_P(DispatchWalkerTestForAuxTranslation, givenKernelWhenNonAuxToAuxWhenTranslationRequiredThenPipeControlWithStallAdded) { + USE_REAL_FILE_SYSTEM(); BuiltinDispatchInfoBuilder &baseBuilder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::auxTranslation, *pClDevice); auto &builder = static_cast &>(baseBuilder); diff --git a/opencl/test/unit_test/command_queue/enqueue_copy_image_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_copy_image_tests.cpp index c5635dc0d1..4a4bc20443 100644 --- a/opencl/test/unit_test/command_queue/enqueue_copy_image_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_copy_image_tests.cpp @@ -6,6 +6,7 @@ */ #include "shared/source/gen_common/reg_configs_common.h" +#include "shared/source/helpers/file_io.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/unit_test_helper.h" #include "shared/test/common/libult/ult_command_stream_receiver.h" @@ -227,6 +228,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, EnqueueCopyImageTest, WhenCopyingImageThenMediaVf using MipMapCopyImageTest = EnqueueCopyImageMipMapTest; HWTEST_P(MipMapCopyImageTest, GivenImagesWithNonZeroMipLevelsWhenCopyImageIsCalledThenProperMipLevelsAreSet) { + USE_REAL_FILE_SYSTEM(); bool heaplessAllowed = UnitTestHelper::isHeaplessAllowed(); bool useHeapless = false; diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp index ffceb7b31b..89d7d713f9 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_1_tests.cpp @@ -91,6 +91,7 @@ TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreSetThenClEnqueueNDRangeKernel } TEST(EnqueueMultiDeviceKernelTest, givenMultiDeviceKernelWhenSetArgDeviceUSMThenOnlyOneKernelIsPatched) { + USE_REAL_FILE_SYSTEM(); REQUIRE_SVM_OR_SKIP(defaultHwInfo); auto deviceFactory = std::make_unique(3, 0); auto device0 = deviceFactory->rootDevices[0]; diff --git a/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp index 6bc2f6dd87..eb848a17a1 100644 --- a/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_kernel_2_tests.cpp @@ -988,6 +988,7 @@ HWTEST_F(EnqueueAuxKernelTests, givenMultipleArgsWhenAuxTranslationIsRequiredThe } HWTEST_F(EnqueueAuxKernelTests, givenKernelWithRequiredAuxTranslationWhenEnqueuedThenDispatchAuxTranslationBuiltin) { + USE_REAL_FILE_SYSTEM(); MockKernelWithInternals mockKernel(*pClDevice, context); MyCmdQ cmdQ(context, pClDevice); size_t gws[3] = {1, 0, 0}; diff --git a/opencl/test/unit_test/command_queue/enqueue_svm_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_svm_tests.cpp index 45ca153abc..8420009ae0 100644 --- a/opencl/test/unit_test/command_queue/enqueue_svm_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_svm_tests.cpp @@ -8,6 +8,7 @@ #include "shared/source/command_stream/command_stream_receiver.h" #include "shared/source/debug_settings/debug_settings_manager.h" #include "shared/source/helpers/aligned_memory.h" +#include "shared/source/helpers/file_io.h" #include "shared/source/memory_manager/allocations_list.h" #include "shared/source/memory_manager/internal_allocation_storage.h" #include "shared/source/memory_manager/surface.h" @@ -911,6 +912,7 @@ TEST_F(EnqueueSvmTest, givenEnqueueSVMMemFillWhenPatternAllocationIsObtainedThen } TEST_F(EnqueueSvmTest, GivenSvmAllocationWhenEnqueingKernelThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); auto svmData = context->getSVMAllocsManager()->getSVMAlloc(ptrSVM); ASSERT_NE(nullptr, svmData); GraphicsAllocation *svmAllocation = svmData->gpuAllocations.getGraphicsAllocation(context->getDevice(0)->getRootDeviceIndex()); @@ -939,6 +941,7 @@ TEST_F(EnqueueSvmTest, GivenSvmAllocationWhenEnqueingKernelThenSuccessIsReturned } TEST_F(EnqueueSvmTest, givenEnqueueTaskBlockedOnUserEventWhenItIsEnqueuedThenSurfacesAreMadeResident) { + USE_REAL_FILE_SYSTEM(); auto svmData = context->getSVMAllocsManager()->getSVMAlloc(ptrSVM); ASSERT_NE(nullptr, svmData); GraphicsAllocation *svmAllocation = svmData->gpuAllocations.getGraphicsAllocation(context->getDevice(0)->getRootDeviceIndex()); diff --git a/opencl/test/unit_test/command_queue/get_size_required_buffer_tests.cpp b/opencl/test/unit_test/command_queue/get_size_required_buffer_tests.cpp index 8524bc4534..fe63eba98c 100644 --- a/opencl/test/unit_test/command_queue/get_size_required_buffer_tests.cpp +++ b/opencl/test/unit_test/command_queue/get_size_required_buffer_tests.cpp @@ -63,6 +63,7 @@ struct GetSizeRequiredBufferTest : public CommandEnqueueFixture, }; HWTEST_F(GetSizeRequiredBufferTest, WhenFillingBufferThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -116,6 +117,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenFillingBufferThenHeapsAndCommandBufferCo } HWTEST_F(GetSizeRequiredBufferTest, WhenCopyingBufferThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -168,6 +170,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenCopyingBufferThenHeapsAndCommandBufferCo } HWTEST_F(GetSizeRequiredBufferTest, WhenReadingBufferNonBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -221,6 +224,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenReadingBufferNonBlockingThenHeapsAndComm } HWTEST_F(GetSizeRequiredBufferTest, WhenReadingBufferBlockingThenThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -275,6 +279,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenReadingBufferBlockingThenThenHeapsAndCom } HWTEST_F(GetSizeRequiredBufferTest, WhenWritingBufferNonBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -326,6 +331,7 @@ HWTEST_F(GetSizeRequiredBufferTest, WhenWritingBufferNonBlockingThenHeapsAndComm } HWTEST_F(GetSizeRequiredBufferTest, WhenWritingBufferBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -440,6 +446,7 @@ HWTEST_F(GetSizeRequiredBufferTest, GivenOutEventForMultiDeviceContextWhenCalcul } HWTEST2_F(GetSizeRequiredBufferTest, givenMultipleKernelRequiringSshWhenTotalSizeIsComputedThenItIsProperlyAligned, IsHeapfulSupported) { + USE_REAL_FILE_SYSTEM(); auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer, pCmdQ->getClDevice()); ASSERT_NE(nullptr, &builder); @@ -549,4 +556,4 @@ HWTEST_F(GetSizeRequiredBufferTest, GivenKernelWithSimpleArgWhenEnqueingKernelTh EXPECT_GE(expectedSizeDSH, dshAfter - dshBefore); EXPECT_GE(expectedSizeIOH, iohAfter - iohBefore); EXPECT_GE(expectedSizeSSH, sshAfter - sshBefore); -} +} \ No newline at end of file diff --git a/opencl/test/unit_test/command_queue/get_size_required_image_tests.cpp b/opencl/test/unit_test/command_queue/get_size_required_image_tests.cpp index 34506a12c2..3a2b770772 100644 --- a/opencl/test/unit_test/command_queue/get_size_required_image_tests.cpp +++ b/opencl/test/unit_test/command_queue/get_size_required_image_tests.cpp @@ -1,11 +1,12 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/built_ins/built_ins.h" +#include "shared/source/helpers/file_io.h" #include "shared/source/utilities/perf_counter.h" #include "shared/test/common/test_macros/test.h" @@ -60,6 +61,7 @@ struct GetSizeRequiredImageTest : public CommandEnqueueFixture, }; HWTEST_F(GetSizeRequiredImageTest, WhenCopyingImageThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -112,6 +114,7 @@ HWTEST_F(GetSizeRequiredImageTest, WhenCopyingImageThenHeapsAndCommandBufferCons } HWTEST_F(GetSizeRequiredImageTest, WhenCopyingReadWriteImageThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -162,6 +165,7 @@ HWTEST_F(GetSizeRequiredImageTest, WhenCopyingReadWriteImageThenHeapsAndCommandB } HWTEST_F(GetSizeRequiredImageTest, WhenReadingImageNonBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -218,6 +222,7 @@ HWTEST_F(GetSizeRequiredImageTest, WhenReadingImageNonBlockingThenHeapsAndComman } HWTEST_F(GetSizeRequiredImageTest, WhenReadingImageBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -274,6 +279,7 @@ HWTEST_F(GetSizeRequiredImageTest, WhenReadingImageBlockingThenHeapsAndCommandBu } HWTEST_F(GetSizeRequiredImageTest, WhenWritingImageNonBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -330,6 +336,7 @@ HWTEST_F(GetSizeRequiredImageTest, WhenWritingImageNonBlockingThenHeapsAndComman } HWTEST_F(GetSizeRequiredImageTest, WhenWritingImageBlockingThenHeapsAndCommandBufferConsumedMinimumRequiredSize) { + USE_REAL_FILE_SYSTEM(); auto &commandStream = pCmdQ->getCS(1024); auto usedBeforeCS = commandStream.getUsed(); auto &dsh = pCmdQ->getIndirectHeap(IndirectHeap::Type::dynamicState, 0u); @@ -383,4 +390,4 @@ HWTEST_F(GetSizeRequiredImageTest, WhenWritingImageBlockingThenHeapsAndCommandBu EXPECT_GE(expectedSizeDSH, usedAfterDSH - usedBeforeDSH); EXPECT_GE(expectedSizeIOH, usedAfterIOH - usedBeforeIOH); EXPECT_GE(expectedSizeSSH, usedAfterSSH - usedBeforeSSH); -} +} \ No newline at end of file diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp index 9df2b2c542..59b02fd325 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_4_tests.cpp @@ -6,6 +6,7 @@ */ #include "shared/source/command_stream/wait_status.h" +#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/timestamp_packet.h" #include "shared/source/utilities/wait_util.h" #include "shared/test/common/libult/ult_command_stream_receiver.h" @@ -30,6 +31,7 @@ using namespace NEO; using MultiRootDeviceCommandStreamReceiverBufferTests = MultiRootDeviceFixture; HWTEST_F(MultiRootDeviceCommandStreamReceiverBufferTests, givenMultipleEventInMultiRootDeviceEnvironmentWhenTheyArePassedToEnqueueWithSubmissionThenCsIsWaitingForEventsFromPreviousDevices) { + USE_REAL_FILE_SYSTEM(); REQUIRE_SVM_OR_SKIP(device1); REQUIRE_SVM_OR_SKIP(device2); diff --git a/opencl/test/unit_test/compiler_interface/cl_compiler_interface_tests.cpp b/opencl/test/unit_test/compiler_interface/cl_compiler_interface_tests.cpp index 6b68a47d4d..ed3930f780 100644 --- a/opencl/test/unit_test/compiler_interface/cl_compiler_interface_tests.cpp +++ b/opencl/test/unit_test/compiler_interface/cl_compiler_interface_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,6 +22,7 @@ class ClCompilerInterfaceTest : public ClDeviceFixture, public ::testing::Test { public: void SetUp() override { + USE_REAL_FILE_SYSTEM(); ClDeviceFixture::setUp(); // create the compiler interface @@ -59,6 +60,7 @@ class ClCompilerInterfaceTest : public ClDeviceFixture, }; TEST_F(ClCompilerInterfaceTest, WhenBuildIsInvokedThenFclReceivesListOfExtensionsInInternalOptions) { + USE_REAL_FILE_SYSTEM(); CompilerCacheConfig config = {}; config.enabled = false; auto tempCompilerCache = std::make_unique(config); @@ -76,6 +78,7 @@ TEST_F(ClCompilerInterfaceTest, WhenBuildIsInvokedThenFclReceivesListOfExtension } TEST_F(ClCompilerInterfaceTest, WhenCompileIsInvokedThenFclReceivesListOfExtensionsInInternalOptions) { + USE_REAL_FILE_SYSTEM(); std::string receivedInternalOptions; MockCompilerDebugVars fclDebugVars; diff --git a/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp b/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp index 289d5187fd..5beaa1f048 100644 --- a/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp +++ b/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp @@ -5,6 +5,7 @@ * */ +#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/local_work_size.h" #include "shared/source/memory_manager/unified_memory_manager.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" @@ -853,6 +854,7 @@ TEST_P(PerformanceHintEnqueueKernelBadSizeTest, GivenBadLocalWorkGroupSizeWhenEn } HWTEST_F(PerformanceHintEnqueueKernelPrintfTest, GivenKernelWithPrintfWhenEnqueueKernelIsCalledWithWorkDim3ThenContextProvidesProperHint) { + USE_REAL_FILE_SYSTEM(); size_t preferredWorkGroupSize[3]; auto maxWorkGroupSize = static_cast(pPlatform->getClDevice(0)->getSharedDeviceInfo().maxWorkGroupSize); if (debugManager.flags.EnableComputeWorkSizeND.get()) { diff --git a/opencl/test/unit_test/fixtures/hello_world_kernel_fixture.h b/opencl/test/unit_test/fixtures/hello_world_kernel_fixture.h index 43abac4f62..e92d2e400c 100644 --- a/opencl/test/unit_test/fixtures/hello_world_kernel_fixture.h +++ b/opencl/test/unit_test/fixtures/hello_world_kernel_fixture.h @@ -32,6 +32,7 @@ struct HelloWorldKernelFixture : public ProgramFixture { using ProgramFixture::setUp; void setUp(ClDevice *pDevice, const char *kernelFilenameStr, const char *kernelNameStr) { + USE_REAL_FILE_SYSTEM(); setUp(pDevice, kernelFilenameStr, kernelNameStr, nullptr); } void setUp(ClDevice *pDevice, const char *kernelFilenameStr, const char *kernelNameStr, const char *options) { diff --git a/opencl/test/unit_test/fixtures/kernel_work_group_info_fixture.h b/opencl/test/unit_test/fixtures/kernel_work_group_info_fixture.h index cf2fcd4c05..f0f6c61d31 100644 --- a/opencl/test/unit_test/fixtures/kernel_work_group_info_fixture.h +++ b/opencl/test/unit_test/fixtures/kernel_work_group_info_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2023 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -18,6 +18,7 @@ struct ClGetKernelWorkGroupInfoTest : public ApiFixture<>, typedef ApiFixture BaseClass; void SetUp() override { + USE_REAL_FILE_SYSTEM(); BaseClass::setUp(); std::unique_ptr pSource = nullptr; diff --git a/opencl/test/unit_test/fixtures/program_fixture.cpp b/opencl/test/unit_test/fixtures/program_fixture.cpp index 02873efe77..592feba467 100644 --- a/opencl/test/unit_test/fixtures/program_fixture.cpp +++ b/opencl/test/unit_test/fixtures/program_fixture.cpp @@ -19,6 +19,7 @@ namespace NEO { void ProgramFixture::createProgramWithSource(Context *pContext, const std::string &sourceFileName) { + USE_REAL_FILE_SYSTEM(); cleanup(); cl_int retVal = CL_SUCCESS; std::string testFile; @@ -58,6 +59,7 @@ void ProgramFixture::createProgramFromBinary(Context *pContext, const std::string &binaryFileName, cl_int &retVal, const std::string &options) { + USE_REAL_FILE_SYSTEM(); retVal = CL_SUCCESS; std::string testFile; diff --git a/opencl/test/unit_test/fixtures/simple_arg_kernel_fixture.h b/opencl/test/unit_test/fixtures/simple_arg_kernel_fixture.h index a957f923fa..6668722277 100644 --- a/opencl/test/unit_test/fixtures/simple_arg_kernel_fixture.h +++ b/opencl/test/unit_test/fixtures/simple_arg_kernel_fixture.h @@ -87,6 +87,7 @@ class SimpleArgNonUniformKernelFixture : public ProgramFixture { protected: void setUp(ClDevice *device, Context *context) { + USE_REAL_FILE_SYSTEM(); ProgramFixture::setUp(); createProgramFromBinary( diff --git a/opencl/test/unit_test/gtpin/gtpin_tests.cpp b/opencl/test/unit_test/gtpin/gtpin_tests.cpp index 05b855d2a4..bbf8072919 100644 --- a/opencl/test/unit_test/gtpin/gtpin_tests.cpp +++ b/opencl/test/unit_test/gtpin/gtpin_tests.cpp @@ -665,6 +665,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceThenGTPinContextCallbackIsCalle } TEST_F(GTPinTests, givenUninitializedGTPinInterfaceThenGTPinKernelCreateCallbackIsNotCalled) { + USE_REAL_FILE_SYSTEM(); cl_kernel kernel = nullptr; cl_program pProgram = nullptr; cl_device_id device = (cl_device_id)pDevice; @@ -734,7 +735,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenContextIsCreatedThenCorrect } TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsExecutedThenGTPinCallbacksAreCalled) { - + USE_REAL_FILE_SYSTEM(); const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper(); if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) { GTEST_SKIP(); @@ -890,7 +891,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsExecutedThenGTPinCa } TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelINTELIsExecutedThenGTPinCallbacksAreCalled) { - + USE_REAL_FILE_SYSTEM(); const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper(); if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) { GTEST_SKIP(); @@ -1048,7 +1049,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelINTELIsExecutedThenGT } TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenTheSameKerneIsExecutedTwiceThenGTPinCreateKernelCallbackIsCalledOnce) { - + USE_REAL_FILE_SYSTEM(); const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper(); if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) { GTEST_SKIP(); @@ -1221,6 +1222,7 @@ TEST_F(GTPinTests, givenMultipleKernelSubmissionsWhenOneOfGtpinSurfacesIsNullThe if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) { GTEST_SKIP(); } + USE_REAL_FILE_SYSTEM(); gtpinCallbacks.onContextCreate = onContextCreate; gtpinCallbacks.onContextDestroy = onContextDestroy; gtpinCallbacks.onKernelCreate = onKernelCreate; @@ -1344,7 +1346,7 @@ TEST_F(GTPinTests, givenMultipleKernelSubmissionsWhenOneOfGtpinSurfacesIsNullThe } TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsCreatedThenAllKernelSubmitRelatedNotificationsAreCalled) { - + USE_REAL_FILE_SYSTEM(); const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper(); if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) { GTEST_SKIP(); @@ -1545,7 +1547,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenKernelIsCreatedThenAllKerne } TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOneKernelIsSubmittedSeveralTimesThenCorrectBuffersAreMadeResident) { - + USE_REAL_FILE_SYSTEM(); const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper(); if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) { GTEST_SKIP(); @@ -1730,6 +1732,7 @@ TEST_F(GTPinTests, givenInitializedGTPinInterfaceWhenOneKernelIsSubmittedSeveral } TEST_F(GTPinTests, givenKernelWithSSHThenVerifyThatSSHResizeWorksWell) { + USE_REAL_FILE_SYSTEM(); const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper(); if (compilerProductHelper.isForceToStatelessRequired() || !compilerProductHelper.isStatelessToStatefulBufferOffsetSupported()) { auto >pinHelper = pDevice->getGTPinGfxCoreHelper(); @@ -1854,6 +1857,7 @@ TEST_F(GTPinTests, givenKernelWithoutAllocatedSSHThenGTPinStillCanAllocateNewSSH } TEST_F(GTPinTests, givenKernelThenVerifyThatKernelCodeSubstitutionWorksWell) { + USE_REAL_FILE_SYSTEM(); cl_kernel kernel = nullptr; cl_program pProgram = nullptr; cl_device_id device = (cl_device_id)pDevice; @@ -2287,6 +2291,7 @@ TEST_F(GTPinTestsWithLocalMemory, givenGtPinCanUseSharedAllocationWhenGtPinBuffe } HWTEST_F(GTPinTestsWithLocalMemory, givenGtPinCanUseSharedAllocationWhenGtPinBufferIsAllocatedInSharedMemoryThenSetSurfaceStateForTheBufferAndMakeItResident) { + USE_REAL_FILE_SYSTEM(); auto >pinHelper = pDevice->getGTPinGfxCoreHelper(); const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper(); if (!gtpinHelper.canUseSharedAllocation(pDevice->getHardwareInfo()) || @@ -2565,4 +2570,4 @@ TEST(GTPinInitNotifyTests, givenAvailablePlatformsAndEnvironmentVariableSetWhenT platformsImpl->clear(); } -} // namespace ULT +} // namespace ULT \ No newline at end of file diff --git a/opencl/test/unit_test/helpers/hardware_commands_helper_tests.cpp b/opencl/test/unit_test/helpers/hardware_commands_helper_tests.cpp index 8902f44621..537e11dd8e 100644 --- a/opencl/test/unit_test/helpers/hardware_commands_helper_tests.cpp +++ b/opencl/test/unit_test/helpers/hardware_commands_helper_tests.cpp @@ -137,6 +137,7 @@ HWCMDTEST_F(IGFX_GEN12LP_CORE, HardwareCommandsTest, WhenMediaStateFlushIsCreate } HWTEST_F(HardwareCommandsTest, WhenCrossThreadDataIsCreatedThenOnlyRequiredSpaceOnIndirectHeapIsAllocated) { + USE_REAL_FILE_SYSTEM(); REQUIRE_IMAGES_OR_SKIP(defaultHwInfo); using DefaultWalkerType = typename FamilyType::DefaultWalkerType; CommandQueueHw cmdQ(pContext, pClDevice, 0, false); diff --git a/opencl/test/unit_test/kernel/kernel_is_patched_tests.cpp b/opencl/test/unit_test/kernel/kernel_is_patched_tests.cpp index c82ea88d47..c1d795ec3f 100644 --- a/opencl/test/unit_test/kernel/kernel_is_patched_tests.cpp +++ b/opencl/test/unit_test/kernel/kernel_is_patched_tests.cpp @@ -1,10 +1,11 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ +#include "shared/source/helpers/file_io.h" #include "shared/test/common/mocks/mock_device.h" #include "opencl/test/unit_test/mocks/mock_cl_device.h" @@ -18,6 +19,7 @@ using namespace NEO; class PatchedKernelTest : public ::testing::Test { public: void SetUp() override { + USE_REAL_FILE_SYSTEM(); device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get(), rootDeviceIndex)); context.reset(new MockContext(device.get())); program.reset(Program::createBuiltInFromSource("FillBufferBytes", context.get(), context->getDevices(), &retVal)); diff --git a/opencl/test/unit_test/mt_tests/command_queue/ioq_task_tests_mt.cpp b/opencl/test/unit_test/mt_tests/command_queue/ioq_task_tests_mt.cpp index b7a5f9e2c1..4f36ed7e29 100644 --- a/opencl/test/unit_test/mt_tests/command_queue/ioq_task_tests_mt.cpp +++ b/opencl/test/unit_test/mt_tests/command_queue/ioq_task_tests_mt.cpp @@ -57,6 +57,7 @@ struct IOQTaskTestsMt : public HelloWorldTest { }; TEST_F(IOQTaskTestsMt, GivenBlockingAndBlockedOnUserEventWhenReadingBufferThenTaskCountAndTaskLevelAreIncremented) { + USE_REAL_FILE_SYSTEM(); auto buffer = std::unique_ptr(BufferHelper<>::create()); auto alignedReadPtr = alignedMalloc(BufferDefaults::sizeInBytes, MemoryConstants::cacheLineSize); diff --git a/opencl/test/unit_test/mt_tests/command_queue/ooq_task_tests_mt.cpp b/opencl/test/unit_test/mt_tests/command_queue/ooq_task_tests_mt.cpp index e4a316e956..0f71bccd9f 100644 --- a/opencl/test/unit_test/mt_tests/command_queue/ooq_task_tests_mt.cpp +++ b/opencl/test/unit_test/mt_tests/command_queue/ooq_task_tests_mt.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -23,6 +23,7 @@ struct OOQTaskTypedTestsMt : public HelloWorldTest { typedef OOQTaskTypedTestsMt> OOQTaskTestsMt; TEST_F(OOQTaskTestsMt, GivenBlockingAndBlockedOnUserEventWhenReadingBufferThenTaskCountIsIncrementedAndTaskLevelIsUnchanged) { + USE_REAL_FILE_SYSTEM(); auto buffer = std::unique_ptr(BufferHelper<>::create()); auto alignedReadPtr = alignedMalloc(BufferDefaults::sizeInBytes, MemoryConstants::cacheLineSize); diff --git a/opencl/test/unit_test/mt_tests/event/user_events_tests_mt.cpp b/opencl/test/unit_test/mt_tests/event/user_events_tests_mt.cpp index 945f670bce..8a193983dc 100644 --- a/opencl/test/unit_test/mt_tests/event/user_events_tests_mt.cpp +++ b/opencl/test/unit_test/mt_tests/event/user_events_tests_mt.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -64,6 +64,7 @@ TEST_F(MockEventTests, GivenEventCreatedFromUserEventsThatIsNotSignaledThenDoNot } TEST_F(EventTests, givenUserEventBlockingEnqueueWithBlockingFlagWhenUserEventIsCompletedAfterBlockedPathIsChosenThenBlockingFlagDoesNotCauseStall) { + USE_REAL_FILE_SYSTEM(); std::unique_ptr srcBuffer(BufferHelper<>::create()); std::unique_ptr dst(new char[srcBuffer->getSize()]); @@ -85,6 +86,7 @@ TEST_F(EventTests, givenUserEventBlockingEnqueueWithBlockingFlagWhenUserEventIsC } TEST_F(EventTests, givenUserEventBlockingEnqueueWithBlockingFlagWhenUserEventIsCompletedAfterUpdateFromCompletionStampThenBlockingFlagDoesNotCauseStall) { + USE_REAL_FILE_SYSTEM(); std::unique_ptr srcBuffer(BufferHelper<>::create()); std::unique_ptr dst(new char[srcBuffer->getSize()]); @@ -112,6 +114,7 @@ TEST_F(EventTests, givenUserEventBlockingEnqueueWithBlockingFlagWhenUserEventIsC } HWTEST_F(EventTests, givenOneThreadUpdatingUserEventAnotherWaitingOnFinishWhenFinishIsCalledThenItWaitsForCorrectTaskCount) { + USE_REAL_FILE_SYSTEM(); MockCommandQueueHw mockCmdQueue(context, pClDevice, nullptr); std::unique_ptr srcBuffer(BufferHelper<>::create()); std::unique_ptr dst(new char[srcBuffer->getSize()]); diff --git a/opencl/test/unit_test/program/program_data_tests.cpp b/opencl/test/unit_test/program/program_data_tests.cpp index e45c295679..15bdfdfcfb 100644 --- a/opencl/test/unit_test/program/program_data_tests.cpp +++ b/opencl/test/unit_test/program/program_data_tests.cpp @@ -1,10 +1,11 @@ /* - * Copyright (C) 2018-2024 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ +#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/string.h" #include "shared/source/kernel/implicit_args_helper.h" #include "shared/source/memory_manager/allocations_list.h" @@ -55,6 +56,7 @@ class ProgramDataTestBase : public testing::Test, void buildAndDecodeProgramPatchList(); void SetUp() override { + USE_REAL_FILE_SYSTEM(); PlatformFixture::setUp(); pClDevice = pPlatform->getClDevice(0); rootDeviceIndex = pClDevice->getRootDeviceIndex(); diff --git a/opencl/test/unit_test/program/program_from_binary.h b/opencl/test/unit_test/program/program_from_binary.h index 75f9aa5467..0431b3677e 100644 --- a/opencl/test/unit_test/program/program_from_binary.h +++ b/opencl/test/unit_test/program/program_from_binary.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,7 @@ #pragma once #include "shared/source/built_ins/built_ins.h" +#include "shared/source/helpers/file_io.h" #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" #include "opencl/test/unit_test/fixtures/context_fixture.h" @@ -32,6 +33,7 @@ struct ProgramFromBinaryFixture : public ClDeviceFixture, ProgramFromBinaryFixture::setUp("CopyBuffer_simd32", "CopyBuffer"); } void setUp(const char *binaryFileName, const char *kernelName) { + USE_REAL_FILE_SYSTEM(); this->binaryFileName = binaryFileName; this->kernelName = kernelName; ClDeviceFixture::setUp(); @@ -74,6 +76,7 @@ class ProgramSimpleFixture : public ClDeviceFixture, public: void setUp() { + USE_REAL_FILE_SYSTEM(); ClDeviceFixture::setUp(); cl_device_id device = pClDevice; diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index 0174777252..2ed4df799d 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -730,6 +730,8 @@ TEST_F(MinimumProgramFixture, givenApplicationContextMarkedAsNonZebinWhenBuildin } TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenBuildingProgramThenSuccessOrCorrectErrorCodeIsReturned) { + USE_REAL_FILE_SYSTEM(); + KernelBinaryHelper kbHelper(binaryFileName, true); auto device = pPlatform->getClDevice(0); @@ -832,6 +834,7 @@ TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenBuildingProgramThenSucc } TEST_F(ProgramFromSourceTest, GivenDuplicateOptionsWhenCreatingWithSourceThenBuildSucceeds) { + USE_REAL_FILE_SYSTEM(); KernelBinaryHelper kbHelper(binaryFileName, false); retVal = pProgram->build(pProgram->getDevices(), nullptr); @@ -851,6 +854,7 @@ TEST_F(ProgramFromSourceTest, GivenDuplicateOptionsWhenCreatingWithSourceThenBui } TEST_F(ProgramFromSourceTest, WhenBuildingProgramThenFeaturesAndExtraExtensionsAreNotAdded) { + USE_REAL_FILE_SYSTEM(); auto cip = new MockCompilerInterfaceCaptureBuildOptions(); auto pClDevice = pContext->getDevice(0); pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip); @@ -868,6 +872,8 @@ TEST_F(ProgramFromSourceTest, WhenBuildingProgramThenFeaturesAndExtraExtensionsA } TEST_F(ProgramFromSourceTest, givenFp64EmulationEnabledWhenBuildingProgramThenExtraExtensionsAreAdded) { + USE_REAL_FILE_SYSTEM(); + auto cip = new MockCompilerInterfaceCaptureBuildOptions(); auto pClDevice = static_cast(devices[0]); pClDevice->getExecutionEnvironment()->setFP64EmulationEnabled(); @@ -884,6 +890,8 @@ TEST_F(ProgramFromSourceTest, givenFp64EmulationEnabledWhenBuildingProgramThenEx } TEST_F(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC20ThenExtraExtensionsAreAdded) { + USE_REAL_FILE_SYSTEM(); + auto cip = new MockCompilerInterfaceCaptureBuildOptions(); auto pClDevice = pContext->getDevice(0); pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip); @@ -904,6 +912,8 @@ TEST_F(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC20ThenExtraExtension } TEST_F(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesAreAdded) { + USE_REAL_FILE_SYSTEM(); + auto cip = new MockCompilerInterfaceCaptureBuildOptions(); auto pClDevice = pContext->getDevice(0); pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip); @@ -926,6 +936,8 @@ TEST_F(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesAreAdd } TEST_F(ProgramFromSourceTest, WhenBuildingProgramWithOpenClC30ThenFeaturesAreAddedOnlyOnce) { + USE_REAL_FILE_SYSTEM(); + auto cip = new MockCompilerInterfaceCaptureBuildOptions(); auto pClDevice = pContext->getDevice(0); pClDevice->getExecutionEnvironment()->rootDeviceEnvironments[pClDevice->getRootDeviceIndex()]->compilerInterface.reset(cip); @@ -1020,6 +1032,7 @@ TEST_F(ProgramFromSourceTest, WhenCompilingProgramWithOpenClC30ThenFeaturesAreAd } TEST_F(ProgramFromSourceTest, GivenDumpZEBinWhenBuildingProgramFromSourceThenZebinIsDumped) { + USE_REAL_FILE_SYSTEM(); DebugManagerStateRestore restorer; debugManager.flags.DumpZEBin.set(1); @@ -1068,6 +1081,8 @@ class Callback { std::map Callback::watchList; TEST_F(ProgramFromSourceTest, GivenDifferentCommpilerOptionsWhenBuildingProgramThenKernelHashesAreDifferent) { + USE_REAL_FILE_SYSTEM(); + KernelBinaryHelper kbHelper(binaryFileName, true); auto rootDeviceIndex = pContext->getDevice(0)->getRootDeviceIndex(); @@ -1134,6 +1149,8 @@ TEST_F(ProgramFromSourceTest, GivenEmptyProgramWhenCreatingProgramThenInvalidVal } TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenCompilingProgramThenSuccessOrCorrectErrorCodeIsReturned) { + USE_REAL_FILE_SYSTEM(); + createProgramWithSource( pContext, sourceFileName); @@ -1256,6 +1273,8 @@ TEST_F(ProgramFromSourceTest, GivenFlagsWhenCompilingProgramThenBuildOptionsHave } TEST_F(ProgramTests, GivenFlagsWhenLinkingProgramThenBuildOptionsHaveBeenApplied) { + USE_REAL_FILE_SYSTEM(); + auto cip = new MockCompilerInterfaceCaptureBuildOptions(); auto pProgram = std::make_unique(toClDeviceVector(*pClDevice)); pProgram->sourceCode = "__kernel mock() {}"; @@ -1286,6 +1305,8 @@ TEST_F(ProgramTests, GivenFlagsWhenLinkingProgramThenBuildOptionsHaveBeenApplied } TEST_F(ProgramFromSourceTest, GivenAdvancedOptionsWhenCreatingProgramThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); + std::string testFile; size_t sourceSize = 0; @@ -1338,6 +1359,8 @@ TEST_F(ProgramFromSourceTest, GivenAdvancedOptionsWhenCreatingProgramThenSuccess } TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenLinkingProgramThenSuccessOrCorrectErrorCodeIsReturned) { + USE_REAL_FILE_SYSTEM(); + createProgramWithSource( pContext, sourceFileName); @@ -1406,6 +1429,8 @@ TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenLinkingProgramThenSucce } TEST_F(ProgramFromSourceTest, GivenInvalidOptionsWhenCreatingLibraryThenCorrectErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); + cl_program program = pProgram; // Order of following microtests is important - do not change. @@ -1836,6 +1861,8 @@ TEST_F(ProgramTests, givenSkipLastExplicitArgWhenContainsStatefulAccessIsCalledT } TEST_F(ProgramTests, givenStatefulAndStatelessAccessesWhenProgramBuildIsCalledThenCorrectResultIsReturned) { + USE_REAL_FILE_SYSTEM(); + DebugManagerStateRestore restorer; const auto &compilerProductHelper = pDevice->getRootDeviceEnvironment().getHelper(); @@ -2164,6 +2191,8 @@ TEST_F(ProgramTests, givenExistingGlobalSurfacesWhenProcessGenBinaryThenCleanupT } TEST_F(ProgramTests, GivenNoCompilerInterfaceRootDeviceEnvironmentWhenRebuildingBinaryThenOutOfHostMemoryErrorIsReturned) { + USE_REAL_FILE_SYSTEM(); + auto pDevice = pContext->getDevice(0); auto executionEnvironment = pDevice->getExecutionEnvironment(); std::unique_ptr rootDeviceEnvironment = std::make_unique(*executionEnvironment); @@ -2414,6 +2443,8 @@ TEST(isValidSpirvBinary, whenBinaryDoesNotContainLllvMagicThenBinaryIsNotValidLL } TEST_F(ProgramTests, WhenLinkingTwoValidSpirvProgramsThenValidProgramIsReturned) { + USE_REAL_FILE_SYSTEM(); + const uint32_t spirv[16] = {0x03022307}; cl_int errCode = CL_SUCCESS; @@ -2485,6 +2516,8 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildProgramIsCalledThenSpirvPat } TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildIsCalledThenRebuildWarningIsIssued) { + USE_REAL_FILE_SYSTEM(); + const auto program{clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)))}; uint32_t spirv[16] = {0x03022307, 0x23471113, 0x17192329}; program->irBinary = makeCopy(spirv, sizeof(spirv)); @@ -2501,6 +2534,8 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildIsCalledThenRebuildWarningI } TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildIsCalledButSuppressFlagIsEnabledThenRebuildWarningIsNotIssued) { + USE_REAL_FILE_SYSTEM(); + const auto program{clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)))}; uint32_t spirv[16] = {0x03022307, 0x23471113, 0x17192329}; program->irBinary = makeCopy(spirv, sizeof(spirv)); @@ -2520,6 +2555,8 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRebuildIsCalledButSuppressFlagIsEn } TEST_F(ProgramTests, givenProgramWithSpirvWhenRecompileIsCalledThenRebuildWarningIsIssued) { + USE_REAL_FILE_SYSTEM(); + const auto program{clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)))}; uint32_t spirv[16] = {0x03022307, 0x23471113, 0x17192329}; program->irBinary = makeCopy(spirv, sizeof(spirv)); @@ -2536,6 +2573,8 @@ TEST_F(ProgramTests, givenProgramWithSpirvWhenRecompileIsCalledThenRebuildWarnin } TEST_F(ProgramTests, givenProgramWithSpirvWhenRecompileIsCalledButSuppressFlagIsEnabledThenRebuildWarningIsNotIssued) { + USE_REAL_FILE_SYSTEM(); + const auto program{clUniquePtr(new MockProgram(toClDeviceVector(*pClDevice)))}; uint32_t spirv[16] = {0x03022307, 0x23471113, 0x17192329}; program->irBinary = makeCopy(spirv, sizeof(spirv)); @@ -3088,6 +3127,8 @@ struct DebugDataGuard { }; TEST_F(ProgramBinTest, GivenBuildWithDebugDataThenBuildDataAvailableViaGetInfo) { + USE_REAL_FILE_SYSTEM(); + DebugDataGuard debugDataGuard; const char *sourceCode = "__kernel void\nCB(\n__global unsigned int* src, __global unsigned int* dst)\n{\nint id = (int)get_global_id(0);\ndst[id] = src[id];\n}\n"; @@ -3175,6 +3216,8 @@ TEST_F(ProgramBinTest, givenNoDebugDataAvailableThenDebugDataIsNotAvailableViaGe } TEST_F(ProgramBinTest, GivenDebugDataAvailableWhenLinkingProgramThenDebugDataIsStoredInProgram) { + USE_REAL_FILE_SYSTEM(); + DebugDataGuard debugDataGuard; const char *sourceCode = "__kernel void\nCB(\n__global unsigned int* src, __global unsigned int* dst)\n{\nint id = (int)get_global_id(0);\ndst[id] = src[id];\n}\n"; @@ -3233,6 +3276,8 @@ class MockCompilerInterfaceWithGtpinParam : public CompilerInterface { }; TEST_F(ProgramBinTest, GivenSourceKernelWhenLinkingProgramThenGtpinInitInfoIsPassed) { + USE_REAL_FILE_SYSTEM(); + void *pIgcInitPtr = reinterpret_cast(0x1234); gtpinSetIgcInit(pIgcInitPtr); const char *sourceCode = "__kernel void\nCB(\n__global unsigned int* src, __global unsigned int* dst)\n{\nint id = (int)get_global_id(0);\ndst[id] = src[id];\n}\n"; @@ -3300,6 +3345,8 @@ TEST(ProgramCallbackTest, whenInvokeCallbackIsCalledThenFunctionIsProperlyInvoke } TEST(BuildProgramTest, givenMultiDeviceProgramWhenBuildingThenStoreAndProcessBinaryOnlyOncePerRootDevice) { + USE_REAL_FILE_SYSTEM(); + MockProgram *pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -3358,6 +3405,8 @@ TEST(BuildProgramTest, givenMultiDeviceProgramWhenBuildingThenStoreAndProcessBin } TEST(BuildProgramTest, givenMultiDeviceProgramWhenBuildingThenStoreKernelInfoPerEachRootDevice) { + USE_REAL_FILE_SYSTEM(); + MockProgram *pProgram = nullptr; std::unique_ptr pSource = nullptr; size_t sourceSize = 0; @@ -3963,4 +4012,4 @@ TEST(ProgramGenerateDefaultArgsMetadataTests, whenGeneratingDefaultMetadataForSa buildInfo.kernelInfoArray.clear(); buildInfo.unpackedDeviceBinary.release(); -} +} \ No newline at end of file diff --git a/opencl/test/unit_test/program/program_with_source.h b/opencl/test/unit_test/program/program_with_source.h index f4a7c1c77b..03a66363b9 100644 --- a/opencl/test/unit_test/program/program_with_source.h +++ b/opencl/test/unit_test/program/program_with_source.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -8,6 +8,7 @@ #pragma once #include "shared/source/compiler_interface/compiler_interface.h" +#include "shared/source/helpers/file_io.h" #include "shared/test/common/fixtures/memory_management_fixture.h" #include "shared/test/common/helpers/kernel_binary_helper.h" @@ -31,6 +32,7 @@ class ProgramFromSourceTest : public ContextFixture, protected: void SetUp() override { + USE_REAL_FILE_SYSTEM(); sourceFileName = "CopyBuffer_simd16.cl"; binaryFileName = "CopyBuffer_simd16"; kernelName = "CopyBuffer"; diff --git a/opencl/test/unit_test/xe_hpc_core/pvc/command_stream_receiver_hw_tests_pvc.cpp b/opencl/test/unit_test/xe_hpc_core/pvc/command_stream_receiver_hw_tests_pvc.cpp index 0ebe2badf7..1ec812786f 100644 --- a/opencl/test/unit_test/xe_hpc_core/pvc/command_stream_receiver_hw_tests_pvc.cpp +++ b/opencl/test/unit_test/xe_hpc_core/pvc/command_stream_receiver_hw_tests_pvc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,6 +11,7 @@ #include "shared/source/gmm_helper/resource_info.h" #include "shared/source/helpers/blit_commands_helper.h" #include "shared/source/helpers/engine_node_helper.h" +#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/preamble.h" #include "shared/source/os_interface/device_factory.h" #include "shared/source/utilities/tag_allocator.h" @@ -223,6 +224,7 @@ using PvcMultiRootDeviceCommandStreamReceiverBufferTests = MultiRootDeviceFixtur HWTEST_EXCLUDE_PRODUCT(MultiRootDeviceCommandStreamReceiverBufferTests, givenMultipleEventInMultiRootDeviceEnvironmentWhenTheyArePassedToEnqueueWithSubmissionThenCsIsWaitingForEventsFromPreviousDevices, IGFX_PVC); PVCTEST_F(PvcMultiRootDeviceCommandStreamReceiverBufferTests, givenMultipleEventInMultiRootDeviceEnvironmentOnPvcWhenTheyArePassedToEnqueueWithSubmissionThenCsIsWaitingForEventsFromPreviousDevices) { + USE_REAL_FILE_SYSTEM(); REQUIRE_SVM_OR_SKIP(device1); REQUIRE_SVM_OR_SKIP(device2); diff --git a/shared/source/helpers/file_io.h b/shared/source/helpers/file_io.h index 7209a6bf1e..e0072598b6 100644 --- a/shared/source/helpers/file_io.h +++ b/shared/source/helpers/file_io.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,10 @@ #pragma once +#include "shared/source/helpers/stdio.h" +#include "shared/source/utilities/io_functions.h" +#include "shared/test/common/helpers/variable_backup.h" + #include #include #include @@ -23,3 +27,14 @@ size_t writeDataToFile( bool fileExists(const std::string &fileName); bool fileExistsHasSize(const std::string &fileName); void dumpFileIncrement(const char *data, size_t dataSize, const std::string &filename, const std::string &extension); + +#define USE_REAL_FILE_SYSTEM() \ + VariableBackup mockFopen(&NEO::IoFunctions::fopenPtr, [](const char *filename, const char *mode) -> FILE * { \ + FILE *pFile = nullptr; \ + fopen_s(&pFile, filename, mode); \ + return pFile; \ + }); \ + VariableBackup mockFseek(&NEO::IoFunctions::fseekPtr, [](FILE *stream, long int offset, int origin) -> int { return fseek(stream, offset, origin); }); \ + VariableBackup mockFtell(&NEO::IoFunctions::ftellPtr, [](FILE *stream) -> long int { return ftell(stream); }); \ + VariableBackup mockFread(&NEO::IoFunctions::freadPtr, [](void *ptr, size_t size, size_t count, FILE *stream) -> size_t { return fread(ptr, size, count, stream); }); \ + VariableBackup mockFclose(&NEO::IoFunctions::fclosePtr, [](FILE *stream) -> int { return fclose(stream); }); diff --git a/shared/source/helpers/file_io_load.cpp b/shared/source/helpers/file_io_load.cpp index 87db1f0d83..68b499a912 100644 --- a/shared/source/helpers/file_io_load.cpp +++ b/shared/source/helpers/file_io_load.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,6 +7,7 @@ #include "shared/source/helpers/debug_helpers.h" #include "shared/source/helpers/stdio.h" +#include "shared/source/utilities/io_functions.h" #include "file_io.h" @@ -22,27 +23,28 @@ std::unique_ptr loadDataFromFile( DEBUG_BREAK_IF(nullptr == filename); // Open the file - fopen_s(&fp, filename, "rb"); + fp = NEO::IoFunctions::fopenPtr(filename, "rb"); if (fp) { // Allocate a buffer for the file contents - fseek(fp, 0, SEEK_END); - nsize = static_cast(ftell(fp)); + NEO::IoFunctions::fseekPtr(fp, 0, SEEK_END); + nsize = static_cast(NEO::IoFunctions::ftellPtr(fp)); + UNRECOVERABLE_IF(nsize == static_cast(-1)); - fseek(fp, 0, SEEK_SET); + NEO::IoFunctions::fseekPtr(fp, 0, SEEK_SET); ret.reset(new (std::nothrow) char[nsize + 1]); if (ret) { // we initialize to all zeroes before reading in data memset(ret.get(), 0x00, nsize + 1); - [[maybe_unused]] auto read = fread(ret.get(), sizeof(unsigned char), nsize, fp); + [[maybe_unused]] auto read = NEO::IoFunctions::freadPtr(ret.get(), sizeof(unsigned char), nsize, fp); DEBUG_BREAK_IF(read != nsize); } else { nsize = 0; } - fclose(fp); + NEO::IoFunctions::fclosePtr(fp); } retSize = nsize; @@ -57,4 +59,4 @@ void dumpFileIncrement(const char *data, size_t dataSize, const std::string &fil suffix++; } writeDataToFile(filenameWithExt.c_str(), data, dataSize); -} +} \ No newline at end of file diff --git a/shared/test/common/helpers/file_io.cpp b/shared/test/common/helpers/file_io.cpp index 32049a6876..d0cf22f635 100644 --- a/shared/test/common/helpers/file_io.cpp +++ b/shared/test/common/helpers/file_io.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022-2024 Intel Corporation + * Copyright (C) 2022-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -9,6 +9,7 @@ #include "shared/source/helpers/debug_helpers.h" #include "shared/source/helpers/stdio.h" +#include "shared/source/utilities/io_functions.h" #include #include @@ -42,9 +43,9 @@ bool fileExists(const std::string &fileName) { return true; } - fopen_s(&pFile, fileName.c_str(), "rb"); + pFile = NEO::IoFunctions::fopenPtr(fileName.c_str(), "rb"); if (pFile) { - fclose(pFile); + NEO::IoFunctions::fclosePtr(pFile); } return pFile != nullptr; } diff --git a/shared/test/unit_test/compiler_interface/compiler_cache_tests.cpp b/shared/test/unit_test/compiler_interface/compiler_cache_tests.cpp index 8620be6bc0..9230934c8e 100644 --- a/shared/test/unit_test/compiler_interface/compiler_cache_tests.cpp +++ b/shared/test/unit_test/compiler_interface/compiler_cache_tests.cpp @@ -11,6 +11,7 @@ #include "shared/source/compiler_interface/intermediate_representations.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/array_count.h" +#include "shared/source/helpers/file_io.h" #include "shared/source/helpers/hash.h" #include "shared/source/helpers/hw_info.h" #include "shared/source/helpers/string.h" @@ -372,6 +373,7 @@ TEST(CompilerCacheTests, GivenEmptyBinaryWhenCachingThenBinaryIsNotCached) { } TEST(CompilerCacheTests, GivenNonExistantConfigWhenLoadingFromCacheThenNullIsReturned) { + VariableBackup mockFopen(&NEO::IoFunctions::fopenPtr, [](const char *filename, const char *mode) -> FILE * { return NULL; }); CompilerCache cache(CompilerCacheConfig{}); size_t size; auto ret = cache.loadCachedBinary("----do-not-exists----", size); @@ -409,6 +411,8 @@ TEST(CompilerInterfaceCachedTests, GivenNoCachedBinaryWhenBuildingThenErrorIsRet } TEST(CompilerInterfaceCachedTests, GivenCachedBinaryWhenBuildingThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); + TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin}; auto src = "#include \"header.h\"\n__kernel k() {}"; @@ -635,6 +639,8 @@ TEST_F(CompilerInterfaceOclElfCacheTest, givenNonEmptyTranslationOutputWhenProce } TEST_F(CompilerInterfaceOclElfCacheTest, GivenKernelWithIncludesWhenBuildingThenPackBinaryOnCacheSaveAndUnpackBinaryOnLoadFromCache) { + USE_REAL_FILE_SYSTEM(); + gEnvironment->igcPushDebugVars(igcDebugVarsDeviceBinary); TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin}; @@ -669,6 +675,8 @@ TEST_F(CompilerInterfaceOclElfCacheTest, GivenKernelWithIncludesWhenBuildingThen } TEST_F(CompilerInterfaceOclElfCacheTest, GivenKernelWithIncludesWhenLoadedCacheDoesNotUnpackCorrectlyThenDoNotEndInCacheAndContinueCompilation) { + USE_REAL_FILE_SYSTEM(); + gEnvironment->igcPushDebugVars(igcDebugVarsInvalidDeviceBinary); TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin}; @@ -700,6 +708,8 @@ TEST_F(CompilerInterfaceOclElfCacheTest, GivenKernelWithIncludesWhenLoadedCacheD } TEST_F(CompilerInterfaceOclElfCacheTest, GivenKernelWithIncludesAndDebugDataWhenBuildingThenPackBinaryOnCacheSaveAndUnpackBinaryOnLoadFromCache) { + USE_REAL_FILE_SYSTEM(); + gEnvironment->igcPushDebugVars(igcDebugVarsDeviceBinaryDebugData); TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin}; @@ -734,6 +744,8 @@ TEST_F(CompilerInterfaceOclElfCacheTest, GivenKernelWithIncludesAndDebugDataWhen } TEST_F(CompilerInterfaceOclElfCacheTest, GivenBinaryWhenBuildingThenPackBinaryOnCacheSaveAndUnpackBinaryOnLoadFromCache) { + USE_REAL_FILE_SYSTEM(); + gEnvironment->igcPushDebugVars(igcDebugVarsDeviceBinary); TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin}; @@ -768,6 +780,8 @@ TEST_F(CompilerInterfaceOclElfCacheTest, GivenBinaryWhenBuildingThenPackBinaryOn } TEST_F(CompilerInterfaceOclElfCacheTest, GivenBinaryWhenLoadedCacheDoesNotUnpackCorrectlyThenDoNotEndInCacheAndContinueCompilation) { + USE_REAL_FILE_SYSTEM(); + gEnvironment->igcPushDebugVars(igcDebugVarsInvalidDeviceBinary); TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin}; @@ -796,6 +810,8 @@ TEST_F(CompilerInterfaceOclElfCacheTest, GivenBinaryWhenLoadedCacheDoesNotUnpack } TEST_F(CompilerInterfaceOclElfCacheTest, GivenBinaryAndDebugDataWhenBuildingThenPackBinaryOnCacheSaveAndUnpackBinaryOnLoadFromCache) { + USE_REAL_FILE_SYSTEM(); + gEnvironment->igcPushDebugVars(igcDebugVarsDeviceBinaryDebugData); TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin}; @@ -967,4 +983,4 @@ TEST_F(CompilerCacheHelperMockedWhitelistedIncludesTests, GivenEnabledCacheAndNo EXPECT_EQ(CachingMode::preProcess, CompilerCacheHelper::getCachingMode(&cache, testCase.second, sourceRef)) << "Failed for source: " << testCase.first; } -} +} \ No newline at end of file diff --git a/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp b/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp index 4ecf5308a2..2ce68826b6 100644 --- a/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp +++ b/shared/test/unit_test/compiler_interface/compiler_interface_tests.cpp @@ -45,7 +45,7 @@ class CompilerInterfaceTest : public DeviceFixture, public: void SetUp() override { DeviceFixture::setUp(); - + USE_REAL_FILE_SYSTEM(); // create the compiler interface this->pCompilerInterface = new MockCompilerInterface(); bool initRet = pCompilerInterface->initialize(std::make_unique(CompilerCacheConfig{}), true); @@ -152,12 +152,16 @@ TEST(CompilerInterfaceCreateInstance, WhenInitializeFailedThenReturnNull) { } TEST_F(CompilerInterfaceTest, WhenCompilingToIsaThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); + TranslationOutput translationOutput; auto err = pCompilerInterface->build(*pDevice, inputArgs, translationOutput); EXPECT_EQ(TranslationOutput::ErrorCode::success, err); } TEST_F(CompilerInterfaceTest, WhenPreferredIntermediateRepresentationSpecifiedThenPreserveIt) { + USE_REAL_FILE_SYSTEM(); + CompilerCacheConfig config = {}; config.enabled = false; auto tempCompilerCache = std::make_unique(config); @@ -191,6 +195,8 @@ TEST_F(CompilerInterfaceTest, whenFclTranslatorReturnsNullptrThenBuildFailsGrace } TEST_F(CompilerInterfaceTest, whenIgcTranslatorReturnsNullptrThenBuildFailsGracefully) { + USE_REAL_FILE_SYSTEM(); + CompilerCacheConfig config = {}; config.enabled = false; auto tempCompilerCache = std::make_unique(config); @@ -203,6 +209,8 @@ TEST_F(CompilerInterfaceTest, whenIgcTranslatorReturnsNullptrThenBuildFailsGrace } TEST_F(CompilerInterfaceTest, GivenOptionsWhenCompilingToIsaThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); + std::string internalOptions = "SOME_OPTION"; MockCompilerDebugVars fclDebugVars; @@ -226,6 +234,8 @@ TEST_F(CompilerInterfaceTest, GivenOptionsWhenCompilingToIsaThenSuccessIsReturne } TEST_F(CompilerInterfaceTest, WhenCompilingToIrThenSuccessIsReturned) { + USE_REAL_FILE_SYSTEM(); + MockCompilerDebugVars fclDebugVars; retrieveBinaryKernelFilename(fclDebugVars.fileName, "CopyBufferShared_simd32_", ".spv"); gEnvironment->fclPushDebugVars(fclDebugVars); @@ -307,6 +317,8 @@ TEST_F(CompilerInterfaceTest, GivenForceBuildFailureWhenLinkingIrThenLinkFailure } TEST_F(CompilerInterfaceTest, WhenLinkIsCalledThenOclGenBinIsTheTranslationTarget) { + USE_REAL_FILE_SYSTEM(); + // link only from .ll to gen ISA MockCompilerDebugVars igcDebugVars; retrieveBinaryKernelFilename(igcDebugVars.fileName, "CopyBufferShared_simd32_", ".spv"); @@ -375,6 +387,8 @@ TEST_F(CompilerInterfaceTest, GivenForceBuildFailureWhenCreatingLibraryThenLinkF } TEST_F(CompilerInterfaceTest, WhenCreateLibraryIsCalledThenLlvmBcIsUsedAsIntermediateRepresentation) { + USE_REAL_FILE_SYSTEM(); + // create library from .ll to IR MockCompilerDebugVars igcDebugVars; retrieveBinaryKernelFilename(igcDebugVars.fileName, "CopyBufferShared_simd32_", ".spv"); @@ -741,6 +755,8 @@ struct WasLockedListener { }; TEST_F(CompilerInterfaceTest, givenUpdatedSpecConstValuesWhenBuildProgramThenProperValuesArePassed) { + USE_REAL_FILE_SYSTEM(); + struct MockTranslationContextSpecConst : public MockIgcOclTranslationCtx { IGC::OclTranslationOutputBase *TranslateImpl( CIF::Version_t outVersion, @@ -1478,4 +1494,4 @@ TEST(getOclCExtensionVersion, whenCheckingVersionOfUntrackedExtensionThenReturns cl_version defaultVer = CL_MAKE_VERSION(7, 2, 5); cl_version ver = NEO::getOclCExtensionVersion("other", defaultVer); EXPECT_EQ(defaultVer, ver); -} +} \ No newline at end of file diff --git a/shared/test/unit_test/debug_settings/debug_settings_manager_tests.cpp b/shared/test/unit_test/debug_settings/debug_settings_manager_tests.cpp index 9fe43e1398..bd8a5aca14 100644 --- a/shared/test/unit_test/debug_settings/debug_settings_manager_tests.cpp +++ b/shared/test/unit_test/debug_settings/debug_settings_manager_tests.cpp @@ -346,6 +346,8 @@ TEST(AllocationInfoLogging, givenBaseGraphicsAllocationWhenGettingImplementation } TEST(DebugSettingsManager, givenDisabledDebugManagerWhenCreateThenOnlyReleaseVariablesAreRead) { + USE_REAL_FILE_SYSTEM(); + bool settingsFileExists = fileExists(SettingsReader::settingsFileName); if (!settingsFileExists) { const char data[] = "LogApiCalls = 1\nMakeAllBuffersResident = 1"; @@ -375,7 +377,6 @@ TEST(DebugSettingsManager, givenEnabledDebugManagerWhenCreateThenAllVariablesAre writeDataToFile(SettingsReader::settingsFileName, &data, sizeof(data)); SettingsReader *reader = MockSettingsReader::createFileReader(); - EXPECT_NE(nullptr, reader); FullyEnabledTestDebugManager debugManager; @@ -389,6 +390,7 @@ TEST(DebugSettingsManager, givenEnabledDebugManagerWhenCreateThenAllVariablesAre } TEST(DebugSettingsManager, GivenLogsEnabledAndDumpToFileWhenPrintDebuggerLogCalledThenStringPrintedToFile) { + USE_REAL_FILE_SYSTEM(); if (!NEO::fileLoggerInstance().enabled()) { GTEST_SKIP(); } @@ -415,6 +417,7 @@ TEST(DebugSettingsManager, GivenLogsEnabledAndDumpToFileWhenPrintDebuggerLogCall } TEST(DebugSettingsManager, GivenLogsDisabledAndDumpToFileWhenPrintDebuggerLogCalledThenStringIsNotPrintedToFile) { + USE_REAL_FILE_SYSTEM(); if (!NEO::debugManager.disabled()) { GTEST_SKIP(); } @@ -435,6 +438,7 @@ TEST(DebugSettingsManager, GivenLogsDisabledAndDumpToFileWhenPrintDebuggerLogCal } TEST(DebugSettingsManager, GivenLogsEnabledWhenLogCacheOperationCalledThenStringPrintedToFile) { + USE_REAL_FILE_SYSTEM(); if (!NEO::usmReusePerfLoggerInstance().enabled()) { GTEST_SKIP(); } @@ -512,4 +516,4 @@ TEST(DebugSettingsManager, GivenHardwareOrHardwareWithAubCsrTypeAndTbxFaultsEnab NEO::debugManager.flags.SetCommandStreamReceiver.set(3); EXPECT_FALSE(NEO::debugManager.isTbxPageFaultManagerEnabled()); -} +} \ No newline at end of file diff --git a/shared/test/unit_test/device_binary_format/device_binary_format_zebin_tests.cpp b/shared/test/unit_test/device_binary_format/device_binary_format_zebin_tests.cpp index d96a957894..ca873e3c39 100644 --- a/shared/test/unit_test/device_binary_format/device_binary_format_zebin_tests.cpp +++ b/shared/test/unit_test/device_binary_format/device_binary_format_zebin_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,8 +12,10 @@ #include "shared/source/helpers/ptr_math.h" #include "shared/source/helpers/string.h" #include "shared/source/program/program_info.h" +#include "shared/source/utilities/io_functions.h" #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/mock_file_io.h" +#include "shared/test/common/helpers/variable_backup.h" #include "shared/test/common/mocks/mock_modules_zebin.h" #include "shared/test/common/test_macros/test.h" @@ -119,6 +121,8 @@ TEST(UnpackSingleDeviceBinaryZebin, WhenValidBinaryAndMatchedWithRequestedTarget } TEST(UnpackSingleDeviceBinaryZebin, givenDumpZEBinFlagSetWhenUnpackingZebinBinaryThenEachTimeZebinIsDumpedToFile) { + VariableBackup mockFopen(&NEO::IoFunctions::fopenPtr, [](const char *filename, const char *mode) -> FILE * { return NULL; }); + DebugManagerStateRestore dbgRestorer; debugManager.flags.DumpZEBin.set(true); @@ -513,4 +517,4 @@ TEST(UnpackSingleDeviceBinaryZebin, GivenMiscZebinSectionWithNameDifferentThanBu EXPECT_FALSE(unpackResult.deviceBinary.empty()); EXPECT_EQ(zebin.storage.data(), unpackResult.deviceBinary.begin()); -} +} \ No newline at end of file diff --git a/shared/test/unit_test/os_interface/linux/drm_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_tests.cpp index 4549fe564a..76fe201a71 100644 --- a/shared/test/unit_test/os_interface/linux/drm_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_tests.cpp @@ -1193,6 +1193,7 @@ TEST(DrmQueryTest, GivenRpsMaxFreqFilesExistWhenFrequenciesAreQueriedThenValidVa } TEST(DrmQueryTest, GivenRpsMaxFreqFileDoesntExistWhenFrequencyIsQueriedThenFallbackToLegacyInterface) { + USE_REAL_FILE_SYSTEM(); int expectedMaxFrequency = 2000; auto executionEnvironment = std::make_unique(); diff --git a/shared/test/unit_test/os_interface/linux/file_logger_linux_tests.cpp b/shared/test/unit_test/os_interface/linux/file_logger_linux_tests.cpp index 8afb635c8f..0c3047a15c 100644 --- a/shared/test/unit_test/os_interface/linux/file_logger_linux_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/file_logger_linux_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2024 Intel Corporation + * Copyright (C) 2019-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -22,9 +22,10 @@ TEST(FileLogger, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) { DebugVariables flags; flags.LogAllocationMemoryPool.set(true); FullyEnabledFileLogger fileLogger(testFile, flags); + fileLogger.useRealFiles(false); // Log file not created - bool logFileCreated = fileExists(fileLogger.getLogFileName()); + bool logFileCreated = virtualFileExists(fileLogger.getLogFileName()); EXPECT_FALSE(logFileCreated); auto executionEnvironment = std::make_unique(); DrmMock drm(*executionEnvironment->rootDeviceEnvironments[0]); @@ -89,9 +90,10 @@ TEST(FileLogger, givenLogAllocationStdoutWhenLogAllocationThenLogToStdoutInstead flags.LogAllocationMemoryPool.set(true); flags.LogAllocationStdout.set(true); FullyEnabledFileLogger fileLogger(testFile, flags); + fileLogger.useRealFiles(false); // Log file not created - bool logFileCreated = fileExists(fileLogger.getLogFileName()); + bool logFileCreated = virtualFileExists(fileLogger.getLogFileName()); EXPECT_FALSE(logFileCreated); auto executionEnvironment = std::make_unique(); DrmMock drm(*executionEnvironment->rootDeviceEnvironments[0]); @@ -140,7 +142,7 @@ TEST(FileLogger, givenLogAllocationStdoutWhenLogAllocationThenLogToStdoutInstead EXPECT_TRUE(output.find("Handle: 4") != std::string::npos); EXPECT_TRUE(output.find("\n") != std::string::npos); - logFileCreated = fileExists(fileLogger.getLogFileName()); + logFileCreated = virtualFileExists(fileLogger.getLogFileName()); EXPECT_FALSE(logFileCreated); } @@ -149,9 +151,10 @@ TEST(FileLogger, GivenDrmAllocationWithoutBOThenNoHandleLogged) { DebugVariables flags; flags.LogAllocationMemoryPool.set(true); FullyEnabledFileLogger fileLogger(testFile, flags); + fileLogger.useRealFiles(false); // Log file not created - bool logFileCreated = fileExists(fileLogger.getLogFileName()); + bool logFileCreated = virtualFileExists(fileLogger.getLogFileName()); EXPECT_FALSE(logFileCreated); MockDrmAllocation allocation(0u, AllocationType::buffer, MemoryPool::system64KBPages); @@ -185,9 +188,10 @@ TEST(FileLogger, GivenLogAllocationMemoryPoolFlagSetFalseThenAllocationIsNotLogg DebugVariables flags; flags.LogAllocationMemoryPool.set(false); FullyEnabledFileLogger fileLogger(testFile, flags); + fileLogger.useRealFiles(false); // Log file not created - bool logFileCreated = fileExists(fileLogger.getLogFileName()); + bool logFileCreated = virtualFileExists(fileLogger.getLogFileName()); EXPECT_FALSE(logFileCreated); MockDrmAllocation allocation(0u, AllocationType::buffer, MemoryPool::system64KBPages); diff --git a/shared/test/unit_test/utilities/linux/cpuinfo_tests_linux.cpp b/shared/test/unit_test/utilities/linux/cpuinfo_tests_linux.cpp index 528fc8d1bd..51c305e214 100644 --- a/shared/test/unit_test/utilities/linux/cpuinfo_tests_linux.cpp +++ b/shared/test/unit_test/utilities/linux/cpuinfo_tests_linux.cpp @@ -1,23 +1,22 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/helpers/file_io.h" -#include "shared/source/os_interface/linux/os_inc.h" #include "shared/source/utilities/cpu_info.h" +#include "shared/source/utilities/io_functions.h" #include "shared/test/common/helpers/variable_backup.h" #include "gtest/gtest.h" -#include -#include - using namespace NEO; TEST(CpuInfo, givenProcCpuinfoFileIsNotExistsWhenIsCpuFlagPresentIsCalledThenValidValueIsReturned) { + USE_REAL_FILE_SYSTEM(); + std::string cpuinfoFile = "test_files/linux/proc/cpuinfo"; EXPECT_FALSE(fileExists(cpuinfoFile)); @@ -25,4 +24,4 @@ TEST(CpuInfo, givenProcCpuinfoFileIsNotExistsWhenIsCpuFlagPresentIsCalledThenVal EXPECT_FALSE(testCpuInfo.isCpuFlagPresent("flag1")); EXPECT_FALSE(testCpuInfo.isCpuFlagPresent("flag2")); EXPECT_FALSE(testCpuInfo.isCpuFlagPresent("nonExistingCpuFlag")); -} +} \ No newline at end of file