| # Copyright 2018 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/dart/dart_component.gni") |
| import("//build/dart/dart_library.gni") |
| import("//build/fidl/fidl.gni") |
| import("//build/rust/rustc_binary.gni") |
| |
| # Import definitions into the protocol being tested. |
| fidl("fidl_import") { |
| name = "fidl.test.imported" |
| sources = [ "compatibility_imported.test.fidl" ] |
| } |
| |
| # The protocol used in the test. |
| fidl("fidl_service") { |
| name = "fidl.test.compatibility" |
| sources = [ "compatibility_service.test.fidl" ] |
| public_deps = [ |
| ":fidl_import", |
| "//zircon/vdso/zx", |
| ] |
| } |
| |
| # Shared between the hlcpp test server and the test harness |
| source_set("hlcpp_client_app") { |
| visibility = [ ":*" ] |
| sources = [ |
| "hlcpp_client_app.cc", |
| "hlcpp_client_app.h", |
| ] |
| |
| deps = [ |
| ":fidl_service", |
| "//sdk/lib/sys/cpp", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| ## CPP (unified bindings / natural types) Test Server |
| |
| executable("cpp_server") { |
| output_name = "cpp-server" |
| output_dir = target_out_dir |
| |
| sources = [ "cpp_server.cc" ] |
| |
| deps = [ |
| ":fidl_service_cpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/stdcompat", |
| "//sdk/lib/sys/cpp", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| fuchsia_component("cpp-server") { |
| manifest = "meta/cpp-server.cmx" |
| deps = [ ":cpp_server" ] |
| } |
| |
| ## HLCPP Test Server |
| |
| executable("hlcpp_server") { |
| output_name = "hlcpp-server" |
| output_dir = target_out_dir |
| |
| sources = [ "hlcpp_server.cc" ] |
| |
| deps = [ |
| ":fidl_service", |
| ":hlcpp_client_app", |
| "//sdk/lib/fidl/cpp", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fxl", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| fuchsia_component("hlcpp-server") { |
| manifest = "meta/hlcpp-server.cmx" |
| deps = [ ":hlcpp_server" ] |
| } |
| |
| ## LLCPP Test Server |
| |
| executable("llcpp_server") { |
| output_name = "llcpp-server" |
| output_dir = target_out_dir |
| testonly = true |
| |
| sources = [ "llcpp_server.cc" ] |
| |
| deps = [ |
| ":fidl_service_llcpp_testing", |
| "//sdk/lib/fdio", |
| "//sdk/lib/sys/cpp", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| fuchsia_component("llcpp-server") { |
| manifest = "meta/llcpp-server.cmx" |
| deps = [ ":llcpp_server" ] |
| testonly = true |
| } |
| |
| ## Rust Test Server |
| |
| rustc_binary("rust_server") { |
| output_name = "rust_server" |
| output_dir = target_out_dir |
| edition = "2021" |
| source_root = "rust_server.rs" |
| |
| deps = [ |
| ":fidl_import-rustc", |
| ":fidl_service-rustc", |
| "//sdk/fidl/fuchsia.sys:fuchsia.sys-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| sources = [ "rust_server.rs" ] |
| } |
| |
| fuchsia_component("rust-server") { |
| manifest = "meta/rust-server.cmx" |
| deps = [ ":rust_server" ] |
| } |
| |
| ## Dart Test Server |
| |
| dart_library("dart_server") { |
| package_name = "dart_server" |
| package_root = "dart" |
| sources = [ "main.dart" ] |
| deps = [ |
| "//sdk/dart/fidl", |
| "//sdk/dart/fuchsia_services", |
| "//sdk/fidl/fuchsia.sys", |
| "//src/tests/fidl/compatibility:fidl_import", |
| "//src/tests/fidl/compatibility:fidl_service", |
| ] |
| } |
| |
| dart_component("dart-server") { |
| manifest = "meta/dart-server.cmx" |
| main_package = "dart_server" |
| deps = [ ":dart_server" ] |
| } |
| |
| ## Test Runner |
| |
| executable("fidl_compatibility_test_executable") { |
| output_name = "fidl_compatibility_test" |
| |
| testonly = true |
| |
| sources = [ "compatibility_test.cc" ] |
| |
| deps = [ |
| ":fidl_service", |
| ":hlcpp_client_app", |
| "//sdk/lib/fidl/cpp", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/files", |
| "//src/lib/fxl", |
| "//src/lib/fxl/test:test_settings", |
| "//third_party/googletest:gtest", |
| "//third_party/re2", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| ## Tests |
| |
| fidl_compatibility_tests = [ |
| { |
| name = "minimal" |
| filter = "Minimal.*" |
| }, |
| { |
| name = "struct" |
| filter = "Struct.*" |
| }, |
| { |
| name = "array" |
| filter = "Array.*" |
| }, |
| { |
| name = "vector" |
| filter = "Vector.*" |
| }, |
| { |
| name = "table" |
| filter = "Table.*" |
| }, |
| { |
| name = "union" |
| filter = "Union.*" |
| }, |
| ] |
| |
| fidl_compatibilty_test_servers = [ |
| "cpp", |
| "hlcpp", |
| "go", |
| "llcpp", |
| "rust", |
| "dart", |
| ] |
| |
| test_component_labels = [] |
| foreach(test, fidl_compatibility_tests) { |
| component_name = "fidl_compatibility_test_${test.name}" |
| component_label = "${component_name}_component" |
| test_label = component_name |
| generate_label = "generate_${test.name}" |
| generate_output = "${target_gen_dir}/${component_name}.cmx" |
| |
| test_component_labels += [ ":${component_label}" ] |
| |
| ## Generate a CMX |
| fuchsia_test_component_manifest(generate_label) { |
| deps = [ ":fidl_compatibility_test_executable" ] |
| visibility = [ ":*" ] |
| v2 = false |
| |
| metadata = { |
| test_component_manifest_cmx = [ |
| { |
| program = { |
| args = [ "--gtest_filter=${test.filter}" ] + |
| fidl_compatibilty_test_servers |
| } |
| sandbox = { |
| services = [ "fuchsia.sys.Launcher" ] |
| } |
| }, |
| ] |
| } |
| } |
| generate_output = get_target_outputs(":$generate_label") |
| generate_output = generate_output[0] |
| |
| ## The test component |
| fuchsia_test_component(component_label) { |
| visibility = [ ":*" ] |
| component_name = component_name |
| manifest = generate_output |
| manifest_deps = [ ":$generate_label" ] |
| } |
| } |
| |
| fuchsia_component("fidl_compatibility_test_component") { |
| testonly = true |
| |
| component_name = "fidl_compatibility_test" |
| manifest = "meta/fidl_compatibility_test.cmx" |
| deps = [ ":fidl_compatibility_test_executable" ] |
| } |
| |
| fuchsia_test_package("fidl_compatibility_test_package") { |
| package_name = "fidl-compatibility-test" |
| deps = [ |
| ":cpp-server", |
| ":dart-server", |
| ":hlcpp-server", |
| ":llcpp-server", |
| ":rust-server", |
| "golang:go-server", |
| ] |
| test_components = test_component_labels |
| } |
| |
| group("compatibility") { |
| testonly = true |
| deps = [ ":fidl_compatibility_test_package" ] |
| } |