Files
compute-runtime/unit_tests/os_interface/linux/device_factory_tests.cpp
Mateusz Jablonski c92afc5b72 Remove OS specific code from DeviceFactory::getDevices
- create RootDeviceEnvironment::initOsInterface method to handle the logic
- move Drm/Wddm's discoverDevices method to OSInterface class
- remove DeviceFactoryCleaner
- add SysCalls::ioctl function

Related-To: NEO-4208
Change-Id: I7600092465fcdfc42da6fa6924069e6b2615fc0c
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
2020-02-14 15:10:46 +01:00

64 lines
2.0 KiB
C++

/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "unit_tests/os_interface/linux/device_factory_tests.h"
#include "core/execution_environment/root_device_environment.h"
#include "core/os_interface/linux/os_interface.h"
#include "core/os_interface/os_interface.h"
#include "core/unit_tests/helpers/default_hw_info.h"
TEST_F(DeviceFactoryLinuxTest, GetDevicesCheckEUCntSSCnt) {
const HardwareInfo *refHwinfo = *platformDevices;
size_t numDevices = 0;
pDrm->StoredEUVal = 11;
pDrm->StoredSSVal = 8;
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
auto hwInfo = executionEnvironment.getHardwareInfo();
EXPECT_TRUE(success);
EXPECT_EQ((int)numDevices, 1);
EXPECT_NE(hwInfo, nullptr);
EXPECT_EQ(refHwinfo->platform.eDisplayCoreFamily, hwInfo->platform.eDisplayCoreFamily);
EXPECT_EQ((int)hwInfo->gtSystemInfo.EUCount, 11);
EXPECT_EQ((int)hwInfo->gtSystemInfo.SubSliceCount, 8);
//temporararily return GT2.
EXPECT_EQ(1u, hwInfo->featureTable.ftrGT2);
}
TEST_F(DeviceFactoryLinuxTest, GetDevicesDrmCreateFailedConfigureHwInfo) {
size_t numDevices = 0;
pDrm->StoredRetValForDeviceID = -1;
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
EXPECT_FALSE(success);
pDrm->StoredRetValForDeviceID = 0;
}
TEST_F(DeviceFactoryLinuxTest, givenGetDeviceCallWhenItIsDoneThenOsInterfaceIsAllocatedAndItContainDrm) {
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
EXPECT_TRUE(success);
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[0]->osInterface);
EXPECT_NE(nullptr, pDrm);
EXPECT_EQ(pDrm, executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->getDrm());
}
TEST_F(DeviceFactoryLinuxTest, whenDrmIsNotCretedThenGetDevicesFails) {
delete pDrm;
pDrm = nullptr;
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
EXPECT_FALSE(success);
}