-
Notifications
You must be signed in to change notification settings - Fork 132
New bb tests #473
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?
New bb tests #473
Changes from all commits
d943a8c
fee3dbf
150fd84
f7bee3a
456566c
4ef7818
a406994
377fcb6
1fa65f1
1ae486c
c8c6ba8
ca14367
c040cff
1340ee7
174d4eb
26fc29f
5fea1ca
fc07360
20b37f4
27b4eb4
ddfcc79
87fc63e
f38a838
File filter
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,74 @@ | ||
| ## | ||
| # Copyright (C) 2026 Intel Corporation | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| ## | ||
|
|
||
| import os | ||
| import sys | ||
| from ctypes import byref, c_uint32 | ||
|
|
||
| import pytest | ||
|
|
||
| CTS_TESTS_DIR = os.path.dirname(os.path.abspath(__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. rename all the variables. |
||
| SOURCE_DIR = os.path.abspath(os.path.join(CTS_TESTS_DIR, "..")) | ||
|
|
||
| if SOURCE_DIR not in sys.path: | ||
| sys.path.insert(0, SOURCE_DIR) | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def pyzes_module(): | ||
| try: | ||
| import pyzes as pz | ||
| except (ImportError, OSError) as exc: | ||
| pytest.skip(f"pyzes is not available for CTS validation: {exc}") | ||
|
|
||
| return pz | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def sysman_devices(pyzes_module): | ||
|
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. What is the meaning of "conftest" ?
Contributor
Author
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. conformance |
||
| pz = pyzes_module | ||
|
|
||
| rc = pz.zesInit(0) | ||
| if rc != pz.ZE_RESULT_SUCCESS: | ||
| pytest.skip(f"zesInit failed with ze_result_t={rc}") | ||
|
|
||
| driver_count = c_uint32(0) | ||
| rc = pz.zesDriverGet(byref(driver_count), None) | ||
| if rc != pz.ZE_RESULT_SUCCESS: | ||
| pytest.skip(f"zesDriverGet(count) failed with ze_result_t={rc}") | ||
|
|
||
| if driver_count.value == 0: | ||
| pytest.skip("No Sysman drivers available") | ||
|
|
||
| DriverArray = pz.zes_driver_handle_t * driver_count.value | ||
| drivers = DriverArray() | ||
| rc = pz.zesDriverGet(byref(driver_count), drivers) | ||
| if rc != pz.ZE_RESULT_SUCCESS: | ||
| pytest.skip(f"zesDriverGet(handles) failed with ze_result_t={rc}") | ||
|
|
||
| devices = [] | ||
| for driver in drivers: | ||
| device_count = c_uint32(0) | ||
| rc = pz.zesDeviceGet(driver, byref(device_count), None) | ||
| if rc != pz.ZE_RESULT_SUCCESS: | ||
| continue | ||
|
|
||
| if device_count.value == 0: | ||
| continue | ||
|
|
||
| DeviceArray = pz.zes_device_handle_t * device_count.value | ||
| driver_devices = DeviceArray() | ||
| rc = pz.zesDeviceGet(driver, byref(device_count), driver_devices) | ||
| if rc != pz.ZE_RESULT_SUCCESS: | ||
| continue | ||
|
|
||
| devices.extend(driver_devices) | ||
|
|
||
| if not devices: | ||
| pytest.skip("No Sysman devices available") | ||
|
|
||
| return devices | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this under test/
instead of cts_tests folder name , please make it as blackbox_tests
Rename "pyzes_black_box_test.py" to pyzes_examples.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok