| # 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/bind/bind.gni") |
| import("//build/components.gni") |
| import("//build/drivers.gni") |
| import("//build/test.gni") |
| import("//src/storage/testing/driver_test_realm.gni") |
| |
| fuchsia_driver("core-driver") { |
| output_name = "block.core" |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| deps = [ |
| ":shared", |
| "//src/devices/lib/driver", |
| ] |
| } |
| |
| fuchsia_driver_component("core") { |
| visibility = [ ":*" ] |
| component_name = "block.core" |
| deps = [ ":core-driver" ] |
| info = "core-info.json" |
| manifest = "meta/core.cml" |
| } |
| |
| fuchsia_driver_package("package") { |
| package_name = "block-core" |
| driver_components = [ ":core" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":block-core-bind_test", |
| ":block-driver-integration-tests", |
| ":core-unittest", |
| ] |
| } |
| |
| test("core-unittest-bin") { |
| output_name = "blockcore" |
| include_dirs = [ "." ] |
| sources = [ |
| "test/main.cc", |
| "test/server.cc", |
| "test/stub-block-device.cc", |
| ] |
| deps = [ |
| ":shared", |
| "//sdk/lib/fdio", |
| "//src/devices/testing/mock-ddk", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/io-scheduler", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/zircon-internal", |
| "//zircon/system/ulib/zx", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| fuchsia_unittest_package("core-unittest") { |
| deps = [ ":core-unittest-bin" ] |
| } |
| |
| driver_bind_rules("block-core-bind") { |
| rules = "block-core.bind" |
| bind_output = "block.bindbc" |
| tests = "bind-tests.json" |
| deps = [ "//src/devices/bind/fuchsia.block" ] |
| } |
| |
| source_set("shared") { |
| visibility = [ "./*" ] |
| configs += [ "//build/config:all_source" ] |
| sources = [ |
| "block-device.cc", |
| "block-device.h", |
| "iobuffer.cc", |
| "message-group.cc", |
| "message.cc", |
| "server.cc", |
| ] |
| deps = [ |
| ":block-core-bind", |
| "//src/devices/lib/block", |
| "//src/devices/lib/driver:driver_runtime", |
| "//src/lib/ddk", |
| "//src/lib/ddktl", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/trace", |
| "//zircon/system/ulib/zircon-internal", |
| "//zircon/system/ulib/zx", |
| ] |
| |
| public_deps = [ |
| "//sdk/banjo/fuchsia.hardware.block.partition:fuchsia.hardware.block.partition_banjo_cpp", |
| "//sdk/banjo/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.block:fuchsia.hardware.block_cpp", |
| "//sdk/fidl/fuchsia.hardware.block.driver:fuchsia.hardware.block.driver_banjo_cpp", |
| "//sdk/fidl/fuchsia.hardware.block.partition:fuchsia.hardware.block.partition_cpp", |
| "//sdk/fidl/fuchsia.hardware.block.volume:fuchsia.hardware.block.volume_cpp", |
| "//src/devices/lib/dev-operation", |
| "//src/storage/lib/storage-metrics", |
| ] |
| } |
| |
| rustc_test("block_driver_integration_test") { |
| edition = "2021" |
| sources = [ "test/integration/src/main.rs" ] |
| source_root = "test/integration/src/main.rs" |
| deps = [ |
| "//src/lib/fuchsia", |
| "//src/storage/lib/block_client/rust:remote-block-device", |
| "//src/storage/lib/ramdevice_client", |
| ] |
| } |
| |
| storage_driver_test_realm_v2_component("block-driver-integration-test") { |
| deps = [ ":block_driver_integration_test" ] |
| } |
| |
| fuchsia_test_package("block-driver-integration-tests") { |
| test_components = [ ":block-driver-integration-test" ] |
| } |