From 3898bc1f3fa54c272f5253e038b4029d827bf6e3 Mon Sep 17 00:00:00 2001 From: Pratik Bari Date: Mon, 18 Nov 2024 15:30:20 +0000 Subject: [PATCH] test: Added changes in the VF APIs ULTs - Added some checks in the ULTs - Rectified the names of some ULTs Related-To: NEO-11337 Signed-off-by: Pratik Bari --- .../windows/test_zes_sysman_vf_management.cpp | 17 ++++++++++------- .../tools/test/black_box_tests/zello_sysman.cpp | 2 +- .../windows/test_zes_sysman_vf_management.cpp | 17 ++++++++++------- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/level_zero/sysman/test/unit_tests/sources/vf_management/windows/test_zes_sysman_vf_management.cpp b/level_zero/sysman/test/unit_tests/sources/vf_management/windows/test_zes_sysman_vf_management.cpp index 627eedd296..aad7609317 100644 --- a/level_zero/sysman/test/unit_tests/sources/vf_management/windows/test_zes_sysman_vf_management.cpp +++ b/level_zero/sysman/test/unit_tests/sources/vf_management/windows/test_zes_sysman_vf_management.cpp @@ -29,12 +29,12 @@ TEST_F(ZesVfFixture, GivenValidDeviceHandleWhenRetrievingVfHandlesThenZeroCountI WddmVfImp::numEnabledVfs = 1; uint32_t count = 0; ze_result_t result = zesDeviceEnumEnabledVFExp(pSysmanDevice->toHandle(), &count, nullptr); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(count, mockHandleCount); uint32_t testCount = count + 1; std::vector handles(testCount); result = zesDeviceEnumEnabledVFExp(pSysmanDevice->toHandle(), &testCount, handles.data()); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(testCount, count); WddmVfImp::numEnabledVfs = 0; } @@ -46,19 +46,20 @@ TEST_F(ZesVfFixture, GivenValidDeviceHandleAndOneVfIsEnabledAndLocalMemoryIsUsed uint32_t count = 0; uint32_t mockHandleCount = 1u; ze_result_t result = zesDeviceEnumEnabledVFExp(pSysmanDevice->toHandle(), &count, nullptr); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(count, mockHandleCount); result = zesDeviceEnumEnabledVFExp(pSysmanDevice->toHandle(), &count, nullptr); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(count, mockHandleCount); std::vector handles(count); result = zesDeviceEnumEnabledVFExp(pSysmanDevice->toHandle(), &count, handles.data()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(handles.size(), mockHandleCount); WddmVfImp::localMemoryUsedStatus = false; WddmVfImp::numEnabledVfs = 0; } -TEST_F(ZesVfFixture, GivenValidVfHandleWhenQueryingVfCapabilitiesThenThenZeroPciAddressIsReturned) { +TEST_F(ZesVfFixture, GivenValidVfHandleWhenQueryingVfCapabilitiesThenZeroPciAddressIsReturned) { uint32_t vfId = 1; std::unique_ptr pVfManagement = std::make_unique(pOsSysman, vfId); @@ -80,7 +81,7 @@ TEST_F(ZesVfFixture, GivenValidVfHandleWhenQueryingOsVfCapabilitiesThenErrorIsRe EXPECT_EQ(result, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); } -TEST_F(ZesVfFixture, GivenValidVfHandleWhenWhenQueryingMemoryUtilizationThenErrorIsReturned) { +TEST_F(ZesVfFixture, GivenValidVfHandleWhenQueryingMemoryUtilizationThenErrorIsReturned) { uint32_t vfId = 1; uint32_t count = 0; @@ -89,10 +90,12 @@ TEST_F(ZesVfFixture, GivenValidVfHandleWhenWhenQueryingMemoryUtilizationThenErro pSysmanDeviceImp->pVfManagementHandleContext->handleList.push_back(std::move(pVfManagement)); ze_result_t result = zesDeviceEnumEnabledVFExp(pSysmanDevice->toHandle(), &count, nullptr); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(count, mockHandleCount); std::vector vfHandleList(count); result = zesDeviceEnumEnabledVFExp(pSysmanDevice->toHandle(), &count, vfHandleList.data()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); for (auto vfHandle : vfHandleList) { EXPECT_NE(vfHandle, nullptr); @@ -101,7 +104,7 @@ TEST_F(ZesVfFixture, GivenValidVfHandleWhenWhenQueryingMemoryUtilizationThenErro } } -TEST_F(ZesVfFixture, GivenValidVfHandleWhenWhenQueryingEngineUtilizationThenErrorIsReturned) { +TEST_F(ZesVfFixture, GivenValidVfHandleWhenQueryingEngineUtilizationThenErrorIsReturned) { uint32_t vfId = 1; uint32_t count = 0; diff --git a/level_zero/tools/test/black_box_tests/zello_sysman.cpp b/level_zero/tools/test/black_box_tests/zello_sysman.cpp index f9e3278ba2..0857fd2e07 100644 --- a/level_zero/tools/test/black_box_tests/zello_sysman.cpp +++ b/level_zero/tools/test/black_box_tests/zello_sysman.cpp @@ -1628,7 +1628,7 @@ void testSysmanVfTelemetry(ze_device_handle_t &device) { for (uint32_t it = 0; it < count; it++) { if (verbose) { std::cout << "Location of the Memory = " << getMemoryModuleLocation(memUtils[it].vfMemLocation) << std::endl; - std::cout << "Memory Utilized in Bytes = " << memUtils[it].vfMemUtilized << std::endl; + std::cout << "Memory Utilized in KiloBytes = " << memUtils[it].vfMemUtilized << std::endl; } } } diff --git a/level_zero/tools/test/unit_tests/sources/sysman/vf_management/windows/test_zes_sysman_vf_management.cpp b/level_zero/tools/test/unit_tests/sources/sysman/vf_management/windows/test_zes_sysman_vf_management.cpp index 120fbd6902..aebc01e0a6 100644 --- a/level_zero/tools/test/unit_tests/sources/sysman/vf_management/windows/test_zes_sysman_vf_management.cpp +++ b/level_zero/tools/test/unit_tests/sources/sysman/vf_management/windows/test_zes_sysman_vf_management.cpp @@ -37,12 +37,12 @@ TEST_F(ZesVfFixture, GivenValidDeviceHandleWhenRetrievingVfHandlesThenZeroCountI WddmVfImp::numEnabledVfs = 1; uint32_t count = 0; ze_result_t result = zesDeviceEnumEnabledVFExp(device->toHandle(), &count, nullptr); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(count, mockHandleCount); uint32_t testCount = count + 1; std::vector handles(testCount); result = zesDeviceEnumEnabledVFExp(device->toHandle(), &testCount, handles.data()); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(testCount, count); WddmVfImp::numEnabledVfs = 0; } @@ -54,19 +54,20 @@ TEST_F(ZesVfFixture, GivenValidDeviceHandleAndOneVfIsEnabledAndLocalMemoryIsUsed uint32_t count = 0; uint32_t mockHandleCount = 1u; ze_result_t result = zesDeviceEnumEnabledVFExp(device->toHandle(), &count, nullptr); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(count, mockHandleCount); result = zesDeviceEnumEnabledVFExp(device->toHandle(), &count, nullptr); - EXPECT_EQ(ZE_RESULT_SUCCESS, result); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(count, mockHandleCount); std::vector handles(count); result = zesDeviceEnumEnabledVFExp(device->toHandle(), &count, handles.data()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(handles.size(), mockHandleCount); WddmVfImp::localMemoryUsedStatus = false; WddmVfImp::numEnabledVfs = 0; } -TEST_F(ZesVfFixture, GivenValidVfHandleWhenQueryingVfCapabilitiesThenThenZeroPciAddressIsReturned) { +TEST_F(ZesVfFixture, GivenValidVfHandleWhenQueryingVfCapabilitiesThenZeroPciAddressIsReturned) { uint32_t vfId = 1; std::unique_ptr pVfManagement = std::make_unique(pOsSysman, vfId); @@ -88,7 +89,7 @@ TEST_F(ZesVfFixture, GivenValidVfHandleWhenQueryingOsVfCapabilitiesThenErrorIsRe EXPECT_EQ(result, ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); } -TEST_F(ZesVfFixture, GivenValidVfHandleWhenWhenQueryingMemoryUtilizationThenErrorIsReturned) { +TEST_F(ZesVfFixture, GivenValidVfHandleWhenQueryingMemoryUtilizationThenErrorIsReturned) { uint32_t vfId = 1; uint32_t count = 0; @@ -97,10 +98,12 @@ TEST_F(ZesVfFixture, GivenValidVfHandleWhenWhenQueryingMemoryUtilizationThenErro pSysmanDeviceImp->pVfManagementHandleContext->handleList.push_back(std::move(pVfManagement)); ze_result_t result = zesDeviceEnumEnabledVFExp(device->toHandle(), &count, nullptr); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); EXPECT_EQ(count, mockHandleCount); std::vector vfHandleList(count); result = zesDeviceEnumEnabledVFExp(device->toHandle(), &count, vfHandleList.data()); + EXPECT_EQ(result, ZE_RESULT_SUCCESS); for (auto vfHandle : vfHandleList) { EXPECT_NE(vfHandle, nullptr); @@ -109,7 +112,7 @@ TEST_F(ZesVfFixture, GivenValidVfHandleWhenWhenQueryingMemoryUtilizationThenErro } } -TEST_F(ZesVfFixture, GivenValidVfHandleWhenWhenQueryingEngineUtilizationThenErrorIsReturned) { +TEST_F(ZesVfFixture, GivenValidVfHandleWhenQueryingEngineUtilizationThenErrorIsReturned) { uint32_t vfId = 1; uint32_t count = 0;