2019-03-01 21:58:11 +08:00
|
|
|
/*
|
2020-02-03 23:18:21 +08:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-03-01 21:58:11 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
2020-03-04 15:51:02 +08:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
|
|
|
#include "shared/source/os_interface/device_factory.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/platform/platform.h"
|
2019-03-01 21:58:11 +08:00
|
|
|
#include "test.h"
|
|
|
|
|
2019-07-16 19:45:35 +08:00
|
|
|
using namespace NEO;
|
2019-03-01 21:58:11 +08:00
|
|
|
|
|
|
|
using GetDevicesTests = ::testing::Test;
|
|
|
|
|
|
|
|
HWTEST_F(GetDevicesTests, WhenGetDevicesIsCalledThenSuccessIsReturned) {
|
|
|
|
size_t numDevicesReturned = 0;
|
2019-07-25 23:59:12 +08:00
|
|
|
ExecutionEnvironment executionEnvironment;
|
2019-03-01 21:58:11 +08:00
|
|
|
|
2019-07-25 23:59:12 +08:00
|
|
|
auto returnValue = DeviceFactory::getDevices(numDevicesReturned, executionEnvironment);
|
2019-03-01 21:58:11 +08:00
|
|
|
EXPECT_EQ(true, returnValue);
|
|
|
|
}
|
2019-07-16 19:45:35 +08:00
|
|
|
|
|
|
|
HWTEST_F(GetDevicesTests, whenGetDevicesIsCalledThenGmmIsBeingInitializedAfterFillingHwInfo) {
|
2020-02-03 23:18:21 +08:00
|
|
|
platformsImpl.clear();
|
2020-02-07 19:15:46 +08:00
|
|
|
auto executionEnvironment = new ExecutionEnvironment();
|
|
|
|
platformsImpl.push_back(std::make_unique<Platform>(*executionEnvironment));
|
2019-07-16 19:45:35 +08:00
|
|
|
size_t numDevicesReturned = 0;
|
2020-03-04 15:51:02 +08:00
|
|
|
executionEnvironment->prepareRootDeviceEnvironments(1u);
|
|
|
|
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
2019-12-17 15:11:16 +08:00
|
|
|
hwInfo->platform.eProductFamily = PRODUCT_FAMILY::IGFX_UNKNOWN;
|
|
|
|
hwInfo->platform.ePCHProductFamily = PCH_PRODUCT_FAMILY::PCH_UNKNOWN;
|
2019-07-16 19:45:35 +08:00
|
|
|
|
2020-02-07 19:15:46 +08:00
|
|
|
auto returnValue = DeviceFactory::getDevices(numDevicesReturned, *executionEnvironment);
|
2019-07-16 19:45:35 +08:00
|
|
|
EXPECT_TRUE(returnValue);
|
|
|
|
}
|