| # 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") |
| |
| driver_bind_rules("usb_mass_storage_bind") { |
| rules = "usb_mass_storage.bind" |
| bind_output = "usb-mass-storage.bindbc" |
| tests = "bind_tests.json" |
| deps = [ |
| "//src/devices/bind/fuchsia.usb", |
| "//src/devices/bind/fuchsia.usb.massstorage", |
| ] |
| } |
| |
| fuchsia_driver("usb-mass-storage-driver") { |
| output_name = "usb-mass-storage" |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| sources = [ "usb-mass-storage.cc" ] |
| deps = [ |
| ":usb_mass_storage_bind", |
| "//sdk/fidl/fuchsia.hardware.block.driver:fuchsia.hardware.block.driver_banjo_cpp", |
| "//src/devices/block/lib/scsi:scsi-dfv1", |
| "//src/devices/lib/driver", |
| "//src/devices/usb/lib/usb", |
| "//src/devices/usb/lib/usb:ums", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fzl", |
| "//zircon/third_party/ulib/safemath", |
| ] |
| } |
| |
| fuchsia_driver_component("usb-mass-storage") { |
| visibility = [ ":*" ] |
| component_name = "usb-mass-storage" |
| deps = [ ":usb-mass-storage-driver" ] |
| info = "usb-mass-storage-info.json" |
| manifest = "meta/usb-mass-storage.cml" |
| } |
| |
| fuchsia_driver_package("package") { |
| package_name = "usb-mass-storage" |
| driver_components = [ ":usb-mass-storage" ] |
| } |
| |
| test("ums") { |
| output_name = "ums-test" |
| sources = [ |
| "tests/usb-mass-storage.cc", |
| "usb-mass-storage.cc", |
| ] |
| defines = [ "UNITTEST" ] |
| deps = [ |
| ":usb_mass_storage_bind", |
| "//sdk/fidl/fuchsia.hardware.block.driver:fuchsia.hardware.block.driver_banjo_cpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/fit", |
| "//src/devices/block/lib/scsi:scsi-dfv1", |
| "//src/devices/testing/fake-bti", |
| "//src/devices/testing/mock-ddk", |
| "//src/devices/usb/lib/usb", |
| "//src/devices/usb/lib/usb:ums", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/zxtest", |
| "//zircon/third_party/ulib/safemath", |
| ] |
| } |
| |
| fuchsia_unittest_package("ums-test") { |
| deps = [ ":ums" ] |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| fuchsia_test_component("ums-integration-component") { |
| component_name = "ums-integration-test" |
| manifest = "tests/meta/ums_integration_test.cml" |
| deps = [ ":ums-integration" ] |
| } |
| |
| test("ums-integration") { |
| output_name = "ums-integration-test" |
| sources = [ "tests/ums-test.cc" ] |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.block:fuchsia.hardware.block_cpp", |
| "//sdk/fidl/fuchsia.hardware.usb.peripheral:fuchsia.hardware.usb.peripheral_cpp", |
| "//sdk/fidl/fuchsia.hardware.usb.virtual.bus:fuchsia.hardware.usb.virtual.bus_cpp", |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/fdio", |
| "//src/devices/usb/lib/usb", |
| "//src/lib/ddk", |
| "//src/storage/lib/block_client/cpp", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fdio-caller", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/usb-virtual-bus-launcher", |
| "//zircon/system/ulib/zx", |
| "//zircon/system/ulib/zxtest", |
| ] |
| |
| # Other components/binaries we depend on. |
| deps += [ |
| "//src/devices/block/bin/blktest", |
| "//src/devices/block/drivers/core", |
| "//src/devices/block/drivers/ums-function", |
| "//src/devices/board/drivers/integration-test", |
| "//src/devices/bus/drivers/platform", |
| "//src/devices/usb/drivers/usb-bus", |
| "//src/devices/usb/drivers/usb-composite", |
| "//src/devices/usb/drivers/usb-peripheral", |
| "//src/devices/usb/drivers/usb-virtual-bus", |
| ] |
| } |
| |
| fuchsia_test_package("ums-integration-test") { |
| test_components = [ ":ums-integration-component" ] |
| deps = [ ":usb-mass-storage" ] |
| test_specs = { |
| log_settings = { |
| max_severity = "ERROR" |
| } |
| } |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| # TODO(b/317154044): Fix flakes and re-enable |
| # ":ums-integration-test", |
| ":ums-test", |
| ":usb_mass_storage_bind_test", |
| ] |
| } |