-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sysman init EnumFreqDomain CTS (#72)
* Sysman EnumFreq CTS * seperate binary for init cases Signed-off-by: Kunder, Shreyas <[email protected]> * minor rename Signed-off-by: Kunder, Shreyas <[email protected]> * Update level_zero_utils * minor change * Sysman EnumFreq CTS * test: sysman init tests from core and sysman handle Signed-off-by: Shreyas Kunder <[email protected]> * test: sysman init tests from core and sysman handle Signed-off-by: Shreyas Kunder <[email protected]> * test: sysman init tests from core and sysman handle Signed-off-by: Shreyas Kunder <[email protected]> * test: sysman init tests from core and sysman handle Signed-off-by: Shreyas Kunder <[email protected]> * test: sysman init tests from core and sysman handle Related-To: VLCLJ-2273 Signed-off-by: Shreyas Kunder <[email protected]> * test: sysman init tests from core and sysman handle Related-To: VLCLJ-2273 Signed-off-by: Shreyas Kunder <[email protected]> --------- Signed-off-by: Kunder, Shreyas <[email protected]> Signed-off-by: Shreyas Kunder <[email protected]>
- Loading branch information
1 parent
ef3e3c6
commit 92223ce
Showing
4 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...ormance_tests/sysman/test_sysman_init/src/test_init_sysman_enum_freq_with_core_handle.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* | ||
* 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 <level_zero/zes_api.h> | ||
|
||
namespace { | ||
|
||
TEST( | ||
SysmanInitTests, | ||
GivenSysmanInitializationDoneUsingZesInitFollowedByZeInitAlongWithSysmanFlagEnabledThenWhenSysmanApiZesDeviceEnumFrequencyDomainsIsCalledWithCoreHandleThenUninitializedErrorIsReturned) { | ||
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; | ||
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, | ||
zesDeviceEnumFrequencyDomains(devices[0], &count, nullptr)); | ||
} | ||
|
||
} // namespace |
46 changes: 46 additions & 0 deletions
46
...mance_tests/sysman/test_sysman_init/src/test_init_sysman_enum_freq_with_sysman_handle.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* | ||
* 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 <level_zero/zes_api.h> | ||
|
||
namespace { | ||
|
||
TEST( | ||
SysmanInitTests, | ||
GivenSysmanInitializationDoneUsingZesInitFollowedByZeInitAlongWithSysmanFlagEnabledThenWhenSysmanApiZesDeviceEnumFrequencyDomainsIsCalledWithSysmanHandleThenSuccessIsReturned) { | ||
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; | ||
EXPECT_EQ(ZE_RESULT_SUCCESS, | ||
zesDeviceEnumFrequencyDomains(devices[0], &count, nullptr)); | ||
} | ||
|
||
} // namespace |
43 changes: 43 additions & 0 deletions
43
conformance_tests/sysman/test_sysman_init/src/test_init_sysman_no_env_with_core_handle.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* | ||
* 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 <level_zero/zes_api.h> | ||
|
||
namespace { | ||
|
||
TEST( | ||
SysmanInitTests, | ||
GivenSysmanInitializationDoneUsingZesInitFollowedByZeInitAlongWithSysmanFlagDisabledThenWhenSysmanApiZesDeviceEnumFrequencyDomainsIsCalledWithCoreHandleThenUninitializedErrorIsReturned) { | ||
static char sys_env[] = "ZES_ENABLE_SYSMAN=0"; | ||
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; | ||
EXPECT_EQ(ZE_RESULT_ERROR_UNINITIALIZED, | ||
zesDeviceEnumFrequencyDomains(devices[0], &count, nullptr)); | ||
} | ||
|
||
} // namespace |