| # 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/config/fuchsia/rules.gni") |
| import("//build/test.gni") |
| import("//build/test/test_package.gni") |
| |
| bind_rules("virtio_ethernet_bind") { |
| rules = "virtio_ethernet.bind" |
| output = "virtio_ethernet-bind.h" |
| tests = "bind-tests.json" |
| deps = [ "//src/devices/bind/fuchsia.pci" ] |
| } |
| |
| source_set("virtio_ethernet_lib") { |
| configs += [ "//build/config:all_source" ] |
| sources = [ |
| "ethernet.cc", |
| "ethernet_driver.cc", |
| ] |
| deps = [ |
| ":virtio_ethernet_bind", |
| "//sdk/banjo/ddk.protocol.ethernet", |
| "//src/devices/bus/lib/virtio", |
| "//src/devices/lib/dev-operation", |
| "//src/lib/ddktl", |
| ] |
| } |
| |
| driver_module("virtio_ethernet") { |
| configs += [ |
| "//build/config:all_source", |
| "//build/config/fuchsia:enable_zircon_asserts", |
| ] |
| configs -= [ "//build/config/fuchsia:no_cpp_standard_library" ] |
| configs += [ "//build/config/fuchsia:static_cpp_standard_library" ] |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| deps = [ |
| ":virtio_ethernet_lib", |
| "//src/devices/lib/driver", |
| ] |
| } |
| |
| test("virtio-ethernet-test") { |
| if (is_fuchsia) { |
| configs += [ "//build/unification/config:zircon-migrated" ] |
| } |
| if (is_fuchsia) { |
| testonly = true |
| } |
| sources = [ "ethernet_test.cc" ] |
| deps = [ |
| ":virtio_ethernet_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", |
| ] |
| } |
| |
| unittest_package("virtio-ethernet-test-package") { |
| package_name = "virtio-ethernet-test" |
| deps = [ ":virtio-ethernet-test" ] |
| |
| tests = [ |
| { |
| name = "virtio-ethernet-test" |
| dest = "virtio-ethernet-test" |
| }, |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":virtio-ethernet-test-package", |
| ":virtio_ethernet_bind_test", |
| ] |
| } |