Skip to content

Commit 51aa747

Browse files
authored
test: Add new checkers for pyzes (#469)
Signed-off-by: shubham kumar <shubham.kumar@intel.com>
1 parent a47c02e commit 51aa747

2 files changed

Lines changed: 406 additions & 0 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
##
2+
# Copyright (C) 2026 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
#
6+
##
7+
8+
name: Python Bindings - Validation Checks
9+
10+
on:
11+
pull_request:
12+
branches:
13+
- '**'
14+
paths:
15+
- 'bindings/sysman/python/**'
16+
push:
17+
branches:
18+
- main
19+
- master
20+
- python_bindings
21+
paths:
22+
- 'bindings/sysman/python/**'
23+
workflow_dispatch:
24+
25+
env:
26+
PYTHON_VERSION: '3.10'
27+
28+
jobs:
29+
validation-checks:
30+
name: Validation Checks
31+
runs-on: ubuntu-latest
32+
defaults:
33+
run:
34+
working-directory: bindings/sysman/python
35+
permissions:
36+
contents: read
37+
38+
steps:
39+
- name: Checkout code
40+
uses: actions/checkout@v4
41+
42+
- name: Set up Python ${{ env.PYTHON_VERSION }}
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version: ${{ env.PYTHON_VERSION }}
46+
47+
- name: Install dependencies for Level-Zero loader build
48+
run: |
49+
sudo apt-get update
50+
sudo apt-get install -y cmake build-essential
51+
52+
- name: Build and install Level-Zero loader
53+
working-directory: ${{ github.workspace }}
54+
run: |
55+
mkdir -p build
56+
cd build
57+
cmake .. -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr
58+
cmake --build . --parallel $(nproc)
59+
sudo cmake --build . --target install
60+
sudo ldconfig
61+
62+
- name: Create virtual environment and install
63+
run: |
64+
python -m venv .venv
65+
source .venv/bin/activate
66+
pip install --upgrade pip --quiet
67+
pip install -e . --quiet
68+
69+
- name: Run validation checks
70+
run: |
71+
source .venv/bin/activate
72+
73+
# Check 1: Verify installation location
74+
PYZES_LOCATION=$(python -c "import pyzes; print(pyzes.__file__ if hasattr(pyzes, '__file__') else 'N/A')")
75+
if [[ ! "$PYZES_LOCATION" =~ "bindings/sysman/python/source" ]]; then
76+
echo "❌ FAIL: pyzes is not loading from local source"
77+
echo "Location: $PYZES_LOCATION"
78+
exit 1
79+
fi
80+
81+
# Check 2: Test silent import (no stdout output)
82+
OUTPUT=$(python -c "import pyzes" 2>/dev/null)
83+
if [ -n "$OUTPUT" ]; then
84+
echo "❌ FAIL: Import produced stdout output:"
85+
echo "$OUTPUT"
86+
echo ""
87+
echo "The 'import pyzes' statement should not print anything to stdout."
88+
echo "Please remove any print statements from the module initialization."
89+
exit 1
90+
fi
91+
92+
# Check 3: Validate structure definitions match C headers
93+
python test/validate_structures.py || {
94+
echo ""
95+
echo "Structure validation failed. Please ensure Python ctypes structures match the C headers."
96+
exit 1
97+
}
98+
99+
echo "✅ All validation checks passed: Local installation verified, import is silent, structures validated"

0 commit comments

Comments
 (0)