blob: 768fbc404971a99bb335887c21afd0d0c750b2b3 [file] [log] [blame]
# 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/dart/test.gni")
import("//build/fidl/fidl.gni")
import("//build/host.gni")
import("//build/testing/environments.gni")
import("//build/testing/host_test_data.gni")
_shared_out_dir = get_label_info(":bogus(${target_toolchain})", "root_out_dir")
dart_test("fidlcat_test") {
sources = [ "fidlcat_test.dart" ]
deps = [
"//sdk/testing/sl4f/client",
"//third_party/dart-pkg/pub/test",
]
non_dart_deps = [ ":runtime_deps($host_toolchain)" ]
args = [ "--data-dir=" + rebase_path(_shared_out_dir, root_build_dir) ]
# Runs on "main" builders (try and ci) in QEMU environments, but only on x64,
# as we don't currently support Dart on arm64 hosts.
# TODO(fxbug.dev/100888): fix the timeout issue with asan on.
environments = []
if (is_host && target_cpu == "x64" && !is_asan) {
environments = [ emu_env ]
}
}
# Extract the symbols for the given ELF file from the .build-id directory.
template("generate_symbols") {
assert(defined(invoker.library_label), "Must define 'library_label'")
assert(defined(invoker.library_path), "Must define 'library_path'")
assert(defined(invoker.output), "Must define 'output'")
action(target_name) {
deps = [ invoker.library_label ]
inputs = [
invoker.library_path,
"//build/images/elfinfo.py",
]
outputs = [ invoker.output ]
script = "generate_debug.sh"
depfile = "${invoker.output}.d"
args = [
"--build-id-dir",
rebase_path("$root_build_dir/.build-id", root_build_dir),
"--build-id-script",
rebase_path("//build/images/elfinfo.py", root_build_dir),
"--binary",
rebase_path(invoker.library_path, root_build_dir),
"--output",
rebase_path(invoker.output, root_build_dir),
"--depfile",
rebase_path(depfile, root_build_dir),
]
}
}
generate_symbols("echo_client_sym") {
library_label =
"//src/testing/fidl/echo_client_placeholder:bin($target_toolchain)"
library_path = "$_shared_out_dir/echo_client_placeholder"
output = "${target_gen_dir}/echo_client_placeholder.debug"
}
# Examples FIDL library required by save/replay .proto tests recorded against
# legacy FIDL examples
fidl("echo") {
testonly = true
name = "fidl.examples.echo"
visibility = [ ":*" ]
sources = [ "echo.test.fidl" ]
}
if (is_host) {
host_test_data("runtime_deps") {
sources = [
# We have to list all required FIDL IR explicitly here or they will not be
# present when we execute the test.
# This must be kept in sync with the list of FIDL IR in the test itself.
"$_shared_out_dir/fidling/gen/sdk/fidl/fuchsia.io/fuchsia.io.fidl.json",
"$_shared_out_dir/fidling/gen/sdk/fidl/fuchsia.mem/fuchsia.mem.fidl.json",
"$_shared_out_dir/fidling/gen/sdk/fidl/fuchsia.sys/fuchsia.sys.fidl.json",
"$_shared_out_dir/fidling/gen/src/testing/fidl/placeholders.fidl.json",
"$_shared_out_dir/fidling/gen/src/tests/end_to_end/fidlcat/echo.fidl.json",
"$root_out_dir/ffx",
"$root_out_dir/fidlcat",
"$root_out_dir/gen/tools/fidlcat/fidlcat_sdk.meta.json",
"${target_gen_dir}/echo_client_placeholder.debug",
"//src/tests/end_to_end/fidlcat/echo.pb",
"//src/tests/end_to_end/fidlcat/echo_client.pb",
"//src/tests/end_to_end/fidlcat/echo_client_sync.pb",
"//src/tests/end_to_end/fidlcat/echo_sync_crash.pb",
"//src/tests/end_to_end/fidlcat/goldens/fidl_examples_echo__echo.test.cc.golden",
"//src/tests/end_to_end/fidlcat/goldens/fidl_examples_echo__echo_sync.test.cc.golden",
"//src/tests/end_to_end/fidlcat/snapshot.pb",
]
outputs = [ "$target_gen_dir/runtime_deps/{{source_file_part}}" ]
deps = [
":echo",
":echo_client_sym",
"//sdk/fidl/fuchsia.io($fidl_toolchain)",
"//sdk/fidl/fuchsia.mem($fidl_toolchain)",
"//sdk/fidl/fuchsia.sys($fidl_toolchain)",
"//src/developer/debug/debug_agent($target_toolchain)",
"//src/developer/ffx:ffx_bin",
"//src/testing/fidl:placeholders",
"//src/testing/sl4f($target_toolchain)",
"//tools/fidlcat",
]
}
}
group("tests") {
testonly = true
deps = [
":fidlcat_test($host_toolchain)",
"//src/testing/fidl/echo_client_placeholder",
"//src/testing/fidl/echo_server_placeholder",
]
}