| # Copyright 2019 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") |
| |
| fuchsia_unittest_component("fdio-gtest-component") { |
| deps = [ ":fdio-gtest" ] |
| } |
| |
| fuchsia_unittest_component("fdio-zxtest-component") { |
| manifest = "meta/fdio_test.cml" |
| deps = [ |
| ":accept-child", |
| ":chroot-child", |
| ":fdio-test", |
| ":hello-world", |
| ":null-namespace-child", |
| ] |
| } |
| |
| fuchsia_unittest_component("cleanpath-tests-component") { |
| deps = [ ":cleanpath-tests" ] |
| } |
| |
| fuchsia_test_package("fdio-unittest-package") { |
| test_components = [ |
| ":cleanpath-tests-component", |
| ":fdio-gtest-component", |
| ":fdio-zxtest-component", |
| ] |
| deps = [ "//src/bringup/bin/ptysvc:component" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| # We build the chroot-child binary for host to make it easier to experiment with host |
| # behavior of chroot. Unfortunately, we cannot test host chroot behavior automatically |
| # because calling chroot requires root (or other) privileges that we lack in our host |
| # test environment. |
| ":chroot-child($host_toolchain)", |
| ":cleanpath-tests", |
| ":fdio-unittest-package", |
| "constructors:tests", |
| "getaddrinfo:tests", |
| ] |
| if (host_os == "linux") { |
| deps += [ |
| ":fdio-gtest($host_toolchain)", |
| ":fdio-test($host_toolchain)", |
| ] |
| } |
| } |
| |
| test("fdio-test") { |
| configs += [ "//build/config:all_source" ] |
| |
| # FDIO tests that can run on host as well as target. |
| sources = [ |
| "badfd.cc", |
| "directory.cc", |
| "eventfd.cc", |
| "fdio_lock.cc", |
| "fdio_mmap.cc", |
| "fdio_poll.cc", |
| "fdio_rmdir.cc", |
| "fdio_select.cc", |
| "fdio_timerfd.cc", |
| "fdio_unistd.cc", |
| "pipe.cc", |
| ] |
| deps = [ |
| "//src/lib/fxl", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/zxtest", |
| ] |
| if (is_fuchsia) { |
| sources += [ |
| "fdio_atexit.cc", |
| "fdio_chroot.cc", |
| "fdio_currently_allocated_fd_count.cc", |
| "fdio_directory.cc", |
| "fdio_eventfd.cc", |
| "fdio_fd.cc", |
| "fdio_fdio.cc", |
| "fdio_get_vmo.cc", |
| "fdio_handle_fd.cc", |
| "fdio_io.cc", |
| "fdio_ioctl.cc", |
| "fdio_memfd.cc", |
| "fdio_namespace.cc", |
| "fdio_null_namespace.cc", |
| "fdio_on_mapped.cc", |
| "fdio_open_max.cc", |
| "fdio_pipe.cc", |
| "fdio_pty.cc", |
| "fdio_root.cc", |
| "fdio_socket.cc", |
| "fdio_socket_cleanup.cc", |
| "fdio_startup.cc", |
| "fdio_stubs.cc", |
| "fdio_unsafe.cc", |
| "fdio_vfs.cc", |
| "fdio_watcher.cc", |
| ] |
| deps += [ |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", |
| "//sdk/fidl/fuchsia.hardware.pty:fuchsia.hardware.pty_cpp", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_cpp_testing", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_cpp_testing", |
| "//sdk/fidl/fuchsia.process:fuchsia.process_cpp", |
| "//sdk/lib/driver_test_realm/simple", |
| "//sdk/lib/fdio", |
| "//sdk/lib/stdcompat", |
| "//sdk/lib/zxio", |
| "//src/connectivity/network/netstack/udp_serde", |
| "//src/connectivity/network/tests/socket:util", |
| "//zircon/system/ulib/async:async-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/test-utils", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| } |
| |
| test("cleanpath-tests") { |
| deps = [ |
| "//sdk/lib/fdio:cleanpath", |
| "//zircon/system/ulib/zxtest", |
| ] |
| sources = [ "fdio_cleanpath.cc" ] |
| } |
| |
| test("fdio-gtest") { |
| configs += [ "//build/config:all_source" ] |
| |
| sources = [ |
| "opath.cc", |
| "socketpair.cc", |
| "socketpair_test_helpers.h", |
| ] |
| |
| deps = [ |
| "//src/lib/fxl/test:gtest_main", |
| "//src/lib/testing/predicates", |
| "//zircon/system/ulib/fbl", |
| ] |
| |
| # TODO(https://fxbug.dev/42085293): delete the below and fix compiler warnings |
| configs += [ "//build/config:Wno-vla-cxx-extension" ] |
| |
| if (is_fuchsia) { |
| sources += [ "fdio_socketpair.cc" ] |
| deps += [ |
| "//sdk/lib/fdio", |
| "//src/sys/test_runners:tmp_storage", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| } |
| |
| executable("accept-child") { |
| visibility = [ ":*" ] |
| |
| testonly = true |
| sources = [ "fdio_atexit_test_accept_child.cc" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//src/zircon/lib/zircon", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| executable("chroot-child") { |
| visibility = [ ":*" ] |
| |
| testonly = true |
| sources = [ "fdio_chroot_child.cc" ] |
| |
| if (is_fuchsia) { |
| deps = [ "//sdk/lib/fdio" ] |
| } |
| } |
| |
| # Used by tests in fdio_startup.cc. |
| executable("hello-world") { |
| visibility = [ ":*" ] |
| |
| testonly = true |
| sources = [ "hello.cc" ] |
| deps = [ "//sdk/lib/fdio" ] |
| } |
| |
| executable("null-namespace-child") { |
| visibility = [ ":*" ] |
| |
| testonly = true |
| sources = [ "fdio_null_namespace_child.cc" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//sdk/lib/fit", |
| "//src/zircon/lib/zircon", |
| ] |
| } |