Skip to content

Commit 10e93fb

Browse files
authored
Revert "[Windows] Run native unit tests in CI (#13923)" (#14286)
This reverts commit f1ca55a.
1 parent 233063c commit 10e93fb

File tree

31 files changed

+112
-236
lines changed

31 files changed

+112
-236
lines changed

.ci/scripts/setup-windows.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
param (
2-
[string]$editable = "false"
2+
[string]$editable = $false
33
)
44

55
conda create --yes --quiet -n et python=3.12

.ci/scripts/unittest-windows.ps1

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,15 @@
11
param (
2-
[string]$buildMode = "Release"
2+
[string]$editable = $false
33
)
44

55
Set-PSDebug -Trace 1
66
$ErrorActionPreference = 'Stop'
77
$PSNativeCommandUseErrorActionPreference = $true
88

9-
# Run native unit tests (via ctest)
10-
New-Item -Path "test-build" -ItemType Directory
11-
cd "test-build"
12-
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-
}
18-
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-
}
24-
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-
}
30-
31-
cd ..
32-
33-
# Run pytest
34-
pytest -v -c pytest-windows.ini
9+
# Run pytest with coverage
10+
# pytest -n auto --cov=./ --cov-report=xml
11+
pytest -v --full-trace -c pytest-windows.ini
3512
if ($LASTEXITCODE -ne 0) {
3613
Write-Host "Pytest invocation was unsuccessful. Exit code: $LASTEXITCODE."
3714
exit $LASTEXITCODE
38-
}
15+
}

.github/workflows/_unittest.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,7 @@ jobs:
6969
\$ErrorActionPreference = 'Stop'
7070
\$PSNativeCommandUseErrorActionPreference = \$true
7171
72-
.ci/scripts/setup-windows.ps1 -editable "${{ inputs.editable }}"
73-
if (\$LASTEXITCODE -ne 0) {
74-
Write-Host "Setup failed. Exit code: \$LASTEXITCODE."
75-
exit \$LASTEXITCODE
76-
}
72+
.ci/scripts/setup-windows.ps1
7773
78-
.ci/scripts/unittest-windows.ps1 -buildMode "${{ inputs.build-mode }}"
79-
if (\$LASTEXITCODE -ne 0) {
80-
Write-Host "Unit tests failed. Exit code: \$LASTEXITCODE."
81-
exit \$LASTEXITCODE
82-
}
74+
powershell .ci/scripts/unittest-windows.ps1 -editable "${{ inputs.editable }}"
8375
}"

.github/workflows/trunk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,5 +1032,5 @@ jobs:
10321032
10331033
.ci/scripts/setup-windows.ps1
10341034
1035-
.ci/scripts/test_model.ps1 -modelName ${{ matrix.model }} -backend ${{ matrix.backend }}
1035+
powershell .ci/scripts/test_model.ps1 -modelName ${{ matrix.model }} -backend ${{ matrix.backend }}
10361036
}"

CMakeLists.txt

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,9 @@ endif()
143143

144144
# -ffunction-sections -fdata-sections: breaks function and data into sections so
145145
# they can be properly gc'd. -s: strip symbol.
146-
if(WIN32)
147-
set(CMAKE_CXX_FLAGS_RELEASE "/Gy /Gw ${CMAKE_CXX_FLAGS_RELEASE}")
148-
else()
149-
set(CMAKE_CXX_FLAGS_RELEASE
150-
"-ffunction-sections -fdata-sections ${CMAKE_CXX_FLAGS_RELEASE}"
151-
)
152-
endif()
146+
set(CMAKE_CXX_FLAGS_RELEASE
147+
"-ffunction-sections -fdata-sections ${CMAKE_CXX_FLAGS_RELEASE}"
148+
)
153149
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
154150
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
155151
endif()

backends/xnnpack/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ foreach(fbs_file ${_xnnpack_schema__srcs})
5959
)
6060
endforeach()
6161

