Skip to content

Commit 316a6d7

Browse files
committed
add 'pti_lib.py' script
Signed-off-by: Anatoly Myachev <[email protected]>
1 parent f0a630a commit 316a6d7

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

.github/workflows/build-test-reusable.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,11 @@ jobs:
284284
if: matrix.suite == 'rest'
285285
run: |
286286
./scripts/install-pti.sh
287+
PTI_LIBS_DIR=$(python ./scripts/pti_lib.py)
288+
ls $PTI_LIBS_DIR
287289
LEVEL_ZERO_LIB=$(pwd)/.scripts_cache/level_zero_for_pti/level-zero-1.24.2/build/lib/
288290
ls $LEVEL_ZERO_LIB
289-
export LD_LIBRARY_PATH=$LEVEL_ZERO_LIB:$LD_LIBRARY_PATH
291+
export LD_LIBRARY_PATH=$PTI_LIBS_DIR:$LEVEL_ZERO_LIB:$LD_LIBRARY_PATH
290292
cd third_party/proton/test
291293
pytest test_api.py test_cmd.py test_lib.py test_profile.py test_viewer.py --device xpu -s -v
292294
cd ..

scripts/pti_lib.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"""Prints a lib directory for pti."""
2+
3+
import importlib.metadata
4+
import pathlib
5+
6+
7+
def get_pti_lib_path() -> pathlib.Path:
8+
"""Returns library path for pti.
9+
10+
Raises:
11+
importlib.metadata.PackageNotFoundError: if 'intel-pti' not installed.
12+
AssertionError: if libpti_view.so not found.
13+
"""
14+
files = importlib.metadata.files('intel-pti') or []
15+
for f in files:
16+
if f.name == 'libpti_view.so':
17+
return pathlib.Path(f.locate()).parent.resolve()
18+
raise AssertionError('libpti_view.so not found')
19+
20+
21+
if __name__ == '__main__':
22+
print(get_pti_lib_path())

0 commit comments

Comments
 (0)