blob: b25ed819dedd609e776e7a5577bf1ce73da89d3c [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.
import("//build/bind/bind.gni")
import("//build/components.gni")
import("//build/config/fuchsia/rules.gni")
import("//build/test.gni")
import("//zircon/system/ulib/devmgr-integration-test/isolated_devmgr.gni")
bind_rules("usb_mass_storage_bind") {
rules = "usb_mass_storage.bind"
output = "usb_mass_storage_bind.h"
tests = "bind_tests.json"
deps = [
"//src/devices/bind/fuchsia.usb",
"//src/devices/bind/fuchsia.usb.massstorage",
]
}
driver_module("usb-mass-storage") {
configs += [
"//build/config:all_source",
"//build/config/fuchsia:enable_zircon_asserts",
]
configs += [ "//build/unification/config:zircon-migrated" ]
sources = [ "usb-mass-storage.cc" ]
deps = [
":block",
"//src/devices/lib/driver",
"//src/devices/usb/lib/usb",
]
}
source_set("block") {
visibility = [ ":*" ]
sources = [ "block.cc" ]
public_deps = [
":usb_mass_storage_bind",
"//sdk/banjo/fuchsia.hardware.block",
"//sdk/banjo/fuchsia.hardware.usb:fuchsia.hardware.usb_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.composite:fuchsia.hardware.usb.composite_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.request:fuchsia.hardware.usb.request_banjo_cpp",
"//src/devices/usb/lib/usb",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/public/lib/fbl",
"//zircon/public/lib/sync",
"//zircon/public/lib/zx",
"//zircon/system/ulib/async-loop",
"//zircon/system/ulib/fidl-async",
"//zircon/system/ulib/fzl",
]
}
test("ums-block") {
output_name = "ums-block-test"
sources = [ "tests/block.cc" ]
deps = [
":block",
"//sdk/lib/fdio",
"//sdk/lib/fit",
"//src/devices/testing/fake-bti",
"//src/devices/testing/fake_ddk",
"//zircon/public/lib/zxtest",
]
}
fuchsia_unittest_package("ums-block-test") {
deps = [ ":ums-block" ]
}
test("ums") {
output_name = "ums-test"
sources = [
"tests/usb-mass-storage.cc",
"usb-mass-storage.cc",
]
defines = [ "UNITTEST" ]
deps = [
":block",
"//sdk/lib/fdio",
"//sdk/lib/fit",
"//src/devices/testing/fake-bti",
"//src/devices/testing/fake_ddk",
"//src/devices/usb/lib/usb",
"//zircon/public/lib/zxtest",
]
}
fuchsia_unittest_package("ums-test") {
deps = [ ":ums" ]
}
test("ums-integration") {
output_name = "ums-integration-test"
sources = [ "tests/ums-test.cc" ]
deps = [
"//sdk/fidl/fuchsia.hardware.block:fuchsia.hardware.block_llcpp",
"//sdk/fidl/fuchsia.hardware.usb.peripheral:fuchsia.hardware.usb.peripheral_llcpp",
"//sdk/fidl/fuchsia.hardware.usb.peripheral.block:fuchsia.hardware.usb.peripheral.block_llcpp",
"//sdk/fidl/fuchsia.hardware.usb.virtual.bus:fuchsia.hardware.usb.virtual.bus_llcpp",
"//sdk/lib/fdio",
"//src/lib/ddk",
"//zircon/public/lib/fbl",
"//zircon/public/lib/zx",
"//zircon/public/lib/zxtest",
"//zircon/system/ulib/fdio-caller",
"//zircon/system/ulib/fidl-async",
"//zircon/system/ulib/fzl",
"//zircon/system/ulib/usb-virtual-bus-launcher",
]
# TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated.
# Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>).
# See linked bug for details.
configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ]
}
isolated_devmgr_unittest_package("ums-integration-test") {
executable_path = "test/ums-integration-test"
deps = [
":ums-integration",
":usb-mass-storage",
"//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",
]
}
group("tests") {
testonly = true
deps = [
":ums-block-test",
":ums-integration-test",
":ums-test",
":usb_mass_storage_bind_test",
]
}