|  | # 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/fuzzing/fuzzer.gni") | 
|  | import("//build/test.gni") | 
|  |  | 
|  | static_library("cpp") { | 
|  | friend = [ ":*" ] | 
|  |  | 
|  | public = [ | 
|  | "debug.h", | 
|  | "shared_mutex.h", | 
|  | "vfs.h", | 
|  | "vfs_types.h", | 
|  | "vnode.h", | 
|  | ] | 
|  |  | 
|  | # Uncomment to enable some debug log messages | 
|  | # defines = [ "FS_TRACE_DEBUG_ENABLED" ] | 
|  |  | 
|  | sources = [ | 
|  | "debug.cc", | 
|  | "vfs.cc", | 
|  | "vnode.cc", | 
|  | ] | 
|  |  | 
|  | public_deps = [ | 
|  | "//sdk/lib/fdio", | 
|  | "//sdk/lib/fit", | 
|  | "//sdk/lib/fit-promise", | 
|  | "//zircon/system/ulib/fbl", | 
|  | ] | 
|  |  | 
|  | deps = [ | 
|  | "//zircon/system/ulib/fbl", | 
|  | "//zircon/system/ulib/zircon-internal", | 
|  | ] | 
|  |  | 
|  | if (is_fuchsia) { | 
|  | public += [ | 
|  | "fidl_transaction.h", | 
|  | "file_connection.h", | 
|  | "fuchsia_vfs.h", | 
|  | "inspectable.h", | 
|  | "lazy_dir.h", | 
|  | "managed_vfs.h", | 
|  | "mount_channel.h", | 
|  | "paged_vfs.h", | 
|  | "paged_vnode.h", | 
|  | "pager_thread_pool.h", | 
|  | "pseudo_dir.h", | 
|  | "pseudo_file.h", | 
|  | "query_service.h", | 
|  | "queue.h", | 
|  | "ref_counted.h", | 
|  | "remote_container.h", | 
|  | "remote_dir.h", | 
|  | "remote_file.h", | 
|  | "service.h", | 
|  | "synchronous_vfs.h", | 
|  | "ticker.h", | 
|  | "trace.h", | 
|  | "tracked_remote_dir.h", | 
|  | "vmo_file.h", | 
|  | "watcher.h", | 
|  | ] | 
|  | sources += [ | 
|  | "advisory_lock.cc", | 
|  | "advisory_lock.h", | 
|  | "connection.cc", | 
|  | "connection.h", | 
|  | "directory_connection.cc", | 
|  | "directory_connection.h", | 
|  | "fidl_transaction.cc", | 
|  | "fidl_transaction.h", | 
|  | "file_connection.cc", | 
|  | "file_connection.h", | 
|  | "fuchsia_vfs.cc", | 
|  | "lazy_dir.cc", | 
|  | "managed_vfs.cc", | 
|  | "mount_channel.cc", | 
|  | "node_connection.cc", | 
|  | "node_connection.h", | 
|  | "paged_vfs.cc", | 
|  | "paged_vnode.cc", | 
|  | "pager_thread_pool.cc", | 
|  | "pseudo_dir.cc", | 
|  | "pseudo_file.cc", | 
|  | "query_service.cc", | 
|  | "remote_container.cc", | 
|  | "remote_dir.cc", | 
|  | "remote_file.cc", | 
|  | "remote_file_connection.cc", | 
|  | "remote_file_connection.h", | 
|  | "service.cc", | 
|  | "stream_file_connection.cc", | 
|  | "stream_file_connection.h", | 
|  | "synchronous_vfs.cc", | 
|  | "tracked_remote_dir.cc", | 
|  | "vfs_types.cc", | 
|  | "vmo_file.cc", | 
|  | "watcher.cc", | 
|  | ] | 
|  | public_deps += [ | 
|  | "//sdk/fidl/fuchsia.fs:fuchsia.fs_llcpp", | 
|  | "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", | 
|  | "//sdk/fidl/fuchsia.io.admin:fuchsia.io.admin_llcpp", | 
|  | "//sdk/fidl/fuchsia.io2:fuchsia.io2_llcpp", | 
|  | "//sdk/lib/file-lock:cpp", | 
|  | "//zircon/system/ulib/async", | 
|  | "//zircon/system/ulib/fidl-async:fidl-async-cpp", | 
|  |  | 
|  | # <fs/tracked_remote_dir.h> has #include <lib/async/cpp/wait.h>. | 
|  | "//zircon/system/ulib/async:async-cpp", | 
|  | "//zircon/system/ulib/zx", | 
|  |  | 
|  | # <fs/trace.h> has #include <lib/trace/event.h>. | 
|  | "//zircon/system/ulib/trace", | 
|  |  | 
|  | # <fs/vnode.h> has #include <lib/zx/status.h> | 
|  | "//zircon/system/ulib/zxc", | 
|  | ] | 
|  | deps += [ | 
|  | "//sdk/fidl/fuchsia.cobalt:fuchsia.cobalt_c", | 
|  | "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", | 
|  | "//sdk/fidl/fuchsia.io2:fuchsia.io2_llcpp", | 
|  | "//sdk/fidl/fuchsia.mem:fuchsia.mem_llcpp", | 
|  | "//sdk/lib/fdio", | 
|  | "//sdk/lib/fit", | 
|  | "//zircon/system/ulib/async", | 
|  | "//zircon/system/ulib/fbl", | 
|  | "//zircon/system/ulib/fidl", | 
|  | "//zircon/system/ulib/fzl", | 
|  | "//zircon/system/ulib/sync", | 
|  | "//zircon/system/ulib/trace", | 
|  | "//zircon/system/ulib/zx", | 
|  | ] | 
|  | } | 
|  |  | 
|  | # TODO(fxbug.dev/85473): This target uses |fidl::WireTryDispatch| which is deprecated. | 
|  | # Please remove ad-hoc composition of FIDL protocols and migrate to |fidl::WireDispatch|. | 
|  | # See linked bug for details. | 
|  | configs += [ "//build/cpp:fidl-llcpp-deprecated-wire-try-dispatch" ] | 
|  | } | 
|  |  | 
|  | static_library("inotify_test_base") { | 
|  | testonly = true | 
|  | public = [ "inotify_test_base.h" ] | 
|  | sources = [ "inotify_test_base.cc" ] | 
|  | deps = [ | 
|  | "//sdk/lib/fdio", | 
|  | "//src/lib/fxl", | 
|  | "//src/lib/storage/vfs/cpp", | 
|  | "//src/storage/memfs", | 
|  | "//zircon/system/ulib/async-loop", | 
|  | "//zircon/system/ulib/async-loop:async-loop-cpp", | 
|  | "//zircon/system/ulib/async-loop:async-loop-default", | 
|  | "//zircon/system/ulib/fbl", | 
|  | "//zircon/system/ulib/fidl", | 
|  | "//zircon/system/ulib/zx", | 
|  | "//zircon/system/ulib/zxtest", | 
|  | ] | 
|  | } | 
|  |  | 
|  | source_set("test_support") { | 
|  | public = [ "dir_test_util.h" ] | 
|  | public_deps = [ ":cpp" ] | 
|  | } | 
|  |  | 
|  | group("tests") { | 
|  | testonly = true | 
|  | deps = [ | 
|  | ":fs-connection-test", | 
|  | ":fs-connection-test-pkg", | 
|  | ":fs-fuzzers", | 
|  | ":fs-inotify-test", | 
|  | ":fs-inotify-test-pkg", | 
|  | ":fs-vnode-test", | 
|  | ":fs-vnode-test-pkg", | 
|  | "journal:tests", | 
|  | "metrics:tests", | 
|  | "transaction:tests", | 
|  | ] | 
|  | } | 
|  |  | 
|  | test("fs-vnode-test") { | 
|  | output_name = "fs-vnode-test" | 
|  | sources = [ | 
|  | "lazy_dir_tests.cc", | 
|  | "pseudo_dir_tests.cc", | 
|  | "pseudo_file_tests.cc", | 
|  | "remote_dir_tests.cc", | 
|  | "remote_file_tests.cc", | 
|  | "service_tests.cc", | 
|  | "teardown_tests.cc", | 
|  | "tracked_remote_dir_tests.cc", | 
|  | "transaction_counting_tests.cc", | 
|  | "vfs_tests.cc", | 
|  | "vfs_types_tests.cc", | 
|  | "vmo_file_tests.cc", | 
|  | "vnode_contract_tests.cc", | 
|  | ] | 
|  | deps = [ | 
|  | ":test_support", | 
|  | "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", | 
|  | "//sdk/fidl/fuchsia.io2:fuchsia.io2_llcpp", | 
|  | "//sdk/lib/fdio", | 
|  | "//src/lib/storage/vfs/cpp", | 
|  | "//zircon/system/ulib/async", | 
|  | "//zircon/system/ulib/async:async-cpp", | 
|  | "//zircon/system/ulib/async-default", | 
|  | "//zircon/system/ulib/async-loop", | 
|  | "//zircon/system/ulib/async-loop:async-loop-cpp", | 
|  | "//zircon/system/ulib/async-loop:async-loop-default", | 
|  | "//zircon/system/ulib/async-testing", | 
|  | "//zircon/system/ulib/fbl", | 
|  | "//zircon/system/ulib/fidl", | 
|  | "//zircon/system/ulib/sync", | 
|  | "//zircon/system/ulib/trace", | 
|  | "//zircon/system/ulib/trace-engine", | 
|  | "//zircon/system/ulib/zx", | 
|  | "//zircon/system/ulib/zxtest", | 
|  | ] | 
|  |  | 
|  | # TODO(https://fxbug.dev/58162): delete the below and fix compiler warnings | 
|  | configs += [ "//build/config:Wno-conversion" ] | 
|  | } | 
|  |  | 
|  | test("fs-connection-test") { | 
|  | output_name = "fs-connection-test" | 
|  | sources = [ | 
|  | "advisory_lock_tests.cc", | 
|  | "connection_contract_tests.cc", | 
|  | "connection_integration_tests.cc", | 
|  | "connection_rights_tests.cc", | 
|  | "fidl_transaction_tests.cc", | 
|  | "paging_test.cc", | 
|  | ] | 
|  | deps = [ | 
|  | "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", | 
|  | "//sdk/fidl/fuchsia.io2:fuchsia.io2_llcpp", | 
|  | "//sdk/lib/fdio", | 
|  | "//src/lib/fxl", | 
|  | "//src/lib/storage/vfs/cpp", | 
|  | "//src/storage/memfs", | 
|  | "//zircon/system/ulib/async", | 
|  | "//zircon/system/ulib/async:async-cpp", | 
|  | "//zircon/system/ulib/async-default", | 
|  | "//zircon/system/ulib/async-loop", | 
|  | "//zircon/system/ulib/async-loop:async-loop-cpp", | 
|  | "//zircon/system/ulib/async-loop:async-loop-default", | 
|  | "//zircon/system/ulib/fbl", | 
|  | "//zircon/system/ulib/fidl", | 
|  | "//zircon/system/ulib/sync", | 
|  | "//zircon/system/ulib/zx", | 
|  | "//zircon/system/ulib/zxtest", | 
|  | ] | 
|  | } | 
|  |  | 
|  | test("fs-inotify-test") { | 
|  | output_name = "fs-inotify-test" | 
|  | sources = [ "inotify_tests.cc" ] | 
|  | deps = [ | 
|  | ":inotify_test_base", | 
|  | "//sdk/fidl/fuchsia.io:fuchsia.io_llcpp", | 
|  | "//sdk/fidl/fuchsia.io2:fuchsia.io2_llcpp", | 
|  | "//sdk/lib/fdio", | 
|  | "//src/lib/fxl", | 
|  | "//src/lib/storage/vfs/cpp", | 
|  | "//src/storage/memfs", | 
|  | "//zircon/system/ulib/async-loop", | 
|  | "//zircon/system/ulib/async-loop:async-loop-cpp", | 
|  | "//zircon/system/ulib/async-loop:async-loop-default", | 
|  | "//zircon/system/ulib/fbl", | 
|  | "//zircon/system/ulib/fidl", | 
|  | "//zircon/system/ulib/zx", | 
|  | "//zircon/system/ulib/zxtest", | 
|  | ] | 
|  | } | 
|  |  | 
|  | fuzzer("vmo_file-fuzzer") { | 
|  | sources = [ "vmo_file-fuzzer.cc" ] | 
|  | deps = [ "//src/lib/storage/vfs/cpp" ] | 
|  | } | 
|  |  | 
|  | fuzzers_package("fs-fuzzers") { | 
|  | cpp_fuzzers = [ ":vmo_file-fuzzer" ] | 
|  | } | 
|  |  | 
|  | fuchsia_unittest_package("fs-connection-test-pkg") { | 
|  | package_name = "fs-connection-test" | 
|  | deps = [ ":fs-connection-test" ] | 
|  | } | 
|  |  | 
|  | fuchsia_unittest_package("fs-inotify-test-pkg") { | 
|  | package_name = "fs-inotify-test" | 
|  | deps = [ ":fs-inotify-test" ] | 
|  | } | 
|  |  | 
|  | fuchsia_unittest_package("fs-vnode-test-pkg") { | 
|  | package_name = "fs-vnode-test" | 
|  | deps = [ ":fs-vnode-test" ] | 
|  | } |