-
Notifications
You must be signed in to change notification settings - Fork 61
Add CTS for Sysman DriverExtension API's #60
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
base: master
Are you sure you want to change the base?
Changes from all commits
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (C) 2024 Intel Corporation | ||
# SPDX-License-Identifier: MIT | ||
|
||
add_lzt_test( | ||
NAME test_sysman_driver_zesinit | ||
GROUP "/conformance_tests/tools/sysman" | ||
SOURCES | ||
src/test_sysman_driver.cpp | ||
src/main.cpp | ||
LINK_LIBRARIES | ||
level_zero_tests::logging | ||
level_zero_tests::utils | ||
) |
8000
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# testSysmanDriver | ||
|
||
## Description | ||
|
||
This test suite is for validating driver Extension APIs provided in Sysman. | ||
|
||
### zesDriverGetExtensionProperties | ||
|
||
* `GivenValidDriverHandleWhileRetrievingExtensionPropertiesThenValidExtensionPropertiesIsReturned`: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please share whether there is a plan to maintain this readme for every test that is going to be added. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure. Since there are only two tests, i added it. In some other test suites like device, it was added in this format. |
||
Test case checks whether zesDriverGetExtensionProperties API returns success and also retrieves valid Extension properties. | ||
If the feature is not supported then the test will be skipped. | ||
|
||
### zesDriverGetExtensionFunctionAddress | ||
|
||
* `GivenValidDriverHandleWhileRetrievingExtensionFunctionAddressThenValidAddressIsReturned`: | ||
Test case checks whether zesDriverGetExtensionFunctionAddress API returns success and | ||
retrieves valid function pointer for all vendor-specific or experimental extensions Sysman API's which are listed in the L0 specification. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* | ||
* Copyright (C) 2024 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
*/ | ||
|
||
#include "gmock/gmock.h" | ||
#include "logging/logging.hpp" | ||
#include "utils/utils.hpp" | ||
#include <stdlib.h> | ||
|
||
int main(int argc, char **argv) { | ||
::testing::InitGoogleMock(&argc, argv); | ||
std::vector<std::string> command_line(argv + 1, argv + argc); | ||
level_zero_tests::init_logging(command_line); | ||
|
||
ze_result_t result = zesInit(0); | ||
if (result) { | ||
throw std::runtime_error("zesInit failed: " + | ||
level_zero_tests::to_string(result)); | ||
} | ||
LOG_TRACE << "Sysman initialized"; | ||
return RUN_ALL_TESTS(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* | ||
* Copyright (C) 2024 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
*/ | ||
|
||
#include "test_harness/test_harness.hpp" | ||
#include "logging/logging.hpp" | ||
#include "utils/utils.hpp" | ||
|
||
namespace lzt = level_zero_tests; | ||
|
||
namespace { | ||
|
||
class SysmanDriverZesTest : public lzt::ZesSysmanCtsClass {}; | ||
#define SYSMAN_DRIVER_TEST SysmanDriverZesTest | ||
|
||
TEST_F( | ||
SYSMAN_DRIVER_TEST, | ||
GivenValidDriverHandleWhileRetrievingExtensionPropertiesThenValidExtensionPropertiesIsReturned) { | ||
zes_driver_handle_t driver = lzt::get_default_zes_driver(); | ||
for (auto device : devices) { | ||
uint32_t count = 0; | ||
ze_result_t result = lzt::get_driver_ext_properties(driver, &count); | ||
|
||
if (result == ZE_RESULT_ERROR_UNSUPPORTED_FEATURE) { | ||
LOG_INFO | ||
<< "Skipping test as zesDriverGetExtensionProperties is Unsupported"; | ||
GTEST_SKIP(); | ||
} | ||
EXPECT_EQ(result, ZE_RESULT_SUCCESS); | ||
EXPECT_GE(count, 0); | ||
|
||
std::vector<zes_driver_extension_properties_t> ext_properties(count); | ||
lzt::get_driver_ext_properties(driver, &count, ext_properties); | ||
for (auto ext_property : ext_properties) { | ||
EXPECT_LE(strlen(ext_property.name), ZES_MAX_EXTENSION_NAME); | ||
EXPECT_GT(ext_property.version, 0); | ||
} | ||
} | ||
} | ||
|
||
TEST_F( | ||
SYSMAN_DRIVER_TEST, | ||
GivenValidDriverHandleWhileRetrievingExtensionFunctionAddressThenValidAddressIsReturned) { | ||
zes_driver_handle_t driver = lzt::get_default_zes_driver(); | ||
std::vector<const char *> ext_functions = { | ||
"zesPowerSetLimitsExt", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are extension functions which are already part of the header file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By referring the Core API, the extension API's are in both header and extension API's. we can have a look at it. |
||
"zesPowerGetLimitsExt", | ||
"zesEngineGetActivityExt", | ||
"zesRasGetStateExp", | ||
"zesRasClearStateExp", | ||
"zesFirmwareGetSecurityVersionExp", | ||
"zesFirmwareSetSecurityVersionExp", | ||
"zesDriverGetDeviceByUuidExp", | ||
"zesDeviceGetSubDevicePropertiesExp", | ||
"zesDeviceEnumActiveVFExp", | ||
"zesVFManagementGetVFPropertiesExp", | ||
"zesVFManagementGetVFMemoryUtilizationExp", | ||
"zesVFManagementGetVFEngineUtilizationExp", | ||
"zesVFManagementSetVFTelemetryModeExp", | ||
"zesVFManagementSetVFTelemetrySamplingIntervalExp"}; | ||
|
||
for (auto device : devices) { | ||
for (auto ext_function : ext_functions) { | ||
lzt::get_driver_ext_function_address(driver, ext_function); | ||
} | ||
} | ||
} | ||
|
||
} // namespace |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* | ||
* Copyright (C) 2024 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
*/ | ||
|
||
#ifndef level_zero_tests_ZE_TEST_HARNESS_SYSMAN_DRIVER_HPP | ||
#define level_zero_tests_ZE_TEST_HARNESS_SYSMAN_DRIVER_HPP | ||
|
||
#include <level_zero/zes_api.h> | ||
#include "gtest/gtest.h" | ||
|
||
namespace level_zero_tests { | ||
|
||
ze_result_t get_driver_ext_properties(zes_driver_handle_t driver, | ||
uint32_t *count); | ||
|
||
void get_driver_ext_properties( | ||
zes_driver_handle_t driver, uint32_t *count, | ||
std::vector<zes_driver_extension_properties_t> &ext_properties); | ||
|
||
void get_driver_ext_function_address(zes_driver_handle_t driver, | ||
const char *function_name); | ||
} // namespace level_zero_tests | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* | ||
* Copyright (C) 2024 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
* | ||
*/ | ||
|
||
#include "test_harness/test_harness.hpp" | ||
|
||
namespace level_zero_tests { | ||
ze_result_t get_driver_ext_properties(zes_driver_handle_t driver, | ||
uint32_t *count) { | ||
return zesDriverGetExtensionProperties(driver, count, nullptr); | ||
} | ||
|
||
void get_driver_ext_properties( | ||
zes_driver_handle_t driver, uint32_t *count, | ||
std::vector<zes_driver_extension_properties_t> &ext_properties) { | ||
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDriverGetExtensionProperties( | ||
driver, count, ext_properties.data())); | ||
} | ||
|
||
void get_driver_ext_function_address(zes_driver_handle_t driver, | ||
const char *function_name) { | ||
void *func_ptr = nullptr; | ||
EXPECT_EQ(ZE_RESULT_SUCCESS, zesDriverGetExtensionFunctionAddress( | ||
driver, function_name, &func_ptr)); | ||
EXPECT_NE(func_ptr, nullptr); | ||
} | ||
} // namespace level_zero_tests |
Uh oh!
There was an error while loading. Please reload this page.