| # 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/package.gni") |
| import("//build/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| |
| source_set("src") { |
| sources = [ |
| "buffer.cc", |
| "buffer.h", |
| "device_adapter.cc", |
| "device_adapter.h", |
| "mac_adapter.cc", |
| "mac_adapter.h", |
| "tun_ctl.cc", |
| "tun_ctl.h", |
| "tun_device.cc", |
| "tun_device.h", |
| "tun_pair.cc", |
| "tun_pair.h", |
| "util.cc", |
| "util.h", |
| ] |
| public_deps = [ |
| "//sdk/banjo/ddk.protocol.network.device", |
| "//sdk/fidl/fuchsia.hardware.network:fuchsia.hardware.network_llcpp", |
| "//sdk/lib/sys/cpp", |
| "//src/connectivity/network/drivers/network-device/device", |
| "//src/connectivity/network/drivers/network-device/mac", |
| "//src/connectivity/network/tun/fidl", |
| "//src/lib/fxl", |
| "//src/lib/vmo_store", |
| "//zircon/public/lib/async-cpp", |
| "//zircon/public/lib/async-default", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/async-loop-default", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fidl-async-cpp", |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/fzl", |
| "//zircon/public/lib/sync", |
| "//zircon/public/lib/syslog", |
| ] |
| } |
| |
| executable("bin") { |
| output_name = "network_tun" |
| sources = [ "main.cc" ] |
| deps = [ ":src" ] |
| } |
| |
| package("network-tun") { |
| deps = [ ":bin" ] |
| |
| binaries = [ |
| { |
| name = "network_tun" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/network-tun.cmx") |
| dest = "network-tun.cmx" |
| }, |
| ] |
| } |
| |
| executable("network_tun_unittest") { |
| testonly = true |
| sources = [ |
| "buffer_unittest.cc", |
| "network_tun_unittest.cc", |
| ] |
| |
| deps = [ |
| ":src", |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/testing/loop_fixture", |
| "//src/lib/testing/predicates", |
| ] |
| } |
| |
| unittest_package("network-tun-test") { |
| deps = [ ":network_tun_unittest" ] |
| |
| tests = [ |
| { |
| name = "network_tun_unittest" |
| environments = [ qemu_env ] |
| }, |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ ":network-tun-test" ] |
| } |