| # Copyright 2024 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("//src/lib/testing/sharding/fuchsia_sharded_test_package.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":iperf-test" ] |
| } |
| |
| rustc_binary("bin") { |
| edition = "2021" |
| name = "iperf_benchmark" |
| with_unit_tests = true |
| testonly = true |
| sources = [ "src/main.rs" ] |
| deps = [ |
| "//sdk/fidl/fuchsia.device:fuchsia.device_rust", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_rust", |
| "//src/connectivity/lib/net-types", |
| "//src/connectivity/network/testing/netemul/fidl:fuchsia.netemul_rust", |
| "//src/connectivity/network/testing/netemul/rust:lib", |
| "//src/connectivity/network/tests/integration/common:netstack_testing_common", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia", |
| "//src/lib/fuchsia-async", |
| "//src/sys/lib/component-events", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:log", |
| ] |
| test_deps = [ |
| "//src/connectivity/network/tests/integration/macros:netstack_testing_macros", |
| "//src/lib/diagnostics/reader/rust", |
| "//third_party/rust_crates:test-case", |
| ] |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| fuchsia_component("iperf-component") { |
| component_name = "iperf" |
| manifest = "meta/iperf.cml" |
| deps = [ "//third_party/iperf:bin" ] |
| } |
| |
| fuchsia_test_component("iperf-benchmark-component") { |
| manifest = "meta/iperf-benchmark.cml" |
| deps = [ ":bin" ] |
| } |
| |
| common_deps = [ |
| ":iperf-component", |
| "//src/bringup/bin/device-name-provider:component", |
| "//src/connectivity/network/testing/netemul/service:netemul-sandbox", |
| ] |
| |
| # RISC-V on Fuchsia does not support Golang. |
| if (target_cpu != "riscv64") { |
| ns2_test_package_deps = |
| [ "//src/connectivity/network/netstack:component-debug" ] |
| ns2_package_deps = [ |
| "//src/connectivity/network/netstack:component", |
| "//src/sys/stash:stash_secure_v2", |
| ] |
| } else { |
| ns2_test_package_deps = [] |
| ns2_package_deps = [] |
| } |
| |
| fuchsia_sharded_test_package("iperf-test") { |
| test_components = [ |
| { |
| name = "iperf-test-component" |
| manifest = "meta/iperf-test.cml" |
| deps = [ ":bin_test" ] |
| num_shards = 3 |
| }, |
| ] |
| deps = common_deps + ns2_test_package_deps + |
| [ "//src/connectivity/network/netstack3:component-debug" ] |
| } |
| |
| # This benchmark is intended to be run by host-side logic alongside the |
| # other non-hermetic iPerf benchmarks, and thus is not a part of a |
| # benchmarks GN target. |
| fuchsia_test_package("iperf-benchmark") { |
| test_components = [ ":iperf-benchmark-component" ] |
| deps = common_deps + ns2_package_deps + |
| [ "//src/connectivity/network/netstack3:component-for-tests" ] |
| |
| # Don't run the benchmark on the target as it is run as a part of the |
| # host-driven iPerf benchmarks. |
| test_specs = { |
| environments = [] |
| } |
| } |