Skip to content

Commit 45443d6

Browse files
committed
Test most of //runtime in unittest buck
Ended up having to skip //runtime/test/..., which means some previous PRs aren't strictly necessary, so don't feel obliged to accept them all. ghstack-source-id: 1d0cf52 ghstack-comment-id: 2683602764 Pull Request resolved: #8713
1 parent fee4157 commit 45443d6

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

.ci/scripts/unittest-buck2.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ buck2 query "//backends/apple/... + //backends/example/... + \
1414
//runtime/... + //schema/... + //test/... + //util/..."
1515

1616
# TODO: expand the covered scope of Buck targets.
17-
buck2 build //runtime/core/portable_type/...
18-
buck2 test //runtime/core/portable_type/...
17+
# //runtime/kernel/... is failing because //third-party:torchgen_files's shell script can't find python on PATH.
18+
# //runtime/test/... requires Python torch, which we don't have in our OSS buck setup.
19+
buck2 build //runtime/backend/... //runtime/core/... //runtime/executor: //runtime/kernel/... //runtime/platform/...
20+
buck2 test //runtime/backend/... //runtime/core/... //runtime/executor: //runtime/kernel/... //runtime/platform/...
Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
1+
load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "get_aten_mode_options", "runtime")
22

33
def define_common_targets():
44
"""Defines targets that should be shared between fbcode and xplat.
@@ -15,19 +15,15 @@ def define_common_targets():
1515
],
1616
)
1717

18-
runtime.cxx_test(
19-
name = "tensor_factory_test",
20-
srcs = ["tensor_factory_test.cpp"],
21-
deps = [
22-
"//executorch/runtime/core/exec_aten/testing_util:tensor_util",
23-
],
24-
)
18+
for aten_mode in get_aten_mode_options():
19+
aten_suffix = "_aten" if aten_mode else ""
20+
preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_mode else []
2521

26-
runtime.cxx_test(
27-
name = "tensor_factory_test_aten",
28-
srcs = ["tensor_factory_test.cpp"],
29-
preprocessor_flags = ["-DUSE_ATEN_LIB"],
30-
deps = [
31-
"//executorch/runtime/core/exec_aten/testing_util:tensor_util_aten",
32-
],
33-
)
22+
runtime.cxx_test(
23+
name = "tensor_factory_test" + aten_suffix,
24+
srcs = ["tensor_factory_test.cpp"],
25+
preprocessor_flags = preprocessor_flags,
26+
deps = [
27+
"//executorch/runtime/core/exec_aten/testing_util:tensor_util" + aten_suffix,
28+
],
29+
)

runtime/core/test/targets.bzl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,15 @@ def define_common_targets():
9393
],
9494
)
9595

96-
runtime.cxx_test(
97-
name = "tensor_shape_dynamism_test_aten",
98-
srcs = ["tensor_shape_dynamism_test_aten.cpp"],
99-
deps = [
100-
"//executorch/runtime/core/exec_aten:lib_aten",
101-
"//executorch/runtime/core/exec_aten/testing_util:tensor_util_aten",
102-
],
103-
)
96+
if True in get_aten_mode_options():
97+
runtime.cxx_test(
98+
name = "tensor_shape_dynamism_test_aten",
99+
srcs = ["tensor_shape_dynamism_test_aten.cpp"],
100+
deps = [
101+
"//executorch/runtime/core/exec_aten:lib_aten",
102+
"//executorch/runtime/core/exec_aten/testing_util:tensor_util_aten",
103+
],
104+
)
104105

105106
for aten_mode in get_aten_mode_options():
106107
aten_suffix = "_aten" if aten_mode else ""

0 commit comments

Comments
 (0)