1load("@fbsource//xplat/executorch/build:runtime_wrapper.bzl", "runtime") 2 3def define_common_targets(): 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 runtime.cxx_test( 11 name = "platform_test", 12 srcs = [ 13 "executor_pal_test.cpp", 14 ], 15 deps = [ 16 "//executorch/runtime/core:core", 17 "//executorch/runtime/platform:platform", 18 ], 19 ) 20 21 runtime.cxx_test( 22 name = "platform_death_test", 23 srcs = [ 24 "executor_pal_death_test.cpp", 25 ], 26 deps = [ 27 "//executorch/runtime/core:core", 28 "//executorch/runtime/platform:platform", 29 ], 30 ) 31 32 # This is an example of a target that provides a PAL implementation. Note 33 # the `link_whole = True` parameter, which is necessary to ensure that the 34 # symbols make their way into the top-level binary. If this target were to 35 # be added to a library instead of directly to a binary, it would need to be 36 # in that library's `exported_deps`. 37 runtime.cxx_library( 38 name = "stub_platform", 39 srcs = [ 40 "stub_platform.cpp", 41 ], 42 exported_headers = [ 43 "stub_platform.h", 44 ], 45 deps = [ 46 "//executorch/runtime/platform:compiler", 47 "//executorch/runtime/platform:platform", 48 "//executorch/test/utils:utils", # gtest.h 49 ], 50 visibility = [], 51 ) 52 53 runtime.cxx_test( 54 name = "platform_override_test", 55 srcs = [ 56 "executor_pal_override_test.cpp", 57 ], 58 deps = [ 59 # This must come first to ensure that the weak platform 60 # calls are overriden. 61 # buildifier: do not sort 62 ":stub_platform", 63 "//executorch/runtime/core:core", 64 "//executorch/runtime/platform:platform", 65 ], 66 ) 67 68 runtime.cxx_test( 69 name = "logging_test", 70 srcs = [ 71 "logging_test.cpp", 72 ], 73 deps = [ 74 "//executorch/runtime/platform:platform", 75 ], 76 compiler_flags = [ 77 # Turn on debug logging. 78 "-DET_MIN_LOG_LEVEL=Debug", 79 ], 80 ) 81 82 runtime.cxx_test( 83 name = "clock_test", 84 srcs = [ 85 "clock_test.cpp", 86 ], 87 deps = [ 88 # This must come first to ensure that the weak platform 89 # calls are overriden. 90 # buildifier: do not sort 91 ":stub_platform", 92 "//executorch/runtime/core:core", 93 "//executorch/runtime/platform:platform", 94 ], 95 ) 96