Debian Codegraph @

level_zero/tools/test/unit_tests/sources/sysman/windows/mock_sysman_fixture.cpp

raw
1 /*
2 * Copyright (C) 2023-2025 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #include "level_zero/tools/test/unit_tests/sources/sysman/windows/mock_sysman_fixture.h"
9
10 #include "shared/source/os_interface/os_interface.h"
11 #include "shared/test/common/mocks/mock_device.h"
12
13 #include "level_zero/tools/source/sysman/os_sysman_driver.h"
14 #include "level_zero/tools/source/sysman/sysman_imp.h"
15
16 namespace L0 {
17 namespace ult {
18
19 void SysmanDeviceFixture::SetUp() {
20 if (!sysmanUltsEnable) {
21 GTEST_SKIP();
22 }
23 DeviceFixture::setUp();
24 neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]->osInterface = std::make_unique<NEO::OSInterface>();
25
26 SysmanEnabledFixture::SetUp();
27 device->setSysmanHandle(L0::SysmanDeviceHandleContext::init(device->toHandle()));
28 pSysmanDevice = device->getSysmanHandle();
29 pSysmanDeviceImp = static_cast<SysmanDeviceImp *>(pSysmanDevice);
30 pOsSysman = pSysmanDeviceImp->pOsSysman;
31 pWddmSysmanImp = static_cast<PublicWddmSysmanImp *>(pOsSysman);
32
33 if (globalOsSysmanDriver == nullptr) {
34 globalOsSysmanDriver = L0::OsSysmanDriver::create();
35 }
36 }
37
38 void SysmanDeviceFixture::TearDown() {
39 if (!sysmanUltsEnable) {
40 GTEST_SKIP();
41 }
42
43 if (globalOsSysmanDriver != nullptr) {
44 delete globalOsSysmanDriver;
45 globalOsSysmanDriver = nullptr;
46 }
47
48 SysmanEnabledFixture::TearDown();
49 DeviceFixture::tearDown();
50 }
51
52 } // namespace ult
53 } // namespace L0