mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-12 17:33:00 +08:00
Add tests for selecting KMD adapter
Related-To: NEO-3007 Change-Id: I040662e68dccf574b14ecffa02f5427f6ef1899b Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
b9e0411c18
commit
fcf2387398
@@ -20,10 +20,12 @@
|
||||
#include "runtime/os_interface/windows/wddm_allocation.h"
|
||||
#include "runtime/os_interface/windows/wddm_engine_mapper.h"
|
||||
#include "runtime/os_interface/windows/wddm_memory_manager.h"
|
||||
#include "unit_tests/helpers/variable_backup.h"
|
||||
#include "unit_tests/mocks/mock_gfx_partition.h"
|
||||
#include "unit_tests/mocks/mock_gmm_resource_info.h"
|
||||
#include "unit_tests/mocks/mock_memory_manager.h"
|
||||
#include "unit_tests/os_interface/windows/mock_wddm_allocation.h"
|
||||
#include "unit_tests/os_interface/windows/ult_dxgi_factory.h"
|
||||
#include "unit_tests/os_interface/windows/wddm_fixture.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
@@ -31,6 +33,12 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
namespace NEO {
|
||||
namespace SysCalls {
|
||||
extern const wchar_t *igdrclFilePath;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
namespace GmmHelperFunctions {
|
||||
@@ -84,6 +92,70 @@ TEST_F(Wddm20Tests, givenNullPageTableManagerAndRenderCompressedResourceWhenMapp
|
||||
EXPECT_TRUE(wddm->mapGpuVirtualAddress(&allocation));
|
||||
}
|
||||
|
||||
TEST(Wddm20EnumAdaptersTest, WhenAdapterDescriptionContainsDCHDAndgdrclPathDoesntContainDchDThenAdapterIsNotOpened) {
|
||||
VariableBackup<const wchar_t *> descriptionBackup(&UltIDXGIAdapter1::description);
|
||||
descriptionBackup = L"Intel DCH-D";
|
||||
VariableBackup<const wchar_t *> igdrclPathBackup(&SysCalls::igdrclFilePath);
|
||||
igdrclPathBackup = L"intel_dch.inf";
|
||||
|
||||
struct MockWddm : Wddm {
|
||||
using Wddm::openAdapter;
|
||||
};
|
||||
|
||||
MockWddm wddm;
|
||||
bool isOpened = wddm.openAdapter();
|
||||
|
||||
EXPECT_FALSE(isOpened);
|
||||
}
|
||||
|
||||
TEST(Wddm20EnumAdaptersTest, WhenAdapterDescriptionContainsDCHIAndgdrclPathDoesntContainDchIThenAdapterIsNotOpened) {
|
||||
VariableBackup<const wchar_t *> descriptionBackup(&UltIDXGIAdapter1::description);
|
||||
descriptionBackup = L"Intel DCH-I";
|
||||
VariableBackup<const wchar_t *> igdrclPathBackup(&SysCalls::igdrclFilePath);
|
||||
igdrclPathBackup = L"intel_dch.inf";
|
||||
|
||||
struct MockWddm : Wddm {
|
||||
using Wddm::openAdapter;
|
||||
};
|
||||
|
||||
auto wddm = std::make_unique<MockWddm>();
|
||||
bool isOpened = wddm->openAdapter();
|
||||
|
||||
EXPECT_FALSE(isOpened);
|
||||
}
|
||||
|
||||
TEST(Wddm20EnumAdaptersTest, WhenAdapterDescriptionContainsDCHDAndgdrclPathContainsDchDThenAdapterIsOpened) {
|
||||
VariableBackup<const wchar_t *> descriptionBackup(&UltIDXGIAdapter1::description);
|
||||
descriptionBackup = L"Intel DCH-D";
|
||||
VariableBackup<const wchar_t *> igdrclPathBackup(&SysCalls::igdrclFilePath);
|
||||
igdrclPathBackup = L"intel_dch_d.inf";
|
||||
|
||||
struct MockWddm : Wddm {
|
||||
using Wddm::openAdapter;
|
||||
};
|
||||
|
||||
auto wddm = std::make_unique<MockWddm>();
|
||||
bool isOpened = wddm->openAdapter();
|
||||
|
||||
EXPECT_TRUE(isOpened);
|
||||
}
|
||||
|
||||
TEST(Wddm20EnumAdaptersTest, WhenAdapterDescriptionContainsDCHIAndgdrclPathContainsDchIThenAdapterIsOpened) {
|
||||
VariableBackup<const wchar_t *> descriptionBackup(&UltIDXGIAdapter1::description);
|
||||
descriptionBackup = L"Intel DCH-I";
|
||||
VariableBackup<const wchar_t *> igdrclPathBackup(&SysCalls::igdrclFilePath);
|
||||
igdrclPathBackup = L"intel_dch_i.inf";
|
||||
|
||||
struct MockWddm : Wddm {
|
||||
using Wddm::openAdapter;
|
||||
};
|
||||
|
||||
auto wddm = std::make_unique<MockWddm>();
|
||||
bool isOpened = wddm->openAdapter();
|
||||
|
||||
EXPECT_TRUE(isOpened);
|
||||
}
|
||||
|
||||
TEST(Wddm20EnumAdaptersTest, expectTrue) {
|
||||
HardwareInfo outHwInfo;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user