From c8875e55611f1ca47b784a520c0c7c56f565e47b Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Fri, 30 Jun 2023 14:16:49 +0000 Subject: [PATCH] test: add missing expectation of printed error message Signed-off-by: Mateusz Jablonski --- .../os_interface/linux/drm_system_info_tests.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/shared/test/unit_test/os_interface/linux/drm_system_info_tests.cpp b/shared/test/unit_test/os_interface/linux/drm_system_info_tests.cpp index ae61b7cb80..226735e405 100644 --- a/shared/test/unit_test/os_interface/linux/drm_system_info_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/drm_system_info_tests.cpp @@ -183,22 +183,31 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoFailsThenSystem executionEnvironment->rootDeviceEnvironments[0]->initGmm(); DrmMockEngine drm(*executionEnvironment->rootDeviceEnvironments[0]); + drm.ioctlHelper = std::make_unique(drm); HardwareInfo hwInfo = *defaultHwInfo; auto setupHardwareInfo = [](HardwareInfo *, bool, const CompilerProductHelper &) {}; DeviceDescriptor device = {0, &hwInfo, setupHardwareInfo}; ::testing::internal::CaptureStdout(); + ::testing::internal::CaptureStderr(); DebugManagerStateRestore restorer; DebugManager.flags.PrintDebugMessages.set(true); drm.failQueryDeviceBlob = true; int ret = drm.setupHardwareInfo(&device, false); + DebugManager.flags.PrintDebugMessages.set(false); EXPECT_EQ(ret, 0); EXPECT_EQ(nullptr, drm.getSystemInfo()); EXPECT_TRUE(hasSubstr(::testing::internal::GetCapturedStdout(), "INFO: System Info query failed!\n")); + auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getHelper(); + if (productHelper.isPlatformQuerySupported()) { + EXPECT_TRUE(hasSubstr(::testing::internal::GetCapturedStderr(), "Size got from PRELIM_DRM_I915_QUERY_HW_IP_VERSION query does not match PrelimI915::prelim_drm_i915_query_hw_ip_version size\n")); + } else { + EXPECT_TRUE(::testing::internal::GetCapturedStderr().empty()); + } } TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoSucceedsThenSystemInfoIsCreatedAndUsedToSetHardwareInfoAttributes) {