blob: 3857f0db032c5e303e4f8fb4b21a3e5d7aa8116f [file] [log] [blame]
# Copyright 2020 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")
bind_rules("virtio_block_bind") {
rules = "virtio_block.bind"
output = "virtio_block_bind.h"
tests = "block_bind_tests.json"
deps = [ "//src/devices/bind/fuchsia.pci" ]
}
driver_module("virtio_block") {
configs += [
"//build/config:all_source",
"//build/config/fuchsia:enable_zircon_asserts",
]
if (is_fuchsia) {
configs += [ "//build/unification/config:zircon-migrated" ]
}
sources = [ "block_driver.cc" ]
deps = [
":block_lib",
":virtio_block_bind",
"//sdk/banjo/fuchsia.hardware.block",
"//src/devices/bus/lib/virtio",
"//src/devices/lib/driver",
"//src/lib/ddktl",
]
}
source_set("block_lib") {
configs += [ "//build/config:all_source" ]
sources = [ "block.cc" ]
public_deps = [
"//sdk/banjo/fuchsia.hardware.block",
"//src/devices/bus/lib/virtio",
"//src/lib/ddktl",
"//src/lib/listnode",
]
}
source_set("scsi_lib") {
configs += [ "//build/config:all_source" ]
sources = [ "scsi.cc" ]
public_deps = [
"//sdk/banjo/fuchsia.hardware.block",
"//src/devices/block/lib/scsi",
"//src/devices/bus/lib/virtio",
"//src/lib/ddktl",
]
}
bind_rules("virtio_scsi_bind") {
rules = "virtio_scsi.bind"
output = "virtio_scsi_bind.h"
tests = "scsi_bind_tests.json"
deps = [ "//src/devices/bind/fuchsia.pci" ]
}
driver_module("virtio_scsi") {
configs += [
"//build/config:all_source",
"//build/config/fuchsia:enable_zircon_asserts",
]
if (is_fuchsia) {
configs += [ "//build/unification/config:zircon-migrated" ]
}
sources = [ "scsi_driver.cc" ]
deps = [
":scsi_lib",
":virtio_scsi_bind",
"//src/devices/bus/lib/virtio",
"//src/devices/lib/driver",
"//src/lib/ddktl",
]
}
test("virtio-block-test-bin") {
if (is_fuchsia) {
configs += [ "//build/unification/config:zircon-migrated" ]
}
if (is_fuchsia) {
fdio_config = [ "//build/config/fuchsia:fdio_config" ]
if (configs + fdio_config - fdio_config != configs) {
configs -= fdio_config
}
}
output_name = "virtio-block-test"
sources = [ "block_test.cc" ]
deps = [
":block_lib",
"//src/devices/bus/lib/virtio",
"//src/devices/testing/fake-bti",
"//src/devices/testing/fake_ddk",
"//zircon/public/lib/zxtest",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/fidl-async:fidl-async-cpp",
]
}
test("virtio-scsi-test-bin") {
if (is_fuchsia) {
configs += [ "//build/unification/config:zircon-migrated" ]
}
if (is_fuchsia) {
fdio_config = [ "//build/config/fuchsia:fdio_config" ]
if (configs + fdio_config - fdio_config != configs) {
configs -= fdio_config
}
}
output_name = "virtio-scsi-test"
sources = [ "scsi_test.cc" ]
deps = [
":scsi_lib",
"//src/devices/bus/lib/virtio",
"//src/devices/testing/fake-bti",
"//src/devices/testing/fake_ddk",
"//zircon/public/lib/zxtest",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/fidl-async:fidl-async-cpp",
]
}
group("tests") {
testonly = true
deps = [
":virtio-block-test",
":virtio-scsi-test",
":virtio_block_bind_test",
":virtio_scsi_bind_test",
]
}
fuchsia_unittest_package("virtio-block-test") {
deps = [ ":virtio-block-test-bin" ]
}
fuchsia_unittest_package("virtio-scsi-test") {
deps = [ ":virtio-scsi-test-bin" ]
}