diff --git a/runtime/dll/linux/drm_neo_create.cpp b/runtime/dll/linux/drm_neo_create.cpp index 627619b634..9a0111bcaf 100644 --- a/runtime/dll/linux/drm_neo_create.cpp +++ b/runtime/dll/linux/drm_neo_create.cpp @@ -170,7 +170,7 @@ Drm *Drm::create(int32_t deviceOrdinal) { const_cast(platformDevices[0]->pSkuTable), true); drmObject->setGtType(eGtType); } else { - printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", + printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "FATAL: Unknown device: deviceId: %04x, revisionId: %04x\n", drmObject->deviceId, drmObject->revisionId); delete drmObject; return nullptr; diff --git a/unit_tests/linux/main_linux_dll.cpp b/unit_tests/linux/main_linux_dll.cpp index eb260423f7..cb5db51fdb 100644 --- a/unit_tests/linux/main_linux_dll.cpp +++ b/unit_tests/linux/main_linux_dll.cpp @@ -10,7 +10,13 @@ #include "runtime/helpers/basic_math.h" #include "runtime/os_interface/linux/allocator_helper.h" #include "unit_tests/custom_event_listener.h" +#include "unit_tests/helpers/debug_manager_state_restore.h" + +#include "gtest/gtest.h" +#include "gmock/gmock.h" + #include "test.h" +#include using namespace OCLRT; @@ -148,10 +154,16 @@ TEST_F(DrmTests, createNoOverrun) { } TEST_F(DrmTests, createUnknownDevice) { + DebugManagerStateRestore dbgRestore; + DebugManager.flags.PrintDebugMessages.set(true); + deviceId = -1; + ::testing::internal::CaptureStderr(); auto drm = DrmWrap::createDrm(0); EXPECT_EQ(drm, nullptr); + std::string errStr = ::testing::internal::GetCapturedStderr(); + EXPECT_THAT(errStr, ::testing::HasSubstr(std::string("FATAL: Unknown device: deviceId: ffffffff, revisionId: 0000"))); } TEST_F(DrmTests, createNoSoftPin) {