| # 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/dart/dart_component.gni") |
| import("//build/dart/dart_library.gni") |
| import("//build/dart/fidl_move.gni") |
| import("//build/fidl/fidl.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//src/sys/build/components.gni") |
| |
| # The protocol used in the test. |
| fidl("fidl") { |
| name = "fidl.test.compatibility" |
| |
| sources = [ "compatibility_service.test.fidl" ] |
| } |
| |
| # 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", |
| "//sdk/lib/sys/cpp", |
| "//zircon/public/lib/zx", |
| ] |
| } |
| |
| ## HLCPP Test Server |
| |
| executable("hlcpp_server") { |
| output_name = "hlcpp-server" |
| output_dir = target_out_dir |
| |
| sources = [ "hlcpp_server.cc" ] |
| |
| deps = [ |
| ":fidl", |
| ":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 |
| |
| sources = [ "llcpp_server.cc" ] |
| |
| deps = [ |
| ":fidl_llcpp", |
| "//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", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| ] |
| } |
| |
| fuchsia_component("llcpp-server") { |
| manifest = "meta/llcpp-server.cmx" |
| deps = [ ":llcpp_server" ] |
| } |
| |
| ## Rust Test Server |
| |
| rustc_binary("rust_server") { |
| name = "rust-server" |
| output_dir = target_out_dir |
| edition = "2018" |
| source_root = "rust_server.rs" |
| |
| deps = [ |
| ":fidl-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/fidl/fuchsia.sys", |
| "//src/tests/fidl/compatibility:fidl", |
| dart_package_label.fidl, |
| dart_package_label.fuchsia_services, |
| ] |
| } |
| |
| 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", |
| ":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", |
| "//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 = "struct" |
| filter = "Struct.*" |
| }, |
| { |
| name = "array" |
| filter = "Array.*" |
| }, |
| { |
| name = "vector" |
| filter = "Vector.*" |
| }, |
| { |
| name = "table" |
| filter = "Table.*" |
| }, |
| { |
| name = "union" |
| filter = "Xunion.*" |
| }, |
| ] |
| |
| fidl_compatibilty_test_servers = [ |
| "hlcpp", |
| "go", |
| "llcpp", |
| "rust", |
| "dart", |
| ] |
| |
| test_component_labels = [] |
| test_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}" ] |
| test_labels += [ ":${test_label}" ] |
| |
| ## Generate a CMX |
| generated_file(generate_label) { |
| visibility = [ ":*" ] |
| testonly = true |
| |
| outputs = [ generate_output ] |
| output_conversion = "json" |
| contents = { |
| include = [ "sdk/lib/diagnostics/syslog/client.shard.cmx" ] |
| program = { |
| binary = "bin/fidl_compatibility_test" |
| args = |
| [ "--gtest_filter=${test.filter}" ] + fidl_compatibilty_test_servers |
| } |
| sandbox = { |
| services = [ "fuchsia.sys.Launcher" ] |
| } |
| } |
| } |
| |
| ## The test component |
| fuchsia_component(component_label) { |
| visibility = [ ":*" ] |
| testonly = true |
| |
| component_name = component_name |
| manifest = rebase_path(generate_output) |
| deps = [ |
| ":${generate_label}", |
| ":fidl_compatibility_test_executable", |
| ] |
| } |
| |
| ## The test declaration |
| fuchsia_test(test_label) { |
| package = ":fidl_compatibility_test_package" |
| package_name = "fidl-compatibility-test" |
| component = ":${component_label}" |
| |
| environments = basic_envs |
| } |
| } |
| |
| 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_package("fidl_compatibility_test_package") { |
| testonly = true |
| |
| package_name = "fidl-compatibility-test" |
| deps = [ |
| ":hlcpp-server", |
| ":llcpp-server", |
| ":rust-server", |
| "golang:go-server", |
| ":dart-server", |
| ] + test_component_labels |
| } |
| |
| group("compatibility") { |
| testonly = true |
| deps = test_labels |
| } |