blob: b986fa9743828bc25ffb81fd9064623969634270 [file]
# Copyright 2026 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.
load("//build/bazel/rules/cc:fx_cc_library.bzl", "fx_cc_library")
load("//build/bazel/rules/cc:fx_cc_test_binary.bzl", "fx_cc_test_binary")
load(
"//build/bazel/rules/components:fx_component.bzl",
"fx_component_manifest",
"fx_test_component",
)
load("//build/bazel/rules/packages:fx_package.bzl", "fx_package")
load(
"//build/bazel/rules/packages:fx_packaged_binary.bzl",
"fx_packaged_binary",
)
load("//build/bazel/rules/testing:fx_test.bzl", "fx_test")
package(default_applicable_licenses = ["//:license"])
test_suite(
name = "tests",
tests = [":netdev-cpp-client-tests"],
visibility = ["//src/connectivity:__pkg__"],
)
fx_cc_library(
name = "cpp",
srcs = ["network_device_client.cc"],
hdrs = ["network_device_client.h"],
implementation_deps = ["//sdk/lib/fit-promise"],
visibility = [
"//src/bringup/bin/netsvc:__pkg__",
"//src/connectivity/ethernet/drivers/asix-88179:__pkg__",
"//src/connectivity/ethernet/drivers/usb-cdc-ecm:__pkg__",
"//src/connectivity/lib/network-device:__pkg__",
"//src/connectivity/network/testing/netemul/network-context/lib:__pkg__",
"//src/virtualization/bin/vmm/device/tests:__pkg__",
"//src/virtualization/tests/lib:__pkg__",
],
deps = [
"//sdk/fidl/fuchsia.hardware.network:fuchsia.hardware.network_cpp",
"//sdk/lib/async:async-cpp",
"//sdk/lib/async-default",
"//sdk/lib/async-loop:async-loop-cpp",
"//sdk/lib/syslog/cpp",
"//src/connectivity/lib/network-device/buffer_descriptor",
"//src/lib/fxl",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/fzl",
],
alwayslink = True,
)
fx_cc_test_binary(
name = "cpp-test",
srcs = ["network_device_client_test.cc"],
deps = [
":cpp",
"//sdk/fidl/fuchsia.net.tun:fuchsia.net.tun_cpp",
"//sdk/lib/component/incoming/cpp",
"//sdk/lib/fit-promise",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/loop_fixture",
"//src/lib/testing/predicates",
# @com_google_googletest//:gtest bundles GoogleMock, whereas GN has a
# separate //third_party/googletest:gmock target.
"@com_google_googletest//:gtest", # @bazel2gn:path_overwrite://third_party/googletest:gmock
],
)
fx_packaged_binary(
name = "cpp-test_packaged",
testonly = True,
binary = ":cpp-test",
binary_name = "cpp-test",
)
fx_component_manifest(
name = "cpp-test-component_manifest",
testonly = True,
component_name = "cpp-test-component",
includes = [
"//sdk/lib/syslog:client.shard",
"//src/connectivity/network/tun/network-tun:meta/network-tun-test.shard",
"//src/sys/test_runners/gtest:default",
],
manifest = "meta/cpp-test.cml",
)
fx_test_component(
name = "cpp-test-component",
compiled_manifest = ":cpp-test-component_manifest",
deps = [":cpp-test_packaged"],
)
fx_package(
name = "netdev-cpp-client-tests-package",
package_name = "netdev-cpp-client-tests",
testonly = True,
subpackages = ["//src/connectivity/network/tun/network-tun"],
test_components = [":cpp-test-component"],
)
fx_test(
name = "netdev-cpp-client-tests",
max_log_severity = "ERROR",
package = ":netdev-cpp-client-tests-package",
)