Skip to content

Commit 9ee0494

Browse files
committed
Try testing in OSS
1 parent c9f46e2 commit 9ee0494

File tree

7 files changed

+65
-42
lines changed

7 files changed

+65
-42
lines changed

.ci/scripts/unittest-buck2.sh

Lines changed: 3 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/..."
@@ -35,6 +36,7 @@ for op in "build" "test"; do
3536
buck2 $op $BUILDABLE_OPTIMIZED_OPS \
3637
//examples/selective_build:select_all_dtype_selective_lib_portable_lib \
3738
//kernels/portable/... \
39+
//codegen/tools:test_tools_selective_build \
3840
$BUILDABLE_KERNELS_PRIM_OPS_TARGETS //runtime/backend/... //runtime/core/... \
3941
//runtime/executor: //runtime/kernel/... //runtime/platform/...
4042
done

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: 46 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -196,27 +196,35 @@ def define_common_targets(is_fbcode = False):
196196
_is_external_target = True,
197197
)
198198

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-
)
199+
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+
compiler_flags = [
211+
"-Wno-deprecated-declarations",
212+
"-fPIC",
213+
"-frtti",
214+
"-fexceptions",
215+
"-Werror",
216+
"-Wall",
217+
],
218+
deps = [
219+
"//executorch/runtime/core:core",
220+
"//executorch/schema:program",
221+
],
222+
external_deps = [
223+
"pybind11",
224+
],
225+
use_static_deps = True,
226+
visibility = ["//executorch/codegen/..."],
227+
)
220228

221229

222230
# 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 +263,20 @@ def define_common_targets(is_fbcode = False):
255263
],
256264
)
257265

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