11param (
2- [string ]$buildMode = " Release"
2+ [string ]$buildMode = " Release" ,
3+ [bool ]$runPythonTests = $true ,
4+ [bool ]$runNativeTests = $true
35)
46
57Set-PSDebug - Trace 1
68$ErrorActionPreference = ' Stop'
79$PSNativeCommandUseErrorActionPreference = $true
810
11+ if ($runNativeTests ) {
912# Run native unit tests (via ctest)
10- New-Item - Path " test-build" - ItemType Directory
11- cd " test-build"
13+ New-Item - Path " test-build" - ItemType Directory
14+ cd " test-build"
1215
13- cmake .. -- preset windows - B . - DEXECUTORCH_BUILD_TESTS= ON - DCMAKE_BUILD_TYPE= $buildMode
14- if ($LASTEXITCODE -ne 0 ) {
15- Write-Host " CMake configuration was unsuccessful. Exit code: $LASTEXITCODE ."
16- exit $LASTEXITCODE
17- }
16+ cmake .. -- preset windows - B . - DEXECUTORCH_BUILD_TESTS= ON - DCMAKE_BUILD_TYPE= $buildMode
17+ if ($LASTEXITCODE -ne 0 ) {
18+ Write-Host " CMake configuration was unsuccessful. Exit code: $LASTEXITCODE ."
19+ exit $LASTEXITCODE
20+ }
1821
19- cmake -- build . - j8 -- config $buildMode -- verbose
20- if ($LASTEXITCODE -ne 0 ) {
21- Write-Host " CMake build was unsuccessful. Exit code: $LASTEXITCODE ."
22- exit $LASTEXITCODE
23- }
22+ cmake -- build . - j8 -- config $buildMode -- verbose
23+ if ($LASTEXITCODE -ne 0 ) {
24+ Write-Host " CMake build was unsuccessful. Exit code: $LASTEXITCODE ."
25+ exit $LASTEXITCODE
26+ }
2427
25- ctest - j8 . -- build-config $buildMode -- output- on- failure - E " method_test|tensor_parser_test"
26- if ($LASTEXITCODE -ne 0 ) {
27- Write-Host " CTest run was unsuccessful. Exit code: $LASTEXITCODE ."
28- exit $LASTEXITCODE
29- }
28+ ctest - j8 . -- build-config $buildMode -- output- on- failure - E " method_test|tensor_parser_test"
29+ if ($LASTEXITCODE -ne 0 ) {
30+ Write-Host " CTest run was unsuccessful. Exit code: $LASTEXITCODE ."
31+ exit $LASTEXITCODE
32+ }
3033
31- cd ..
34+ cd ..
35+ }
3236
37+ if ($runPythonTests ) {
3338# Run pytest
34- pytest - v - c pytest- windows.ini
35- if ($LASTEXITCODE -ne 0 ) {
36- Write-Host " Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE ."
37- exit $LASTEXITCODE
38- }
39+ pytest - v - c pytest- windows.ini
40+ if ($LASTEXITCODE -ne 0 ) {
41+ Write-Host " Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE ."
42+ exit $LASTEXITCODE
43+ }
44+ }
0 commit comments