| # Copyright 2020 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. |
| |
| import("//build/components.gni") |
| import("//build/fidl/fidl.gni") |
| import("//build/test.gni") |
| import("//src/tests/fidl/conformance_suite/gidl-conformance-suite.gni") |
| import("//tools/fidl/gidl/gidl.gni") |
| |
| gidl_deps = [] |
| foreach(gidl_file, conformance_suite_gidl_files) { |
| gidl_name = get_path_info(gidl_file, "name") |
| target = "conformance_suite__${gidl_name}" |
| gidl_deps += [ ":" + target ] |
| gidl_c_conformance(target) { |
| testonly = true |
| inputs = [ gidl_file ] |
| fidl = conformance_suite_fidl_target |
| deps = [ "//third_party/googletest:gtest" ] |
| if (is_fuchsia) { |
| deps += [ "//sdk/cts/tests/pkg/fidl/cpp:handle_util" ] |
| } |
| } |
| } |
| |
| source_set("test_sources") { |
| testonly = true |
| sources = [ |
| "decoding_tests.cc", |
| "encoding_tests.cc", |
| "fidl_align_tests.cc", |
| "fidl_coded_types.cc", |
| "formatting_tests.cc", |
| "on_error_handle_tests.cc", |
| "validating_tests.cc", |
| ] |
| public_deps = [ |
| ":fidl.test.coding.fuchsia_llcpp", |
| ":fidl.test.coding_llcpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/fidl/cpp:cpp_base", |
| "//sdk/lib/fit", |
| "//zircon/system/ulib/async", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fidl", |
| "//zircon/system/ulib/fidl-async", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/zx", |
| "//zircon/system/ulib/zxtest", |
| ] |
| |
| # TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated. |
| # Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>). |
| # See linked bug for details. |
| configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ] |
| } |
| |
| if (is_fuchsia) { |
| executable("walker_tests_bin") { |
| output_name = "walker-tests" |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| testonly = true |
| sources = [] |
| deps = [ ":test_sources" ] |
| } |
| |
| fuchsia_unittest_package("fidl-walker-tests") { |
| deps = [ ":walker_tests_bin" ] |
| deprecated_legacy_test_execution = true |
| } |
| |
| executable("c_conformance_tests_bin") { |
| output_name = "c-conformance-tests" |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] |
| if (configs + fdio_config - fdio_config != configs) { |
| configs -= fdio_config |
| } |
| testonly = true |
| sources = [] |
| deps = gidl_deps + [ "//src/lib/fxl/test:gtest_main" ] |
| } |
| |
| fuchsia_unittest_package("fidl-c-conformance-tests") { |
| deps = [ ":c_conformance_tests_bin" ] |
| deprecated_legacy_test_execution = true |
| } |
| |
| executable("tests_to_run_under_handle_policy") { |
| # this must match the requested binary in run_with_handle_policy_tests.cc |
| output_name = "fidl-handle-policy-test-app" |
| testonly = true |
| sources = [ "fidl_coded_types.cc" ] |
| public_deps = [ |
| "//sdk/lib/fit", |
| "//zircon/system/ulib/fidl", |
| "//zircon/system/ulib/zx", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| executable("test_launcher_bin") { |
| testonly = true |
| output_name = "run_with_handle_policy_tests" |
| sources = [ "run_with_handle_policy_tests.cc" ] |
| deps = [ |
| ":fidl.test.coding.fuchsia_llcpp", |
| ":fidl.test.coding_llcpp", |
| ":tests_to_run_under_handle_policy", |
| "//sdk/lib/fdio", |
| "//src/lib/fxl/test:gtest_main", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| fuchsia_unittest_package("fidl-handle-closing-tests") { |
| manifest = "run_with_handle_policy_tests.cml" |
| deps = [ ":test_launcher_bin" ] |
| } |
| } |
| |
| source_set("host_test_sources") { |
| testonly = true |
| sources = [ |
| "decoding_tests.cc", |
| "encoding_tests.cc", |
| "fidl_align_tests.cc", |
| "fidl_coded_types.cc", |
| "validate_string_tests.cc", |
| "validating_tests.cc", |
| ] |
| public_deps = [ |
| ":fidl.test.coding_llcpp", |
| "//sdk/lib/fidl/cpp:cpp_base", |
| "//zircon/system/ulib/fidl:fidl_base", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| if (!is_fuchsia) { |
| # Some of the tests can run on host. |
| test("fidl-walker-host-tests") { |
| testonly = true |
| sources = [] |
| deps = [ ":host_test_sources" ] |
| } |
| |
| test("fidl-c-conformance-host-tests") { |
| testonly = true |
| sources = [] |
| deps = gidl_deps + [ "//src/lib/fxl/test:gtest_main" ] |
| } |
| } |
| |
| fidl("fidl.test.coding") { |
| visibility = [ ":*" ] |
| sources = [ "extra_messages.test.fidl" ] |
| } |
| |
| fidl("fidl.test.coding.fuchsia") { |
| visibility = [ ":*" ] |
| sources = [ |
| "extra_messages_fuchsia.test.fidl", |
| "messages.test.fidl", |
| ] |
| public_deps = [ "//zircon/vdso/zx" ] |
| } |