diff --git a/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp index 6e1db5ed0d..f7344949b8 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_l0_device.cpp @@ -2770,14 +2770,27 @@ TEST_F(DeviceGetStatusTest, givenCallToDeviceGetStatusThenCorrectErrorCodeIsRetu EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, res); } -TEST_F(DeviceGetStatusTest, givenCallToDeviceGetStatusThenCorrectErrorCodeIsReturnedWhenGpuHangs) { +struct DeviceGetStatusTestWithMockCsr : public DeviceGetStatusTest { + + void SetUp() override { + EnvironmentWithCsrWrapper environment; + environment.setCsrType(); + + DeviceGetStatusTest::SetUp(); + } + + void TearDown() override { + DeviceGetStatusTest::TearDown(); + } +}; + +TEST_F(DeviceGetStatusTestWithMockCsr, givenCallToDeviceGetStatusThenCorrectErrorCodeIsReturnedWhenGpuHangs) { ze_result_t res = device->getStatus(); EXPECT_EQ(ZE_RESULT_SUCCESS, res); - auto mockCSR = new MockCommandStreamReceiver(*neoDevice->getExecutionEnvironment(), 0, neoDevice->getDeviceBitfield()); + auto mockCSR = static_cast(&neoDevice->getGpgpuCommandStreamReceiver()); mockCSR->isGpuHangDetectedReturnValue = true; - neoDevice->resetCommandStreamReceiver(mockCSR); res = device->getStatus(); EXPECT_EQ(ZE_RESULT_ERROR_DEVICE_LOST, res); diff --git a/opencl/test/unit_test/command_queue/command_queue_fixture.h b/opencl/test/unit_test/command_queue/command_queue_fixture.h index 805f7b6416..3439a17136 100644 --- a/opencl/test/unit_test/command_queue/command_queue_fixture.h +++ b/opencl/test/unit_test/command_queue/command_queue_fixture.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2023 Intel Corporation + * Copyright (C) 2018-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -137,6 +137,27 @@ struct CommandQueueHwTest const HardwareInfo *pHwInfo = nullptr; }; +template