Skip to content

Commit 42e9adc

Browse files
committed
Try testing in OSS
1 parent 95888a4 commit 42e9adc

File tree

6 files changed

+63
-46
lines changed

6 files changed

+63
-46
lines changed

.ci/scripts/unittest-buck2.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ buck2 query "//backends/apple/... + //backends/arm: + //backends/arm/debug/... +
1515
//backends/arm/_passes/... + //backends/arm/runtime/... + //backends/arm/tosa/... \
1616
+ //backends/example/... + \
1717
//backends/mediatek/... + //backends/transforms/... + \
18-
//backends/xnnpack/... + //configurations/... + //extension/flat_tensor: + \
18+
//backends/xnnpack/... + //codegen/tools/... + \
19+
//configurations/... + //extension/flat_tensor: + \
1920
//extension/llm/runner: + //kernels/aten/... + //kernels/optimized/... + \
2021
//kernels/portable/... + //kernels/quantized/... + //kernels/test/... + \
2122
//runtime/... + //schema/... + //test/... + //util/..."
@@ -38,3 +39,6 @@ for op in "build" "test"; do
3839
$BUILDABLE_KERNELS_PRIM_OPS_TARGETS //runtime/backend/... //runtime/core/... \
3940
//runtime/executor: //runtime/kernel/... //runtime/platform/...
4041
done
42+
43+
# Build only without testing
44+
buck2 build //codegen/tools/... # Needs torch for testing which we don't have in our OSS buck setup.

codegen/tools/targets.bzl

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ def define_common_targets(is_fbcode = False):
1717
],
1818
deps = [
1919
"//executorch/codegen:gen_lib",
20-
] + ([] if runtime.is_oss else select({
21-
"DEFAULT": [],
22-
"ovr_config//os:linux": ["//executorch/codegen/tools:selective_build"], # TODO(larryliu0820) :selective_build doesn't build in OSS yet
23-
})),
20+
"//executorch/codegen/tools:selective_build",
21+
],
2422
)
2523

2624
runtime.python_binary(
@@ -29,7 +27,7 @@ def define_common_targets(is_fbcode = False):
2927
deps = [
3028
":gen_oplist_lib",
3129
],
32-
preload_deps = [] if runtime.is_oss else ["//executorch/codegen/tools:selective_build"], # TODO(larryliu0820) :selective_build doesn't build in OSS yet
30+
preload_deps = ["//executorch/codegen/tools:selective_build"],
3331
package_style = "inplace",
3432
visibility = [
3533
"//executorch/...",
@@ -196,27 +194,36 @@ def define_common_targets(is_fbcode = False):
196194
_is_external_target = True,
197195
)
198196

199-
if not runtime.is_oss:
200-
runtime.cxx_python_extension(
201-
name = "selective_build",
202-
srcs = [
203-
"selective_build.cpp",
204-
],
205-
base_module = "executorch.codegen.tools",
206-
types = ["selective_build.pyi"],
207-
preprocessor_flags = [
208-
"-DEXECUTORCH_PYTHON_MODULE_NAME=selective_build",
209-
],
210-
deps = [
211-
"//executorch/runtime/core:core",
212-
"//executorch/schema:program",
213-
],
214-
external_deps = [
215-
"pybind11",
216-
],
217-
use_static_deps = True,
218-
visibility = ["//executorch/codegen/..."],
219-
)
197+
198+
runtime.cxx_python_extension(
199+
name = "selective_build",
200+
srcs = [
201+
"selective_build.cpp",
202+
],
203+
base_module = "executorch.codegen.tools",
204+
types = ["selective_build.pyi"],
205+
preprocessor_flags = [
206+
"-DEXECUTORCH_PYTHON_MODULE_NAME=selective_build",
207+
],
208+
compiler_flags = [
209+
"-Wno-deprecated-declarations",
210+
"-fPIC",
211+
"-frtti",
212+
"-fexceptions",
213+
"-Werror",
214+
"-Wunused-variable",
215+
"-Wno-unknown-argument",
216+
],
217+
deps = [
218+
"//executorch/runtime/core:core",
219+
"//executorch/schema:program",
220+
],
221+
external_deps = [
222+
"pybind11",
223+
],
224+
use_static_deps = True,
225+
visibility = ["//executorch/codegen/..."],
226+
)
220227

221228

222229
# TODO(larryliu0820): This is a hack to only run these two on fbcode. These targets depends on exir which is only available in fbcode.
@@ -255,20 +262,20 @@ def define_common_targets(is_fbcode = False):
255262
],
256263
)
257264

258-
runtime.python_test(
259-
name = "test_selective_build",
260-
srcs = [
261-
"test/test_selective_build.py",
262-
],
263-
package_style = "inplace",
264-
visibility = [
265-
"PUBLIC",
266-
],
267-
deps = [
268-
":selective_build",
269-
"fbsource//third-party/pypi/expecttest:expecttest",
270-
"//caffe2:torch",
271-
"//executorch/exir:lib",
272-
],
273-
_is_external_target = True,
274-
)
265+
runtime.python_test(
266+
name = "test_tools_selective_build",
267+
srcs = [
268+
"test/test_tools_selective_build.py",
269+
],
270+
package_style = "inplace",
271+
visibility = [
272+
"PUBLIC",
273+
],
274+
deps = [
275+
":selective_build",
276+
"fbsource//third-party/pypi/expecttest:expecttest",
277+
"//caffe2:torch",
278+
"//executorch/exir:lib",
279+
],
280+
_is_external_target = True,
281+
)
File renamed without changes.

extension/pytree/TARGETS

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ runtime.cxx_python_extension(
1515
],
1616
base_module = "executorch.extension.pytree",
1717
deps = [
18-
"fbsource//third-party/pybind11:pybind11",
1918
":pytree",
2019
],
20+
external_deps = [
21+
"pybind11",
22+
],
2123
)
2224

2325
runtime.cxx_python_extension(
@@ -27,9 +29,11 @@ runtime.cxx_python_extension(
2729
],
2830
base_module = "executorch.extension.pytree",
2931
deps = [
30-
"fbsource//third-party/pybind11:pybind11",
3132
":pytree",
3233
],
34+
external_deps = [
35+
"pybind11",
36+
],
3337
)
3438

3539
runtime.python_library(

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ addopts =
3131

3232
# codegen
3333
codegen/test
34+
codegen/tools/test/test_tools_selective_build.py
3435

3536
# devtools
3637
devtools/

shim_et/xplat/executorch/build/runtime_wrapper.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ def _python_binary(*args, **kwargs):
346346

347347
def _python_test(*args, **kwargs):
348348
_patch_kwargs_common(kwargs)
349+
_remove_caffe2_deps(kwargs)
349350
env.python_test(*args, **kwargs)
350351

351352
def get_oss_build_kwargs():

0 commit comments

Comments
 (0)