blob: d401ce456ab60c4a89f5ae510b527d6c7aed97a9 [file] [log] [blame]
# 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 = "2021"
# Only for internal use.
visibility = [ "./*" ]
deps = [
"//sdk/fidl/fuchsia.component:fuchsia.component-rustc",
"//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner-rustc",
"//sdk/fidl/fuchsia.io:fuchsia.io-rustc",
"//sdk/fidl/fuchsia.ldsvc:fuchsia.ldsvc-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/fidl/rust/fidl",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-fs",
"//src/lib/fuchsia-runtime",
"//src/lib/storage/vfs/rust:vfs",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/sys/lib/library_loader:library_loader",
"//src/sys/lib/runner",
"//src/sys/test_runners/fidl/fuchsia.test.runner:fuchsia.test.runner-rustc",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:assert_matches",
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:rand",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:test-case",
"//third_party/rust_crates:thiserror",
"//third_party/rust_crates:tracing",
]
test_deps = [ "//src/lib/fuchsia-fs" ]
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 = "2021"
source_root = "src/test_lib.rs"
# Only for use by test runners.
visibility = [
"./*",
"//src/connectivity/network/testing/netemul/runner/*",
]
deps = [
":lib",
"//sdk/fidl/fuchsia.component:fuchsia.component-rustc",
"//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl-rustc",
"//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner-rustc",
"//sdk/fidl/fuchsia.io:fuchsia.io-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-async",
"//src/lib/fuchsia-component",
"//src/lib/fuchsia-fs",
"//src/lib/fuchsia-runtime",
"//src/lib/zircon/rust:fuchsia-zircon",
"//src/sys/lib/runner",
"//src/sys/test_manager:test_lib",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:futures",
]
test_deps = [ "//third_party/rust_crates:maplit" ]
sources = [ "src/test_lib.rs" ]
}
rustc_binary("echo_server_for_concurrency_test_bin") {
name = "echo_server_for_concurrency_test"
edition = "2021"
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_component("test-component") {
deps = [
":lib_test",
"//src/sys/test_runners:test-with-process-launcher",
]
}
fuchsia_test_package("test-runner-unit-tests") {
test_components = [ ":test-component" ]
deps =
[ "//src/sys/test_runners/lib_loader_cache:lib_loader_runner_cache_cmp" ]
}
fuchsia_unittest_package("test-runner-test-lib-unit-tests") {
deps = [ ":test_lib_test" ]
}
expect_includes("tmp_storage") {
includes = [ "tmp_storage.shard.cml" ]
}
group("test_runners") {
testonly = true
deps = [
"elf",
"gotests",
"gtest",
"gunit",
"inspect",
"legacy_test",
"lib_loader_cache",
"rust",
"starnix",
"stress_test",
"//src/connectivity/network/testing/netemul/runner:package",
]
}
group("tests") {
testonly = true
deps = [
":test-runner-test-lib-unit-tests",
":test-runner-unit-tests",
"elf:tests",
"gotests:tests",
"gtest:tests",
"gunit:tests",
"inspect:tests",
"legacy_test:tests",
"lib_loader_cache:tests",
"rust:tests",
"starnix:tests",
"stress_test: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 = [
{
children = [
{
name = "lib_loader_cache"
url = "#meta/lib_loader_runner_cache.cm"
},
]
use = [
{
protocol = [ "fuchsia.process.Launcher" ]
},
{
protocol = [ "fuchsia.test.runner.LibraryLoaderCacheBuilder" ]
from = "#lib_loader_cache"
},
]
offer = [
{
protocol = [ "fuchsia.logger.LogSink" ]
from = "parent"
to = [ "#lib_loader_cache" ]
},
]
},
]
}
}