blob: f79ed3fd20d3314bcfc5dba6c33318e2411617db [file] [log] [blame]
# Copyright 2020 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/test.gni")
import("//build/testing/perf/test.gni")
import("//src/connectivity/network/drivers/network-device/ddk_source_split.gni")
# TODO(https://fxbug.dev/42155349): Get rid of this target once std::shared_mutex
# and std::shared_lock have thread analysis annotations.
source_set("shared_lock") {
sources = [ "public/locks.h" ]
}
ddk_source_split("banjo_shims") {
sources = [
"log.h",
"mac_addr_shim.cc",
"network_device_shim.cc",
"network_port_shim.cc",
]
public_deps = [
"//sdk/fidl/fuchsia.hardware.network.driver:fuchsia.hardware.network.driver_banjo_cpp",
"//sdk/fidl/fuchsia.hardware.network.driver:fuchsia.hardware.network.driver_cpp",
"//sdk/lib/driver/runtime:driver_runtime_env_cpp",
"//zircon/system/ulib/fbl",
]
}
ddk_source_split("device") {
sources = [
"definitions.h",
"device_interface.cc",
"device_interface.h",
"device_port.cc",
"device_port.h",
"diagnostics_service.cc",
"diagnostics_service.h",
"log.h",
"port_watcher.cc",
"port_watcher.h",
"public/network_device.h",
"rx_queue.cc",
"rx_queue.h",
"session.cc",
"session.h",
"status_watcher.cc",
"status_watcher.h",
"tx_queue.cc",
"tx_queue.h",
]
public_deps = [
":shared_lock",
"//sdk/fidl/fuchsia.hardware.network:fuchsia.hardware.network_cpp",
"//sdk/fidl/fuchsia.hardware.network.driver:fuchsia.hardware.network.driver_cpp",
"//sdk/lib/driver/runtime:driver_runtime_env_cpp",
"//sdk/lib/fidl",
"//src/connectivity/lib/network-device/buffer_descriptor",
"//src/lib/debug:backtrace-request",
"//src/lib/vmo_store",
"//zircon/system/ulib/async:async-cpp",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/fzl",
"//zircon/system/ulib/sync:sync-cpp",
"//zircon/system/ulib/zx",
]
ddk_deps = [ "//src/connectivity/network/drivers/network-device/mac:mac_ddk" ]
non_ddk_deps = [ "//src/connectivity/network/drivers/network-device/mac" ]
# TODO(https://fxbug.dev/42176699): This target uses mutable tables which are deprecated,
# rather than builders.
configs = [ "//build/cpp:fidl-wire-deprecated-mutable-tables" ]
}
test("test_bin") {
output_name = "network-device-lib-test"
sources = [
"data_structs-test.cc",
"network_device-test.cc",
"status_watcher-test.cc",
"test_session.cc",
"test_session.h",
"test_util.cc",
"test_util.h",
"test_util_banjo.cc",
"test_util_banjo.h",
]
deps = [
":banjo_shims",
":device",
"//sdk/lib/driver/testing/cpp:cpp",
"//src/connectivity/network/drivers/network-device/mac:test_util",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/predicates",
"//third_party/googletest:gmock",
"//zircon/system/ulib/sync",
"//zircon/system/ulib/sync:sync-cpp",
]
# TODO(https://fxbug.dev/42176699): This target uses mutable tables which are deprecated,
# rather than builders.
configs += [ "//build/cpp:fidl-wire-deprecated-mutable-tables" ]
}
fuchsia_unittest_package("network-device-lib-test") {
deps = [ ":test_bin" ]
manifest = "meta/network-device-lib-test.cml"
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
test("microbenchmarks_bin") {
output_name = "network-device-microbenchmarks"
sources = [
"network_device-microbenchmarks.cc",
"test_session.cc",
"test_session.h",
]
deps = [
":banjo_shims",
":device",
"//sdk/lib/driver/runtime/testing/cpp:cpp",
"//sdk/lib/driver/testing/cpp",
"//src/lib/fxl",
"//zircon/system/ulib/perftest",
"//zircon/system/ulib/sync:sync-cpp",
]
# TODO(https://fxbug.dev/42176699): This target uses mutable tables which are deprecated,
# rather than builders.
configs += [ "//build/cpp:fidl-wire-deprecated-mutable-tables" ]
}
fuchsia_unittest_package("network-device-microbenchmarks") {
deps = [ ":microbenchmarks_bin" ]
manifest = "meta/network-device-microbenchmarks.cml"
}
group("tests") {
testonly = true
deps = [
":network-device-lib-test",
":network-device-microbenchmarks",
]
}
fuchsia_component_perf_test("network_device_microbenchmarks") {
package = ":network-device-microbenchmarks"
component_name = "network-device-microbenchmarks"
expected_metric_names_filepath = "//src/tests/end_to_end/perf/expected_metric_names/fuchsia.network.device.txt"
test_component_args = [
"-p",
"--quiet",
]
results_path_test_arg = "--out"
}
group("benchmarks") {
testonly = true
deps = [ ":network_device_microbenchmarks" ]
}