| # 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/test.gni") |
| import("//src/sys/build/fuchsia_unittest_package.gni") |
| |
| fuchsia_unittest_package("fdio-unittest-package") { |
| manifest = "meta/fdio_test.cmx" |
| deps = [ |
| ":accept-child", |
| ":chroot-child", |
| ":fdio", |
| ":hello-world", |
| ":null-namespace-child", |
| ] |
| } |
| |
| 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)", |
| ":fdio-unittest-package", |
| ":fdio_hosttests($host_toolchain)", |
| "constructors:tests", |
| ] |
| } |
| |
| # FDIO tests that can run on host as well as target. |
| test("fdio_hosttests") { |
| sources = [] |
| if (is_linux) { |
| sources += [ |
| "fdio_eventfd.cc", |
| "fdio_poll.cc", |
| "fdio_timerfd.cc", |
| ] |
| } |
| deps = [ |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/zxtest", |
| ] |
| } |
| |
| test("fdio") { |
| output_name = "fdio-test" |
| |
| configs += [ "//build/config:all_source" ] |
| |
| # If your test can run on host as well as target, consider adding it to |
| # fdio_hosttests above. |
| sources = [ |
| "fdio_atexit.cc", |
| "fdio_chroot.cc", |
| "fdio_directory.cc", |
| "fdio_eventfd.cc", |
| "fdio_fd.cc", |
| "fdio_fdio.cc", |
| "fdio_get_vmo.cc", |
| "fdio_handle_fd.c", |
| "fdio_io.cc", |
| "fdio_memfd.cc", |
| "fdio_null_namespace.cc", |
| "fdio_open_max.c", |
| "fdio_path_canonicalize.c", |
| "fdio_poll.cc", |
| "fdio_pty.cc", |
| "fdio_root.c", |
| "fdio_socket.cc", |
| "fdio_socket_cleanup.cc", |
| "fdio_socketpair.cc", |
| "fdio_startup.cc", |
| "fdio_stubs.cc", |
| "fdio_timerfd.cc", |
| "fdio_unsafe.cc", |
| "fdio_watcher.cc", |
| "memfd.h", |
| ] |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.pty:fuchsia.hardware.pty_llcpp", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", |
| "//sdk/fidl/fuchsia.posix.socket:fuchsia.posix.socket_llcpp", |
| "//sdk/fidl/fuchsia.process:fuchsia.process_llcpp", |
| "//sdk/lib/fdio", |
| "//zircon/public/lib/fbl", |
| "//zircon/public/lib/sync", |
| "//zircon/public/lib/zx", |
| "//zircon/public/lib/zxtest", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fidl-async", |
| "//zircon/system/ulib/fidl-async:fidl-async-cpp", |
| "//zircon/system/ulib/test-utils", |
| "//zircon/system/ulib/zxio", |
| ] |
| } |
| |
| executable("accept-child") { |
| visibility = [ ":*" ] |
| |
| testonly = true |
| sources = [ "fdio_atexit_test_accept_child.cc" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//src/zircon/lib/zircon", |
| ] |
| } |
| |
| executable("chroot-child") { |
| visibility = [ ":*" ] |
| |
| testonly = true |
| sources = [ "fdio_chroot_child.cc" ] |
| |
| if (is_fuchsia) { |
| deps = [ |
| "//sdk/lib/fdio", |
| "//src/zircon/lib/zircon", |
| ] |
| } |
| } |
| |
| # 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.c" ] |
| deps = [ |
| "//sdk/lib/fdio", |
| "//src/zircon/lib/zircon", |
| ] |
| } |