| # Copyright 2019 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. |
| |
| ########################################## |
| # Though under //zircon, this build file # |
| # is meant to be used in the Fuchsia GN # |
| # build. # |
| # See fxb/36139. # |
| ########################################## |
| |
| assert(!defined(zx) || zx != "/", |
| "This file can only be used in the Fuchsia GN build.") |
| |
| import("//build/fidl/fidl.gni") |
| import("//build/test.gni") |
| import("//build/unification/images/migrated_manifest.gni") |
| |
| if (is_fuchsia) { |
| source_set("common") { |
| # Dependent manifests unfortunately cannot be marked as `testonly`. |
| # TODO(44278): switch back to true. |
| testonly = false |
| visibility = [ ":*" ] |
| sources = [ |
| "fidl_align_tests.cc", |
| "fidl_coded_types.cc", |
| "handle_closing_tests.cc", |
| "linearizing_tests.cc", |
| "llcpp_client_test.cc", |
| "llcpp_transaction_tests.cc", |
| "llcpp_types_tests.cc", |
| "main.cc", |
| "on_error_handle_tests.cc", |
| ] |
| include_dirs = [ "generated" ] |
| public_deps = [ |
| ":example_c", |
| ":fidl.test.coding_llcpp", |
| "//zircon/public/lib/async", |
| "//zircon/public/lib/async-loop", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fdio", |
| "//zircon/public/lib/fidl", |
| "//zircon/public/lib/fidl-llcpp", |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/unittest", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxtest", |
| ] |
| } |
| |
| # Run the common tests under a strict invalid handle policy |
| executable("fidl-handle-policy-test-app") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| |
| # Dependent manifests unfortunately cannot be marked as `testonly`. |
| # TODO(44278): switch back to true. |
| testonly = false |
| sources = [] |
| deps = [ ":common" ] |
| |
| # TODO(46873): Fix the leaks and remove this. |
| deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ] |
| } |
| |
| test("fidl") { |
| # Dependent manifests unfortunately cannot be marked as `testonly`. |
| # TODO(44278): Remove when converting this file to proper GN build idioms. |
| if (is_fuchsia) { |
| testonly = false |
| } |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| sources = [ |
| "abi_tests.cc", |
| "cpp_types_tests.cc", |
| "decoding_tests.cc", |
| "encoding_tests.cc", |
| "formatting_tests.cc", |
| "message_tests.cc", |
| "run_with_handle_policy_tests.cc", |
| "transformer_tests.c", |
| "validating_tests.cc", |
| ] |
| deps = [ |
| ":common", |
| ":example_c", |
| ":fidl-handle-policy-test-app", |
| ] |
| |
| # TODO(41897): UBSan has found an instance of undefined behavior in this target. |
| # Disable UBSan for this target temporarily until it is migrated into CI/CQ. |
| configs += [ "//build/config:temporarily_disable_ubsan_do_not_use" ] |
| |
| # TODO(46873): Fix the leaks and remove this. |
| deps += [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ] |
| } |
| |
| migrated_manifest("fidl-handle-policy-test-app-manifest") { |
| deps = [ ":fidl-handle-policy-test-app" ] |
| } |
| |
| migrated_manifest("fidl-manifest") { |
| deps = [ ":fidl" ] |
| } |
| } else if (current_os == host_os && current_cpu == host_cpu) { |
| # Some of the tests can run on host. |
| test("fidl") { |
| # Dependent manifests unfortunately cannot be marked as `testonly`. |
| # TODO(44278): Remove when converting this file to proper GN build idioms. |
| if (is_fuchsia) { |
| testonly = false |
| } |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| } |
| sources = [ |
| "abi_tests.cc", |
| "cpp_types_tests.cc", |
| "fidl_align_tests.cc", |
| "validate_string_tests.cc", |
| ] |
| deps = [ |
| "//zircon/public/lib/fidl_base", |
| "//zircon/public/lib/unittest-static", |
| ] |
| } |
| } |
| |
| fidl("example") { |
| visibility = [ |
| ":*", |
| "//zircon/system/utest/fidl-simple:*", |
| ] |
| sources = [ "transformer.test.fidl" ] |
| } |
| |
| fidl("fidl.test.coding") { |
| visibility = [ ":*" ] |
| sources = [ |
| "extra_messages.test.fidl", |
| "llcpp.test.fidl", |
| "messages.test.fidl", |
| ] |
| } |