Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sysman init EnumFreqDomain CTS #72

Merged
merged 13 commits into from
Nov 5, 2024
47 changes: 47 additions & 0 deletions conformance_tests/sysman/test_sysman_init/src/test_init_sysman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,51 @@ TEST(SysmanInitTests,
ASSERT_GT(pCount, 0);
}

TEST(SysmanInitTests,
GivenCoreAndSysmanInitializedSysmanHandleWorksForEnumFrequencyDomanis) {
shreyaskunder marked this conversation as resolved.
Show resolved Hide resolved
shreyaskunder marked this conversation as resolved.
Show resolved Hide resolved
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, zesDriverGet(&driver_count, nullptr));
ASSERT_GT(driver_count, 0);
std::vector<zes_driver_handle_t> drivers(driver_count);
ASSERT_EQ(ZE_RESULT_SUCCESS, zesDriverGet(&driver_count, drivers.data()));

uint32_t device_count = 0;
ASSERT_EQ(ZE_RESULT_SUCCESS, zesDeviceGet(drivers[0], &device_count, nullptr));
std::vector<zes_device_handle_t> devices(device_count);
ASSERT_EQ(ZE_RESULT_SUCCESS, zesDeviceGet(drivers[0], &device_count, devices.data()));

uint32_t count = 0;
ASSERT_EQ(ZE_RESULT_SUCCESS, zesDeviceEnumFrequencyDomains(devices[0], &count, nullptr));

}

TEST(SysmanInitTests,
GivenCoreAndSysmanInitializedCoreHandleReturnsUninitializedErrorForEnumFrequencyDomanis) {
shreyaskunder marked this conversation as resolved.
Show resolved Hide resolved
shreyaskunder marked this conversation as resolved.
Show resolved Hide resolved
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<zes_driver_handle_t> 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<zes_device_handle_t> devices(device_count);
ASSERT_EQ(ZE_RESULT_SUCCESS, zeDeviceGet(drivers[0], &device_count, devices.data()));

uint32_t count = 0;
ASSERT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, zesDeviceEnumFrequencyDomains(devices[0], &count, nullptr));
shreyaskunder marked this conversation as resolved.
Show resolved Hide resolved
}

} // namespace
Loading