2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-01-10 20:57:40 +08:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-12-10 17:30:39 +08:00
|
|
|
#include "runtime/command_stream/preemption.h"
|
2019-02-13 00:27:13 +08:00
|
|
|
#include "runtime/helpers/hw_helper.h"
|
2018-11-08 20:05:46 +08:00
|
|
|
#include "runtime/os_interface/linux/os_context_linux.h"
|
|
|
|
#include "runtime/os_interface/linux/os_interface.h"
|
|
|
|
#include "unit_tests/os_interface/linux/drm_mock.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
|
|
|
namespace OCLRT {
|
|
|
|
|
|
|
|
TEST(OsInterfaceTest, GivenLinuxWhenare64kbPagesEnabledThenFalse) {
|
|
|
|
EXPECT_FALSE(OSInterface::are64kbPagesEnabled());
|
|
|
|
}
|
2018-04-20 20:44:14 +08:00
|
|
|
|
|
|
|
TEST(OsInterfaceTest, GivenLinuxOsInterfaceWhenDeviceHandleQueriedthenZeroIsReturned) {
|
|
|
|
OSInterface osInterface;
|
|
|
|
EXPECT_EQ(0u, osInterface.getDeviceHandle());
|
|
|
|
}
|
2018-08-27 17:58:31 +08:00
|
|
|
|
2018-11-08 20:05:46 +08:00
|
|
|
TEST(OsContextTest, givenDrmWhenOsContextIsCreatedThenImplIsAvailable) {
|
|
|
|
DrmMock drmMock;
|
2018-08-27 17:58:31 +08:00
|
|
|
OSInterface osInterface;
|
2018-11-08 20:05:46 +08:00
|
|
|
osInterface.get()->setDrm(&drmMock);
|
|
|
|
|
2019-02-12 18:31:19 +08:00
|
|
|
auto osContext = std::make_unique<OsContext>(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
2018-08-27 17:58:31 +08:00
|
|
|
EXPECT_NE(nullptr, osContext->get());
|
|
|
|
}
|
2018-09-12 13:47:55 +08:00
|
|
|
} // namespace OCLRT
|