| # 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_rust", |
| "//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/fidl/fuchsia.ldsvc:fuchsia.ldsvc_rust", |
| "//sdk/fidl/fuchsia.process:fuchsia.process_rust", |
| "//sdk/fidl/fuchsia.test:fuchsia.test_rust", |
| "//sdk/fidl/fuchsia.test:rust_measure_tape_for_case", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//src/storage/lib/vfs/rust:vfs", |
| "//src/sys/lib/library_loader:library_loader", |
| "//src/sys/lib/namespace", |
| "//src/sys/lib/runner", |
| "//src/sys/test_runners/fidl/fuchsia.test.runner:fuchsia.test.runner_rust", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:async-trait", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:tracing", |
| ] |
| |
| test_deps = [ |
| "//src/lib/fuchsia-fs", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:rand", |
| "//third_party/rust_crates:test-case", |
| ] |
| |
| 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/*", |
| "//src/lib/testing/sharding/tests/*", |
| ] |
| |
| deps = [ |
| ":lib", |
| "//sdk/fidl/fuchsia.component:fuchsia.component_rust", |
| "//sdk/fidl/fuchsia.component.decl:fuchsia.component.decl_rust", |
| "//sdk/fidl/fuchsia.component.runner:fuchsia.component.runner_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/fidl/fuchsia.test:fuchsia.test_rust", |
| "//sdk/fidl/fuchsia.test.manager:fuchsia.test.manager_rust", |
| "//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/namespace", |
| "//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_rust", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//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("tests") { |
| testonly = true |
| deps = [ |
| ":test-runner-test-lib-unit-tests", |
| ":test-runner-unit-tests", |
| "elf:tests", |
| "fuzz:tests", |
| "gtest:tests", |
| "gunit:tests", |
| "inspect:tests", |
| "lib_loader_cache:tests", |
| "rust:tests", |
| "starnix:tests", |
| "stress_test:tests", |
| ] |
| |
| # The Go toolchain does not support RISC-V. |
| if (current_cpu != "riscv64") { |
| deps += [ "gotests: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" ] |
| }, |
| ] |
| }, |
| ] |
| } |
| } |