mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 17:33:00 +08:00
Add a method to check drm support
Related-To: NEO-6999 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
fb40e8d1a6
commit
3ac5853e8d
@@ -11,6 +11,7 @@ set(NEO_CORE_OS_INTERFACE_TESTS_LINUX
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_bind_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_command_stream_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_engine_info_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_version_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_mock_impl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_query_topology_upstream_tests.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drm_special_heap_test.cpp
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/os_interface/linux/sys_calls_linux_ult.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
TEST(DrmVersionTest, givenDrmVersionI915WhenCheckingDrmSupportThenSuccessIsReturned) {
|
||||
int fileDescriptor = 123;
|
||||
VariableBackup<const char *> backup(&SysCalls::drmVersion);
|
||||
SysCalls::drmVersion = "i915";
|
||||
EXPECT_TRUE(Drm::isDrmSupported(fileDescriptor));
|
||||
}
|
||||
|
||||
TEST(DrmVersionTest, givenInvalidDrmVersionWhenCheckingDrmSupportThenFalseIsReturned) {
|
||||
int fileDescriptor = 123;
|
||||
VariableBackup<const char *> backup(&SysCalls::drmVersion);
|
||||
SysCalls::drmVersion = "unknown";
|
||||
EXPECT_FALSE(Drm::isDrmSupported(fileDescriptor));
|
||||
}
|
||||
Reference in New Issue
Block a user