| # 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/fuchsia/zircon_images.gni") |
| import("//build/rust/rustc_test.gni") |
| import("//build/test.gni") |
| import("//build/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":netstack_bsdsocket_c_api_test($host_toolchain)", |
| ":netstack_c_api_tests", |
| ":netstack_external_network_test_client($host_toolchain)", |
| ":netstack_if_nameindex_test($host_toolchain)", |
| ":netstack_integration_tests", |
| "benchmarks", |
| "integration:tests", |
| ] |
| } |
| |
| rustc_test("netstack_fidl_integration_test") { |
| edition = "2018" |
| |
| deps = [ |
| "//garnet/lib/rust/fidl_fuchsia_net_ext", |
| "//garnet/lib/rust/fidl_fuchsia_net_stack_ext", |
| "//sdk/fidl/fuchsia.hardware.ethernet:fuchsia.hardware.ethernet-rustc", |
| "//sdk/fidl/fuchsia.inspect.deprecated:fuchsia.inspect.deprecated-rustc", |
| "//sdk/fidl/fuchsia.net.dhcp:fuchsia.net.dhcp-rustc", |
| "//sdk/fidl/fuchsia.net.name:fuchsia.net.name-rustc", |
| "//sdk/fidl/fuchsia.net.stack:fuchsia.net.stack-rustc", |
| "//sdk/fidl/fuchsia.netstack:fuchsia.netstack-rustc", |
| "//sdk/fidl/fuchsia.stash:fuchsia.stash-rustc", |
| "//sdk/fidl/fuchsia.sys:fuchsia.sys-rustc", |
| "//src/connectivity/network/testing/netemul/lib/fidl:environment-rustc", |
| "//src/connectivity/network/testing/netemul/lib/fidl:network-rustc", |
| "//src/connectivity/network/testing/netemul/lib/fidl:sandbox-rustc", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:thiserror", |
| "//zircon/system/fidl/fuchsia-cobalt:fuchsia-cobalt-rustc", |
| "//zircon/system/fidl/fuchsia-net:fuchsia-net-rustc", |
| "//zircon/system/fidl/fuchsia-posix-socket:fuchsia-posix-socket-rustc", |
| ] |
| |
| # TODO(46769): Fix the leaks and remove this. |
| non_rust_deps = [ "//build/config/sanitizers:suppress-lsan.DO-NOT-USE-THIS" ] |
| } |
| |
| rustc_test("netstack_cobalt_integration_test") { |
| edition = "2018" |
| source_root = "src/cobalt.rs" |
| deps = [ |
| "//sdk/fidl/fuchsia.cobalt.test:fuchsia.cobalt.test-rustc", |
| "//sdk/fidl/fuchsia.net.stack:fuchsia.net.stack-rustc", |
| "//src/connectivity/network/netstack:networking_metrics_rustlib", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:itertools", |
| "//zircon/system/fidl/fuchsia-cobalt:fuchsia-cobalt-rustc", |
| ] |
| } |
| |
| zircon_extras_manifest("device_name_provider_manifest") { |
| visibility = [ ":*" ] |
| manifest = "image" |
| patterns = [ "bin/device-name-provider" ] |
| } |
| |
| package("device_name_provider") { |
| deps = [ ":device_name_provider_manifest" ] |
| extra = get_target_outputs(":device_name_provider_manifest") |
| meta = [ |
| { |
| path = rebase_path("meta/device_name_provider.cmx") |
| dest = "device_name_provider.cmx" |
| }, |
| ] |
| } |
| |
| # This target contains the test package netstack_integration_tests and the |
| # dependencies needed in the image/universe to run the tests within it. |
| # There's currently no way to express a dependency between packages in the build |
| # system, so we aggregate all the dependencies in this group target. |
| # See bug 36293 for more details. |
| group("netstack_integration_tests") { |
| testonly = true |
| deps = [ |
| ":netstack_integration_tests_inner", |
| |
| # device_name_provider provides fuchsia.device.NameProvider. |
| ":device_name_provider", |
| |
| # dhcpd is used to test DHCP address acquisition. |
| "//src/connectivity/network/dhcp:dhcpd-testing", |
| |
| # netstack{,3} is under test. |
| "//src/connectivity/network/netstack", |
| "//src/connectivity/network/netstack3", |
| |
| # netemul is used to create hermetic environments. |
| "//src/connectivity/network/testing/netemul", |
| |
| # mock_cobalt provides fuchsia.cobalt.LoggerFactory and fuchsia.cobalt.test.LoggerQuerier. |
| "//src/cobalt/bin/testing/mock_cobalt", |
| |
| # dns_resolver integration with netstack is tested. |
| "//src/connectivity/network/dns:dns-resolver", |
| ] |
| } |
| |
| test_package("netstack_integration_tests_inner") { |
| package_name = "netstack_integration_tests" |
| deps = [ |
| ":netstack_cobalt_integration_test", |
| ":netstack_fidl_integration_test", |
| ] |
| |
| visibility = [ ":*" ] |
| |
| tests = [ |
| { |
| name = "netstack_cobalt_integration_test" |
| environments = [ qemu_env ] |
| }, |
| { |
| name = "netstack_fidl_integration_test" |
| environments = [ qemu_env ] |
| }, |
| ] |
| } |
| |
| test("netstack_bsdsocket_c_api_test") { |
| if (is_linux || is_fuchsia) { |
| sources = [ |
| "bsdsocket_test.cc", |
| "util.cc", |
| "util.h", |
| ] |
| |
| # TODO(46920): UBSan has found an instance of undefined behavior in this target. |
| # Disable UBSan for this target temporarily until it is migrated into CI/CQ. |
| configs += [ "//build/config:temporarily_disable_ubsan_do_not_use" ] |
| } |
| |
| deps = [ |
| "//src/lib/fxl/test:gtest_main", |
| "//zircon/public/lib/fbl", |
| ] |
| } |
| |
| test("netstack_if_nameindex_test") { |
| if (is_linux || is_fuchsia) { |
| sources = [ "if_nameindex_test.cc" ] |
| } |
| |
| deps = [ "//src/lib/fxl/test:gtest_main" ] |
| } |
| |
| test("netstack_external_network_test_client") { |
| if (is_linux || is_fuchsia) { |
| sources = [ "external_network_test_client.cc" ] |
| } |
| deps = [ "//src/lib/fxl/test:gtest_main" ] |
| } |
| |
| test("netstack_fuchsia_c_api_test") { |
| sources = [ |
| "fdio_test.cc", |
| "util.cc", |
| "util.h", |
| ] |
| |
| deps = [ |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/testing/predicates", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/fdio", |
| "//zircon/public/lib/sync", |
| "//zircon/system/fidl/fuchsia-posix-socket:llcpp", |
| ] |
| } |
| |
| test("netstack_no_network_test") { |
| sources = [ "no_network_test.cc" ] |
| |
| deps = [ "//src/lib/fxl/test:gtest_main" ] |
| } |
| |
| test("name_provider_no_network_test") { |
| sources = [ "name_provider_no_network_test.cc" ] |
| |
| deps = [ |
| ":device_name_provider", |
| "//sdk/lib/sys/cpp", |
| "//src/lib/fxl/test:gtest_main", |
| "//zircon/system/fidl/fuchsia-device:fuchsia-device_llcpp", |
| ] |
| } |
| |
| test("name_provider_service_not_present_test") { |
| sources = [ "name_provider_service_not_present_test.cc" ] |
| |
| deps = [ |
| ":device_name_provider", |
| "//src/lib/fxl/test:gtest_main", |
| "//zircon/system/fidl/fuchsia-device", |
| ] |
| } |
| |
| group("netemul_empty_binaries") { |
| write_file("$root_out_dir/connect_test", "") |
| write_file("$root_out_dir/netstack_external_network_test", "") |
| } |
| |
| # This target contains the test package netstack_c_api_tests and the |
| # dependencies needed in the image/universe to run the tests within it. |
| # There's currently no way to express a dependency between packages in the build |
| # system, so we aggregate all the dependencies in this group target. |
| # See bug 36293 for more details. |
| group("netstack_c_api_tests") { |
| testonly = true |
| deps = [ |
| ":netstack_c_api_tests_inner", |
| |
| # device_name_provider provides fuchsia.device.NameProvider. |
| ":device_name_provider", |
| |
| # netstack is under test. |
| "//src/connectivity/network/netstack", |
| |
| # netemul is used to create hermetic environments. |
| "//src/connectivity/network/testing/netemul", |
| |
| # cat is used to test FD passing. |
| "//third_party/sbase:cat", |
| ] |
| } |
| |
| test_package("netstack_c_api_tests_inner") { |
| package_name = "netstack_c_api_tests" |
| deps = [ |
| ":name_provider_no_network_test", |
| ":name_provider_service_not_present_test", |
| ":netemul_empty_binaries", |
| ":netstack_bsdsocket_c_api_test", |
| ":netstack_external_network_test_client", |
| ":netstack_fuchsia_c_api_test", |
| ":netstack_if_nameindex_test", |
| ":netstack_no_network_test", |
| "connect", |
| ] |
| |
| visibility = [ ":*" ] |
| |
| binaries = [ |
| { |
| name = "connect" |
| }, |
| { |
| name = "netstack_external_network_test_client" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/connect.cmx") |
| dest = "connect.cmx" |
| }, |
| { |
| path = rebase_path("meta/netstack_external_network_test_client.cmx") |
| dest = "netstack_external_network_test_client.cmx" |
| }, |
| ] |
| |
| tests = [ |
| { |
| name = "connect_test" |
| environments = [ qemu_env ] |
| }, |
| { |
| name = "name_provider_service_not_present_test" |
| environments = [ qemu_env ] |
| }, |
| { |
| name = "name_provider_no_network_test" |
| environments = [ qemu_env ] |
| }, |
| { |
| name = "netstack_bsdsocket_c_api_test" |
| environments = [ qemu_env ] |
| }, |
| { |
| name = "netstack_if_nameindex_test" |
| environments = [ qemu_env ] |
| }, |
| { |
| name = "netstack_external_network_test" |
| environments = [ qemu_env ] |
| }, |
| { |
| name = "netstack_fuchsia_c_api_test" |
| environments = [ qemu_env ] |
| }, |
| { |
| name = "netstack_no_network_test" |
| environments = [ qemu_env ] |
| }, |
| ] |
| } |