From 203b54b2fc541cd9d544aae741b1ca09e23a16a1 Mon Sep 17 00:00:00 2001 From: viki435 Date: Mon, 11 Aug 2025 18:57:18 +0530 Subject: [PATCH 1/2] Primary JIRA: VLCLJ-2513 Sub-tasks: VLCLJ-2563, VLCLJ-2565, VLCLJ-2566 Fix: Handling GTEST_FAIL logic for multi-device scenario for engine, fabric and overclocking modules. Signed-off-by: viki435 --- .../src/test_sysman_engine.cpp | 348 +++++++----- .../src/test_sysman_fabric.cpp | 470 +++++++++------- .../src/test_sysman_overclocking.cpp | 514 ++++++++++-------- 3 files changed, 756 insertions(+), 576 deletions(-) diff --git a/conformance_tests/sysman/test_sysman_engine/src/test_sysman_engine.cpp b/conformance_tests/sysman/test_sysman_engine/src/test_sysman_engine.cpp index 99e09bd7..2d4dadba 100644 --- a/conformance_tests/sysman/test_sysman_engine/src/test_sysman_engine.cpp +++ b/conformance_tests/sysman/test_sysman_engine/src/test_sysman_engine.cpp @@ -18,10 +18,16 @@ namespace lzt = level_zero_tests; namespace { #ifdef USE_ZESINIT -class EngineModuleZesTest : public lzt::ZesSysmanCtsClass {}; +class EngineModuleZesTest : public lzt::ZesSysmanCtsClass { +public: + bool is_engine_supported = false; +}; #define ENGINE_TEST EngineModuleZesTest #else // USE_ZESINIT -class EngineModuleTest : public lzt::SysmanCtsClass {}; +class EngineModuleTest : public lzt::SysmanCtsClass { +public: + bool is_engine_supported = false; +}; #define ENGINE_TEST EngineModuleTest #endif // USE_ZESINIT @@ -31,11 +37,16 @@ LZT_TEST_F( for (auto device : devices) { uint32_t count = 0; count = lzt::get_engine_handle_count(device); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + if (count > 0) { + is_engine_supported = true; + LOG_INFO << "Engine handles are available on this device! "; + } else { + LOG_INFO << "No engine handles found for this device! "; } } + if (!is_engine_supported) { + FAIL() << "No engine handles found on any of the devices! "; + } } LZT_TEST_F( @@ -43,17 +54,22 @@ LZT_TEST_F( GivenComponentCountZeroWhenRetrievingSysmanEngineHandlesThenNotNullEngineHandlesAreReturned) { for (auto device : devices) { uint32_t count = 0; - auto engine_handles = lzt::get_engine_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - ASSERT_EQ(engine_handles.size(), count); - for (auto engine_handle : engine_handles) { - EXPECT_NE(nullptr, engine_handle); + count = lzt::get_engine_handle_count(device); + if (count > 0) { + is_engine_supported = true; + LOG_INFO << "Engine handles are available on this device! "; + auto engine_handles = lzt::get_engine_handles(device, count); + ASSERT_EQ(engine_handles.size(), count); + for (auto engine_handle : engine_handles) { + EXPECT_NE(nullptr, engine_handle); + } + } else { + LOG_INFO << "No engine handles found for this device! "; } } + if (!is_engine_supported) { + FAIL() << "No engine handles found on any of the devices! "; + } } LZT_TEST_F( @@ -61,15 +77,20 @@ LZT_TEST_F( GivenInvalidComponentCountWhenRetrievingSysmanEngineHandlesThenActualComponentCountIsUpdated) { for (auto device : devices) { uint32_t actual_count = 0; - lzt::get_engine_handles(device, actual_count); - if (actual_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + actual_count = lzt::get_engine_handle_count(device); + if (actual_count > 0) { + is_engine_supported = true; + LOG_INFO << "Engine handles are available on this device! "; + lzt::get_engine_handles(device, actual_count); + uint32_t test_count = actual_count + 1; + lzt::get_engine_handles(device, test_count); + EXPECT_EQ(test_count, actual_count); + } else { + LOG_INFO << "No engine handles found for this device! "; } - - uint32_t test_count = actual_count + 1; - lzt::get_engine_handles(device, test_count); - EXPECT_EQ(test_count, actual_count); + } + if (!is_engine_supported) { + FAIL() << "No engine handles found on any of the devices! "; } } @@ -78,22 +99,26 @@ LZT_TEST_F( GivenValidComponentCountWhenCallingApiTwiceThenSimilarEngineHandlesReturned) { for (auto device : devices) { uint32_t count = 0; - auto engine_handles_initial = lzt::get_engine_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto engine_handle : engine_handles_initial) { - EXPECT_NE(nullptr, engine_handle); - } - - count = 0; - auto engine_handles_later = lzt::get_engine_handles(device, count); - for (auto engine_handle : engine_handles_later) { - EXPECT_NE(nullptr, engine_handle); + count = lzt::get_engine_handle_count(device); + if (count > 0) { + is_engine_supported = true; + LOG_INFO << "Engine handles are available on this device! "; + auto engine_handles_initial = lzt::get_engine_handles(device, count); + for (auto engine_handle : engine_handles_initial) { + EXPECT_NE(nullptr, engine_handle); + } + count = 0; + auto engine_handles_later = lzt::get_engine_handles(device, count); + for (auto engine_handle : engine_handles_later) { + EXPECT_NE(nullptr, engine_handle); + } + EXPECT_EQ(engine_handles_initial, engine_handles_later); + } else { + LOG_INFO << "No engine handles found for this device! "; } - EXPECT_EQ(engine_handles_initial, engine_handles_later); + } + if (!is_engine_supported) { + FAIL() << "No engine handles found on any of the devices! "; } } @@ -103,22 +128,27 @@ LZT_TEST_F( for (auto device : devices) { auto deviceProperties = lzt::get_sysman_device_properties(device); uint32_t count = 0; - auto engine_handles = lzt::get_engine_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto engine_handle : engine_handles) { - ASSERT_NE(nullptr, engine_handle); - auto properties = lzt::get_engine_properties(engine_handle); - EXPECT_GE(properties.type, ZES_ENGINE_GROUP_ALL); - EXPECT_LE(properties.type, ZES_ENGINE_GROUP_3D_ALL); - if (properties.onSubdevice) { - EXPECT_LT(properties.subdeviceId, deviceProperties.numSubdevices); + count = lzt::get_engine_handle_count(device); + if (count > 0) { + is_engine_supported = true; + LOG_INFO << "Engine handles are available on this device! "; + auto engine_handles = lzt::get_engine_handles(device, count); + for (auto engine_handle : engine_handles) { + ASSERT_NE(nullptr, engine_handle); + auto properties = lzt::get_engine_properties(engine_handle); + EXPECT_GE(properties.type, ZES_ENGINE_GROUP_ALL); + EXPECT_LE(properties.type, ZES_ENGINE_GROUP_3D_ALL); + if (properties.onSubdevice) { + EXPECT_LT(properties.subdeviceId, deviceProperties.numSubdevices); + } } + } else { + LOG_INFO << "No engine handles found for this device! "; } } + if (!is_engine_supported) { + FAIL() << "No engine handles found on any of the devices! "; + } } LZT_TEST_F( @@ -126,23 +156,29 @@ LZT_TEST_F( GivenValidEngineHandleWhenRetrievingEnginePropertiesThenExpectSamePropertiesReturnedTwice) { for (auto device : devices) { uint32_t count = 0; - auto engine_handles = lzt::get_engine_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto engine_handle : engine_handles) { - EXPECT_NE(nullptr, engine_handle); - auto properties_initial = lzt::get_engine_properties(engine_handle); - auto properties_later = lzt::get_engine_properties(engine_handle); - EXPECT_EQ(properties_initial.type, properties_later.type); - EXPECT_EQ(properties_initial.onSubdevice, properties_later.onSubdevice); - if (properties_initial.onSubdevice && properties_later.onSubdevice) { - EXPECT_EQ(properties_initial.subdeviceId, properties_later.subdeviceId); + count = lzt::get_engine_handle_count(device); + if (count > 0) { + is_engine_supported = true; + LOG_INFO << "Engine handles are available on this device! "; + auto engine_handles = lzt::get_engine_handles(device, count); + for (auto engine_handle : engine_handles) { + EXPECT_NE(nullptr, engine_handle); + auto properties_initial = lzt::get_engine_properties(engine_handle); + auto properties_later = lzt::get_engine_properties(engine_handle); + EXPECT_EQ(properties_initial.type, properties_later.type); + EXPECT_EQ(properties_initial.onSubdevice, properties_later.onSubdevice); + if (properties_initial.onSubdevice && properties_later.onSubdevice) { + EXPECT_EQ(properties_initial.subdeviceId, + properties_later.subdeviceId); + } } + } else { + LOG_INFO << "No engine handles found for this device! "; } } + if (!is_engine_supported) { + FAIL() << "No engine handles found on any of the devices! "; + } } LZT_TEST_F( @@ -150,17 +186,22 @@ LZT_TEST_F( GivenValidEngineHandleWhenRetrievingEngineActivityStatsThenValidStatsIsReturned) { for (auto device : devices) { uint32_t count = 0; - auto engine_handles = lzt::get_engine_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto engine_handle : engine_handles) { - ASSERT_NE(nullptr, engine_handle); - lzt::get_engine_activity(engine_handle); + count = lzt::get_engine_handle_count(device); + if (count > 0) { + is_engine_supported = true; + LOG_INFO << "Engine handles are available on this device! "; + auto engine_handles = lzt::get_engine_handles(device, count); + for (auto engine_handle : engine_handles) { + ASSERT_NE(nullptr, engine_handle); + lzt::get_engine_activity(engine_handle); + } + } else { + LOG_INFO << "No engine handles found for this device! "; } } + if (!is_engine_supported) { + FAIL() << "No engine handles found on any of the devices! "; + } } LZT_TEST_F( @@ -168,41 +209,45 @@ LZT_TEST_F( GivenValidEngineHandleWhenRetrievingEngineActivityOfPfAndVfsThenValidStatsIsReturned) { for (auto device : devices) { uint32_t count = 0; - auto engine_handles = lzt::get_engine_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto engine_handle : engine_handles) { - ASSERT_NE(nullptr, engine_handle); - uint32_t count = 0; - auto status = zesEngineGetActivityExt(engine_handle, &count, nullptr); - if (status == ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) { - GTEST_SKIP() << "zesEngineGetActivityExt Unsupported. May be not " - "running in an environment with Virtual Functions" - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - EXPECT_ZE_RESULT_SUCCESS(status); - EXPECT_NE(count, 0u); - std::vector engine_stats_list(count); - status = zesEngineGetActivityExt(engine_handle, &count, - engine_stats_list.data()); - EXPECT_ZE_RESULT_SUCCESS(status); - - zes_engine_properties_t engine_properties = {}; - EXPECT_ZE_RESULT_SUCCESS( - zesEngineGetProperties(engine_handle, &engine_properties)); - LOG_INFO << "| Engine Type = " - << static_cast(engine_properties.type); - for (uint32_t index = 0; index < engine_stats_list.size(); index++) { - const auto &engine_stats = engine_stats_list[index]; - LOG_INFO << "[" << index << "]" - << "| Active = " << engine_stats.activeTime - << " | Ts = " << engine_stats.timestamp; + count = lzt::get_engine_handle_count(device); + if (count > 0) { + is_engine_supported = true; + LOG_INFO << "Engine handles are available on this device! "; + auto engine_handles = lzt::get_engine_handles(device, count); + for (auto engine_handle : engine_handles) { + ASSERT_NE(nullptr, engine_handle); + uint32_t count = 0; + auto status = zesEngineGetActivityExt(engine_handle, &count, nullptr); + if (status == ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) { + GTEST_SKIP() << "zesEngineGetActivityExt Unsupported. May be not " + "running in an environment with Virtual Functions" + << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + } + EXPECT_ZE_RESULT_SUCCESS(status); + EXPECT_NE(count, 0u); + std::vector engine_stats_list(count); + status = zesEngineGetActivityExt(engine_handle, &count, + engine_stats_list.data()); + EXPECT_ZE_RESULT_SUCCESS(status); + zes_engine_properties_t engine_properties = {}; + EXPECT_ZE_RESULT_SUCCESS( + zesEngineGetProperties(engine_handle, &engine_properties)); + LOG_INFO << "| Engine Type = " + << static_cast(engine_properties.type); + for (uint32_t index = 0; index < engine_stats_list.size(); index++) { + const auto &engine_stats = engine_stats_list[index]; + LOG_INFO << "[" << index << "]" + << "| Active = " << engine_stats.activeTime + << " | Ts = " << engine_stats.timestamp; + } } + } else { + LOG_INFO << "No engine handles found for this device! "; } } + if (!is_engine_supported) { + FAIL() << "No engine handles found on any of the devices! "; + } } static void workload_for_device(ze_device_handle_t device) { @@ -257,57 +302,64 @@ LZT_TEST_F( GivenValidEngineHandleWhenGpuWorkloadIsSubmittedThenEngineActivityMeasuredIsHigher) { for (auto device : devices) { uint32_t count = 0; - auto engine_handles = lzt::get_engine_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - for (auto engine_handle : engine_handles) { - ASSERT_NE(nullptr, engine_handle); - auto properties = lzt::get_engine_properties(engine_handle); - if (properties.type == ZES_ENGINE_GROUP_COMPUTE_ALL) { - // Get pre-workload utilization - auto s1 = lzt::get_engine_activity(engine_handle); - auto s2 = lzt::get_engine_activity(engine_handle); - double pre_utilization = 0.0; - if (s2.timestamp > s1.timestamp) { - pre_utilization = (static_cast(s2.activeTime) - - static_cast(s1.activeTime)) / - (static_cast(s2.timestamp) - - static_cast(s1.timestamp)); - } + count = lzt::get_engine_handle_count(device); + if (count > 0) { + is_engine_supported = true; + LOG_INFO << "Engine handles are available on this device! "; + auto engine_handles = lzt::get_engine_handles(device, count); + for (auto engine_handle : engine_handles) { + ASSERT_NE(nullptr, engine_handle); + auto properties = lzt::get_engine_properties(engine_handle); + if (properties.type == ZES_ENGINE_GROUP_COMPUTE_ALL) { + // Get pre-workload utilization + auto s1 = lzt::get_engine_activity(engine_handle); + auto s2 = lzt::get_engine_activity(engine_handle); + double pre_utilization = 0.0; + if (s2.timestamp > s1.timestamp) { + pre_utilization = (static_cast(s2.activeTime) - + static_cast(s1.activeTime)) / + (static_cast(s2.timestamp) - + static_cast(s1.timestamp)); + } - // submit workload and measure utilization + // submit workload and measure utilization #ifdef USE_ZESINIT - auto sysman_device_properties = - lzt::get_sysman_device_properties(device); - ze_device_handle_t core_device = - lzt::get_core_device_by_uuid(sysman_device_properties.core.uuid.id); - EXPECT_NE(core_device, nullptr); - s1 = lzt::get_engine_activity(engine_handle); - std::thread thread(workload_for_device, core_device); - thread.join(); - s2 = lzt::get_engine_activity(engine_handle); + auto sysman_device_properties = + lzt::get_sysman_device_properties(device); + ze_device_handle_t core_device = lzt::get_core_device_by_uuid( + sysman_device_properties.core.uuid.id); + EXPECT_NE(core_device, nullptr); + s1 = lzt::get_engine_activity(engine_handle); + std::thread thread(workload_for_device, core_device); + thread.join(); + s2 = lzt::get_engine_activity(engine_handle); #else // USE_ZESINIT - s1 = lzt::get_engine_activity(engine_handle); - std::thread thread(workload_for_device, device); - thread.join(); - s2 = lzt::get_engine_activity(engine_handle); + s1 = lzt::get_engine_activity(engine_handle); + std::thread thread(workload_for_device, device); + thread.join(); + s2 = lzt::get_engine_activity(engine_handle); #endif // USE_ZESINIT - EXPECT_NE(s2.timestamp, s1.timestamp); - if (s2.timestamp > s1.timestamp) { - double post_utilization = (static_cast(s2.activeTime) - - static_cast(s1.activeTime)) / - (static_cast(s2.timestamp) - - static_cast(s1.timestamp)); - // check if engine utilization increases with GPU workload - EXPECT_LT(pre_utilization, post_utilization); - LOG_INFO << "pre_utilization: " << pre_utilization * 100 << "%" - << " | post_utilization: " << post_utilization * 100 << "%"; + EXPECT_NE(s2.timestamp, s1.timestamp); + if (s2.timestamp > s1.timestamp) { + double post_utilization = (static_cast(s2.activeTime) - + static_cast(s1.activeTime)) / + (static_cast(s2.timestamp) - + static_cast(s1.timestamp)); + // check if engine utilization increases with GPU workload + EXPECT_LT(pre_utilization, post_utilization); + LOG_INFO << "pre_utilization: " << pre_utilization * 100 << "%" + << " | post_utilization: " << post_utilization * 100 + << "%"; + } } } + } else { + LOG_INFO << "No engine handles found for this device! "; } } + if (!is_engine_supported) { + FAIL() << "No engine handles found on any of the devices! "; + } } } // namespace diff --git a/conformance_tests/sysman/test_sysman_fabric/src/test_sysman_fabric.cpp b/conformance_tests/sysman/test_sysman_fabric/src/test_sysman_fabric.cpp index 8158588b..bce14fd5 100644 --- a/conformance_tests/sysman/test_sysman_fabric/src/test_sysman_fabric.cpp +++ b/conformance_tests/sysman/test_sysman_fabric/src/test_sysman_fabric.cpp @@ -19,10 +19,16 @@ namespace lzt = level_zero_tests; namespace { #ifdef USE_ZESINIT -class FabricPortsOperationsZesTest : public lzt::ZesSysmanCtsClass {}; +class FabricPortsOperationsZesTest : public lzt::ZesSysmanCtsClass { +public: + bool is_fabric_supported = false; +}; #define FABRICPORT_TEST FabricPortsOperationsZesTest #else // USE_ZESINIT -class FabricPortsOperationsTest : public lzt::SysmanCtsClass {}; +class FabricPortsOperationsTest : public lzt::SysmanCtsClass { +public: + bool is_fabric_supported = false; +}; #define FABRICPORT_TEST FabricPortsOperationsTest #endif // USE_ZESINIT @@ -43,12 +49,18 @@ LZT_TEST_F( GivenComponentCountZeroWhenRetrievingSysmanHandlesThenNonZeroCountIsReturned) { for (auto device : devices) { uint32_t count = 0; - lzt::get_fabric_port_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + count = lzt::get_fabric_port_handles_count(device); + if (count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + lzt::get_fabric_port_handles(device, count); + } else { + LOG_INFO << "No fabric handles found for this device! "; } } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; + } } LZT_TEST_F( @@ -56,17 +68,22 @@ LZT_TEST_F( GivenComponentCountZeroWhenRetrievingSysmanHandlesThenNotNullFabricPortHandlesAreReturned) { for (auto device : devices) { uint32_t count = 0; - auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - ASSERT_EQ(fabric_port_handles.size(), count); - for (auto fabric_port_handle : fabric_port_handles) { - EXPECT_NE(nullptr, fabric_port_handle); + count = lzt::get_fabric_port_handles_count(device); + if (count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); + ASSERT_EQ(fabric_port_handles.size(), count); + for (auto fabric_port_handle : fabric_port_handles) { + EXPECT_NE(nullptr, fabric_port_handle); + } + } else { + LOG_INFO << "No fabric handles found for this device! "; } } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; + } } LZT_TEST_F( @@ -74,15 +91,20 @@ LZT_TEST_F( GivenInvalidComponentCountWhenRetrievingSysmanHandlesThenActualComponentCountIsUpdated) { for (auto device : devices) { uint32_t actual_count = 0; - lzt::get_fabric_port_handles(device, actual_count); - if (actual_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); + actual_count = lzt::get_fabric_port_handles_count(device); + if (actual_count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + lzt::get_fabric_port_handles(device, actual_count); + uint32_t test_count = actual_count + 1; + lzt::get_fabric_port_handles(device, test_count); + EXPECT_EQ(test_count, actual_count); + } else { + LOG_INFO << "No fabric handles found for this device! "; } - - uint32_t test_count = actual_count + 1; - lzt::get_fabric_port_handles(device, test_count); - EXPECT_EQ(test_count, actual_count); + } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; } } @@ -91,24 +113,28 @@ LZT_TEST_F( GivenValidComponentCountWhenCallingApiTwiceThenSimilarFabricPortHandlesReturned) { for (auto device : devices) { uint32_t count = 0; - auto fabric_port_handles_initial = - lzt::get_fabric_port_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto fabric_port_handle : fabric_port_handles_initial) { - EXPECT_NE(nullptr, fabric_port_handle); - } - - count = 0; - auto fabric_port_handles_later = - lzt::get_fabric_port_handles(device, count); - for (auto fabric_port_handle : fabric_port_handles_later) { - EXPECT_NE(nullptr, fabric_port_handle); + count = lzt::get_fabric_port_handles_count(device); + if (count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + auto fabric_port_handles_initial = + lzt::get_fabric_port_handles(device, count); + for (auto fabric_port_handle : fabric_port_handles_initial) { + EXPECT_NE(nullptr, fabric_port_handle); + } + count = 0; + auto fabric_port_handles_later = + lzt::get_fabric_port_handles(device, count); + for (auto fabric_port_handle : fabric_port_handles_later) { + EXPECT_NE(nullptr, fabric_port_handle); + } + EXPECT_EQ(fabric_port_handles_initial, fabric_port_handles_later); + } else { + LOG_INFO << "No fabric handles found for this device! "; } - EXPECT_EQ(fabric_port_handles_initial, fabric_port_handles_later); + } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; } } @@ -118,31 +144,36 @@ LZT_TEST_F( for (auto device : devices) { auto deviceProperties = lzt::get_sysman_device_properties(device); uint32_t count = 0; - auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto fabric_port_handle : fabric_port_handles) { - ASSERT_NE(nullptr, fabric_port_handle); - auto properties = lzt::get_fabric_port_properties(fabric_port_handle); - if (properties.onSubdevice) { - EXPECT_LT(properties.subdeviceId, deviceProperties.numSubdevices); - } - validate_fabric_port_speed(properties.maxRxSpeed); - validate_fabric_port_speed(properties.maxTxSpeed); - // If we have at least one non-null byte, then we Pass - if (properties.model[0] == '\0') { - FAIL(); - } else { - SUCCEED(); + count = lzt::get_fabric_port_handles_count(device); + if (count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); + for (auto fabric_port_handle : fabric_port_handles) { + ASSERT_NE(nullptr, fabric_port_handle); + auto properties = lzt::get_fabric_port_properties(fabric_port_handle); + if (properties.onSubdevice) { + EXPECT_LT(properties.subdeviceId, deviceProperties.numSubdevices); + } + validate_fabric_port_speed(properties.maxRxSpeed); + validate_fabric_port_speed(properties.maxTxSpeed); + // If we have at least one non-null byte, then we Pass + if (properties.model[0] == '\0') { + FAIL(); + } else { + SUCCEED(); + } + EXPECT_LT(properties.portId.fabricId, UINT32_MAX); + EXPECT_LT(properties.portId.attachId, UINT32_MAX); + EXPECT_LT(properties.portId.portNumber, UINT8_MAX); } - EXPECT_LT(properties.portId.fabricId, UINT32_MAX); - EXPECT_LT(properties.portId.attachId, UINT32_MAX); - EXPECT_LT(properties.portId.portNumber, UINT8_MAX); + } else { + LOG_INFO << "No fabric handles found for this device! "; } } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; + } } LZT_TEST_F( @@ -150,45 +181,51 @@ LZT_TEST_F( GivenValidFabricPortHandleWhenRetrievingFabricPortPropertiesThenExpectSamePropertiesReturnedTwice) { for (auto device : devices) { uint32_t count = 0; - auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto fabric_port_handle : fabric_port_handles) { - ASSERT_NE(nullptr, fabric_port_handle); - auto properties_initial = - lzt::get_fabric_port_properties(fabric_port_handle); - auto properties_later = - lzt::get_fabric_port_properties(fabric_port_handle); - EXPECT_EQ(properties_initial.onSubdevice, properties_later.onSubdevice); - if (properties_initial.onSubdevice && properties_later.onSubdevice) { - EXPECT_EQ(properties_initial.subdeviceId, properties_later.subdeviceId); - } - if (strcmp(properties_initial.model, properties_later.model) == 0) { - SUCCEED(); - } else { - FAIL(); + count = lzt::get_fabric_port_handles_count(device); + if (count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); + for (auto fabric_port_handle : fabric_port_handles) { + ASSERT_NE(nullptr, fabric_port_handle); + auto properties_initial = + lzt::get_fabric_port_properties(fabric_port_handle); + auto properties_later = + lzt::get_fabric_port_properties(fabric_port_handle); + EXPECT_EQ(properties_initial.onSubdevice, properties_later.onSubdevice); + if (properties_initial.onSubdevice && properties_later.onSubdevice) { + EXPECT_EQ(properties_initial.subdeviceId, + properties_later.subdeviceId); + } + if (strcmp(properties_initial.model, properties_later.model) == 0) { + SUCCEED(); + } else { + FAIL(); + } + EXPECT_EQ(strlen(properties_initial.model), + strlen(properties_later.model)); + EXPECT_EQ(properties_initial.maxRxSpeed.bitRate, + properties_later.maxRxSpeed.bitRate); + EXPECT_EQ(properties_initial.maxRxSpeed.width, + properties_later.maxRxSpeed.width); + EXPECT_EQ(properties_initial.maxTxSpeed.bitRate, + properties_later.maxTxSpeed.bitRate); + EXPECT_EQ(properties_initial.maxTxSpeed.width, + properties_later.maxTxSpeed.width); + EXPECT_EQ(properties_initial.portId.fabricId, + properties_later.portId.fabricId); + EXPECT_EQ(properties_initial.portId.attachId, + properties_later.portId.attachId); + EXPECT_EQ(properties_initial.portId.portNumber, + properties_later.portId.portNumber); } - EXPECT_EQ(strlen(properties_initial.model), - strlen(properties_later.model)); - EXPECT_EQ(properties_initial.maxRxSpeed.bitRate, - properties_later.maxRxSpeed.bitRate); - EXPECT_EQ(properties_initial.maxRxSpeed.width, - properties_later.maxRxSpeed.width); - EXPECT_EQ(properties_initial.maxTxSpeed.bitRate, - properties_later.maxTxSpeed.bitRate); - EXPECT_EQ(properties_initial.maxTxSpeed.width, - properties_later.maxTxSpeed.width); - EXPECT_EQ(properties_initial.portId.fabricId, - properties_later.portId.fabricId); - EXPECT_EQ(properties_initial.portId.attachId, - properties_later.portId.attachId); - EXPECT_EQ(properties_initial.portId.portNumber, - properties_later.portId.portNumber); + } else { + LOG_INFO << "No fabric handles found for this device! "; } } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; + } } LZT_TEST_F( @@ -196,26 +233,31 @@ LZT_TEST_F( GivenValidFabricPortHandleWhenSettingPortConfigThenGetSamePortConfig) { for (auto device : devices) { uint32_t count = 0; - auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto fabric_port_handle : fabric_port_handles) { - ASSERT_NE(nullptr, fabric_port_handle); - auto defaultConfig = lzt::get_fabric_port_config(fabric_port_handle); - zes_fabric_port_config_t setConfig = {}; - // To validate if set_fabric_port_config API is really working, try to - // toggle config as compared to defaultConfig - setConfig.beaconing = (defaultConfig.beaconing == true) ? false : true; - setConfig.enabled = (defaultConfig.enabled == true) ? false : true; - lzt::set_fabric_port_config(fabric_port_handle, setConfig); - auto get_config = lzt::get_fabric_port_config(fabric_port_handle); - EXPECT_EQ(setConfig.beaconing, get_config.beaconing); - EXPECT_EQ(setConfig.enabled, get_config.enabled); + count = lzt::get_fabric_port_handles_count(device); + if (count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); + for (auto fabric_port_handle : fabric_port_handles) { + ASSERT_NE(nullptr, fabric_port_handle); + auto defaultConfig = lzt::get_fabric_port_config(fabric_port_handle); + zes_fabric_port_config_t setConfig = {}; + // To validate if set_fabric_port_config API is really working, try to + // toggle config as compared to defaultConfig + setConfig.beaconing = (defaultConfig.beaconing == true) ? false : true; + setConfig.enabled = (defaultConfig.enabled == true) ? false : true; + lzt::set_fabric_port_config(fabric_port_handle, setConfig); + auto get_config = lzt::get_fabric_port_config(fabric_port_handle); + EXPECT_EQ(setConfig.beaconing, get_config.beaconing); + EXPECT_EQ(setConfig.enabled, get_config.enabled); + } + } else { + LOG_INFO << "No fabric handles found for this device! "; } } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; + } } LZT_TEST_F( @@ -223,50 +265,55 @@ LZT_TEST_F( GivenValidFabricPortHandleWhenGettingPortStateThenValidStatesAreReturned) { for (auto device : devices) { uint32_t count = 0; - auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto fabric_port_handle : fabric_port_handles) { - ASSERT_NE(nullptr, fabric_port_handle); - auto state = lzt::get_fabric_port_state(fabric_port_handle); - EXPECT_GE(state.status, ZES_FABRIC_PORT_STATUS_UNKNOWN); - EXPECT_LE(state.status, ZES_FABRIC_PORT_STATUS_DISABLED); - if (state.status == ZES_FABRIC_PORT_STATUS_DEGRADED) { - EXPECT_GE(state.qualityIssues, - ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS); - EXPECT_LE(state.qualityIssues, - ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS | - ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_SPEED); - } else { - EXPECT_EQ(state.qualityIssues, 0); - } - if (state.status == ZES_FABRIC_PORT_STATUS_FAILED) { - EXPECT_GE(state.failureReasons, - ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS); - EXPECT_LE(state.failureReasons, - ZES_FABRIC_PORT_FAILURE_FLAG_FAILED | - ZES_FABRIC_PORT_FAILURE_FLAG_TRAINING_TIMEOUT | - ZES_FABRIC_PORT_FAILURE_FLAG_FLAPPING); - } else { - EXPECT_EQ(state.failureReasons, 0); + count = lzt::get_fabric_port_handles_count(device); + if (count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); + for (auto fabric_port_handle : fabric_port_handles) { + ASSERT_NE(nullptr, fabric_port_handle); + auto state = lzt::get_fabric_port_state(fabric_port_handle); + EXPECT_GE(state.status, ZES_FABRIC_PORT_STATUS_UNKNOWN); + EXPECT_LE(state.status, ZES_FABRIC_PORT_STATUS_DISABLED); + if (state.status == ZES_FABRIC_PORT_STATUS_DEGRADED) { + EXPECT_GE(state.qualityIssues, + ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS); + EXPECT_LE(state.qualityIssues, + ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS | + ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_SPEED); + } else { + EXPECT_EQ(state.qualityIssues, 0); + } + if (state.status == ZES_FABRIC_PORT_STATUS_FAILED) { + EXPECT_GE(state.failureReasons, + ZES_FABRIC_PORT_QUAL_ISSUE_FLAG_LINK_ERRORS); + EXPECT_LE(state.failureReasons, + ZES_FABRIC_PORT_FAILURE_FLAG_FAILED | + ZES_FABRIC_PORT_FAILURE_FLAG_TRAINING_TIMEOUT | + ZES_FABRIC_PORT_FAILURE_FLAG_FLAPPING); + } else { + EXPECT_EQ(state.failureReasons, 0); + } + if (state.status == ZES_FABRIC_PORT_STATUS_HEALTHY || + state.status == ZES_FABRIC_PORT_STATUS_DEGRADED || + state.status == ZES_FABRIC_PORT_STATUS_FAILED) { + auto properties = lzt::get_fabric_port_properties(fabric_port_handle); + bool loopback = + (state.remotePortId.fabricId == properties.portId.fabricId) && + (state.remotePortId.attachId == properties.portId.attachId) && + (state.remotePortId.portNumber == properties.portId.portNumber); + EXPECT_FALSE(loopback); + } + validate_fabric_port_speed(state.rxSpeed); + validate_fabric_port_speed(state.txSpeed); } - if (state.status == ZES_FABRIC_PORT_STATUS_HEALTHY || - state.status == ZES_FABRIC_PORT_STATUS_DEGRADED || - state.status == ZES_FABRIC_PORT_STATUS_FAILED) { - auto properties = lzt::get_fabric_port_properties(fabric_port_handle); - bool loopback = - (state.remotePortId.fabricId == properties.portId.fabricId) && - (state.remotePortId.attachId == properties.portId.attachId) && - (state.remotePortId.portNumber == properties.portId.portNumber); - EXPECT_FALSE(loopback); - } - validate_fabric_port_speed(state.rxSpeed); - validate_fabric_port_speed(state.txSpeed); + } else { + LOG_INFO << "No fabric handles found for this device! "; } } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; + } } LZT_TEST_F( @@ -274,45 +321,55 @@ LZT_TEST_F( GivenValidFabricPortHandleWhenGettingPortThroughputThenValidThroughputAreReturned) { for (auto device : devices) { uint32_t count = 0; - auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto fabric_port_handle : fabric_port_handles) { - ASSERT_NE(nullptr, fabric_port_handle); - auto throughput = lzt::get_fabric_port_throughput(fabric_port_handle); - EXPECT_LT(throughput.rxCounter, UINT64_MAX); - EXPECT_LT(throughput.txCounter, UINT64_MAX); - EXPECT_LT(throughput.timestamp, UINT64_MAX); + count = lzt::get_fabric_port_handles_count(device); + if (count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); + for (auto fabric_port_handle : fabric_port_handles) { + ASSERT_NE(nullptr, fabric_port_handle); + auto throughput = lzt::get_fabric_port_throughput(fabric_port_handle); + EXPECT_LT(throughput.rxCounter, UINT64_MAX); + EXPECT_LT(throughput.txCounter, UINT64_MAX); + EXPECT_LT(throughput.timestamp, UINT64_MAX); + } + } else { + LOG_INFO << "No fabric handles found for this device! "; } } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; + } } LZT_TEST_F(FABRICPORT_TEST, GivenValidFabricPortHandleWhenGettingPortLinkThenSuccessIsReturned) { for (auto device : devices) { uint32_t count = 0; - auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto fabric_port_handle : fabric_port_handles) { - ASSERT_NE(nullptr, fabric_port_handle); - auto fabric_port_link_type = - lzt::get_fabric_port_link(fabric_port_handle); - if (fabric_port_link_type.desc[0] == '\0') { - FAIL(); - } else { - SUCCEED(); + count = lzt::get_fabric_port_handles_count(device); + if (count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); + for (auto fabric_port_handle : fabric_port_handles) { + ASSERT_NE(nullptr, fabric_port_handle); + auto fabric_port_link_type = + lzt::get_fabric_port_link(fabric_port_handle); + if (fabric_port_link_type.desc[0] == '\0') { + FAIL(); + } else { + SUCCEED(); + } + EXPECT_LE(strlen(fabric_port_link_type.desc), + ZES_MAX_FABRIC_LINK_TYPE_SIZE); } - EXPECT_LE(strlen(fabric_port_link_type.desc), - ZES_MAX_FABRIC_LINK_TYPE_SIZE); + } else { + LOG_INFO << "No fabric handles found for this device! "; } } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; + } } LZT_TEST_F( @@ -320,28 +377,33 @@ LZT_TEST_F( GivenValidFabricPortHandleWhenGettingPortLinkTwiceThenSameValueIsReturnedTwice) { for (auto device : devices) { uint32_t count = 0; - auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); - if (count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto fabric_port_handle : fabric_port_handles) { - ASSERT_NE(nullptr, fabric_port_handle); - auto fabric_port_link_type_initial = - lzt::get_fabric_port_link(fabric_port_handle); - auto fabric_port_link_type_later = - lzt::get_fabric_port_link(fabric_port_handle); - if (strcmp(fabric_port_link_type_initial.desc, - fabric_port_link_type_later.desc) == 0) { - SUCCEED(); - } else { - FAIL(); + count = lzt::get_fabric_port_handles_count(device); + if (count > 0) { + is_fabric_supported = true; + LOG_INFO << "Fabric handles are available on this device! "; + auto fabric_port_handles = lzt::get_fabric_port_handles(device, count); + for (auto fabric_port_handle : fabric_port_handles) { + ASSERT_NE(nullptr, fabric_port_handle); + auto fabric_port_link_type_initial = + lzt::get_fabric_port_link(fabric_port_handle); + auto fabric_port_link_type_later = + lzt::get_fabric_port_link(fabric_port_handle); + if (strcmp(fabric_port_link_type_initial.desc, + fabric_port_link_type_later.desc) == 0) { + SUCCEED(); + } else { + FAIL(); + } + EXPECT_EQ(strlen(fabric_port_link_type_initial.desc), + strlen(fabric_port_link_type_later.desc)); } - EXPECT_EQ(strlen(fabric_port_link_type_initial.desc), - strlen(fabric_port_link_type_later.desc)); + } else { + LOG_INFO << "No fabric handles found for this device! "; } } + if (!is_fabric_supported) { + FAIL() << "No fabric handles found on any of the devices! "; + } } } // namespace diff --git a/conformance_tests/sysman/test_sysman_overclocking/src/test_sysman_overclocking.cpp b/conformance_tests/sysman/test_sysman_overclocking/src/test_sysman_overclocking.cpp index f3baf307..55ad9e8e 100644 --- a/conformance_tests/sysman/test_sysman_overclocking/src/test_sysman_overclocking.cpp +++ b/conformance_tests/sysman/test_sysman_overclocking/src/test_sysman_overclocking.cpp @@ -18,10 +18,16 @@ namespace lzt = level_zero_tests; namespace { #ifdef USE_ZESINIT -class OverclockingZesTest : public lzt::ZesSysmanCtsClass {}; +class OverclockingZesTest : public lzt::ZesSysmanCtsClass { +public: + bool is_overclocking_supported = false; +}; #define OVERCLOCK_TEST OverclockingZesTest #else // USE_ZESINIT -class OverclockingTest : public lzt::SysmanCtsClass {}; +class OverclockingTest : public lzt::SysmanCtsClass { +public: + bool is_overclocking_supported = false; +}; #define OVERCLOCK_TEST OverclockingTest #endif // USE_ZESINIT @@ -30,150 +36,174 @@ LZT_TEST_F( GivenValidFrequencyHandlesWhenGettingOverclockingCapabilitiesThenSuccessIsReturned) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - EXPECT_GT(capabilities.maxFactoryDefaultFrequency, 0); - EXPECT_GT(capabilities.maxFactoryDefaultVoltage, 0); - EXPECT_GT(capabilities.maxOcFrequency, 0); - EXPECT_GT(capabilities.maxOcVoltage, 0); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + EXPECT_GT(capabilities.maxFactoryDefaultFrequency, 0); + EXPECT_GT(capabilities.maxFactoryDefaultVoltage, 0); + EXPECT_GT(capabilities.maxOcFrequency, 0); + EXPECT_GT(capabilities.maxOcVoltage, 0); + } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( OVERCLOCK_TEST, GivenValidFrequencyHandlesWhenCallingApiTwiceThenSimilarOverclockingCapabilitiesAreReturned) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilitiesInitial = lzt::get_oc_capabilities(freq_handle); - auto capabilitiesLater = lzt::get_oc_capabilities(freq_handle); - EXPECT_EQ(capabilitiesInitial.isOcSupported, - capabilitiesLater.isOcSupported); - EXPECT_DOUBLE_EQ(capabilitiesInitial.maxFactoryDefaultFrequency, - capabilitiesLater.maxFactoryDefaultFrequency); - EXPECT_DOUBLE_EQ(capabilitiesInitial.maxFactoryDefaultVoltage, - capabilitiesLater.maxFactoryDefaultVoltage); - EXPECT_DOUBLE_EQ(capabilitiesInitial.maxOcFrequency, - capabilitiesLater.maxOcFrequency); - EXPECT_DOUBLE_EQ(capabilitiesInitial.minOcVoltageOffset, - capabilitiesLater.minOcVoltageOffset); - EXPECT_DOUBLE_EQ(capabilitiesInitial.maxOcVoltageOffset, - capabilitiesLater.maxOcVoltageOffset); - EXPECT_DOUBLE_EQ(capabilitiesInitial.maxOcVoltage, - capabilitiesLater.maxOcVoltage); - EXPECT_EQ(capabilitiesInitial.isTjMaxSupported, - capabilitiesLater.isTjMaxSupported); - EXPECT_EQ(capabilitiesInitial.isIccMaxSupported, - capabilitiesLater.isIccMaxSupported); - EXPECT_EQ(capabilitiesInitial.isHighVoltModeCapable, - capabilitiesLater.isHighVoltModeCapable); - EXPECT_EQ(capabilitiesInitial.isHighVoltModeEnabled, - capabilitiesLater.isHighVoltModeEnabled); - EXPECT_EQ(capabilitiesInitial.isExtendedModeSupported, - capabilitiesLater.isExtendedModeSupported); - EXPECT_EQ(capabilitiesInitial.isFixedModeSupported, - capabilitiesLater.isFixedModeSupported); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilitiesInitial = lzt::get_oc_capabilities(freq_handle); + auto capabilitiesLater = lzt::get_oc_capabilities(freq_handle); + EXPECT_EQ(capabilitiesInitial.isOcSupported, + capabilitiesLater.isOcSupported); + EXPECT_DOUBLE_EQ(capabilitiesInitial.maxFactoryDefaultFrequency, + capabilitiesLater.maxFactoryDefaultFrequency); + EXPECT_DOUBLE_EQ(capabilitiesInitial.maxFactoryDefaultVoltage, + capabilitiesLater.maxFactoryDefaultVoltage); + EXPECT_DOUBLE_EQ(capabilitiesInitial.maxOcFrequency, + capabilitiesLater.maxOcFrequency); + EXPECT_DOUBLE_EQ(capabilitiesInitial.minOcVoltageOffset, + capabilitiesLater.minOcVoltageOffset); + EXPECT_DOUBLE_EQ(capabilitiesInitial.maxOcVoltageOffset, + capabilitiesLater.maxOcVoltageOffset); + EXPECT_DOUBLE_EQ(capabilitiesInitial.maxOcVoltage, + capabilitiesLater.maxOcVoltage); + EXPECT_EQ(capabilitiesInitial.isTjMaxSupported, + capabilitiesLater.isTjMaxSupported); + EXPECT_EQ(capabilitiesInitial.isIccMaxSupported, + capabilitiesLater.isIccMaxSupported); + EXPECT_EQ(capabilitiesInitial.isHighVoltModeCapable, + capabilitiesLater.isHighVoltModeCapable); + EXPECT_EQ(capabilitiesInitial.isHighVoltModeEnabled, + capabilitiesLater.isHighVoltModeEnabled); + EXPECT_EQ(capabilitiesInitial.isExtendedModeSupported, + capabilitiesLater.isExtendedModeSupported); + EXPECT_EQ(capabilitiesInitial.isFixedModeSupported, + capabilitiesLater.isFixedModeSupported); + } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( OVERCLOCK_TEST, GivenValidFrequencyHandlesWhenGettingOverclockingFrequencyTargetThenSuccessIsReturned) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - if (capabilities.isOcSupported == true) { - auto freqTarget = lzt::get_oc_freq_target(freq_handle); - EXPECT_PRED_FORMAT2(::testing::DoubleLE, freqTarget, - capabilities.maxOcFrequency); - if (capabilities.isExtendedModeSupported == false) { - EXPECT_EQ(fmod(freqTarget, 50), 0); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + if (capabilities.isOcSupported == true) { + auto freqTarget = lzt::get_oc_freq_target(freq_handle); + EXPECT_PRED_FORMAT2(::testing::DoubleLE, freqTarget, + capabilities.maxOcFrequency); + if (capabilities.isExtendedModeSupported == false) { + EXPECT_EQ(fmod(freqTarget, 50), 0); + } } } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( OVERCLOCK_TEST, GivenValidFrequencyHandlesWhenSettingOverclockingFrequencyTargetExpectzesFrequencyOcSetFrequencyTargetFollowedByzesFrequencyOcGetFrequencyTargetToMatch) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - if (capabilities.isOcSupported == true) { - double init_freq_target = lzt::get_oc_freq_target(freq_handle); - double set_freq_target = 0; - set_freq_target = capabilities.maxOcFrequency; - lzt::set_oc_freq_target(freq_handle, set_freq_target); - double get_freq_target = lzt::get_oc_freq_target(freq_handle); - if (capabilities.isExtendedModeSupported == false) { - EXPECT_EQ(fmod(get_freq_target, 50), 0); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + if (capabilities.isOcSupported == true) { + double init_freq_target = lzt::get_oc_freq_target(freq_handle); + double set_freq_target = 0; + set_freq_target = capabilities.maxOcFrequency; + lzt::set_oc_freq_target(freq_handle, set_freq_target); + double get_freq_target = lzt::get_oc_freq_target(freq_handle); + if (capabilities.isExtendedModeSupported == false) { + EXPECT_EQ(fmod(get_freq_target, 50), 0); + } + EXPECT_DOUBLE_EQ(get_freq_target, set_freq_target); + lzt::set_oc_freq_target(freq_handle, init_freq_target); } - EXPECT_DOUBLE_EQ(get_freq_target, set_freq_target); - lzt::set_oc_freq_target(freq_handle, init_freq_target); } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( OVERCLOCK_TEST, GivenValidFrequencyHandlesWhenGettingOverclockingVoltageTargetThenSuccessIsReturned) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - if (capabilities.isOcSupported == true) { - if ((capabilities.isHighVoltModeCapable == true) && - (capabilities.isHighVoltModeEnabled == true)) { - auto voltageTarget = lzt::get_oc_voltage_target(freq_handle); - auto voltageOffset = lzt::get_oc_voltage_offset(freq_handle); - - EXPECT_PRED_FORMAT2(::testing::DoubleLE, voltageTarget, - capabilities.maxOcVoltage); - EXPECT_PRED_FORMAT2(::testing::DoubleLE, voltageOffset, - capabilities.maxOcVoltageOffset); - EXPECT_PRED_FORMAT2(::testing::DoubleLE, - capabilities.minOcVoltageOffset, voltageOffset); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + if (capabilities.isOcSupported == true) { + if ((capabilities.isHighVoltModeCapable == true) && + (capabilities.isHighVoltModeEnabled == true)) { + auto voltageTarget = lzt::get_oc_voltage_target(freq_handle); + auto voltageOffset = lzt::get_oc_voltage_offset(freq_handle); + EXPECT_PRED_FORMAT2(::testing::DoubleLE, voltageTarget, + capabilities.maxOcVoltage); + EXPECT_PRED_FORMAT2(::testing::DoubleLE, voltageOffset, + capabilities.maxOcVoltageOffset); + EXPECT_PRED_FORMAT2(::testing::DoubleLE, + capabilities.minOcVoltageOffset, voltageOffset); + } } } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( @@ -181,34 +211,40 @@ LZT_TEST_F( GivenValidFrequencyHandlesWhenSettingOverclockingVoltageTargetThenExpectzesFrequencyOcSetVoltageTargetFollowedByzesFrequencyOcGetVoltageTargetToMatch) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - if (capabilities.isOcSupported == true) { - if ((capabilities.isHighVoltModeCapable == true) && - (capabilities.isHighVoltModeEnabled == true)) { - auto capabilities = lzt::get_oc_capabilities(freq_handle); - auto voltageTargetInitial = lzt::get_oc_voltage_target(freq_handle); - auto voltageOffsetInitial = lzt::get_oc_voltage_offset(freq_handle); - double voltageTargetSet = capabilities.maxOcVoltage; - double voltageOffsetSet = capabilities.maxOcVoltageOffset; - lzt::set_oc_voltage(freq_handle, voltageTargetSet, voltageOffsetSet); - auto voltageTargetGet = lzt::get_oc_voltage_target(freq_handle); - auto voltageOffsetGet = lzt::get_oc_voltage_offset(freq_handle); - EXPECT_DOUBLE_EQ(voltageTargetSet, voltageTargetGet); - EXPECT_DOUBLE_EQ(voltageOffsetSet, voltageOffsetGet); - lzt::set_oc_voltage(freq_handle, voltageTargetInitial, - voltageOffsetInitial); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + if (capabilities.isOcSupported == true) { + if ((capabilities.isHighVoltModeCapable == true) && + (capabilities.isHighVoltModeEnabled == true)) { + auto capabilities = lzt::get_oc_capabilities(freq_handle); + auto voltageTargetInitial = lzt::get_oc_voltage_target(freq_handle); + auto voltageOffsetInitial = lzt::get_oc_voltage_offset(freq_handle); + double voltageTargetSet = capabilities.maxOcVoltage; + double voltageOffsetSet = capabilities.maxOcVoltageOffset; + lzt::set_oc_voltage(freq_handle, voltageTargetSet, + voltageOffsetSet); + auto voltageTargetGet = lzt::get_oc_voltage_target(freq_handle); + auto voltageOffsetGet = lzt::get_oc_voltage_offset(freq_handle); + EXPECT_DOUBLE_EQ(voltageTargetSet, voltageTargetGet); + EXPECT_DOUBLE_EQ(voltageOffsetSet, voltageOffsetGet); + lzt::set_oc_voltage(freq_handle, voltageTargetInitial, + voltageOffsetInitial); + } } } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( @@ -216,22 +252,27 @@ LZT_TEST_F( GivenValidFrequencyHandlesWhenGettingOverclockingModeThenSuccessIsReturned) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - if (capabilities.isOcSupported == true) { - auto mode = lzt::get_oc_mode(freq_handle); - EXPECT_GE(mode, ZES_OC_MODE_OFF); - EXPECT_LE(mode, ZES_OC_MODE_FIXED); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + if (capabilities.isOcSupported == true) { + auto mode = lzt::get_oc_mode(freq_handle); + EXPECT_GE(mode, ZES_OC_MODE_OFF); + EXPECT_LE(mode, ZES_OC_MODE_FIXED); + } } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( @@ -239,32 +280,37 @@ LZT_TEST_F( GivenValidFrequencyHandlesWhenSettingOverclockingModeThenExpectzesFrequencyOcSetModeFollowedByzesFrequencyOcGetModeToMatch) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - if (capabilities.isOcSupported == true) { - auto initialMode = lzt::get_oc_mode(freq_handle); - zes_oc_mode_t setMode = ZES_OC_MODE_OFF; - auto getMode = lzt::get_oc_mode(freq_handle); - EXPECT_EQ(setMode, getMode); - setMode = ZES_OC_MODE_OVERRIDE; - getMode = lzt::get_oc_mode(freq_handle); - EXPECT_EQ(setMode, getMode); - setMode = ZES_OC_MODE_INTERPOLATIVE; - getMode = lzt::get_oc_mode(freq_handle); - EXPECT_EQ(setMode, getMode); - setMode = ZES_OC_MODE_FIXED; - getMode = lzt::get_oc_mode(freq_handle); - EXPECT_EQ(setMode, getMode); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + if (capabilities.isOcSupported == true) { + auto initialMode = lzt::get_oc_mode(freq_handle); + zes_oc_mode_t setMode = ZES_OC_MODE_OFF; + auto getMode = lzt::get_oc_mode(freq_handle); + EXPECT_EQ(setMode, getMode); + setMode = ZES_OC_MODE_OVERRIDE; + getMode = lzt::get_oc_mode(freq_handle); + EXPECT_EQ(setMode, getMode); + setMode = ZES_OC_MODE_INTERPOLATIVE; + getMode = lzt::get_oc_mode(freq_handle); + EXPECT_EQ(setMode, getMode); + setMode = ZES_OC_MODE_FIXED; + getMode = lzt::get_oc_mode(freq_handle); + EXPECT_EQ(setMode, getMode); + } } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( @@ -272,94 +318,114 @@ LZT_TEST_F( GivenValidFrequencyHandlesWhenGettingCurrentLimitThenSuccessIsReturned) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - if ((capabilities.isOcSupported == true) && - (capabilities.isIccMaxSupported == true)) { - auto icmax = lzt::get_oc_iccmax(freq_handle); - EXPECT_GT(icmax, 0); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + if ((capabilities.isOcSupported == true) && + (capabilities.isIccMaxSupported == true)) { + auto icmax = lzt::get_oc_iccmax(freq_handle); + EXPECT_GT(icmax, 0); + } } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( OVERCLOCK_TEST, GivenValidFrequencyHandlesWhenSettingCurrentLimitThenExpectzesSysmanFrequencyOcSetIccMaxFollowedByzesSysmanFrequencyOcGetIccMaxToReturnSuccess) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - if ((capabilities.isOcSupported == true) && - (capabilities.isIccMaxSupported == true)) { - auto icmax_initial = lzt::get_oc_iccmax(freq_handle); - EXPECT_GT(icmax_initial, 0); - lzt::set_oc_iccmax(freq_handle, icmax_initial); - auto icmax_later = lzt::get_oc_iccmax(freq_handle); - EXPECT_DOUBLE_EQ(icmax_initial, icmax_later); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + if ((capabilities.isOcSupported == true) && + (capabilities.isIccMaxSupported == true)) { + auto icmax_initial = lzt::get_oc_iccmax(freq_handle); + EXPECT_GT(icmax_initial, 0); + lzt::set_oc_iccmax(freq_handle, icmax_initial); + auto icmax_later = lzt::get_oc_iccmax(freq_handle); + EXPECT_DOUBLE_EQ(icmax_initial, icmax_later); + } } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( OVERCLOCK_TEST, GivenValidFrequencyHandlesWhenGettingTemperaturetLimitThenSuccessIsReturned) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - if ((capabilities.isOcSupported == true) && - (capabilities.isTjMaxSupported == true)) { - auto tjmax = lzt::get_oc_tjmax(freq_handle); - EXPECT_GT(tjmax, 0); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + if ((capabilities.isOcSupported == true) && + (capabilities.isTjMaxSupported == true)) { + auto tjmax = lzt::get_oc_tjmax(freq_handle); + EXPECT_GT(tjmax, 0); + } } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } LZT_TEST_F( OVERCLOCK_TEST, GivenValidFrequencyHandlesWhenSettingCurrentLimitThenExpectzesSysmanFrequencyOcSetTjMaxFollowedByzesSysmanFrequencyOcGetTjMaxToMatch) { for (auto device : devices) { uint32_t p_count = 0; - auto freq_handles = lzt::get_freq_handles(device, p_count); - if (p_count == 0) { - FAIL() << "No handles found: " - << _ze_result_t(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE); - } - - for (auto freq_handle : freq_handles) { - ASSERT_NE(nullptr, freq_handle); - auto capabilities = lzt::get_oc_capabilities(freq_handle); - if ((capabilities.isOcSupported == true) && - (capabilities.isTjMaxSupported == true)) { - auto tjmaxInitial = lzt::get_oc_tjmax(freq_handle); - EXPECT_GT(tjmaxInitial, 0); - lzt::set_oc_tjmax(freq_handle, tjmaxInitial); - auto tjmaxLater = lzt::get_oc_tjmax(freq_handle); - EXPECT_DOUBLE_EQ(tjmaxInitial, tjmaxLater); + p_count = lzt::get_freq_handle_count(device); + if (p_count > 0) { + is_overclocking_supported = true; + LOG_INFO << "Overclocking handles are available on this device! "; + auto freq_handles = lzt::get_freq_handles(device, p_count); + for (auto freq_handle : freq_handles) { + ASSERT_NE(nullptr, freq_handle); + auto capabilities = lzt::get_oc_capabilities(freq_handle); + if ((capabilities.isOcSupported == true) && + (capabilities.isTjMaxSupported == true)) { + auto tjmaxInitial = lzt::get_oc_tjmax(freq_handle); + EXPECT_GT(tjmaxInitial, 0); + lzt::set_oc_tjmax(freq_handle, tjmaxInitial); + auto tjmaxLater = lzt::get_oc_tjmax(freq_handle); + EXPECT_DOUBLE_EQ(tjmaxInitial, tjmaxLater); + } } + } else { + LOG_INFO << "No overclocking handles found for this device! "; } } + if (!is_overclocking_supported) { + FAIL() << "No overclocking handles found on any of the devices! "; + } } } // namespace From e7893fb3aef848b43ead4273a9aa85063f16090d Mon Sep 17 00:00:00 2001 From: viki435 Date: Fri, 22 Aug 2025 00:27:35 +0530 Subject: [PATCH 2/2] Primary JIRA: VLCLJ-2513 Sub-tasks: VLCLJ-2573, VLCLJ-2569, VLCLJ-2571 Fix: Handling GTEST_FAIL logic for multi-device scenario for engine, fabric and overclocking modules. Signed-off-by: viki435 --- .../src/test_sysman_overclocking.cpp | 124 +++++++++--------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/conformance_tests/sysman/test_sysman_overclocking/src/test_sysman_overclocking.cpp b/conformance_tests/sysman/test_sysman_overclocking/src/test_sysman_overclocking.cpp index 55ad9e8e..5ad41a44 100644 --- a/conformance_tests/sysman/test_sysman_overclocking/src/test_sysman_overclocking.cpp +++ b/conformance_tests/sysman/test_sysman_overclocking/src/test_sysman_overclocking.cpp @@ -20,13 +20,13 @@ namespace { #ifdef USE_ZESINIT class OverclockingZesTest : public lzt::ZesSysmanCtsClass { public: - bool is_overclocking_supported = false; + bool is_frequency_supported = false; }; #define OVERCLOCK_TEST OverclockingZesTest #else // USE_ZESINIT class OverclockingTest : public lzt::SysmanCtsClass { public: - bool is_overclocking_supported = false; + bool is_frequency_supported = false; }; #define OVERCLOCK_TEST OverclockingTest #endif // USE_ZESINIT @@ -38,8 +38,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -50,11 +50,11 @@ LZT_TEST_F( EXPECT_GT(capabilities.maxOcVoltage, 0); } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } LZT_TEST_F( @@ -64,8 +64,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -99,11 +99,11 @@ LZT_TEST_F( capabilitiesLater.isFixedModeSupported); } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } LZT_TEST_F( @@ -113,8 +113,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -129,11 +129,11 @@ LZT_TEST_F( } } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } LZT_TEST_F( @@ -143,8 +143,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -163,11 +163,11 @@ LZT_TEST_F( } } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } LZT_TEST_F( @@ -177,8 +177,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -198,11 +198,11 @@ LZT_TEST_F( } } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } @@ -213,8 +213,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -239,11 +239,11 @@ LZT_TEST_F( } } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } @@ -254,8 +254,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -267,11 +267,11 @@ LZT_TEST_F( } } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } @@ -282,8 +282,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -305,11 +305,11 @@ LZT_TEST_F( } } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } @@ -320,8 +320,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -333,11 +333,11 @@ LZT_TEST_F( } } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } LZT_TEST_F( @@ -347,8 +347,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -363,11 +363,11 @@ LZT_TEST_F( } } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } LZT_TEST_F( @@ -377,8 +377,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -390,11 +390,11 @@ LZT_TEST_F( } } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } } LZT_TEST_F( @@ -404,8 +404,8 @@ LZT_TEST_F( uint32_t p_count = 0; p_count = lzt::get_freq_handle_count(device); if (p_count > 0) { - is_overclocking_supported = true; - LOG_INFO << "Overclocking handles are available on this device! "; + is_frequency_supported = true; + LOG_INFO << "Frequency handles are available on this device! "; auto freq_handles = lzt::get_freq_handles(device, p_count); for (auto freq_handle : freq_handles) { ASSERT_NE(nullptr, freq_handle); @@ -420,11 +420,11 @@ LZT_TEST_F( } } } else { - LOG_INFO << "No overclocking handles found for this device! "; + LOG_INFO << "No frequency handles found for this device! "; } } - if (!is_overclocking_supported) { - FAIL() << "No overclocking handles found on any of the devices! "; + if (!is_frequency_supported) { + FAIL() << "No frequency handles found on any of the devices! "; } }