Skip to content

Commit 80499e0

Browse files
committed
[Windows] Run native unit tests in CI
ghstack-source-id: 1dca42f ghstack-comment-id: 3251228740 Pull-Request: #13925
1 parent 686bb71 commit 80499e0

File tree

4 files changed

+31
-10
lines changed

4 files changed

+31
-10
lines changed

.ci/scripts/test_model.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function ExportModel-Xnnpack {
3434
[bool]$quantize
3535
)
3636

37-
if $(quantize) {
37+
if ($quantize) {
3838
python -m examples.xnnpack.aot_compiler --model_name="${MODEL_NAME}" --delegate --quantize | Write-Host
3939
$modelFile = "$($modelName)_xnnpack_q8.pte"
4040
} else {

.ci/scripts/unittest-windows.ps1

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,31 @@ Set-PSDebug -Trace 1
66
$ErrorActionPreference = 'Stop'
77
$PSNativeCommandUseErrorActionPreference = $true
88

9-
# Run pytest with coverage
10-
# pytest -n auto --cov=./ --cov-report=xml
11-
pytest -v --full-trace -c pytest-windows.ini
9+
# Run pytest
10+
pytest -v -c pytest-windows.ini
1211
if ($LASTEXITCODE -ne 0) {
1312
Write-Host "Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE."
1413
exit $LASTEXITCODE
1514
}
15+
16+
# Run native unit tests (via ctest)
17+
New-Item -Path "test-build" -ItemType Directory
18+
cd "test-build"
19+
20+
cmake .. --preset windows -B . -DCMAKE_BUILD_TESTS=ON
21+
if ($LASTEXITCODE -ne 0) {
22+
Write-Host "CMake configuration was unsuccessful. Exit code: $LASTEXITCODE."
23+
exit $LASTEXITCODE
24+
}
25+
26+
cmake --build . -j8 --config Release
27+
if ($LASTEXITCODE -ne 0) {
28+
Write-Host "CMake build was unsuccessful. Exit code: $LASTEXITCODE."
29+
exit $LASTEXITCODE
30+
}
31+
32+
ctest -j8
33+
if ($LASTEXITCODE -ne 0) {
34+
Write-Host "CTest run was unsuccessful. Exit code: $LASTEXITCODE."
35+
exit $LASTEXITCODE
36+
}

.github/workflows/_unittest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
\$ErrorActionPreference = 'Stop'
7070
\$PSNativeCommandUseErrorActionPreference = \$true
7171
72-
.ci/scripts/setup-windows.ps1
72+
.ci/scripts/setup-windows.ps1
7373
74-
powershell .ci/scripts/unittest-windows.ps1 -editable "${{ inputs.editable }}"
74+
.ci/scripts/unittest-windows.ps1 -editable "${{ inputs.editable }}"
7575
}"

.github/workflows/trunk.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -993,13 +993,13 @@ jobs:
993993
timeout: 60
994994
script: |
995995
conda init powershell
996-
996+
997997
powershell -Command "& {
998998
Set-PSDebug -Trace 1
999999
\$ErrorActionPreference = 'Stop'
10001000
\$PSNativeCommandUseErrorActionPreference = \$true
10011001
1002-
.ci/scripts/setup-windows.ps1
1002+
.ci/scripts/setup-windows.ps1
10031003
1004-
powershell .ci/scripts/test_model.ps1 -modelName ${{ matrix.model }} -backend ${{ matrix.backend }}
1005-
}"
1004+
.ci/scripts/test_model.ps1 -modelName ${{ matrix.model }} -backend ${{ matrix.backend }}
1005+
}"

0 commit comments

Comments
 (0)