blob: 8226754d025ed5d8e86fac64e20e42e08627e4c5 [file] [log] [blame]
# Copyright 2016 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/config/fuchsia/zircon_images.gni")
import("//build/go/go_library.gni")
import("//build/go/go_test.gni")
import("//build/go/toolchain.gni")
import("//build/package.gni")
import("//build/test/test_package.gni")
import("//build/testing/environments.gni")
import("//third_party/cobalt/metrics_registry.gni")
import("gentool/generated.gni")
package("netstack") {
deps = [ "//garnet/go/src/grand_unified_binary" ]
binaries = [
{
name = "netstack"
source = "grand_unified_binary"
},
]
meta = [
{
path = rebase_path("meta/netstack.cmx")
dest = "netstack.cmx"
},
{
path = rebase_path("meta/netstack_debug.cmx")
dest = "netstack_debug.cmx"
},
]
}
package("tools") {
deps = [ "ifconfig" ]
binaries = [
{
name = "ifconfig"
shell = true
},
]
}
metrics_registry("networking_metrics") {
# This must match the ID of our Cobalt project as specified in:
# third_party/cobalt_config/projects.yaml
project_id = 1
go_package_name = "networking_metrics"
generate_go = true
generate_rust = true
generate_binarypb = false
}
test_package("netstack_gotests") {
deps = [
":netstack_bench_test",
":netstack_connectivity_test",
":netstack_fidlconv_test",
":netstack_filter_test",
":netstack_link_eth_test",
":netstack_link_fifo_test",
":netstack_link_netdevice_test",
":netstack_test",
"ifconfig:netstack_ifconfig_test",
"netstack_service_test",
"util:netstack_util_test",
]
binaries = [
{
name = "netstack_service_test"
},
]
tests = [
{
name = "netstack_bench_test"
environments = [ emu_env ]
},
{
name = "netstack_connectivity_test"
environments = [ emu_env ]
},
{
name = "netstack_fidlconv_test"
environments = [ emu_env ]
},
{
name = "netstack_filter_test"
environments = [ emu_env ]
},
{
name = "netstack_link_eth_test"
environments = [ emu_env ]
},
{
name = "netstack_link_netdevice_test"
environments = [ emu_env ]
},
{
name = "netstack_link_fifo_test"
environments = [ emu_env ]
},
{
name = "netstack_test"
environments = [ emu_env ]
},
{
name = "netstack_util_test"
environments = [ emu_env ]
},
{
name = "netstack_ifconfig_test"
environments = [ emu_env ]
},
]
}
generated_go("gen/netstack") {
definitions = [
{
src = "link/eth/handler.json"
package = "link/eth"
template = "link/fifo/gen/handler.tmpl"
copy = [ "link/fifo/gen/fifo_entry.go" ]
},
{
src = "link/eth/entries.json"
package = "link/eth"
template = "link/fifo/gen/entries.tmpl"
},
{
src = "link/netdevice/handler.json"
package = "link/netdevice"
template = "link/fifo/gen/handler.tmpl"
},
{
src = "link/netdevice/entries.json"
package = "link/netdevice"
template = "link/fifo/gen/entries.tmpl"
},
]
}
go_library("netstack_lib") {
name = "go.fuchsia.dev/fuchsia/src/connectivity/network/netstack"
deps = [
":gen/netstack",
":networking_metrics_golib",
"//garnet/go/src/fidlext/fuchsia/hardware/ethernet:fidlext_fuchsia_hardware_ethernet_fake_lib($go_toolchain)",
"//sdk/fidl/fuchsia.cobalt($go_toolchain)",
"//sdk/fidl/fuchsia.device($go_toolchain)",
"//sdk/fidl/fuchsia.hardware.ethernet($go_toolchain)",
"//sdk/fidl/fuchsia.hardware.network($go_toolchain)",
"//sdk/fidl/fuchsia.inspect.deprecated($go_toolchain)",
"//sdk/fidl/fuchsia.net($go_toolchain)",
"//sdk/fidl/fuchsia.net.dhcp($go_toolchain)",
"//sdk/fidl/fuchsia.net.filter($go_toolchain)",
"//sdk/fidl/fuchsia.net.name($go_toolchain)",
"//sdk/fidl/fuchsia.net.neighbor($go_toolchain)",
"//sdk/fidl/fuchsia.net.stack($go_toolchain)",
"//sdk/fidl/fuchsia.netstack($go_toolchain)",
"//sdk/fidl/fuchsia.posix.socket($go_toolchain)",
"//sdk/fidl/fuchsia.stash($go_toolchain)",
"//sdk/fidl/fuchsia.sys($go_toolchain)",
"//src/connectivity/network/tun/fidl($go_toolchain)",
"//src/lib/component",
"//src/lib/syslog/go",
"//third_party/golibs:github.com/google/btree",
"//third_party/golibs:github.com/google/go-cmp",
"//third_party/golibs:go.uber.org/multierr",
"//third_party/golibs:golang.org/x/net",
"//third_party/golibs:golang.org/x/time",
"//third_party/golibs:gvisor.dev/gvisor",
]
}
go_test("netstack_bench_test") {
gopackages =
[ "go.fuchsia.dev/fuchsia/src/connectivity/network/netstack/bench" ]
deps = [ ":netstack_lib" ]
}
go_test("netstack_connectivity_test") {
gopackages = [
"go.fuchsia.dev/fuchsia/src/connectivity/network/netstack/connectivity",
]
deps = [ ":netstack_lib" ]
}
go_test("netstack_fidlconv_test") {
gopackages =
[ "go.fuchsia.dev/fuchsia/src/connectivity/network/netstack/fidlconv" ]
deps = [ ":netstack_lib" ]
}
go_test("netstack_filter_test") {
gopackages =
[ "go.fuchsia.dev/fuchsia/src/connectivity/network/netstack/filter" ]
deps = [ ":netstack_lib" ]
}
go_test("netstack_link_eth_test") {
gopackages =
[ "go.fuchsia.dev/fuchsia/src/connectivity/network/netstack/link/eth" ]
deps = [ ":netstack_lib" ]
}
generated_go("entries_gen_test") {
definitions = [
{
src = "link/fifo/test_entries.json"
package = "entries"
template = "link/fifo/gen/entries.tmpl"
},
]
}
go_test("netstack_link_fifo_test") {
gopackages =
[ "go.fuchsia.dev/fuchsia/src/connectivity/network/netstack/link/fifo" ]
deps = [
":entries_gen_test",
":netstack_lib",
]
}
go_test("netstack_link_netdevice_test") {
gopackages = [
"go.fuchsia.dev/fuchsia/src/connectivity/network/netstack/link/netdevice",
]
deps = [ ":netstack_lib" ]
}
go_test("netstack_test") {
gopackages = [ "go.fuchsia.dev/fuchsia/src/connectivity/network/netstack" ]
deps = [ ":netstack_lib" ]
}
group("tests") {
testonly = true
deps = [
":netstack_gotests",
"dhcp:netstack_dhcp_gotests",
"dns:netstack_dns_gotests",
"inspect/validator:tests",
"link/bridge:netstack_link_bridge_test($host_toolchain)",
"routes:netstack_routes_gotests",
"tests",
"util:netstack_util_test($host_toolchain)",
"//src/connectivity/network/tun/network-tun",
]
}