1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/file_io.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/test/unit_test/helpers/default_hw_info.h"
#include "opencl/test/unit_test/os_interface/linux/drm_mock.h"
#include "gtest/gtest.h"
using namespace NEO;
TEST(DrmQueryTest, GivenGtMaxFreqFileExistsWhenFrequencyIsQueriedThenValidValueIsReturned) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
int expectedMaxFrequency = 1000;
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
auto hwInfo = *defaultHwInfo;
std::string gtMaxFreqFile = "test_files/linux/devices/device/drm/card1/gt_max_freq_mhz";
EXPECT_TRUE(fileExists(gtMaxFreqFile));
drm.setPciPath("device");
int maxFrequency = 0;
int ret = drm.getMaxGpuFrequency(hwInfo, maxFrequency);
EXPECT_EQ(0, ret);
EXPECT_EQ(expectedMaxFrequency, maxFrequency);
}
|