blob: d17b49ab928d122031d78114109af22210d15077 [file] [log] [blame]
# 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.
##########################################
# Though under //zircon, this build file #
# is meant to be used in the Fuchsia GN #
# build. #
# See fxbug.dev/36139. #
##########################################
assert(!defined(zx) || zx != "/",
"This file can only be used in the Fuchsia GN build.")
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",
":fdio",
":hello-world",
":null-namespace-child",
]
}
group("tests") {
testonly = true
deps = [
":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_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_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.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",
]
}
# 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",
]
}