Skip to content

Commit 95d604e

Browse files
[CI] Add xpu test for windows (#1375)
Add xpu related API test
1 parent 5c1c479 commit 95d604e

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

.github/workflows/_windows_ut.yml

+11
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,14 @@ jobs:
170170
set PYTORCH_TEST_WITH_SLOW=1
171171
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/extended/
172172
python run_test_with_skip_mtl.py
173+
174+
- name: Run Test XPU UT
175+
if: contains(inputs.ut, 'torch_xpu') || github.event_name == 'schedule'
176+
shell: cmd
177+
run: |
178+
call "C:\ProgramData\miniforge3\Scripts\activate.bat"
179+
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
180+
call conda activate windows_ci
181+
call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"
182+
cd ../pytorch/third_party/torch-xpu-ops/test/xpu/
183+
python run_test_win_with_skip_mtl.py

.github/workflows/pull.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ jobs:
234234
needs: [preci-lint-check, check-conditions]
235235
uses: ./.github/workflows/_windows_ut.yml
236236
with:
237-
ut: op_extended
237+
ut: op_extended,torch_xpu
238238
runner: Windows_CI
239239
files-changed: ${{ needs.check-conditions.outputs.files-changed }}
240240
has-label: ${{ needs.check-conditions.outputs.has-label }}
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import re
2+
import sys
3+
from io import StringIO
4+
5+
import pytest
6+
from skip_list_win_mtl import skip_dict
7+
8+
IS_WINDOWS = sys.platform == "win32"
9+
10+
skip_list = skip_dict["test_xpu.py"]
11+
12+
skip_options = "not " + skip_list[0]
13+
for skip_case in skip_list[1:]:
14+
skip_option = " and not " + skip_case
15+
skip_options += skip_option
16+
17+
original_stdout = sys.stdout
18+
sys.stdout = StringIO()
19+
20+
test_command = ["-k", skip_options, "../../../../test/test_xpu.py", "-v"]
21+
res = pytest.main(test_command)
22+
23+
output = sys.stdout.getvalue()
24+
sys.stdout = original_stdout
25+
26+
cleaned_output = re.sub(
27+
r"\.\.(\/|\\)\.\.(\/|\\)\.\.(\/|\\)\.\.(\/|\\)test(\/|\\)", "", output
28+
)
29+
print(cleaned_output, end="")
30+
sys.exit(res)

test/xpu/skip_list_win_mtl.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
skip_dict = {
2+
# failed on MTL windows, skip first for Preci
3+
"test_xpu.py": ("test_mem_get_info_xpu",),
4+
}

0 commit comments

Comments
 (0)