Move hw_info_config tests to shared

Signed-off-by: Daniel Chabrowski <daniel.chabrowski@intel.com>
This commit is contained in:
Daniel Chabrowski
2022-06-06 15:22:09 +00:00
committed by Compute-Runtime-Automation
parent 2055daf696
commit 0268c4dfcd
13 changed files with 31 additions and 28 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2018-2021 Intel Corporation
# Copyright (C) 2018-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -11,8 +11,6 @@ set(IGDRCL_SRCS_tests_os_interface_windows
${CMAKE_CURRENT_SOURCE_DIR}/device_os_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/driver_info_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/file_logger_win_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_win_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_info_config_win_tests.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_kmdaf_listener.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_os_time_win.h
${CMAKE_CURRENT_SOURCE_DIR}/mock_performance_counters_win.cpp

View File

@@ -1,87 +0,0 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/test/unit_test/os_interface/windows/hw_info_config_win_tests.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/hw_helper.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/source/os_interface/windows/wddm/wddm.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/test.h"
namespace NEO {
HwInfoConfigTestWindows::HwInfoConfigTestWindows() {
this->executionEnvironment = std::make_unique<MockExecutionEnvironment>();
this->rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
}
HwInfoConfigTestWindows::~HwInfoConfigTestWindows() {
}
void HwInfoConfigTestWindows::SetUp() {
HwInfoConfigTest::SetUp();
osInterface.reset(new OSInterface());
auto wddm = Wddm::createWddm(nullptr, *rootDeviceEnvironment);
wddm->init();
outHwInfo = *rootDeviceEnvironment->getHardwareInfo();
}
void HwInfoConfigTestWindows::TearDown() {
HwInfoConfigTest::TearDown();
}
TEST_F(HwInfoConfigTestWindows, givenCorrectParametersWhenConfiguringHwInfoThenReturnSuccess) {
int ret = hwConfig.configureHwInfoWddm(&pInHwInfo, &outHwInfo, osInterface.get());
EXPECT_EQ(0, ret);
}
TEST_F(HwInfoConfigTestWindows, givenCorrectParametersWhenConfiguringHwInfoThenSetFtrSvmCorrectly) {
auto ftrSvm = outHwInfo.featureTable.flags.ftrSVM;
int ret = hwConfig.configureHwInfoWddm(&pInHwInfo, &outHwInfo, osInterface.get());
ASSERT_EQ(0, ret);
EXPECT_EQ(outHwInfo.capabilityTable.ftrSvm, ftrSvm);
}
TEST_F(HwInfoConfigTestWindows, givenInstrumentationForHardwareIsEnabledOrDisabledWhenConfiguringHwInfoThenOverrideItUsingHaveInstrumentation) {
int ret;
outHwInfo.capabilityTable.instrumentationEnabled = false;
ret = hwConfig.configureHwInfoWddm(&pInHwInfo, &outHwInfo, osInterface.get());
ASSERT_EQ(0, ret);
EXPECT_FALSE(outHwInfo.capabilityTable.instrumentationEnabled);
outHwInfo.capabilityTable.instrumentationEnabled = true;
ret = hwConfig.configureHwInfoWddm(&pInHwInfo, &outHwInfo, osInterface.get());
ASSERT_EQ(0, ret);
EXPECT_TRUE(outHwInfo.capabilityTable.instrumentationEnabled);
}
HWTEST_F(HwInfoConfigTestWindows, givenFtrIaCoherencyFlagWhenConfiguringHwInfoThenSetCoherencySupportCorrectly) {
HardwareInfo initialHwInfo = *defaultHwInfo;
auto hwInfoConfig = HwInfoConfig::get(initialHwInfo.platform.eProductFamily);
bool initialCoherencyStatus = false;
hwInfoConfig->setCapabilityCoherencyFlag(outHwInfo, initialCoherencyStatus);
initialHwInfo.featureTable.flags.ftrL3IACoherency = false;
hwInfoConfig->configureHwInfoWddm(&initialHwInfo, &outHwInfo, osInterface.get());
EXPECT_FALSE(outHwInfo.capabilityTable.ftrSupportsCoherency);
initialHwInfo.featureTable.flags.ftrL3IACoherency = true;
hwInfoConfig->configureHwInfoWddm(&initialHwInfo, &outHwInfo, osInterface.get());
EXPECT_EQ(initialCoherencyStatus, outHwInfo.capabilityTable.ftrSupportsCoherency);
}
} // namespace NEO

View File

@@ -1,36 +0,0 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/unit_test/os_interface/hw_info_config_tests.h"
#include <memory>
namespace NEO {
struct MockExecutionEnvironment;
struct RootDeviceEnvironment;
struct DummyHwConfig : HwInfoConfigHw<IGFX_UNKNOWN> {
};
struct HwInfoConfigTestWindows : public HwInfoConfigTest {
HwInfoConfigTestWindows();
~HwInfoConfigTestWindows();
void SetUp() override;
void TearDown() override;
std::unique_ptr<OSInterface> osInterface;
DummyHwConfig hwConfig;
std::unique_ptr<MockExecutionEnvironment> executionEnvironment;
std::unique_ptr<RootDeviceEnvironment> rootDeviceEnvironment;
};
} // namespace NEO