mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
refactor: Mock file system in ULTs
Functions: fileExists and loadDataToFile use IO functions from namespace IoFunctions Now tests that use these functions are mocked by default, but some still require access to real files and have been restored the ability to read files. They will be mocked in next PRs. Related-To: NEO-7006 Signed-off-by: Marcel Skierkowski <marcel.skierkowski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
077fe1ab48
commit
5d01677454
@@ -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
|
||||
@@ -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<MockDeviceForSpv<false, false>> testDevice = std::unique_ptr<MockDeviceForSpv<false, false>>(new MockDeviceForSpv<false, false>(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<MockDeviceForSpv<false, false>> testDevice = std::unique_ptr<MockDeviceForSpv<false, false>>(new MockDeviceForSpv<false, false>(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<MockDeviceForSpv<false, false>> testDevice = std::unique_ptr<MockDeviceForSpv<false, false>>(new MockDeviceForSpv<false, false>(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<MockDeviceForSpv<false, false>> testDevice = std::unique_ptr<MockDeviceForSpv<false, false>>(new MockDeviceForSpv<false, false>(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
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user