Skip to content

Commit 71787e1

Browse files
committed
Try testing in OSS
1 parent 0329a8a commit 71787e1

File tree

7 files changed

+70
-47
lines changed

7 files changed

+70
-47
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/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@ target_include_directories(
2424

2525
# Compile options
2626
target_compile_options(
27-
selective_build PUBLIC -Wno-deprecated-declarations -fPIC -frtti -fexceptions
27+
selective_build
28+
PUBLIC -Wno-deprecated-declarations
29+
-fPIC
30+
-frtti
31+
-fexceptions
32+
-Werror
33+
-Wunused-variable
34+
-Wno-unknown-argument
2835
)
2936

3037
# Link against required libraries

codegen/tools/targets.bzl

Lines changed: 49 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,35 @@ 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+
"-Wall",
215+
],
216+
deps = [
217+
"//executorch/runtime/core:core",
218+
"//executorch/schema:program",
219+
],
220+
external_deps = [
221+
"pybind11",
222+
],
223+
use_static_deps = True,
224+
visibility = ["//executorch/codegen/..."],
225+
)
220226

221227

222228
# 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 +261,20 @@ def define_common_targets(is_fbcode = False):
255261
],
256262
)
257263

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-
)
264+
runtime.python_test(
265+
name = "test_tools_selective_build",
266+
srcs = [
267+
"test/test_tools_selective_build.py",
268+
],
269+
package_style = "inplace",
270+
visibility = [
271+
"PUBLIC",
272+
],
273+
deps = [
274+
":selective_build",
275+
"fbsource//third-party/pypi/expecttest:expecttest",
276+
"//caffe2:torch",
277+
"//executorch/exir:lib",
278+
],
279+
_is_external_target = True,
280+
)

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)