From b63563243989f6baad5b418ab90a934e6af793df Mon Sep 17 00:00:00 2001 From: Vishnu Khanth Date: Mon, 28 Oct 2024 16:25:19 +0530 Subject: [PATCH 1/4] test: CTS to test Sysman API's with core handle Signed-off-by: Vishnu Khanth --- .../sysman/test_sysman_init/CMakeLists.txt | 8 + ...nit_invoke_sysman_api_with_core_handle.cpp | 151 ++++++++++++++++++ scripts/level_zero_report_utils.py | 2 + 3 files changed, 161 insertions(+) create mode 100644 conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp diff --git a/conformance_tests/sysman/test_sysman_init/CMakeLists.txt b/conformance_tests/sysman/test_sysman_init/CMakeLists.txt index b3523e59..69dd6f33 100644 --- a/conformance_tests/sysman/test_sysman_init/CMakeLists.txt +++ b/conformance_tests/sysman/test_sysman_init/CMakeLists.txt @@ -27,4 +27,12 @@ add_lzt_test( src/test_init_sysman_before_core.cpp src/main.cpp LINK_LIBRARIES level_zero_tests::logging level_zero_tests::utils) + +add_lzt_test( + NAME test_init_invoke_sysman_api_with_core_handle + GROUP "/conformance_tests/tools/sysman" + SOURCES + src/test_init_invoke_sysman_api_with_core_handle.cpp + src/main.cpp + LINK_LIBRARIES level_zero_tests::logging level_zero_tests::utils) \ No newline at end of file diff --git a/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp b/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp new file mode 100644 index 00000000..ba8ae75d --- /dev/null +++ b/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp @@ -0,0 +1,151 @@ +/* + * + * Copyright (C) 2024 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "gtest/gtest.h" +#include "logging/logging.hpp" +#include "utils/utils.hpp" +#include "test_harness/test_harness.hpp" +#include + +namespace { + +TEST( + SysmanInitTests, + GivenSysmanInitializedFromZesInitAndCoreInitializedWithSysmanFlagWhenSysmanApiAreCalledWithCoreHandleThenUninitializedErrorIsReturned) { + static char sys_env[] = "ZES_ENABLE_SYSMAN=1"; + putenv(sys_env); + + ASSERT_EQ(ZE_RESULT_SUCCESS, zesInit(0)); + ASSERT_EQ(ZE_RESULT_SUCCESS, zeInit(0)); + + uint32_t driver_count = 0; + ASSERT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&driver_count, nullptr)); + ASSERT_GT(driver_count, 0); + std::vector drivers(driver_count); + ASSERT_EQ(ZE_RESULT_SUCCESS, zeDriverGet(&driver_count, drivers.data())); + + uint32_t device_count = 0; + ASSERT_EQ(ZE_RESULT_SUCCESS, zeDeviceGet(drivers[0], &device_count, nullptr)); + std::vector devices(device_count); + ASSERT_EQ(ZE_RESULT_SUCCESS, + zeDeviceGet(drivers[0], &device_count, devices.data())); + + uint32_t count = 0; + ze_bool_t bool_false{}; + zes_device_handle_t device_handle{}; + zes_uuid_t uuid{}; + zes_device_properties_t properties{}; + zes_device_state_t state{}; + zes_reset_properties_t reset_properties{}; + zes_pci_properties_t pci_properties{}; + zes_pci_state_t pci_state{}; + zes_pci_stats_t pci_stats{}; + zes_overclock_mode_t overclock_mode = ZES_OVERCLOCK_MODE_MODE_OFF; + zes_pending_action_t pending_action = ZES_PENDING_ACTION_PENDING_NONE; + zes_device_ecc_properties_t ecc_properties{}; + const zes_device_ecc_desc_t ecc_state{}; + zes_fabric_port_handle_t fabric_port{}; + zes_fabric_port_throughput_t *fabric_throughput{}; + std::vector event_type{}; + + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceGet(drivers[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceGetProperties(devices[0], &properties)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceGetState(devices[0], &state)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceReset(devices[0], false)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceResetExt(devices[0], &reset_properties)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceProcessesGetState(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDevicePciGetProperties(devices[0], &pci_properties)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDevicePciGetState(devices[0], &pci_state)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDevicePciGetBars(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDevicePciGetStats(devices[0], &pci_stats)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceSetOverclockWaiver(devices[0])); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceGetOverclockDomains(devices[0], &count)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceGetOverclockControls(devices[0], ZES_OVERCLOCK_DOMAIN_CARD, + &count)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceResetOverclockSettings(devices[0], false)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceReadOverclockState(devices[0], &overclock_mode, + &bool_false, &bool_false, + &pending_action, &bool_false)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumOverclockDomains(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumDiagnosticTestSuites(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEccAvailable(devices[0], &bool_false)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEccConfigurable(devices[0], &bool_false)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceGetEccState(devices[0], &ecc_properties)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceSetEccState(devices[0], &ecc_state, &ecc_properties)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumEngineGroups(devices[0], &count, nullptr)); + EXPECT_EQ( + ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEventRegister(devices[0], ZES_EVENT_TYPE_FLAG_DEVICE_DETACH)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDriverEventListen(drivers[0], + std::numeric_limits::max(), 1, + &devices[0], &count, event_type.data())); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDriverEventListenEx(drivers[0], + std::numeric_limits::max(), 1, + &devices[0], &count, event_type.data())); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumFabricPorts(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesFabricPortGetMultiPortThroughput(devices[0], count, &fabric_port, + &fabric_throughput)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumFans(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumFirmwares(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumFrequencyDomains(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumLeds(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumMemoryModules(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumPerformanceFactorDomains(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumPowerDomains(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumPsus(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumRasErrorSets(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumSchedulers(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumStandbyDomains(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumTemperatureSensors(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceGetSubDevicePropertiesExp(devices[0], &count, nullptr)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDriverGetDeviceByUuidExp(drivers[0], uuid, &device_handle, + &bool_false, &count)); + EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + zesDeviceEnumEnabledVFExp(devices[0], &count, nullptr)); +} + +} // namespace \ No newline at end of file diff --git a/scripts/level_zero_report_utils.py b/scripts/level_zero_report_utils.py index 58e81fef..c080d977 100644 --- a/scripts/level_zero_report_utils.py +++ b/scripts/level_zero_report_utils.py @@ -212,6 +212,8 @@ def assign_tool_test_feature(test_binary: str, test_name: str): test_feature = "SysMan Frequency" elif (re.search('test_init_sysman', test_binary, re.IGNORECASE)): test_feature = "SysMan Init" + elif (re.search('test_init_invoke_sysman_api', test_binary, re.IGNORECASE)): + test_feature = "SysMan Init" elif test_binary == "test_sysman_pci": test_feature = "SysMan PCIe" elif test_binary == "test_sysman_pci_zesinit": From 507d3cd16db7f806c67a658f681961ac8279f354 Mon Sep 17 00:00:00 2001 From: Vishnu Khanth Date: Mon, 28 Oct 2024 16:25:19 +0530 Subject: [PATCH 2/4] test: CTS to test Sysman API's with core handle Signed-off-by: Vishnu Khanth --- .../src/test_init_invoke_sysman_api_with_core_handle.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp b/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp index ba8ae75d..026ec40d 100644 --- a/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp +++ b/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp @@ -53,8 +53,6 @@ TEST( zes_fabric_port_throughput_t *fabric_throughput{}; std::vector event_type{}; - EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, - zesDeviceGet(drivers[0], &count, nullptr)); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceGetProperties(devices[0], &properties)); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, From fbd190de470c7739ccafdfbb359d37d446300ceb Mon Sep 17 00:00:00 2001 From: Vishnu Khanth Date: Mon, 28 Oct 2024 16:25:19 +0530 Subject: [PATCH 3/4] test: CTS to test Sysman API's with core handle Signed-off-by: Vishnu Khanth --- .../src/test_init_invoke_sysman_api_with_core_handle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp b/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp index 026ec40d..3c098e82 100644 --- a/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp +++ b/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp @@ -142,8 +142,8 @@ TEST( EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDriverGetDeviceByUuidExp(drivers[0], uuid, &device_handle, &bool_false, &count)); - EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, - zesDeviceEnumEnabledVFExp(devices[0], &count, nullptr)); + // EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, + // zesDeviceEnumEnabledVFExp(devices[0], &count, nullptr)); } } // namespace \ No newline at end of file From 247044e06bd3235ecb9abdbfc6b7526065762ca5 Mon Sep 17 00:00:00 2001 From: Vishnu Khanth Date: Mon, 28 Oct 2024 16:25:19 +0530 Subject: [PATCH 4/4] test: CTS to test Sysman API's with core handle Signed-off-by: Vishnu Khanth --- .../test_init_invoke_sysman_api_with_core_handle.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp b/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp index 3c098e82..d314f0c7 100644 --- a/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp +++ b/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp @@ -100,14 +100,6 @@ TEST( EXPECT_EQ( ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceEventRegister(devices[0], ZES_EVENT_TYPE_FLAG_DEVICE_DETACH)); - EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, - zesDriverEventListen(drivers[0], - std::numeric_limits::max(), 1, - &devices[0], &count, event_type.data())); - EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, - zesDriverEventListenEx(drivers[0], - std::numeric_limits::max(), 1, - &devices[0], &count, event_type.data())); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceEnumFabricPorts(devices[0], &count, nullptr)); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, @@ -139,9 +131,6 @@ TEST( zesDeviceEnumTemperatureSensors(devices[0], &count, nullptr)); EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceGetSubDevicePropertiesExp(devices[0], &count, nullptr)); - EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, - zesDriverGetDeviceByUuidExp(drivers[0], uuid, &device_handle, - &bool_false, &count)); // EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, // zesDeviceEnumEnabledVFExp(devices[0], &count, nullptr)); }