From 12e8d9fbfb875a0c2c17e014dcd215deb5456269 Mon Sep 17 00:00:00 2001 From: Gregory James Comer Date: Wed, 3 Sep 2025 17:42:24 -0700 Subject: [PATCH] Update [ghstack-poisoned] --- .ci/scripts/test_model.ps1 | 2 +- .ci/scripts/unittest-windows.ps1 | 27 ++++++++++++++++++++++++--- .github/workflows/_unittest.yml | 4 ++-- .github/workflows/trunk.yml | 8 ++++---- 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.ci/scripts/test_model.ps1 b/.ci/scripts/test_model.ps1 index 2ff2e7c890d..19d70c591ac 100644 --- a/.ci/scripts/test_model.ps1 +++ b/.ci/scripts/test_model.ps1 @@ -34,7 +34,7 @@ function ExportModel-Xnnpack { [bool]$quantize ) - if $(quantize) { + if ($quantize) { python -m examples.xnnpack.aot_compiler --model_name="${MODEL_NAME}" --delegate --quantize | Write-Host $modelFile = "$($modelName)_xnnpack_q8.pte" } else { diff --git a/.ci/scripts/unittest-windows.ps1 b/.ci/scripts/unittest-windows.ps1 index 65ed303051b..62435112575 100644 --- a/.ci/scripts/unittest-windows.ps1 +++ b/.ci/scripts/unittest-windows.ps1 @@ -6,10 +6,31 @@ Set-PSDebug -Trace 1 $ErrorActionPreference = 'Stop' $PSNativeCommandUseErrorActionPreference = $true -# Run pytest with coverage -# pytest -n auto --cov=./ --cov-report=xml -pytest -v --full-trace -c pytest-windows.ini +# Run pytest +pytest -v pytest-windows.ini if ($LASTEXITCODE -ne 0) { Write-Host "Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE." exit $LASTEXITCODE } + +# Run native unit tests (via ctest) +New-Item -Path "test-build" -ItemType Directory +cd "test-build" + +cmake .. --preset Windows -DCMAKE_BUILD_TESTS=ON +if ($LASTEXITCODE -ne 0) { + Write-Host "CMake configuration was unsuccessful. Exit code: $LASTEXITCODE." + exit $LASTEXITCODE +} + +cmake --build . -j8 --config Release +if ($LASTEXITCODE -ne 0) { + Write-Host "CMake build was unsuccessful. Exit code: $LASTEXITCODE." + exit $LASTEXITCODE +} + +ctest -j8 +if ($LASTEXITCODE -ne 0) { + Write-Host "CTest run was unsuccessful. Exit code: $LASTEXITCODE." + exit $LASTEXITCODE +} diff --git a/.github/workflows/_unittest.yml b/.github/workflows/_unittest.yml index a619b33dd2e..52c121099f1 100644 --- a/.github/workflows/_unittest.yml +++ b/.github/workflows/_unittest.yml @@ -69,7 +69,7 @@ jobs: \$ErrorActionPreference = 'Stop' \$PSNativeCommandUseErrorActionPreference = \$true - .ci/scripts/setup-windows.ps1 + .ci/scripts/setup-windows.ps1 - powershell .ci/scripts/unittest-windows.ps1 -editable "${{ inputs.editable }}" + .ci/scripts/unittest-windows.ps1 -editable "${{ inputs.editable }}" }" diff --git a/.github/workflows/trunk.yml b/.github/workflows/trunk.yml index 8eecf950e61..7bf9d022a20 100644 --- a/.github/workflows/trunk.yml +++ b/.github/workflows/trunk.yml @@ -993,13 +993,13 @@ jobs: timeout: 60 script: | conda init powershell - + powershell -Command "& { Set-PSDebug -Trace 1 \$ErrorActionPreference = 'Stop' \$PSNativeCommandUseErrorActionPreference = \$true - .ci/scripts/setup-windows.ps1 + .ci/scripts/setup-windows.ps1 - powershell .ci/scripts/test_model.ps1 -modelName ${{ matrix.model }} -backend ${{ matrix.backend }} - }" \ No newline at end of file + .ci/scripts/test_model.ps1 -modelName ${{ matrix.model }} -backend ${{ matrix.backend }} + }"