| # Copyright 2019 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/rust/rustc_binary.gni") | 
 | import("//build/rust/rustc_library.gni") | 
 | import("//tools/cmc/build/expect_includes.gni") | 
 |  | 
 | rustc_library("lib") { | 
 |   name = "test_runners_lib" | 
 |   with_unit_tests = true | 
 |   edition = "2018" | 
 |  | 
 |   # Only for internal use. | 
 |   visibility = [ "./*" ] | 
 |  | 
 |   deps = [ | 
 |     "//garnet/lib/rust/io_util", | 
 |     "//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner-rustc", | 
 |     "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", | 
 |     "//sdk/fidl/fuchsia.process:fuchsia.process-rustc", | 
 |     "//sdk/fidl/fuchsia.test:fuchsia.test-rustc", | 
 |     "//sdk/fidl/fuchsia.test:rust_measure_tape_for_case", | 
 |     "//src/lib/fdio/rust:fdio", | 
 |     "//src/lib/fidl/rust/fidl", | 
 |     "//src/lib/fuchsia-async", | 
 |     "//src/lib/fuchsia-component", | 
 |     "//src/lib/fuchsia-runtime", | 
 |     "//src/lib/syslog/rust:syslog", | 
 |     "//src/lib/zircon/rust:fuchsia-zircon", | 
 |     "//src/lib/zircon/rust:fuchsia-zircon-sys", | 
 |     "//src/sys/lib/runner", | 
 |     "//third_party/rust_crates:anyhow", | 
 |     "//third_party/rust_crates:async-trait", | 
 |     "//third_party/rust_crates:futures", | 
 |     "//third_party/rust_crates:log", | 
 |     "//third_party/rust_crates:matches", | 
 |     "//third_party/rust_crates:rand", | 
 |     "//third_party/rust_crates:serde_json", | 
 |     "//third_party/rust_crates:test-case", | 
 |     "//third_party/rust_crates:thiserror", | 
 |   ] | 
 |  | 
 |   sources = [ | 
 |     "src/cases.rs", | 
 |     "src/elf/elf_component.rs", | 
 |     "src/elf/mod.rs", | 
 |     "src/elf/server.rs", | 
 |     "src/errors.rs", | 
 |     "src/launch.rs", | 
 |     "src/lib.rs", | 
 |     "src/logs.rs", | 
 |   ] | 
 | } | 
 |  | 
 | rustc_library("test_lib") { | 
 |   testonly = true | 
 |   name = "test_runners_test_lib" | 
 |   with_unit_tests = true | 
 |   edition = "2018" | 
 |   source_root = "src/test_lib.rs" | 
 |  | 
 |   # Only for internal use. | 
 |   visibility = [ "./*" ] | 
 |  | 
 |   deps = [ | 
 |     "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", | 
 |     "//sdk/fidl/fuchsia.sys2:fuchsia.sys2-rustc", | 
 |     "//sdk/fidl/fuchsia.test:fuchsia.test-rustc", | 
 |     "//sdk/fidl/fuchsia.test.manager:fuchsia.test.manager-rustc", | 
 |     "//src/lib/fidl/rust/fidl", | 
 |     "//src/lib/fuchsia-component", | 
 |     "//src/lib/test_executor/rust:test_executor", | 
 |     "//third_party/rust_crates:anyhow", | 
 |     "//third_party/rust_crates:futures", | 
 |   ] | 
 |  | 
 |   sources = [ "src/test_lib.rs" ] | 
 | } | 
 |  | 
 | rustc_binary("echo_server_for_concurrency_test_bin") { | 
 |   name = "echo_server_for_concurrency_test" | 
 |   edition = "2018" | 
 |   source_root = "src/echo_server_for_concurrency_test.rs" | 
 |   deps = [ | 
 |     "//examples/components/routing/fidl:echo-rustc", | 
 |     "//src/lib/fidl/rust/fidl", | 
 |     "//src/lib/fuchsia-async", | 
 |     "//src/lib/fuchsia-component", | 
 |     "//third_party/rust_crates:anyhow", | 
 |     "//third_party/rust_crates:futures", | 
 |   ] | 
 |  | 
 |   sources = [ "src/echo_server_for_concurrency_test.rs" ] | 
 | } | 
 |  | 
 | fuchsia_component("echo_server_for_concurrency_test") { | 
 |   testonly = true | 
 |   manifest = "meta/echo-server-for-concurrency-test.cml" | 
 |   component_name = "echo-server-for-concurrency-test" | 
 |   deps = [ ":echo_server_for_concurrency_test_bin" ] | 
 | } | 
 |  | 
 | fuchsia_unittest_package("test-runner-unit-tests") { | 
 |   deps = [ ":lib_test" ] | 
 | } | 
 |  | 
 | fuchsia_unittest_package("test-runner-test-lib-unit-tests") { | 
 |   deps = [ ":test_lib_test" ] | 
 | } | 
 |  | 
 | expect_includes("tmp_storage") { | 
 |   includes = [ | 
 |     "tmp_storage.shard.cml", | 
 |     "tmp_storage.shard.cmx", | 
 |   ] | 
 | } | 
 |  | 
 | group("test_runners") { | 
 |   testonly = true | 
 |   deps = [ | 
 |     "elf", | 
 |     "gotests", | 
 |     "gtest", | 
 |     "inspect", | 
 |     "rust", | 
 |     "starnix", | 
 |   ] | 
 | } | 
 |  | 
 | group("tests") { | 
 |   testonly = true | 
 |   deps = [ | 
 |     ":test-runner-test-lib-unit-tests", | 
 |     ":test-runner-unit-tests", | 
 |     "elf:tests", | 
 |     "gotests:tests", | 
 |     "gtest:tests", | 
 |     "inspect:tests", | 
 |     "rust:tests", | 
 |     "starnix:tests", | 
 |   ] | 
 | } | 
 |  | 
 | # Use this group to include fuchsia.process.Launcher in generated test manifests. | 
 | # | 
 | # Intended for use in tests for test runners. | 
 | group("test-with-process-launcher") { | 
 |   testonly = true | 
 |   metadata = { | 
 |     test_component_manifest_cml = [ | 
 |       { | 
 |         use = [ | 
 |           { | 
 |             protocol = [ "fuchsia.process.Launcher" ] | 
 |           }, | 
 |         ] | 
 |       }, | 
 |     ] | 
 |   } | 
 | } |