xref: /aosp_15_r20/external/executorch/extension/runner_util/test/targets.bzl (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime")
2
3def define_common_targets(is_fbcode = False):
4    """Defines targets that should be shared between fbcode and xplat.
5
6    The directory containing this targets.bzl file should also contain both
7    TARGETS and BUCK files that call this function.
8    """
9
10    for aten_mode in (True, False):
11        aten_suffix = ("_aten" if aten_mode else "")
12
13        # TODO(dbort): Find a way to make these run for ANDROID/APPLE in xplat. The
14        # android and ios test determinators don't like the reference to the model
15        # file in fbcode. See https://fburl.com/9esapdmd
16        if not runtime.is_oss and is_fbcode:
17            runtime.cxx_test(
18                name = "inputs_test" + aten_suffix,
19                srcs = [
20                    "inputs_test.cpp",
21                ],
22                deps = [
23                    "//executorch/extension/runner_util:inputs",
24                    "//executorch/runtime/executor/test:managed_memory_manager",
25                    "//executorch/runtime/executor:program",
26                    "//executorch/kernels/portable:generated_lib",
27                    "//executorch/extension/data_loader:file_data_loader",
28                ],
29                env = {
30                    "ET_MODULE_ADD_PATH": "$(location fbcode//executorch/test/models:exported_programs[ModuleAdd.pte])",
31                },
32            )
33