Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 30 additions & 24 deletions .ci/scripts/unittest-windows.ps1
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
param (
[string]$buildMode = "Release"
[string]$buildMode = "Release",
[bool]$runPythonTests = $true,
[bool]$runNativeTests = $true
)

Set-PSDebug -Trace 1
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true

if ($runNativeTests) {
# Run native unit tests (via ctest)
New-Item -Path "test-build" -ItemType Directory
cd "test-build"
New-Item -Path "test-build" -ItemType Directory
cd "test-build"

cmake .. --preset windows -B . -DEXECUTORCH_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$buildMode
if ($LASTEXITCODE -ne 0) {
Write-Host "CMake configuration was unsuccessful. Exit code: $LASTEXITCODE."
exit $LASTEXITCODE
}
cmake .. --preset windows -B . -DEXECUTORCH_BUILD_TESTS=ON -DCMAKE_BUILD_TYPE=$buildMode
if ($LASTEXITCODE -ne 0) {
Write-Host "CMake configuration was unsuccessful. Exit code: $LASTEXITCODE."
exit $LASTEXITCODE
}

cmake --build . -j8 --config $buildMode --verbose
if ($LASTEXITCODE -ne 0) {
Write-Host "CMake build was unsuccessful. Exit code: $LASTEXITCODE."
exit $LASTEXITCODE
}
cmake --build . -j8 --config $buildMode --verbose
if ($LASTEXITCODE -ne 0) {
Write-Host "CMake build was unsuccessful. Exit code: $LASTEXITCODE."
exit $LASTEXITCODE
}

ctest -j8 . --build-config $buildMode --output-on-failure -E "method_test|tensor_parser_test"
if ($LASTEXITCODE -ne 0) {
Write-Host "CTest run was unsuccessful. Exit code: $LASTEXITCODE."
exit $LASTEXITCODE
}
ctest -j8 . --build-config $buildMode --output-on-failure -E "method_test|tensor_parser_test"
if ($LASTEXITCODE -ne 0) {
Write-Host "CTest run was unsuccessful. Exit code: $LASTEXITCODE."
exit $LASTEXITCODE
}

cd ..
cd ..
}

if ($runPythonTests) {
# Run pytest
pytest -v -c pytest-windows.ini
if ($LASTEXITCODE -ne 0) {
Write-Host "Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE."
exit $LASTEXITCODE
}
pytest -v -c pytest-windows.ini
if ($LASTEXITCODE -ne 0) {
Write-Host "Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE."
exit $LASTEXITCODE
}
}
7 changes: 6 additions & 1 deletion .github/workflows/_unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ jobs:
exit \$LASTEXITCODE
}

.ci/scripts/unittest-windows.ps1 -buildMode "${{ inputs.build-mode }}"
# Skip python tests on unittest-release job, which tests the native tests in release mode.
\$runPythonTests = ("${{ inputs.build-mode }}" -eq "Debug")
# Skip native tests in the editable job, as the native tests are unaffected by editable mode.
\$runNativeTests = ("${{ inputs.editable }}" -eq "false")

.ci/scripts/unittest-windows.ps1 -buildMode "${{ inputs.build-mode }}" -runPythonTests \$runPythonTests -runNativeTests \$runNativeTests
if (\$LASTEXITCODE -ne 0) {
Write-Host "Unit tests failed. Exit code: \$LASTEXITCODE."
exit \$LASTEXITCODE
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1016,8 +1016,8 @@ jobs:
strategy:
fail-fast: false
matrix:
model: [linear, add, add_mul, ic3, ic4, mv2, mv3, resnet18, resnet50, vit, w2l, mobilebert, emformer_join, emformer_transcribe]
backend: [portable, xnnpack-f32, xnnpack-q8]
model: [mv3, resnet50, vit, mobilebert, emformer_transcribe]
backend: [portable, xnnpack-q8]
with:
submodules: 'recursive'
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
Expand Down
Loading