blob: fd89f5eaedb362d6b212385bd0e2ed4990072b10 [file] [log] [blame]
# Copyright 2018 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.gni")
import("//build/test.gni")
import("//src/sys/build/components.gni")
group("tests") {
testonly = true
deps = [
":netstack-c-api-tests",
"benchmarks",
"dhcp_interop:dhcp_integration_tests",
"getifaddrs:tests",
"integration:tests",
]
if (host_os == "linux") {
deps += [
":netstack_bsdsocket_c_api_test($host_toolchain)",
":netstack_external_network_test_client($host_toolchain)",
":netstack_if_nameindex_test($host_toolchain)",
]
}
}
fuchsia_component("device_name_provider") {
testonly = true
manifest = "meta/device_name_provider.cmx"
deps = [ "//src/bringup/bin/device-name-provider" ]
}
test("netstack_bsdsocket_c_api_test") {
sources = [
"bsdsocket_test.cc",
"util.cc",
"util.h",
]
deps = [
"//src/lib/fxl/test:gtest_main",
"//zircon/public/lib/fbl",
]
}
test("netstack_if_nameindex_test") {
sources = [ "if_nameindex_test.cc" ]
deps = [ "//src/lib/fxl/test:gtest_main" ]
}
test("netstack_external_network_test_client") {
sources = [ "external_network_test_client.cc" ]
deps = [
"//src/lib/fxl/test:gtest_main",
"//zircon/public/lib/fbl",
]
}
test("netstack_fuchsia_c_api_test") {
sources = [
"fdio_test.cc",
"util.cc",
"util.h",
]
deps = [
"//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_llcpp",
"//sdk/lib/fdio",
"//src/lib/fxl/test:gtest_main",
"//src/lib/testing/predicates",
"//zircon/public/lib/fbl",
"//zircon/public/lib/sync",
]
}
test("netstack_no_network_test") {
sources = [ "no_network_test.cc" ]
deps = [ "//src/lib/fxl/test:gtest_main" ]
}
test("name_provider_service_not_present_test") {
sources = [ "name_provider_service_not_present_test.cc" ]
deps = [
"//sdk/fidl/fuchsia.device",
"//src/lib/fxl/test:gtest_main",
]
}
# This target contains the test package netstack_c_api_tests and the
# package dependencies needed in the image/universe to run the tests within it.
# We can remove this once all the dependencies move to the new build templates
# so we can include dependent components in the test package. Note, there's
# currently no way to express a dependency between packages in the build
# system, so we aggregate all the package dependencies in this group target.
# See bug 36293 for more details.
group("netstack-c-api-tests") {
testonly = true
deps = [
":netstack-c-api-tests-inner",
# netemul-runner is used to create hermetic test environments.
"//src/connectivity/network/testing/netemul/runner/runner:netemul-runner",
# cat is used to test FD passing.
"//third_party/sbase:cat",
]
}
fuchsia_component("connect") {
testonly = true
manifest = "meta/connect.cmx"
deps = [ "connect" ]
}
fuchsia_component("connect_test") {
testonly = true
deps = [ ":connect" ]
manifest = "meta/connect_test.cmx"
}
fuchsia_component("netstack_external_network_test_client_component") {
testonly = true
component_name = "netstack_external_network_test_client"
deps = [ ":netstack_external_network_test_client" ]
manifest = "meta/netstack_external_network_test_client.cmx"
}
fuchsia_unittest_component("netstack_external_network_test") {
deps = [ ":netstack_external_network_test_client_component" ]
manifest = "meta/netstack_external_network_test.cmx"
}
tests = [
"name_provider_service_not_present",
"netstack_bsdsocket_c_api",
"netstack_fuchsia_c_api",
"netstack_if_nameindex",
"netstack_no_network",
]
foreach(test, tests) {
name = "${test}_test"
fuchsia_unittest_component("${name}_component") {
component_name = name
deps = [ ":${name}" ]
manifest = "meta/${name}.cmx"
}
}
fuchsia_test_package("netstack-c-api-tests-inner") {
package_name = "netstack-c-api-tests"
test_components = [
":connect_test",
":netstack_external_network_test",
]
foreach(test, tests) {
test_components += [ ":${test}_test_component" ]
}
deps = [
# device_name_provider provides fuchsia.device.NameProvider.
":device_name_provider",
# dns_resolver is under test.
"//src/connectivity/network/dns:component",
# netstack is under test.
"//src/connectivity/network/netstack:component-debug",
# netstack-cfg is used to configure netstack in test environments.
"//src/connectivity/network/testing/netemul/runner:netstack-cfg",
]
visibility = [ ":*" ]
}