| # Copyright 2021 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_library.gni") |
| |
| rustc_library("rust") { |
| name = "netdevice_client" |
| with_unit_tests = true |
| edition = "2021" |
| |
| sources = [ |
| "src/client.rs", |
| "src/error.rs", |
| "src/lib.rs", |
| "src/port_slab.rs", |
| "src/session/buffer/mod.rs", |
| "src/session/buffer/pool.rs", |
| "src/session/buffer/sys.rs", |
| "src/session/mod.rs", |
| ] |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.network:fuchsia.hardware.network_rust", |
| "//src/connectivity/network/lib/explicit", |
| "//src/lib/async-utils", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fidl_table_validation", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/fuchsia-sync", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:derivative", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:static_assertions", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:zerocopy", |
| ] |
| |
| test_deps = [ |
| "//src/lib/const-unwrap", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:test-case", |
| ] |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| rustc_test("tun-test") { |
| edition = "2021" |
| source_root = "tests/tun.rs" |
| deps = [ |
| ":rust", |
| "//sdk/fidl/fuchsia.hardware.network:fuchsia.hardware.network_rust", |
| "//sdk/fidl/fuchsia.net.tun:fuchsia.net.tun_rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:assert_matches", |
| "//third_party/rust_crates:futures", |
| ] |
| sources = [ "tests/tun.rs" ] |
| |
| configs -= [ "//build/config/rust/lints:allow_unused_results" ] |
| } |
| |
| fuchsia_component("tun-test-component") { |
| testonly = true |
| manifest = "tests/meta/tun-test.cml" |
| deps = [ ":tun-test" ] |
| } |
| |
| fuchsia_unittest_component("netdev-rust-client-unittest-component") { |
| deps = [ ":rust_test" ] |
| } |
| |
| fuchsia_test_package("netdev-rust-client-tests") { |
| test_components = [ |
| ":tun-test-component", |
| ":netdev-rust-client-unittest-component", |
| ] |
| deps = [ "//src/connectivity/network/tun/network-tun:component" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ ":netdev-rust-client-tests" ] |
| } |