Skip to content

Commit 824bcaf

Browse files
digantdesaifacebook-github-bot
authored andcommitted
Build public API manifest tests in OSS buck only
Summary: The Arm public API manifest / backward-compatibility feature added two unit tests (`misc/test_public_api_manifest.py`, `misc/test_validate_public_api_manifest.py`) and wired the `:public_api` / `public_api_manifest` libraries into the shared `deps` of every Arm op/pass test in `define_arm_tests`. `:public_api` is the top-level `executorch/backends/arm/__init__.py`, which eagerly imports torch, so pytest now imports it while collecting every test — and that import fails in the packaged buck build, breaking test listing for the whole Arm test suite. Build the two manifest unit tests and those deps only in OSS (`runtime.is_oss`), where they are covered by the dedicated public-API backward-compatibility CI job. Op/pass tests no longer pull in the top-level package `__init__`. Authored with Claude. Reviewed By: Gasoonjia Differential Revision: D109918480
1 parent 9e23c9c commit 824bcaf

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

backends/arm/test/targets.bzl

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ def define_arm_tests():
6161
"misc/tosa_dialect/test_tosa_dialect_mxfp_conv2d.py",
6262
"misc/tosa_dialect/test_tosa_dialect_mxfp_linear.py",
6363
"misc/tosa_dialect/test_tosa_resize.py",
64-
"misc/test_public_api_manifest.py",
65-
"misc/test_validate_public_api_manifest.py",
6664
"misc/test_tosa_spec.py",
6765
"misc/test_bn_relu_folding_qat.py",
6866
"misc/test_custom_partition.py",
@@ -81,6 +79,16 @@ def define_arm_tests():
8179
"deprecation/test_arm_compile_spec_deprecation.py",
8280
]
8381

82+
# These import the top-level executorch.backends.arm package, whose
83+
# __init__ eagerly imports torch. Pulling that into pytest collection fails
84+
# in the packaged (non-OSS) build, so build them in OSS only; the public API
85+
# surface is covered by a dedicated backward-compatibility CI job.
86+
if runtime.is_oss:
87+
test_files += [
88+
"misc/test_public_api_manifest.py",
89+
"misc/test_validate_public_api_manifest.py",
90+
]
91+
8492
TESTS = {}
8593

8694
for test_file in test_files:
@@ -116,8 +124,6 @@ def define_arm_tests():
116124
"//executorch/backends/arm/test:mxfp_test_common",
117125
"//executorch/backends/arm/test/misc:dw_convs_shared_weights_module",
118126
"//executorch/backends/arm:ao_ext",
119-
"//executorch/backends/arm/scripts/public_api_manifest:public_api_manifest",
120-
"//executorch/backends/arm:public_api",
121127
"//executorch/backends/arm:ethosu",
122128
"//executorch/backends/arm/tosa:compile_spec",
123129
"//executorch/backends/arm/tosa:partitioner",
@@ -129,5 +135,11 @@ def define_arm_tests():
129135
"fbsource//third-party/pypi/pytest:pytest",
130136
"fbsource//third-party/pypi/parameterized:parameterized",
131137
"fbsource//third-party/tosa_tools:tosa_reference_model",
132-
],
138+
] + ([
139+
# Needed only by the OSS-only public API manifest tests above.
140+
# Depending on them everywhere drags the top-level package
141+
# __init__ (and its torch import) into pytest collection.
142+
"//executorch/backends/arm/scripts/public_api_manifest:public_api_manifest",
143+
"//executorch/backends/arm:public_api",
144+
] if runtime.is_oss else []),
133145
)

0 commit comments

Comments
 (0)