62-
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
62+
if(WIN32 AND NOT CMAKE_CROSSCOMPILING)
6363
set(MV_COMMAND
6464
powershell -Command
6565
"Move-Item -Path ${_xnnpack_flatbuffer__outputs} -Destination ${_xnnpack_schema__outputs} -Force"

export/target_recipes.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,26 @@
1111
selection and combine multiple backends optimally for target hardware.
1212
"""
1313

14-
import sys
1514
from typing import Dict, List
1615

17-
if sys.platform != "win32":
18-
import coremltools as ct
19-
from executorch.backends.apple.coreml.recipes import CoreMLRecipeType
16+
import coremltools as ct
2017

2118
# pyre-ignore
19+
from executorch.backends.apple.coreml.recipes import CoreMLRecipeType
2220
from executorch.backends.xnnpack.recipes import XNNPackRecipeType
2321
from executorch.export.recipe import ExportRecipe, RecipeType
2422

2523

2624
## IOS Target configs
2725
# The following list of recipes are not exhaustive for CoreML; refer to CoreMLRecipeType for more detailed recipes.
28-
IOS_CONFIGS: Dict[str, List[RecipeType]] = (
29-
{
30-
# pyre-ignore
31-
"ios-arm64-coreml-fp32": [CoreMLRecipeType.FP32, XNNPackRecipeType.FP32],
32-
# pyre-ignore
33-
"ios-arm64-coreml-fp16": [CoreMLRecipeType.FP16],
34-
# pyre-ignore
35-
"ios-arm64-coreml-int8": [CoreMLRecipeType.PT2E_INT8_STATIC],
36-
}
37-
if sys.platform != "win32"
38-
else {}
39-
)
26+
IOS_CONFIGS: Dict[str, List[RecipeType]] = {
27+
# pyre-ignore
28+
"ios-arm64-coreml-fp32": [CoreMLRecipeType.FP32, XNNPackRecipeType.FP32],
29+
# pyre-ignore
30+
"ios-arm64-coreml-fp16": [CoreMLRecipeType.FP16],
31+
# pyre-ignore
32+
"ios-arm64-coreml-int8": [CoreMLRecipeType.PT2E_INT8_STATIC],
33+
}
4034

4135

4236
def _create_target_recipe(

export/tests/test_target_recipes.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,17 @@
77
# pyre-strict
88

99
import logging
10-
import sys
1110
import unittest
1211

1312
import torch
13+
from executorch.backends.apple.coreml.recipes import CoreMLRecipeProvider # pyre-ignore
1414
from executorch.backends.xnnpack.recipes.xnnpack_recipe_provider import (
1515
XNNPACKRecipeProvider,
1616
)
1717
from executorch.export import export, recipe_registry
1818
from executorch.export.target_recipes import get_ios_recipe
1919
from executorch.runtime import Runtime
2020

21-
if sys.platform != "win32":
22-
from executorch.backends.apple.coreml.recipes import ( # pyre-ignore
23-
CoreMLRecipeProvider,
24-
)
25-
2621

2722
class TestTargetRecipes(unittest.TestCase):
2823
"""Test target recipes."""
@@ -31,14 +26,12 @@ def setUp(self) -> None:
3126
torch._dynamo.reset()
3227
super().setUp()
3328
recipe_registry.register_backend_recipe_provider(XNNPACKRecipeProvider())
34-
if sys.platform != "win32":
35-
# pyre-ignore
36-
recipe_registry.register_backend_recipe_provider(CoreMLRecipeProvider())
29+
# pyre-ignore
30+
recipe_registry.register_backend_recipe_provider(CoreMLRecipeProvider())
3731

3832
def tearDown(self) -> None:
3933
super().tearDown()
4034

41-
@unittest.skipIf(sys.platform == "win32", "Core ML is not available on Windows.")
4235
def test_ios_fp32_recipe_with_xnnpack_fallback(self) -> None:
4336
# Linear ops skipped by coreml but handled by xnnpack
4437
class Model(torch.nn.Module):
@@ -114,7 +107,6 @@ def forward(self, x, y):
114107
et_output = session.run_method("forward", example_inputs[0])
115108
logging.info(f"et output {et_output}")
116109

117-
@unittest.skipIf(sys.platform == "win32", "Core ML is not available on Windows.")
118110
def test_ios_quant_recipes(self) -> None:
119111
class Model(torch.nn.Module):
120112
def __init__(self):

extension/evalue_util/test/print_evalue_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ TEST(PrintEvalueTest, UnelidedBoolLists) {
267267
// case; the other scalar types use the same underlying code, so they don't
268268
// need to test this again.
269269
{
270-
EValue value(ArrayRef<bool>(list.data(), static_cast<size_t>(0ul)));
270+
EValue value(ArrayRef<bool>(list.data(), 0ul));
271271
expect_output(value, "(len=0)[]");
272272
}
273273
{
@@ -419,7 +419,7 @@ TEST(PrintEvalueTest, UnelidedDoubleLists) {
419419
std::array<double, 6> list = {-2.2, -1, 0, INFINITY, NAN, 3.3};
420420

421421
{
422-
EValue value(ArrayRef<double>(list.data(), static_cast<size_t>(0ul)));
422+
EValue value(ArrayRef<double>(list.data(), 0ul));
423423
expect_output(value, "(len=0)[]");
424424
}
425425
{

extension/flat_tensor/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ add_custom_command(
2323
"${CMAKE_CURRENT_BINARY_DIR}/ModuleAddMulProgram.ptd"
2424
COMMAND
2525
${PYTHON_EXECUTABLE} -m test.models.export_program --modules "ModuleAddMul"
26-
--external-constants --outdir "${CMAKE_CURRENT_BINARY_DIR}"
26+
--external-constants --outdir "${CMAKE_CURRENT_BINARY_DIR}" 2> /dev/null
2727
WORKING_DIRECTORY ${EXECUTORCH_ROOT}
2828
)
2929

0 commit comments

Comments
 (0)