Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.1k
[Windows] Run Python unit test CI on Windows#13716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
d6a70d618866f4e7423a4323d96cbca23f5ab69e35c47d467cd8e9bccb6087119dda19cd0178fed4cffd934682fef62839441fd5f7010cf33cfae60b583635ed133f7228e146b64bd0ffe40834b97ba635be90d9f15e67433da5e32a6f87b8ce9df7d5efbf9e918a783a12680f0511c6dcc1ad94fcf61e3b38d5a2bc56f36e392b682b7858e2bf0b0fe214c0f7db054e075beda1056d73a644981b9b95100ffef28664d51ca165c7a3be73a9b3c472c46506deca7e47ecf4665fa1b4975c0dd42c76e310612cec00f9fdc5aad0d66480f09c07b3463083701d9173ed5e0d149e198cd72d138641715b64800aa3b41b80338b55594f920c64f6b48e0170b980c2706db0fdd8e12edfd321b41ddeefd3d9c38a4a0e3fbde97dFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| param ( | ||
| [string]$editable | ||
| ) | ||
| Set-PSDebug -Trace 1 | ||
| $ErrorActionPreference = 'Stop' | ||
| $PSNativeCommandUseErrorActionPreference = $true | ||
| conda create --yes --quiet -n et python=3.12 | ||
| conda activate et | ||
| # Activate the VS environment - this is required for Dynamo to work, as it uses MSVC. | ||
| # There are a bunch of environment variables that it requires. | ||
| # See https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line. | ||
| & "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 | ||
| # Install test dependencies | ||
| pip install -r .ci/docker/requirements-ci.txt | ||
| if ($editable -eq 'true') { | ||
| install_executorch.bat --editable | ||
| } else { | ||
| install_executorch.bat | ||
| } | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Host "Installation was unsuccessful. Exit code: $LASTEXITCODE." | ||
| exit $LASTEXITCODE | ||
| } | ||
| # Run pytest with coverage | ||
| # pytest -n auto --cov=./ --cov-report=xml | ||
| pytest -v --full-trace -c pytest-windows.ini | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Host "Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE." | ||
| exit $LASTEXITCODE | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -65,3 +65,7 @@ xcuserdata/ | ||
| # Android | ||
| *.aar | ||
| # Windows | ||
| *.dll | ||
| *.pyd | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import sys | ||
| collect_ignore_glob: list[str] = [] | ||
| # Skip Apple tests on Windows. Note that some Core ML tests can run on Linux, as the AOT flow | ||
| # is available. Tests will manage this internally. However, the coremltools import is not available | ||
| # on Windows and causes collection to fail. The easiest way to manage this seems to be to just | ||
| # skip collection for this subdirectory on unsupported platforms. | ||
| if sys.platform == "win32": | ||
| collect_ignore_glob += [ | ||
| "backends/apple/**", | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| # NOTE: This file is a copy of pytest.ini, but with additional tests disabled for Windows. This | ||
| # is intended to be a short-term solution to allow for incrementally enabling tests on Windows. | ||
| # This file is intended to be deleted once the enablement is complete. | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. create an issue to track deletion of this file please ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Filed as #13883. | ||
| [pytest] | ||
| addopts = | ||
| # show summary of all tests that did not pass | ||
| -rEfX | ||
| # Make tracebacks shorter | ||
| --tb=native | ||
| # capture only Python print and C++ py::print, but not C output (low-level Python errors) | ||
| --capture=sys | ||
| # don't suppress warnings, but don't shove them all to the end either | ||
| -p no:warnings | ||
| # Ignore backends/arm tests you need to run examples/arm/setup.sh to install some tool to make them work | ||
| # For GitHub testing this is setup/executed in the unittest-arm job see .github/workflows/pull.yml for more info. | ||
| --ignore-glob=backends/arm/**/* | ||
| # explicitly list out tests that are running successfully in oss | ||
| .ci/scripts/tests | ||
| examples/models/test | ||
| devtools/ | ||
| --ignore=devtools/visualization/visualization_utils_test.py | ||
| # examples | ||
| # examples/models/llava/test TODO: enable this | ||
| # exir | ||
| exir/_serialize/test | ||
| exir/backend/test | ||
| exir/dialects/backend/test | ||
| exir/dialects/edge/test | ||
| exir/dialects/test | ||
| exir/emit/test | ||
| exir/program/test | ||
| exir/tests/ | ||
| # executorch/export | ||
| export/tests | ||
| --ignore=export/tests/test_export_stages.py | ||
| # kernels/ | ||
| kernels/prim_ops/test | ||
| kernels/quantized | ||
| # Because this test depends on test only cpp ops lib | ||
| # Will add test only cmake targets to re-enable this test | ||
| # but maybe it is a bit of anti-pattern | ||
| --ignore=kernels/quantized/test/test_quant_dequant_per_token.py | ||
| kernels/test/test_case_gen.py | ||
| # backends/test | ||
| # This effort is WIP and will be enabled in CI once testing infra | ||
| # is stable and signal to noise ratio is good (no irrelevant failures). | ||
| # See https://github.com/pytorch/executorch/discussions/11140 | ||
| --ignore=backends/test | ||
| backends/test/harness/tests | ||
| backends/test/suite/tests | ||
| # backends/xnnpack | ||
| backends/xnnpack/test/ops | ||
| --ignore=backends/xnnpack/test/ops/test_bmm.py | ||
| --ignore=backends/xnnpack/test/ops/test_conv2d.py | ||
| --ignore=backends/xnnpack/test/ops/test_linear.py | ||
| --ignore=backends/xnnpack/test/ops/test_sdpa.py | ||
| backends/xnnpack/test/passes | ||
| backends/xnnpack/test/recipes | ||
| backends/xnnpack/test/serialization | ||
| # backends/apple/coreml | ||
| backends/apple/coreml/test | ||
| # extension/ | ||
| extension/llm/custom_ops/test_sdpa_with_kv_cache.py | ||
| extension/llm/custom_ops/test_update_cache.py | ||
| extension/llm/custom_ops/test_quantized_sdpa.py | ||
| extension/pybindings/test | ||
| extension/training/pybindings/test | ||
| # Runtime | ||
| runtime | ||
| # Tools | ||
| codegen/test | ||
| tools/cmake | ||
| # test TODO: fix these tests | ||
| # test/end2end/test_end2end.py | ||
| --ignore=backends/xnnpack/test/ops/linear.py | ||
| --ignore=backends/xnnpack/test/models/llama2_et_example.py | ||
| # T200992559: Add torchao to ET as core dependency | ||
| --ignore=examples/models/llama/tests/test_pre_quantization_transforms.py | ||
| --ignore=exir/backend/test/demos | ||
| --ignore=exir/backend/test/test_backends.py | ||
| --ignore=exir/backend/test/test_backends_lifted.py | ||
| --ignore=exir/backend/test/test_partitioner.py | ||
| --ignore=exir/tests/test_common.py | ||
| --ignore=exir/tests/test_memory_format_ops_pass_aten.py | ||
| --ignore=exir/tests/test_memory_planning.py | ||
| --ignore=exir/tests/test_op_convert.py | ||
| --ignore=exir/tests/test_passes.py | ||
| --ignore=exir/tests/test_quant_fusion_pass.py | ||
| --ignore=exir/tests/test_quantization.py | ||
| --ignore=exir/tests/test_verification.py | ||
| # Tests that are (temporarily) disabled for Windows | ||
| # TODO(gjcomer) Re-enable the LLM tests when tokenizers library is available on Windows. | ||
| #examples/models/llama3_2_vision/preprocess | ||
| #examples/models/llama3_2_vision/vision_encoder/test | ||
| #examples/models/llama3_2_vision/text_decoder/test | ||
| #examples/models/llama/tests | ||
| #examples/models/llama/config | ||
| #extension/llm/modules/test | ||
| #extension/llm/export | ||
| --deselect=extension/pybindings/test/test_pybindings.py::PybindingsTest::test_method_quantized_ops | ||
| --deselect=extension/pybindings/test/test_pybindings.py::PybindingsTest::test_quantized_ops | ||
| --deselect=runtime/test/test_runtime.py::RuntimeTest::test_load_program_with_path | ||
| --deselect=exir/backend/test/test_compatibility.py::TestCompatibility::test_compatibility_in_runtime | ||
| --deselect=exir/backend/test/test_compatibility.py::TestCompatibility::test_compatibility_in_runtime_edge_program_manager | ||
| --deselect=exir/backend/test/test_lowered_backend_module.py::TestBackendAPI::test_emit_lowered_backend_module_end_to_end | ||
| --deselect=exir/backend/test/test_to_backend_multi_method.py::TestToBackendMultiMethod::test_multi_method_end_to_end | ||
| --deselect=extension/llm/custom_ops/test_sdpa_with_kv_cache.py::SDPATestForSpeculativeDecode::test_sdpa_with_cache_seq_len_130 | ||
| --deselect=devtools/inspector/tests/inspector_test.py::TestInspector::test_etrecord_populates_correct_edge_dialect_aot_intermediate_outputs | ||
| --deselect=devtools/inspector/tests/inspector_test.py::TestInspector::test_etrecord_populates_correct_export_program_aot_intermediate_outputs | ||
| # run the same tests multiple times to determine their | ||
| # flakiness status. Default to 50 re-runs | ||
| flake-finder = true | ||
| flake-runs = 50 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -28,8 +28,8 @@ endif() | ||
| # We use ExternalProject to build flatc from source to force it target the host. | ||
| # Otherwise, flatc will target the project's toolchain (i.e. iOS, or Android). | ||
| ExternalProject_Add( | ||
| flatbuffers_external_project | ||
| PREFIX ${CMAKE_CURRENT_BINARY_DIR}/flatbuffers_external_project | ||
| flatbuffers_ep | ||
| PREFIX ${CMAKE_CURRENT_BINARY_DIR}/flatc_proj | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't it flatbuffers_ep? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was intentional, though I can rename it if desired. Flatbuffers builds flatc (distinct from flatcc). The path limitations are pretty tight in CI so I squeezed out a few more characters. | ||
| SOURCE_DIR ${PROJECT_SOURCE_DIR}/third-party/flatbuffers | ||
| CMAKE_ARGS -DFLATBUFFERS_BUILD_FLATC=ON | ||
| -DFLATBUFFERS_INSTALL=ON | ||
| @@ -46,9 +46,9 @@ ExternalProject_Add( | ||
| BUILD_BYPRODUCTS <INSTALL_DIR>/bin/flatc | ||
| ${_executorch_external_project_additional_args} | ||
| ) | ||
| ExternalProject_Get_Property(flatbuffers_external_project INSTALL_DIR) | ||
| ExternalProject_Get_Property(flatbuffers_ep INSTALL_DIR) | ||
| add_executable(flatc IMPORTED GLOBAL) | ||
| add_dependencies(flatc flatbuffers_external_project) | ||
| add_dependencies(flatc flatbuffers_ep) | ||
| if(WIN32 AND NOT CMAKE_CROSSCOMPILING) | ||
| # flatbuffers does not use CMAKE_BUILD_TYPE. Internally, the build forces Release | ||
| # config, but from CMake's perspective the build type is always Debug. | ||
| @@ -79,8 +79,8 @@ endif() | ||
| # Similar to flatbuffers, we want to build flatcc for the host. See inline comments | ||
| # in the flatbuffers ExternalProject_Add for more details. | ||
| ExternalProject_Add( | ||
| flatcc_external_project | ||
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to resolve path length issues. | ||
| PREFIX ${CMAKE_CURRENT_BINARY_DIR}/flatcc_external_project | ||
| flatcc_ep | ||
| PREFIX ${CMAKE_CURRENT_BINARY_DIR}/flatcc_ep | ||
| SOURCE_DIR ${PROJECT_SOURCE_DIR}/third-party/flatcc | ||
| CMAKE_ARGS -DFLATCC_RTONLY=OFF | ||
| -DFLATCC_TEST=OFF | ||
| @@ -98,9 +98,9 @@ ExternalProject_Add( | ||
| {_executorch_external_project_additional_args} | ||
| ) | ||
| file(REMOVE_RECURSE ${PROJECT_SOURCE_DIR}/third-party/flatcc/lib) | ||
| ExternalProject_Get_Property(flatcc_external_project INSTALL_DIR) | ||
| ExternalProject_Get_Property(flatcc_ep INSTALL_DIR) | ||
| add_executable(flatcc_cli IMPORTED GLOBAL) | ||
| add_dependencies(flatcc_cli flatcc_external_project) | ||
| add_dependencies(flatcc_cli flatcc_ep) | ||
| if(WIN32 AND NOT CMAKE_CROSSCOMPILING) | ||
| set_target_properties(flatcc_cli PROPERTIES IMPORTED_LOCATION ${INSTALL_DIR}/bin/flatcc.exe) | ||
| else() | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this change? is lib name something different on windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's named quantized_ops_aot_lib.dll (no lib prefix). We could maybe force the dll to have the lib prefix in the filename in cmake, but it seemed more idiomatic to do this.