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..d314f0c7 --- /dev/null +++ b/conformance_tests/sysman/test_sysman_init/src/test_init_invoke_sysman_api_with_core_handle.cpp @@ -0,0 +1,138 @@ +/* + * + * 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, + 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, + 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, + // 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":