Skip to content

Commit 9b4a784

Browse files
hsharma35facebook-github-bot
authored andcommitted
Allow backends/cadence to use TestUtil.h. (#7304)
Summary: Create a separate buck target for `TestUtil.h` that can be used by backends. The current `test_util` target has dependencies that don't compile for xtensa toolchain. Reviewed By: zonglinpeng Differential Revision: D67128600
1 parent 61b9e1b commit 9b4a784

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

kernels/test/targets.bzl

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,29 @@ def define_common_targets():
4141

4242
for aten_kernel in (True, False):
4343
aten_suffix = "_aten" if aten_kernel else ""
44+
runtime.cxx_library(
45+
name = "gtest_utils" + aten_suffix,
46+
exported_headers=[
47+
"TestUtil.h",
48+
],
49+
visibility = [
50+
"//executorch/kernels/...",
51+
"@EXECUTORCH_CLIENTS",
52+
],
53+
preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_kernel else [],
54+
exported_deps = [
55+
"//executorch/runtime/core:core",
56+
"//executorch/runtime/kernel:kernel_includes",
57+
"//executorch/test/utils:utils" + aten_suffix,
58+
"//executorch/runtime/platform:pal_interface",
59+
],
60+
fbcode_exported_deps = [
61+
"//common/gtest:gtest",
62+
],
63+
xplat_exported_deps = [
64+
"//third-party/googletest:gtest_main",
65+
],
66+
)
4467
runtime.cxx_library(
4568
name = "test_util" + aten_suffix,
4669
srcs = [
@@ -49,7 +72,6 @@ def define_common_targets():
4972
],
5073
exported_headers = [
5174
"BinaryLogicalOpTest.h",
52-
"TestUtil.h",
5375
"UnaryUfuncRealHBBF16ToFloatHBF16Test.h",
5476
],
5577
visibility = [
@@ -59,6 +81,7 @@ def define_common_targets():
5981
preprocessor_flags = ["-DUSE_ATEN_LIB"] if aten_kernel else [],
6082
exported_deps = [
6183
":supported_features_header",
84+
":gtest_utils",
6285
"//executorch/runtime/core/exec_aten:lib" + aten_suffix,
6386
"//executorch/runtime/core/exec_aten/testing_util:tensor_util" + aten_suffix,
6487
"//executorch/runtime/kernel:kernel_includes",

0 commit comments

Comments
 (0)