mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
fix: OclocIgcFacade->getIgcRevision() could return nullptr
* Make sure igcRevision is always initialized. * Improve coverage. Signed-off-by: Kacper Kasper <kacper.k.kasper@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
1b9d30ca01
commit
996c261430
@@ -70,6 +70,14 @@ CIF::RAII::UPtr_t<IGC::IgcOclDeviceCtxTagOCL> MockOclocIgcFacade::createIgcDevic
|
||||
}
|
||||
}
|
||||
|
||||
CIF::RAII::UPtr_t<IGC::IgcOclDeviceCtx<3>> MockOclocIgcFacade::createIgcDeviceContext3() const {
|
||||
if (shouldFailCreationOfIgcDeviceContext3) {
|
||||
return nullptr;
|
||||
} else {
|
||||
return OclocIgcFacade::createIgcDeviceContext3();
|
||||
}
|
||||
}
|
||||
|
||||
CIF::RAII::UPtr_t<IGC::PlatformTagOCL> MockOclocIgcFacade::getIgcPlatformHandle() const {
|
||||
if (shouldReturnInvalidIgcPlatformHandle) {
|
||||
return nullptr;
|
||||
|
||||
@@ -22,6 +22,7 @@ class MockOclocIgcFacade : public OclocIgcFacade {
|
||||
bool shouldFailLoadingOfIgcCreateMainFunction{false};
|
||||
bool shouldFailCreationOfIgcMain{false};
|
||||
bool shouldFailCreationOfIgcDeviceContext{false};
|
||||
bool shouldFailCreationOfIgcDeviceContext3{false};
|
||||
bool shouldReturnInvalidIgcPlatformHandle{false};
|
||||
bool shouldReturnInvalidGTSystemInfoHandle{false};
|
||||
bool shouldReturnInvalidIgcFeaturesAndWorkaroundsHandle{false};
|
||||
@@ -46,6 +47,8 @@ class MockOclocIgcFacade : public OclocIgcFacade {
|
||||
|
||||
CIF::RAII::UPtr_t<IGC::IgcOclDeviceCtxTagOCL> createIgcDeviceContext() const override;
|
||||
|
||||
CIF::RAII::UPtr_t<IGC::IgcOclDeviceCtx<3>> createIgcDeviceContext3() const override;
|
||||
|
||||
CIF::RAII::UPtr_t<IGC::PlatformTagOCL> getIgcPlatformHandle() const override;
|
||||
|
||||
CIF::RAII::UPtr_t<IGC::GTSystemInfoTagOCL> getGTSystemInfoHandle() const override;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -163,4 +163,17 @@ TEST_F(OclocIgcFacadeTest, GivenInitializedIgcWhenGettingIncompatibleInterfaceTh
|
||||
EXPECT_TRUE(incompatibleInterface.empty()) << incompatibleInterface;
|
||||
}
|
||||
|
||||
TEST_F(OclocIgcFacadeTest, GivenFailingCreationOfIgcDeviceContext3WhenGettingRevisionThenEmptyStringIsReturned) {
|
||||
MockOclocIgcFacade mockIgcFacade{&mockArgHelper};
|
||||
mockIgcFacade.shouldFailCreationOfIgcDeviceContext3 = true;
|
||||
|
||||
::testing::internal::CaptureStdout();
|
||||
const auto igcPreparationResult{mockIgcFacade.initialize(hwInfo)};
|
||||
const auto output{::testing::internal::GetCapturedStdout()};
|
||||
|
||||
ASSERT_EQ(OclocErrorCode::SUCCESS, igcPreparationResult);
|
||||
|
||||
EXPECT_STREQ(mockIgcFacade.getIgcRevision(), "");
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user