Skip to content

Commit 169469e

Browse files
refactor: extract querying device id / revision id to separate method in xe path
Related-To: NEO-13527 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent 270570c commit 169469e

File tree

10 files changed

+273
-108
lines changed

10 files changed

+273
-108
lines changed

shared/source/os_interface/linux/xe/ioctl_helper_xe.cpp

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,44 @@ IoctlHelperXe::IoctlHelperXe(Drm &drmArg) : IoctlHelper(drmArg) {
127127
xeLog("IoctlHelperXe::IoctlHelperXe\n", "");
128128
}
129129

130+
bool IoctlHelperXe::queryDeviceIdAndRevision(const Drm &drm) {
131+
auto fileDescriptor = drm.getFileDescriptor();
132+
133+
drm_xe_device_query queryConfig = {};
134+
queryConfig.query = DRM_XE_DEVICE_QUERY_CONFIG;
135+
136+
int ret = SysCalls::ioctl(fileDescriptor, DRM_IOCTL_XE_DEVICE_QUERY, &queryConfig);
137+
if (ret || queryConfig.size == 0) {
138+
printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query size for device config!\n");
139+
return false;
140+
}
141+
142+
auto data = std::vector<uint64_t>(Math::divideAndRoundUp(sizeof(drm_xe_query_config) + sizeof(uint64_t) * queryConfig.size, sizeof(uint64_t)), 0);
143+
struct drm_xe_query_config *config = reinterpret_cast<struct drm_xe_query_config *>(data.data());
144+
queryConfig.data = castToUint64(config);
145+
146+
ret = SysCalls::ioctl(fileDescriptor, DRM_IOCTL_XE_DEVICE_QUERY, &queryConfig);
147+
148+
if (ret) {
149+
printDebugString(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: Cannot query device ID and revision!\n");
150+
return false;
151+
}
152+
153+
auto hwInfo = drm.getRootDeviceEnvironment().getMutableHardwareInfo();
154+
hwInfo->platform.usDeviceID = config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
155+
hwInfo->platform.usRevId = static_cast<int>((config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] >> 16) & 0xff);
156+
return true;
157+
}
158+
130159
bool IoctlHelperXe::initialize() {
131160
xeLog("IoctlHelperXe::initialize\n", "");
132161

133162
euDebugInterface = EuDebugInterface::create(drm.getSysFsPciPath());
163+
164+
if (!IoctlHelperXe::queryDeviceIdAndRevision(this->drm)) {
165+
return false;
166+
}
167+
134168
drm_xe_device_query queryConfig = {};
135169
queryConfig.query = DRM_XE_DEVICE_QUERY_CONFIG;
136170

@@ -174,8 +208,6 @@ bool IoctlHelperXe::initialize() {
174208
IoctlHelper::ioctl(DrmIoctl::query, &queryConfig);
175209

176210
auto hwInfo = this->drm.getRootDeviceEnvironment().getMutableHardwareInfo();
177-
hwInfo->platform.usDeviceID = config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] & 0xffff;
178-
hwInfo->platform.usRevId = static_cast<int>((config->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] >> 16) & 0xff);
179211
hwInfo->capabilityTable.gpuAddressSpace = (1ull << config->info[DRM_XE_QUERY_CONFIG_VA_BITS]) - 1;
180212

181213
hwInfo->capabilityTable.cxlType = 0;

