blob: 508bcd3e53ee5293007285875666c5ae71df3f2a [file] [log] [blame]
# Copyright 2023 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/rust/rustc_library.gni")
import(
"//src/lib/testing/expectation/fuchsia_test_with_expectations_package.gni")
rustc_library("netlink") {
version = "0.0.1"
edition = "2021"
with_unit_tests = true
deps = [
"//sdk/fidl/fuchsia.hardware.network:fuchsia.hardware.network_rust",
"//sdk/fidl/fuchsia.net:fuchsia.net_rust",
"//sdk/fidl/fuchsia.net.interfaces:fuchsia.net.interfaces_rust",
"//sdk/fidl/fuchsia.net.interfaces.admin:fuchsia.net.interfaces.admin_rust",
"//sdk/fidl/fuchsia.net.root:fuchsia.net.root_rust",
"//sdk/fidl/fuchsia.net.routes:fuchsia.net.routes_rust",
"//sdk/fidl/fuchsia.net.routes.admin:fuchsia.net.routes.admin_rust",
"//src/connectivity/lib/net-types",
"//src/lib/const-unwrap",
"//src/lib/fidl/rust/fidl",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-component",
"//src/lib/network/fidl_fuchsia_net_ext",
"//src/lib/network/fidl_fuchsia_net_interfaces_ext",
"//src/lib/network/fidl_fuchsia_net_routes_ext",
"//src/starnix/lib/linux_uapi",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:assert_matches",
# TODO(https://github.com/rust-lang/rust/issues/91611): Replace this with
# #![feature(async_fn_in_trait)] once it supports `Send` bounds.
"//third_party/rust_crates:async-trait",
"//third_party/rust_crates:bit-set",
"//third_party/rust_crates:derivative",
"//third_party/rust_crates:either",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:itertools",
"//third_party/rust_crates:libc",
"//third_party/rust_crates:netlink-packet-core",
"//third_party/rust_crates:netlink-packet-route",
"//third_party/rust_crates:netlink-packet-utils",
"//third_party/rust_crates:thiserror",
"//third_party/rust_crates:tracing",
]
test_deps = [
"//sdk/fidl/fuchsia.net:fuchsia.net_rust",
"//sdk/fidl/fuchsia.net.routes:fuchsia.net.routes_rust",
"//src/connectivity/lib/net-declare",
"//src/lib/fuchsia",
"//src/lib/fuchsia-async",
"//src/lib/zircon/rust:fuchsia-zircon",
"//third_party/rust_crates:pretty_assertions",
"//third_party/rust_crates:test-case",
]
sources = [
"src/client.rs",
"src/errors.rs",
"src/eventloop.rs",
"src/interfaces.rs",
"src/lib.rs",
"src/logging.rs",
"src/messaging.rs",
"src/multicast_groups.rs",
"src/netlink_packet.rs",
"src/protocol_family.rs",
"src/routes.rs",
"src/rules.rs",
"src/util.rs",
]
configs -= [ "//build/config/rust/lints:allow_unused_results" ]
}
fuchsia_test_component("netlink-lib-test-component") {
manifest = "meta/netlink-lib-test.cml"
deps = [ ":netlink_test" ]
}
fuchsia_test_with_expectations_package("netlink-lib-test-no-err-logs") {
test_components = [ ":netlink-lib-test-component" ]
treatment_of_cases_with_error_logs = "SKIP_CASES_WITH_ERROR_LOGS"
expectations = "expects/expectations.json5"
}
fuchsia_test_with_expectations_package("netlink-lib-test-with-err-logs") {
test_components = [ ":netlink-lib-test-component" ]
treatment_of_cases_with_error_logs = "RUN_ONLY_CASES_WITH_ERROR_LOGS"
expectations = "expects/expectations.json5"
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
group("tests") {
testonly = true
deps = [
":netlink",
":netlink-lib-test-no-err-logs",
":netlink-lib-test-with-err-logs",
]
}