Skip to content

Commit e7a8936

Browse files
test: don't use product specific ioctl helper in generic tests
Related-To: NEO-13527 Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent c5d541d commit e7a8936

File tree

8 files changed

+25
-1
lines changed

8 files changed

+25
-1
lines changed

level_zero/sysman/test/unit_tests/sources/linux/mock_sysman_fixture.h

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "shared/source/os_interface/device_factory.h"
1212
#include "shared/source/os_interface/linux/drm_neo.h"
1313
#include "shared/source/os_interface/os_interface.h"
14+
#include "shared/test/common/helpers/debug_manager_state_restore.h"
1415
#include "shared/test/common/helpers/default_hw_info.h"
1516
#include "shared/test/common/helpers/variable_backup.h"
1617
#include "shared/test/common/os_interface/linux/sys_calls_linux_ult.h"
@@ -50,6 +51,7 @@ class PublicLinuxSysmanImp : public L0::Sysman::LinuxSysmanImp {
5051
class SysmanDeviceFixture : public ::testing::Test {
5152
public:
5253
void SetUp() override {
54+
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
5355
VariableBackup<decltype(NEO::SysCalls::sysCallsRealpath)> mockRealPath(&NEO::SysCalls::sysCallsRealpath, [](const char *path, char *buf) -> char * {
5456
constexpr size_t sizeofPath = sizeof("/sys/devices/pci0000:00/0000:00:02.0");
5557
strcpy_s(buf, sizeofPath, "/sys/devices/pci0000:00/0000:00:02.0");
@@ -93,6 +95,7 @@ class SysmanDeviceFixture : public ::testing::Test {
9395
NEO::ExecutionEnvironment *execEnv = nullptr;
9496
std::unique_ptr<L0::Sysman::SysmanDriverHandleImp> driverHandle;
9597
const uint32_t numRootDevices = 1u;
98+
DebugManagerStateRestore restore;
9699
};
97100

98101
class SysmanMultiDeviceFixture : public ::testing::Test {

opencl/test/unit_test/linux/main_linux_dll.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,7 @@ int main(int argc, char **argv) {
858858
defaultHwInfo = std::make_unique<HardwareInfo>();
859859
*defaultHwInfo = DEFAULT_TEST_PLATFORM::hwInfo;
860860

861+
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
861862
initializeTestedDevice();
862863

863864
Os::dxcoreDllName = "";

shared/test/common/libult/linux/drm_mock.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "shared/source/helpers/hw_info.h"
1414
#include "shared/source/os_interface/linux/i915.h"
1515
#include "shared/source/os_interface/linux/sys_calls.h"
16+
#include "shared/test/common/helpers/debug_manager_state_restore.h"
1617

1718
#include "gtest/gtest.h"
1819

@@ -32,6 +33,8 @@ DrmMock::DrmMock(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std
3233
}
3334
}
3435

36+
DebugManagerStateRestore restore;
37+
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
3538
setupIoctlHelper(rootDeviceEnvironment.getHardwareInfo()->platform.eProductFamily);
3639
if (!isPerContextVMRequired()) {
3740
createVirtualMemoryAddressSpace(GfxCoreHelper::getSubDevicesCount(rootDeviceEnvironment.getHardwareInfo()));

shared/test/common/os_interface/linux/device_command_stream_fixture.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ std::unique_ptr<DrmMockCustom> DrmMockCustom::create(RootDeviceEnvironment &root
239239
}
240240

241241
std::unique_ptr<DrmMockCustom> DrmMockCustom::create(std::unique_ptr<HwDeviceIdDrm> &&hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
242+
DebugManagerStateRestore restore;
243+
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
242244
auto drm{new DrmMockCustom{std::move(hwDeviceId), rootDeviceEnvironment}};
243245

244246
drm->reset();

shared/test/common/os_interface/linux/device_command_stream_fixture.h

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "shared/source/os_interface/linux/drm_memory_manager.h"
1212
#include "shared/source/os_interface/linux/drm_neo.h"
1313
#include "shared/source/os_interface/os_context.h"
14+
#include "shared/test/common/helpers/debug_manager_state_restore.h"
1415
#include "shared/test/common/helpers/default_hw_info.h"
1516
#include "shared/test/common/mocks/linux/mock_drm_wrappers.h"
1617

@@ -64,6 +65,9 @@ class DrmMockSuccess : public Drm {
6465
public:
6566
using Drm::setupIoctlHelper;
6667
DrmMockSuccess(int fd, RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(fd, mockPciPath), rootDeviceEnvironment) {
68+
69+
DebugManagerStateRestore restore;
70+
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
6771
setupIoctlHelper(NEO::defaultHwInfo->platform.eProductFamily);
6872
}
6973

@@ -73,6 +77,8 @@ class DrmMockSuccess : public Drm {
7377
class DrmMockFail : public Drm {
7478
public:
7579
DrmMockFail(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<HwDeviceIdDrm>(mockFd, mockPciPath), rootDeviceEnvironment) {
80+
DebugManagerStateRestore restore;
81+
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
7682
setupIoctlHelper(NEO::defaultHwInfo->platform.eProductFamily);
7783
}
7884

shared/test/common/os_interface/linux/drm_neo_create.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2018-2023 Intel Corporation
2+
* Copyright (C) 2018-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -9,6 +9,7 @@
99
#include "shared/source/execution_environment/execution_environment.h"
1010
#include "shared/source/execution_environment/root_device_environment.h"
1111
#include "shared/source/helpers/gfx_core_helper.h"
12+
#include "shared/test/common/helpers/debug_manager_state_restore.h"
1213
#include "shared/test/common/helpers/default_hw_info.h"
1314
#include "shared/test/common/libult/linux/drm_mock.h"
1415

@@ -32,6 +33,8 @@ Drm **pDrmToReturnFromCreateFunc = nullptr;
3233
bool disableBindDefaultInTests = true;
3334

3435
Drm *Drm::create(std::unique_ptr<HwDeviceIdDrm> &&hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) {
36+
DebugManagerStateRestore restore;
37+
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
3538
rootDeviceEnvironment.setHwInfoAndInitHelpers(defaultHwInfo.get());
3639
if (pDrmToReturnFromCreateFunc) {
3740
return *pDrmToReturnFromCreateFunc;

shared/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ class DrmGemCloseWorkerFixture {
6363
this->drmMock = new DrmMockForWorker(*executionEnvironment.rootDeviceEnvironments[0]);
6464

6565
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
66+
DebugManagerStateRestore restore;
67+
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
6668
drmMock->setupIoctlHelper(hwInfo->platform.eProductFamily);
6769

6870
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface = std::make_unique<OSInterface>();

shared/test/unit_test/os_interface/linux/drm_tests.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,8 @@ TEST(DrmTest, whenImmediateVmBindExtIsEnabledThenUseVmBindImmediate) {
964964
}
965965

966966
TEST(DrmQueryTest, GivenDrmWhenSetupHardwareInfoCalledThenCorrectMaxValuesInGtSystemInfoArePreservedAndIoctlHelperSet) {
967+
DebugManagerStateRestore restore;
968+
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
967969
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
968970

969971
*executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo() = *NEO::defaultHwInfo.get();
@@ -1725,6 +1727,8 @@ TEST(DrmTest, whenNotDisablingScratchPagesThenFaultCheckingDoesNotHappen) {
17251727
}
17261728

17271729
TEST(DrmTest, givenSetupIoctlHelperWhenCalledTwiceThenIoctlHelperIsSetOnlyOnce) {
1730+
DebugManagerStateRestore restore;
1731+
debugManager.flags.IgnoreProductSpecificIoctlHelper.set(true);
17281732
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
17291733
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
17301734

0 commit comments

Comments
 (0)