| # 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") | |
| group("tests") { | |
| testonly = true | |
| deps = [ ":block_client_test_pkg" ] | |
| } | |
| # Contains just the BlockDevice interface, but not the concrete implementation | |
| # (RemoteBlockDevice). This also includes Reader and Writer which are simple | |
| # wrappers around the interface. | |
| source_set("interface") { | |
| sources = [ | |
| "block_device.cc", | |
| "block_device.h", | |
| "reader_writer.cc", | |
| "reader_writer.h", | |
| ] | |
| public_deps = [ | |
| "//src/storage/lib/block_protocol:block_fifo", | |
| # For storage/buffer/... | |
| "//src/storage/lib/buffer", | |
| # For fidl/fuchsia.../wire.h | |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", | |
| "//sdk/fidl/fuchsia.storage.block:fuchsia.storage.block_cpp", | |
| # For lib/zx/... | |
| "//zircon/system/ulib/zx", | |
| # For lib/fzl/owned-vmo-mapper.h | |
| "//zircon/system/ulib/fzl", | |
| ] | |
| deps = [ "//zircon/third_party/ulib/safemath" ] | |
| } | |
| static_library("cpp") { | |
| public = [ | |
| "client.h", | |
| "pass_through_read_only_device.h", | |
| "remote_block_device.h", | |
| ] | |
| sources = [ | |
| "client.cc", | |
| "remote_block_device.cc", | |
| ] | |
| public_deps = [ | |
| ":interface", | |
| "//src/storage/lib/block_protocol:block_fifo", | |
| # client.h has #include "src/storage/lib/buffer/vmoid_registry.h". | |
| "//src/storage/lib/buffer", | |
| # client.h has #include <lib/zx/fifo.h>. | |
| "//zircon/system/ulib/zx", | |
| ] | |
| deps = [ | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_cpp", | |
| "//sdk/fidl/fuchsia.storage.block:fuchsia.storage.block_cpp", | |
| "//sdk/lib/fdio", | |
| "//zircon/system/ulib/zx", | |
| "//zircon/third_party/ulib/safemath", | |
| ] | |
| } | |
| static_library("remote_rebindable_block_device") { | |
| public = [ "remote_rebindable_block_device.h" ] | |
| sources = [ "remote_rebindable_block_device.cc" ] | |
| public_deps = [ ":cpp" ] | |
| deps = [ | |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_cpp", | |
| "//sdk/fidl/fuchsia.storage.block:fuchsia.storage.block_cpp", | |
| "//sdk/lib/fdio", | |
| "//zircon/system/ulib/zx", | |
| ] | |
| } | |
| static_library("fake_device") { | |
| testonly = true | |
| public = [ "fake_block_device.h" ] | |
| sources = [ "fake_block_device.cc" ] | |
| public_deps = [ | |
| ":cpp", | |
| "//src/storage/lib/buffer", | |
| "//src/storage/lib/range", | |
| "//zircon/system/ulib/fbl", | |
| "//zircon/system/ulib/zx", | |
| ] | |
| deps = [ | |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", | |
| "//sdk/fidl/fuchsia.storage.block:fuchsia.storage.block_cpp", | |
| "//sdk/lib/syslog/cpp", | |
| "//src/storage/fvm", | |
| "//src/storage/lib/buffer", | |
| "//src/storage/lib/range", | |
| ] | |
| } | |
| test("block_client_unit_test") { | |
| if (is_fuchsia) { | |
| fdio_config = [ "//build/config/fuchsia:fdio_config" ] | |
| if (configs + fdio_config - fdio_config != configs) { | |
| configs -= fdio_config | |
| } | |
| } | |
| sources = [ | |
| "fake_block_device_unittest.cc", | |
| "reader_writer_unittest.cc", | |
| "remote_block_device_unittest.cc", | |
| ] | |
| deps = [ | |
| ":cpp", | |
| ":fake_device", | |
| "//sdk/fidl/fuchsia.io:fuchsia.io_cpp_testing", | |
| "//sdk/fidl/fuchsia.storage.block:fuchsia.storage.block_cpp_testing", | |
| "//sdk/lib/async-loop", | |
| "//sdk/lib/async-loop:async-loop-cpp", | |
| "//sdk/lib/async-loop:async-loop-default", | |
| "//sdk/lib/fdio", | |
| "//src/devices/lib/block", | |
| "//src/lib/fxl/test:gtest_main", | |
| "//src/storage/fvm", | |
| "//src/storage/lib/range", | |
| "//zircon/system/ulib/fzl", | |
| ] | |
| } | |
| test("block_client_ramdisk_test") { | |
| sources = [ "ramdisk_test.cc" ] | |
| deps = [ | |
| ":cpp", | |
| "//src/lib/fxl/test:gtest_main", | |
| "//src/storage/testing:storage_driver_test_support", | |
| "//src/storage/testing/driver_test_realm", | |
| ] | |
| } | |
| fuchsia_unittest_component("block_client_unit_test_component") { | |
| component_name = "block_client_unit_test" | |
| deps = [ ":block_client_unit_test" ] | |
| } | |
| fuchsia_unittest_component("block_client_ramdisk_test_component") { | |
| component_name = "block_client_ramdisk_test" | |
| deps = [ ":block_client_ramdisk_test" ] | |
| } | |
| fuchsia_test_package("block_client_test_pkg") { | |
| package_name = "block_client_tests" | |
| test_components = [ | |
| ":block_client_unit_test_component", | |
| ":block_client_ramdisk_test_component", | |
| ] | |
| } |