From dfd361dc748a7d7b525e0ff0fd288433c280ac20 Mon Sep 17 00:00:00 2001 From: "Jobczyk, Lukasz" Date: Tue, 16 Jul 2019 13:45:35 +0200 Subject: [PATCH] Add test that ensures gmm is being initialized with proper HwInfo Related-To: NEO-3331 Change-Id: If7f463a065d5d10a22a550c46cb05f3f7a322b0d Signed-off-by: Jobczyk, Lukasz --- unit_tests/mock_gmm/mock_gmm.cpp | 5 +++++ unit_tests/windows/get_devices_tests.cpp | 23 ++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/unit_tests/mock_gmm/mock_gmm.cpp b/unit_tests/mock_gmm/mock_gmm.cpp index 3f15be7ce5..9c9b2b4f97 100644 --- a/unit_tests/mock_gmm/mock_gmm.cpp +++ b/unit_tests/mock_gmm/mock_gmm.cpp @@ -19,6 +19,11 @@ GMM_STATUS GMM_STDCALL createSingletonContext(const PLATFORM Platform, const SKU_FEATURE_TABLE *featureTable, const WA_TABLE *workaroundTable, const GT_SYSTEM_INFO *pGtSysInfo) { + if (Platform.eProductFamily == PRODUCT_FAMILY::IGFX_UNKNOWN && + Platform.eRenderCoreFamily == GFXCORE_FAMILY::IGFX_UNKNOWN_CORE && + Platform.ePCHProductFamily == PCH_PRODUCT_FAMILY::PCH_UNKNOWN) { + return GMM_ERROR; + } return GMM_SUCCESS; } #else diff --git a/unit_tests/windows/get_devices_tests.cpp b/unit_tests/windows/get_devices_tests.cpp index c145ce4bda..d1837d64d2 100644 --- a/unit_tests/windows/get_devices_tests.cpp +++ b/unit_tests/windows/get_devices_tests.cpp @@ -7,18 +7,31 @@ #include "runtime/execution_environment/execution_environment.h" #include "runtime/helpers/hw_info.h" +#include "runtime/os_interface/device_factory.h" +#include "runtime/platform/platform.h" #include "test.h" -namespace NEO { -bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment); -} // namespace NEO +using namespace NEO; using GetDevicesTests = ::testing::Test; HWTEST_F(GetDevicesTests, WhenGetDevicesIsCalledThenSuccessIsReturned) { size_t numDevicesReturned = 0; - NEO::ExecutionEnvironment executionEnviornment; + ExecutionEnvironment executionEnviornment; - auto returnValue = NEO::getDevices(numDevicesReturned, executionEnviornment); + auto returnValue = DeviceFactory::getDevices(numDevicesReturned, executionEnviornment); EXPECT_EQ(true, returnValue); } + +HWTEST_F(GetDevicesTests, whenGetDevicesIsCalledThenGmmIsBeingInitializedAfterFillingHwInfo) { + platformImpl.reset(new Platform()); + size_t numDevicesReturned = 0; + HardwareInfo hwInfo; + hwInfo.platform.eProductFamily = PRODUCT_FAMILY::IGFX_UNKNOWN; + hwInfo.platform.eRenderCoreFamily = GFXCORE_FAMILY::IGFX_UNKNOWN_CORE; + hwInfo.platform.ePCHProductFamily = PCH_PRODUCT_FAMILY::PCH_UNKNOWN; + platform()->peekExecutionEnvironment()->setHwInfo(&hwInfo); + + auto returnValue = DeviceFactory::getDevices(numDevicesReturned, *platform()->peekExecutionEnvironment()); + EXPECT_TRUE(returnValue); +}