blob: 8bbc9bec5dae9e3849aa6d02565cf75c61df0182 [file]
# 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_test_component.gni")
# Shared between the hlcpp test server and the test harness.
source_set("hlcpp_client_app") {
visibility = [
":*",
"hlcpp:*",
]
sources = [
"hlcpp_client_app.cc",
"hlcpp_client_app.h",
]
deps = [
"fidl:fidl_service_hlcpp",
"//sdk/lib/sys/cpp",
"//zircon/system/ulib/zx",
]
}
# Categories of behaviors to be tested for compatibility.
fidl_compatibility_tests_categories = [
"minimal",
"struct",
"array",
"vector",
"table",
"union",
]
# Binding implementations under test.
fidl_compatibilty_test_impls = [
"cpp",
"dart",
"hlcpp",
"go",
"llcpp",
"rust",
]
# Gather the child definitions and capability offers for every possible proxy + server combination.
test_component_cml_children = []
test_component_cml_offers = []
foreach(impl, fidl_compatibilty_test_impls) {
# Define proxy and server instances for this binding implementation.
test_component_cml_children += [
{
name = "${impl}_proxy"
url = "#meta/${impl}-impl.cml"
},
{
name = "${impl}_server"
url = "#meta/${impl}-impl.cml"
},
]
# Enable logging for both the proxy and server instances of the given implementation.
test_component_cml_offers += [
{
protocol = [ "fuchsia.logger.LogSink" ]
from = "parent"
to = [
"#${impl}_proxy",
"#${impl}_server",
]
},
]
}
# Generate a test-running component for each category.
test_component_labels = []
foreach(test, fidl_compatibility_tests_categories) {
component_name = "fidl_compatibility_test_${test}"
component_label = "${component_name}_component"
output = "${component_name}_output"
executable_name = "${component_name}_executable"
test_label = component_name
generate_label = "generate_${test}"
generate_output = "${target_gen_dir}/${component_name}.cml"
# Build the test runner binary for this test category.
executable(executable_name) {
output_name = output
testonly = true
sources = [
"${test}_test.cc",
"helpers.cc",
"helpers.h",
]
deps = [
":hlcpp_client_app",
"fidl:fidl_service_hlcpp",
"//sdk/lib/fidl/cpp",
"//sdk/lib/sys/component/cpp/testing: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",
]
}
# Generate a CML.
fuchsia_test_component_manifest(generate_label) {
visibility = [ ":*" ]
metadata = {
test_component_manifest_cml = [
{
include = [
"//sdk/lib/sys/component/realm_builder.shard.cml",
"//sdk/lib/sys/testing/elf_test_runner.shard.cml",
]
program = {
binary = "bin/$output"
args = fidl_compatibilty_test_impls
}
children = test_component_cml_children
offer = test_component_cml_offers
},
]
}
}
generate_output = get_target_outputs(":$generate_label")
generate_output = generate_output[0]
# Define the test component for this category.
fuchsia_test_component(component_label) {
visibility = [ ":*" ]
component_name = component_name
experimental_force_runner = "elf_test_runner"
manifest = generate_output
manifest_deps = [ ":$generate_label" ]
deps = [ ":$executable_name" ]
}
# Save the component label, so that it may be included as a dependency of the test package.
test_component_labels += [ ":${component_label}" ]
}
fuchsia_test_package("fidl_compatibility_test_package") {
package_name = "fidl-compatibility-test"
deps = [
"cpp:cpp-impl",
"dart:dart-impl",
"go:go-impl",
"hlcpp:hlcpp-impl",
"llcpp:llcpp-impl",
"rust:rust-impl",
]
test_components = test_component_labels
}
group("compatibility") {
testonly = true
deps = [
":fidl_compatibility_test_package",
"//src/dart",
]
}