mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Improve code coverage of OfflineCompiler class
This change introduces unit tests related to member functions of OfflineCompiler class. OfflineCompiler::initialize() is not covered and it will be added in a separate commit. Related-To: NEO-6834 Signed-off-by: Patryk Wrobel <patryk.wrobel@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
db9c0d1103
commit
76349b8030
@@ -493,6 +493,10 @@ CIF::ICIF *MockIgcOclDeviceCtx::Create(CIF::InterfaceId_t intId, CIF::Version_t
|
||||
IGC::IgcOclTranslationCtxBase *MockIgcOclDeviceCtx::CreateTranslationCtxImpl(CIF::Version_t ver,
|
||||
IGC::CodeType::CodeType_t inType,
|
||||
IGC::CodeType::CodeType_t outType) {
|
||||
if (igcDebugVars->shouldFailCreationOfTranslationContext) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
requestedTranslationCtxs.emplace_back(inType, outType);
|
||||
return new MockIgcOclTranslationCtx;
|
||||
}
|
||||
@@ -662,6 +666,11 @@ CIF::ICIF *MockFclOclDeviceCtx::Create(CIF::InterfaceId_t intId, CIF::Version_t
|
||||
IGC::FclOclTranslationCtxBase *MockFclOclDeviceCtx::CreateTranslationCtxImpl(CIF::Version_t ver,
|
||||
IGC::CodeType::CodeType_t inType,
|
||||
IGC::CodeType::CodeType_t outType) {
|
||||
if (fclDebugVars->shouldFailCreationOfTranslationContext) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
requestedTranslationCtxs.emplace_back(inType, outType);
|
||||
return new MockFclOclTranslationCtx;
|
||||
}
|
||||
|
||||
@@ -669,6 +678,15 @@ IGC::FclOclTranslationCtxBase *MockFclOclDeviceCtx::CreateTranslationCtxImpl(CIF
|
||||
IGC::CodeType::CodeType_t inType,
|
||||
IGC::CodeType::CodeType_t outType,
|
||||
CIF::Builtins::BufferSimple *err) {
|
||||
if (!fclDebugVars->translationContextCreationError.empty() && err) {
|
||||
err->PushBackRawBytes(fclDebugVars->translationContextCreationError.c_str(), fclDebugVars->translationContextCreationError.size());
|
||||
}
|
||||
|
||||
if (fclDebugVars->shouldFailCreationOfTranslationContext) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
requestedTranslationCtxs.emplace_back(inType, outType);
|
||||
return new MockFclOclTranslationCtx;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ struct MockCompilerDebugVars {
|
||||
bindless
|
||||
};
|
||||
bool shouldReturnInvalidTranslationOutput = false;
|
||||
bool shouldFailCreationOfTranslationContext = false;
|
||||
bool forceBuildFailure = false;
|
||||
bool forceCreateFailure = false;
|
||||
bool forceRegisterFail = false;
|
||||
@@ -45,6 +46,7 @@ struct MockCompilerDebugVars {
|
||||
std::string *receivedInput = nullptr;
|
||||
|
||||
std::string fileName;
|
||||
std::string translationContextCreationError;
|
||||
};
|
||||
|
||||
struct MockCompilerEnableGuard {
|
||||
@@ -287,6 +289,9 @@ struct MockFclOclDeviceCtx : MockCIF<IGC::FclOclDeviceCtxTagOCL> {
|
||||
|
||||
uint32_t oclApiVersion = 120;
|
||||
MockCIFPlatform *platform = nullptr;
|
||||
|
||||
using TranslationOpT = std::pair<IGC::CodeType::CodeType_t, IGC::CodeType::CodeType_t>;
|
||||
std::vector<TranslationOpT> requestedTranslationCtxs;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user