| # Copyright 2026 The Fuchsia Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| load("//build/bazel/platforms:constraints.bzl", "HOST_OS_CONSTRAINTS") | |
| load("//build/bazel/rules/cc:fx_cc_test_binary.bzl", "fx_cc_test_binary") | |
| load( | |
| "//build/bazel/rules/components:fx_component.bzl", | |
| "fx_component_manifest", | |
| "fx_test_component", | |
| ) | |
| load("//build/bazel/rules/fidl:fidl_library.bzl", "fidl_library") | |
| load("//build/bazel/rules/host_tests:host_test.bzl", "host_test") | |
| load("//build/bazel/rules/packages:fx_package.bzl", "fx_package") | |
| load("//build/bazel/rules/packages:fx_packaged_binary.bzl", "fx_packaged_binary") | |
| load("//build/bazel/rules/testing:fx_test.bzl", "fx_test") | |
| load("//build/bazel/rules/testing:fx_unittest_package.bzl", "fx_unittest_package") | |
| package(default_applicable_licenses = ["//:license"]) | |
| test_suite( | |
| name = "tests", | |
| tests = [ | |
| ":fidl_llcpp_message_container_tests_test", | |
| ":fidl_llcpp_message_storage_tests", | |
| ":fidl_llcpp_status_types_tests", | |
| ], | |
| visibility = ["//src/lib:__pkg__"], | |
| ) | |
| test_suite( | |
| name = "host_tests", | |
| target_compatible_with = HOST_OS_CONSTRAINTS, | |
| tests = [ | |
| ":fidl_llcpp_status_types_tests_host_test", | |
| ], | |
| visibility = ["//src/lib:__pkg__"], | |
| ) | |
| fidl_library( | |
| name = "fidl.llcpp.linearized.test", | |
| testonly = True, | |
| srcs = ["linearized.test.fidl"], | |
| ) | |
| fidl_library( | |
| name = "fidl.llcpp.empty.test", | |
| testonly = True, | |
| srcs = ["empty.test.fidl"], | |
| ) | |
| fidl_library( | |
| name = "fidl.llcpp.buffersize.test", | |
| testonly = True, | |
| srcs = ["buffersize.test.fidl"], | |
| deps = ["//zircon/vdso/zx"], | |
| ) | |
| fx_cc_test_binary( | |
| name = "fidl_llcpp_message_container_tests_bin", | |
| srcs = [ | |
| "decoded_value_test.cc", | |
| "encoded_test.cc", | |
| "incoming_message_test.cc", | |
| "outgoing_message_test.cc", | |
| "outgoing_to_incoming_message_test.cc", | |
| "wire_format_metadata_test.cc", | |
| ], | |
| gn_output_name = "fidl_llcpp_message_container_tests", | |
| # test-parity-allow-manual: packaged in :fidl_llcpp_message_container_tests | |
| tags = ["manual"], | |
| deps = [ | |
| ":fidl.llcpp.empty.test_cpp", | |
| ":fidl.llcpp.linearized.test_cpp", | |
| "//sdk/testing/fidl:fidl_test_cpp", | |
| "//sdk/testing/fidl/types_tests:test.types_cpp", | |
| "//src/lib/fidl/llcpp/tests:types_test_utils", | |
| "//src/lib/fxl/test:gtest_main", | |
| "@com_google_googletest//:gtest", # @bazel2gn:path_overwrite://third_party/googletest:gtest | |
| ], | |
| ) | |
| fx_packaged_binary( | |
| name = "fidl_llcpp_message_container_tests_packaged_bin", | |
| testonly = True, | |
| binary = ":fidl_llcpp_message_container_tests_bin", | |
| binary_name = "fidl_llcpp_message_container_tests", | |
| install_root = "test/", | |
| ) | |
| # TODO(https://fxbug.dev/42154178): Required for death-tests. We could remove | |
| # the manifests by switching to zxtest. | |
| fx_component_manifest( | |
| name = "fidl_llcpp_message_container_tests_manifest", | |
| component_name = "fidl_llcpp_message_container_tests", | |
| includes = [ | |
| "//sdk/lib/syslog:client.shard", | |
| "//src/sys/test_runners/gtest:default.shard.cml", | |
| ], | |
| manifest = "meta/fidl_llcpp_message_container_tests.cml", | |
| ) | |
| fx_test_component( | |
| name = "fidl_llcpp_message_container_tests_component", | |
| compiled_manifest = ":fidl_llcpp_message_container_tests_manifest", | |
| deps = [":fidl_llcpp_message_container_tests_packaged_bin"], | |
| ) | |
| fx_package( | |
| name = "fidl_llcpp_message_container_tests", | |
| testonly = True, | |
| test_components = [":fidl_llcpp_message_container_tests_component"], | |
| ) | |
| fx_test( | |
| name = "fidl_llcpp_message_container_tests_test", | |
| package = ":fidl_llcpp_message_container_tests", | |
| visibility = ["//src/lib:__pkg__"], | |
| ) | |
| fx_cc_test_binary( | |
| name = "fidl_llcpp_status_types_tests_bin", | |
| srcs = ["status_test.cc"], | |
| gn_output_name = "fidl_llcpp_status_types_tests", | |
| deps = [ | |
| "//sdk/lib/fidl/cpp/wire", | |
| "//zircon/system/ulib/zxtest", | |
| ], | |
| ) | |
| fx_unittest_package( | |
| name = "fidl_llcpp_status_types_tests", | |
| unit_tests = [":fidl_llcpp_status_types_tests_bin"], | |
| visibility = ["//src/lib:__pkg__"], | |
| ) | |
| host_test( | |
| name = "fidl_llcpp_status_types_tests_host_test", | |
| binary = ":fidl_llcpp_status_types_tests_bin", | |
| target_compatible_with = HOST_OS_CONSTRAINTS, | |
| visibility = ["//src/lib:__pkg__"], | |
| ) | |
| fx_cc_test_binary( | |
| name = "fidl_llcpp_message_storage_tests_bin", | |
| srcs = [ | |
| "any_allocator_test.cc", | |
| "message_buffer_size_test.cc", | |
| ], | |
| gn_output_name = "fidl_llcpp_message_storage_tests", | |
| # test-parity-allow-manual: packaged in :fidl_llcpp_message_storage_tests | |
| tags = ["manual"], | |
| deps = [ | |
| ":fidl.llcpp.buffersize.test_cpp", | |
| "//zircon/system/ulib/zxtest", | |
| ], | |
| ) | |
| fx_unittest_package( | |
| name = "fidl_llcpp_message_storage_tests", | |
| unit_tests = [":fidl_llcpp_message_storage_tests_bin"], | |
| visibility = ["//src/lib:__pkg__"], | |
| ) |