shared/source/os_interface/linux/xe/ioctl_helper_xe.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class IoctlHelperXe : public IoctlHelper {
3636
public:
3737
using IoctlHelper::IoctlHelper;
3838
static std::unique_ptr<IoctlHelperXe> create(Drm &drmArg);
39+
static bool queryDeviceIdAndRevision(const Drm &drm);
40+
3941
IoctlHelperXe(Drm &drmArg);
4042
~IoctlHelperXe() override;
4143
int ioctl(DrmIoctl request, void *arg) override;

shared/test/common/os_interface/linux/xe/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ set(neo_libult_common_SRCS_LIB_ULT_LINUX_XE
1010
${CMAKE_CURRENT_SOURCE_DIR}/mock_drm_xe.h
1111
${CMAKE_CURRENT_SOURCE_DIR}/mock_drm_xe.inl
1212
${CMAKE_CURRENT_SOURCE_DIR}/mock_drm_xe_definitions.inl
13+
${CMAKE_CURRENT_SOURCE_DIR}/xe_config_fixture.h
1314
)
1415
if(UNIX)
1516

shared/test/common/os_interface/linux/xe/mock_drm_xe.inl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ struct DrmMockXe : public DrmMockCustom {
3030
int gemMmapOffsetCalled = 0;
3131
int gemDestroyContextCalled = 0;
3232

33-
const uint16_t revId = 0x12;
34-
const uint16_t devId = 0xabc;
35-
3633
uint64_t queryConfig[7]{}; // 1 qword for num params and 1 qwords per param
3734
uint32_t mockExecQueueId = 1234;
3835
static constexpr int32_t mockMaxExecQueuePriority = 3;

shared/test/common/os_interface/linux/xe/mock_drm_xe_definitions.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ void DrmMockXe::initInstance() {
224224

225225
auto xeQueryConfig = reinterpret_cast<drm_xe_query_config *>(this->queryConfig);
226226
xeQueryConfig->num_params = 6;
227-
xeQueryConfig->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] = (this->revId << 16) | this->devId;
227+
xeQueryConfig->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] = 0; // this should be queried by ioctl sys call
228228
xeQueryConfig->info[DRM_XE_QUERY_CONFIG_VA_BITS] = 48;
229229
xeQueryConfig->info[DRM_XE_QUERY_CONFIG_MAX_EXEC_QUEUE_PRIORITY] = mockMaxExecQueuePriority;
230230

shared/test/common/os_interface/linux/xe/mock_ioctl_helper_xe.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ struct MockIoctlHelperXe : IoctlHelperXe {
4646
if (failPerfDisable) {
4747
return -1;
4848
}
49+
return 0;
4950
}
5051
if (request == DrmIoctl::perfEnable) {
5152
if (failPerfEnable) {
5253
return -1;
5354
}
55+
return 0;
5456
}
5557
return IoctlHelperXe::ioctl(fd, request, arg);
5658
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (C) 2024 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#pragma once
9+
10+
#include "shared/test/common/helpers/variable_backup.h"
11+
#include "shared/test/common/os_interface/linux/sys_calls_linux_ult.h"
12+
namespace NEO {
13+
class XeConfigFixture {
14+
public:
15+
XeConfigFixture() {
16+
const auto &hwInfo = *defaultHwInfo;
17+
static uint64_t queryConfig[2]{}; // 1 qword for num params and 1 qwords per param
18+
auto xeQueryConfig = reinterpret_cast<drm_xe_query_config *>(queryConfig);
19+
xeQueryConfig->num_params = 1;
20+
xeQueryConfig->info[DRM_XE_QUERY_CONFIG_REV_AND_DEVICE_ID] = (hwInfo.platform.usRevId << 16) | hwInfo.platform.usDeviceID;
21+
22+
SysCalls::sysCallsIoctl = [](int fileDescriptor, unsigned long int request, void *arg) -> int {
23+
if (request == DRM_IOCTL_XE_DEVICE_QUERY) {
24+
struct drm_xe_device_query *deviceQuery = static_cast<struct drm_xe_device_query *>(arg);
25+
if (deviceQuery->query == DRM_XE_DEVICE_QUERY_CONFIG) {
26+
if (deviceQuery->data) {
27+
memcpy_s(reinterpret_cast<void *>(deviceQuery->data), deviceQuery->size, queryConfig, sizeof(queryConfig));
28+
}
29+
deviceQuery->size = sizeof(queryConfig);
30+
return 0;
31+
}
32+
}
33+
return -1;
34+
};
35+
}
36+
37+
void setUp(){};
38+
void tearDown(){};
39+
40+
VariableBackup<decltype(SysCalls::sysCallsIoctl)> mockIoctl{&SysCalls::sysCallsIoctl};
41+
};
42+
} // namespace NEO

shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_debugger_tests.cpp

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@
2121
#include "shared/test/common/mocks/linux/mock_os_time_linux.h"
2222
#include "shared/test/common/mocks/mock_execution_environment.h"
2323
#include "shared/test/common/mocks/mock_io_functions.h"
24+
#include "shared/test/common/os_interface/linux/xe/xe_config_fixture.h"
2425
#include "shared/test/common/test_macros/hw_test.h"
2526
#include "shared/test/common/test_macros/test.h"
2627

2728
using namespace NEO;
2829

29-
TEST(IoctlHelperXeTest, whenCallingDebuggerOpenIoctlThenProperValueIsReturned) {
30+
using IoctlHelperXeTest = Test<XeConfigFixture>;
31+
TEST_F(IoctlHelperXeTest, whenCallingDebuggerOpenIoctlThenProperValueIsReturned) {
3032
int ret;
3133
DebugManagerStateRestore restorer;
3234
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
@@ -40,7 +42,7 @@ TEST(IoctlHelperXeTest, whenCallingDebuggerOpenIoctlThenProperValueIsReturned) {
4042
EXPECT_EQ(ret, drm->debuggerOpenRetval);
4143
}
4244

43-
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGetIoctForDebuggerThenCorrectValueReturned) {
45+
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGetIoctForDebuggerThenCorrectValueReturned) {
4446
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
4547
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
4648
auto xeIoctlHelper = drm->getIoctlHelper();
@@ -56,7 +58,7 @@ TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGetIoctForDebuggerThenCorre
5658
verifyIoctlRequestValue(EuDebugParam::connect, DrmIoctl::debuggerOpen);
5759
}
5860

59-
TEST(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGetEudebugExtPropertyThenCorrectValueReturned) {
61+
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallingGetEudebugExtPropertyThenCorrectValueReturned) {
6062
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
6163
executionEnvironment->setDebuggingMode(DebuggingMode::offline);
6264
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
@@ -162,14 +164,14 @@ HWTEST_F(IoctlHelperXeTestFixture, GivenContextCreatedForCopyEngineWhenCreateDrm
162164
EXPECT_NE(ext.property, static_cast<uint32_t>(EuDebugParam::execQueueSetPropertyEuDebug));
163165
}
164166

165-
TEST(IoctlHelperXeTest, GivenXeDriverThenDebugAttachReturnsTrue) {
167+
TEST_F(IoctlHelperXeTest, GivenXeDriverThenDebugAttachReturnsTrue) {
166168
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
167169
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
168170
auto xeIoctlHelper = static_cast<MockIoctlHelperXeDebug *>(drm->ioctlHelper.get());
169171
EXPECT_TRUE(xeIoctlHelper->isDebugAttachAvailable());
170172
}
171173

172-
TEST(IoctlHelperXeTest, givenEuDebugSysFsContentWhenItIsZeroThenEuDebugInterfaceIsNotCreated) {
174+
TEST_F(IoctlHelperXeTest, givenEuDebugSysFsContentWhenItIsZeroThenEuDebugInterfaceIsNotCreated) {
173175
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
174176
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
175177

@@ -184,7 +186,7 @@ TEST(IoctlHelperXeTest, givenEuDebugSysFsContentWhenItIsZeroThenEuDebugInterface
184186
EXPECT_EQ(nullptr, euDebugInterface);
185187
}
186188

187-
TEST(IoctlHelperXeTest, givenInvalidPathWhenCreateEuDebugInterfaceThenReturnNullptr) {
189+
TEST_F(IoctlHelperXeTest, givenInvalidPathWhenCreateEuDebugInterfaceThenReturnNullptr) {
188190
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
189191
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
190192

@@ -195,7 +197,7 @@ TEST(IoctlHelperXeTest, givenInvalidPathWhenCreateEuDebugInterfaceThenReturnNull
195197
EXPECT_EQ(nullptr, euDebugInterface);
196198
}
197199

198-
TEST(IoctlHelperXeTest, whenEuDebugInterfaceIsCreatedThenEuDebugIsAvailable) {
200+
TEST_F(IoctlHelperXeTest, whenEuDebugInterfaceIsCreatedThenEuDebugIsAvailable) {
199201
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
200202
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
201203
auto xeIoctlHelper = static_cast<MockIoctlHelperXeDebug *>(drm->ioctlHelper.get());
@@ -206,7 +208,7 @@ TEST(IoctlHelperXeTest, whenEuDebugInterfaceIsCreatedThenEuDebugIsAvailable) {
206208
EXPECT_EQ(1, xeIoctlHelper->getEuDebugSysFsEnable());
207209
}
208210

209-
TEST(IoctlHelperXeTest, givenXeRegisterResourceThenCorrectIoctlCalled) {
211+
TEST_F(IoctlHelperXeTest, givenXeRegisterResourceThenCorrectIoctlCalled) {
210212
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
211213
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
212214
auto xeIoctlHelper = static_cast<MockIoctlHelperXeDebug *>(drm->ioctlHelper.get());
@@ -256,15 +258,15 @@ TEST(IoctlHelperXeTest, givenXeRegisterResourceThenCorrectIoctlCalled) {
256258
EXPECT_EQ(drm->metadataType, static_cast<uint64_t>(EuDebugParam::metadataModuleArea));
257259
}
258260

259-
TEST(IoctlHelperXeTest, givenXeunregisterResourceThenCorrectIoctlCalled) {
261+
TEST_F(IoctlHelperXeTest, givenXeunregisterResourceThenCorrectIoctlCalled) {
260262
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
261263
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
262264
auto xeIoctlHelper = static_cast<MockIoctlHelperXeDebug *>(drm->ioctlHelper.get());
263265
xeIoctlHelper->unregisterResource(0x1234);
264266
EXPECT_EQ(drm->metadataID, 0x1234u);
265267
}
266268

267-
TEST(IoctlHelperXeTest, whenGettingVmBindExtFromHandlesThenProperStructsAreReturned) {
269+
TEST_F(IoctlHelperXeTest, whenGettingVmBindExtFromHandlesThenProperStructsAreReturned) {
268270
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
269271
auto drm = DrmMockXeDebug::create(*executionEnvironment->rootDeviceEnvironments[0]);
270272
auto xeIoctlHelper = static_cast<MockIoctlHelperXeDebug *>(drm->ioctlHelper.get());
@@ -287,7 +289,7 @@ TEST(IoctlHelperXeTest, whenGettingVmBindExtFromHandlesThenProperStructsAreRetur
287289
EXPECT_EQ(reinterpret_cast<uintptr_t>(&vmBindExt[2]), vmBindExt[1].base.nextExtension);
288290
}
289291

290-
TEST(IoctlHelperXeTest, givenResourceRegistrationEnabledWhenAllocationTypeShouldBeRegisteredThenBoHasBindExtHandleAdded) {
292+
TEST_F(IoctlHelperXeTest, givenResourceRegistrationEnabledWhenAllocationTypeShouldBeRegisteredThenBoHasBindExtHandleAdded) {
291293
const uint32_t rootDeviceIndex = 0u;
292294
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
293295
DrmMockResources drm(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
@@ -336,7 +338,7 @@ TEST(IoctlHelperXeTest, givenResourceRegistrationEnabledWhenAllocationTypeShould
336338
}
337339
}
338340

339-
TEST(IoctlHelperXeTest, givenResourceRegistrationEnabledWhenAllocationTypeShouldNotBeRegisteredThenNoBindHandleCreated) {
341+
TEST_F(IoctlHelperXeTest, givenResourceRegistrationEnabledWhenAllocationTypeShouldNotBeRegisteredThenNoBindHandleCreated) {
340342
const uint32_t rootDeviceIndex = 0u;
341343
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
342344
DrmMockResources drm(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
@@ -356,7 +358,7 @@ TEST(IoctlHelperXeTest, givenResourceRegistrationEnabledWhenAllocationTypeShould
356358
EXPECT_EQ(DrmResourceClass::maxSize, drm.registeredClass);
357359
}
358360

359-
TEST(IoctlHelperXeTest, givenDebuggingEnabledWhenCallingVmBindThenWaitUserFenceIsCalledWithCorrectTimeout) {
361+
TEST_F(IoctlHelperXeTest, givenDebuggingEnabledWhenCallingVmBindThenWaitUserFenceIsCalledWithCorrectTimeout) {
360362

361363
DebugManagerStateRestore restorer;
362364
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();

shared/test/unit_test/os_interface/linux/xe/ioctl_helper_xe_perf_tests.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@
1111
#include "shared/test/common/mocks/linux/mock_drm_memory_manager.h"
1212
#include "shared/test/common/mocks/linux/mock_os_context_linux.h"
1313
#include "shared/test/common/os_interface/linux/xe/mock_drm_xe.h"
14+
#include "shared/test/common/os_interface/linux/xe/xe_config_fixture.h"
1415
#include "shared/test/common/test_macros/test.h"
1516

1617
using namespace NEO;
18+
using IoctlHelperXeTest = Test<XeConfigFixture>;
1719

18-
TEST(IoctlHelperXeTest, whenCallingGetEuStallPropertiesThenFailueIsReturned) {
20+
TEST_F(IoctlHelperXeTest, whenCallingGetEuStallPropertiesThenFailueIsReturned) {
1921
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
2022
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
2123
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
@@ -24,7 +26,7 @@ TEST(IoctlHelperXeTest, whenCallingGetEuStallPropertiesThenFailueIsReturned) {
2426
EXPECT_FALSE(xeIoctlHelper.get()->getEuStallProperties(properties, 0x101, 0x102, 0x103, 1, 20u));
2527
}
2628

27-
TEST(IoctlHelperXeTest, whenCallingPerfOpenEuStallStreamThenFailueIsReturned) {
29+
TEST_F(IoctlHelperXeTest, whenCallingPerfOpenEuStallStreamThenFailueIsReturned) {
2830
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
2931
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
3032
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
@@ -34,7 +36,7 @@ TEST(IoctlHelperXeTest, whenCallingPerfOpenEuStallStreamThenFailueIsReturned) {
3436
EXPECT_FALSE(xeIoctlHelper.get()->perfOpenEuStallStream(0u, properties, &invalidFd));
3537
}
3638

37-
TEST(IoctlHelperXeTest, whenCallingPerfDisableEuStallStreamThenFailueIsReturned) {
39+
TEST_F(IoctlHelperXeTest, whenCallingPerfDisableEuStallStreamThenFailueIsReturned) {
3840
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
3941
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
4042
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
@@ -43,64 +45,64 @@ TEST(IoctlHelperXeTest, whenCallingPerfDisableEuStallStreamThenFailueIsReturned)
4345
EXPECT_FALSE(xeIoctlHelper.get()->perfDisableEuStallStream(&invalidFd));
4446
}
4547

46-
TEST(IoctlHelperXeTest, whenCallingGetIoctlRequestValuePerfOpenThenZeroisReturned) {
48+
TEST_F(IoctlHelperXeTest, whenCallingGetIoctlRequestValuePerfOpenThenZeroisReturned) {
4749
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
4850
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
4951
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
5052
EXPECT_NE(nullptr, xeIoctlHelper);
5153
EXPECT_EQ(0u, xeIoctlHelper.get()->getIoctlRequestValuePerf(DrmIoctl::perfOpen));
5254
}
5355

54-
TEST(IoctlHelperXeTest, whenCallingGetIoctlRequestValuePerfEnableThenZeroisReturned) {
56+
TEST_F(IoctlHelperXeTest, whenCallingGetIoctlRequestValuePerfEnableThenZeroisReturned) {
5557
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
5658
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
5759
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
5860
EXPECT_NE(nullptr, xeIoctlHelper);
5961
EXPECT_EQ(0u, xeIoctlHelper.get()->getIoctlRequestValuePerf(DrmIoctl::perfEnable));
6062
}
6163

62-
TEST(IoctlHelperXeTest, whenCallingGetIoctlRequestValuePerfDisableThenZeroisReturned) {
64+
TEST_F(IoctlHelperXeTest, whenCallingGetIoctlRequestValuePerfDisableThenZeroisReturned) {
6365
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
6466
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
6567
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
6668
EXPECT_NE(nullptr, xeIoctlHelper);
6769
EXPECT_EQ(0u, xeIoctlHelper.get()->getIoctlRequestValuePerf(DrmIoctl::perfDisable));
6870
}
6971

70-
TEST(IoctlHelperXeTest, whenCallingPerfOpenIoctlWithInvalidValuesThenZeroisReturned) {
72+
TEST_F(IoctlHelperXeTest, whenCallingPerfOpenIoctlWithInvalidValuesThenZeroisReturned) {
7173
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
7274
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
7375
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
7476
EXPECT_NE(nullptr, xeIoctlHelper);
7577
EXPECT_EQ(0, xeIoctlHelper.get()->perfOpenIoctl(DrmIoctl::perfOpen, nullptr));
7678
}
7779

78-
TEST(IoctlHelperXeTest, whenCallingGetIoctlRequestValueWithInvalidValueThenErrorReturned) {
80+
TEST_F(IoctlHelperXeTest, whenCallingGetIoctlRequestValueWithInvalidValueThenErrorReturned) {
7981
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
8082
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
8183
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
8284
EXPECT_NE(nullptr, xeIoctlHelper);
8385
EXPECT_EQ(0u, xeIoctlHelper.get()->getIoctlRequestValuePerf(DrmIoctl::version));
8486
}
8587

86-
TEST(IoctlHelperXeTest, whenCallingPerfOpenIoctlThenProperValueIsReturned) {
88+
TEST_F(IoctlHelperXeTest, whenCallingPerfOpenIoctlThenProperValueIsReturned) {
8789
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
8890
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
8991
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
9092
EXPECT_NE(nullptr, xeIoctlHelper);
9193
EXPECT_EQ(0, xeIoctlHelper.get()->ioctl(DrmIoctl::perfOpen, nullptr));
9294
}
9395

94-
TEST(IoctlHelperXeTest, whenCallingPerfDisableIoctlThenProperValueIsReturned) {
96+
TEST_F(IoctlHelperXeTest, whenCallingPerfDisableIoctlThenProperValueIsReturned) {
9597
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
9698
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
9799
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);
98100
EXPECT_NE(nullptr, xeIoctlHelper);
99101
int32_t invalidFd = -1;
100-
EXPECT_EQ(0, xeIoctlHelper.get()->ioctl(invalidFd, DrmIoctl::perfDisable, nullptr));
102+
EXPECT_EQ(-1, xeIoctlHelper.get()->ioctl(invalidFd, DrmIoctl::perfDisable, nullptr));
101103
}
102104

103-
TEST(IoctlHelperXeTest, whenCallingIsEuStallSupportedThenFalseIsReturned) {
105+
TEST_F(IoctlHelperXeTest, whenCallingIsEuStallSupportedThenFalseIsReturned) {
104106
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
105107
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
106108
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(*drm);

0 commit comments

Comments
 (0)