refactor: add debug message about the zero engine info size
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
parent
06faaab5bb
commit
a70aaa72ed
|
@ -976,6 +976,10 @@ bool Drm::queryMemoryInfo() {
|
|||
|
||||
bool Drm::queryEngineInfo(bool isSysmanEnabled) {
|
||||
this->engineInfo = ioctlHelper->createEngineInfo(isSysmanEnabled);
|
||||
if (this->engineInfo && this->engineInfo.get()->engines.size() == 0) {
|
||||
printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Engine info size is equal to 0.\n");
|
||||
}
|
||||
|
||||
return this->engineInfo != nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,39 @@ TEST(DrmTest, givenMemRegionQueryNotSupportedWhenQueryingMemRegionInfoThenFailGr
|
|||
EXPECT_EQ(nullptr, drm->engineInfo);
|
||||
}
|
||||
|
||||
class MockIoctlHelperEngineInfoDetection : public IoctlHelperPrelim20 {
|
||||
public:
|
||||
using IoctlHelperPrelim20::IoctlHelperPrelim20;
|
||||
|
||||
std::unique_ptr<EngineInfo> createEngineInfo(bool isSysmanEnabled) override {
|
||||
std::vector<NEO::EngineCapabilities> engineInfo(0);
|
||||
|
||||
return std::make_unique<EngineInfo>(&drm, engineInfo);
|
||||
}
|
||||
};
|
||||
|
||||
TEST(DrmTest, givenEngineQueryOnIncorrectSetupWithZeroEnginesThenProperDebugMessageIsPrinted) {
|
||||
DebugManagerStateRestore dbgState;
|
||||
debugManager.flags.PrintDebugMessages.set(1);
|
||||
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
|
||||
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
auto ioctlHelper = std::make_unique<MockIoctlHelperEngineInfoDetection>(*drm);
|
||||
drm->ioctlHelper.reset(ioctlHelper.release());
|
||||
|
||||
testing::internal::CaptureStderr();
|
||||
|
||||
drm->queryEngineInfo();
|
||||
EXPECT_EQ(0u, drm->engineInfo.get()->engines.size());
|
||||
|
||||
std::string output = testing::internal::GetCapturedStderr();
|
||||
std::string expectedError = "FATAL: Engine info size is equal to 0.\n";
|
||||
|
||||
EXPECT_EQ(output, expectedError);
|
||||
}
|
||||
|
||||
TEST(DrmTest, givenDistanceQueryNotSupportedWhenQueryingDistanceInfoThenFailGracefully) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
|
||||
|
|
Loading…
Reference in New Issue