| # 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/components.gni") |
| import("//build/test.gni") |
| |
| declare_args() { |
| netsvc_extra_defines = [] |
| } |
| |
| config("netsvc_config") { |
| defines = netsvc_extra_defines |
| } |
| |
| fuchsia_component("component") { |
| component_name = "netsvc" |
| manifest = "meta/netsvc.cml" |
| deps = [ ":netsvc" ] |
| } |
| |
| fuchsia_package("package") { |
| package_name = "netsvc" |
| deps = [ ":component" ] |
| } |
| |
| executable("netsvc") { |
| sources = [ |
| "debug-command.cc", |
| "netsvc.cc", |
| ] |
| deps = [ |
| ":args", |
| ":inet6", |
| ":netsvc_common", |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot_cpp", |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//sdk/lib/fdio", |
| "//src/sys/lib/stdout-to-debuglog/cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/tftp", |
| "//zircon/system/ulib/zx", |
| ] |
| data_deps = [ |
| # netsvc launches /boot/bin/sh for netruncmd. |
| "//zircon/third_party/uapp/dash", |
| ] |
| configs += [ ":netsvc_config" ] |
| } |
| |
| source_set("args") { |
| sources = [ "args.cc" ] |
| deps = [ |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot_cpp", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_cpp", |
| "//sdk/lib/component/incoming/cpp", |
| ] |
| } |
| |
| source_set("netsvc_common") { |
| sources = [ |
| "board-info.cc", |
| "debuglog.cc", |
| "file-api.cc", |
| "netboot.cc", |
| "netcp.cc", |
| "paver.cc", |
| "payload-streamer.cc", |
| "tftp.cc", |
| "zbi.cc", |
| ] |
| deps = [ |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot_cpp", |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", |
| "//sdk/fidl/fuchsia.device.manager:fuchsia.device.manager_cpp", |
| "//sdk/fidl/fuchsia.hardware.block:fuchsia.hardware.block_cpp", |
| "//sdk/fidl/fuchsia.hardware.power.statecontrol:fuchsia.hardware.power.statecontrol_cpp", |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_cpp", |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/zbi-format", |
| "//src/bringup/lib/mexec", |
| "//src/lib/zbitl", |
| "//src/storage/gpt", |
| "//zircon/system/ulib/async-default", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/sysconfig-client:sysconfig-sync-client", |
| ] |
| public_deps = [ |
| ":inet6", |
| "//sdk/fidl/fuchsia.fshost:fuchsia.fshost_cpp", |
| "//sdk/fidl/fuchsia.logger:fuchsia.logger_cpp", |
| "//sdk/fidl/fuchsia.paver:fuchsia.paver_cpp", |
| "//src/bringup/lib/netboot", |
| "//src/storage/testing:fake-paver", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/sync", |
| "//zircon/system/ulib/tftp", |
| "//zircon/system/ulib/zx", |
| ] |
| } |
| |
| test("netsvc-test") { |
| sources = [ |
| "test/args-test.cc", |
| "test/debuglog-test.cc", |
| "test/file-api-test.cc", |
| "test/paver-test.cc", |
| "test/payload-streamer-test.cc", |
| ] |
| deps = [ |
| ":args", |
| ":netsvc", |
| ":netsvc_common", |
| "//sdk/fidl/fuchsia.boot:fuchsia.boot_cpp", |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_cpp", |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//sdk/lib/fdio", |
| "//src/devices/testing/devmgr-integration-test-shim", |
| "//src/storage/lib/ramdevice_client/cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| "//zircon/system/ulib/mock-boot-arguments", |
| "//zircon/system/ulib/zircon-internal", |
| "//zircon/system/ulib/zx", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| test("netsvc-stress-test") { |
| sources = [ "test/paver-stress-test.cc" ] |
| deps = [ |
| ":netsvc_common", |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", |
| "//sdk/fidl/fuchsia.sysinfo:fuchsia.sysinfo_cpp", |
| "//sdk/lib/component/outgoing/cpp", |
| "//sdk/lib/fdio", |
| "//src/devices/testing/devmgr-integration-test-shim", |
| "//src/storage/lib/ramdevice_client/cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/zircon-internal", |
| "//zircon/system/ulib/zx", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| fuchsia_test_component("netsvc-stress-test-component") { |
| component_name = "netsvc-stress-test" |
| manifest = "meta/netsvc-stress-test.cml" |
| deps = [ |
| ":netsvc-stress-test", |
| "//src/devices/board/drivers/integration-test", |
| "//src/devices/bus/drivers/platform", |
| ] |
| } |
| |
| fuchsia_test_component("netsvc-test-component") { |
| component_name = "netsvc-test" |
| manifest = "meta/netsvc-test.cml" |
| deps = [ |
| ":netsvc-test", |
| "//src/bringup/bin/device-name-provider:component", |
| "//src/devices/block/drivers/core", |
| "//src/devices/block/drivers/gpt", |
| "//src/devices/block/drivers/ramdisk", |
| "//src/devices/board/drivers/integration-test", |
| "//src/devices/bus/drivers/platform", |
| ] |
| } |
| |
| # This component only exists to be included in the integration tests. |
| fuchsia_component("test-component") { |
| testonly = true |
| component_name = "netsvc" |
| manifest = "meta/netsvc.cml" |
| deps = [ ":netsvc" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| public_deps = [ |
| ":netsvc-tests-package", |
| "test/integration", |
| ] |
| } |
| |
| fuchsia_test_package("netsvc-tests-package") { |
| package_name = "netsvc-tests" |
| test_components = [ |
| ":netsvc-stress-test-component", |
| ":netsvc-test-component", |
| ] |
| if (is_coverage) { |
| test_specs = { |
| log_settings = { |
| # We get a test flake only on coverage builders that is not reproducible |
| # locally, owed purely to an error log from driver test realm in an |
| # otherwise-passing test. |
| # See https://fxbug.dev/42081776. |
| max_severity = "ERROR" |
| } |
| } |
| } |
| if (current_cpu == "riscv64") { |
| # TODO(b/310244232): This test runs extremely slowly on RISC-V QEMU and |
| # times out in CI/CQ. Reenable once it can be run on real RISC-V hardware. |
| test_components -= [ ":netsvc-stress-test-component" ] |
| } |
| } |
| |
| # NB: These sources were historically part of a zircon library called inet6. |
| source_set("inet6") { |
| sources = [ |
| "checksum.cc", |
| "inet6.cc", |
| "inet6.h", |
| "netifc.cc", |
| "netifc.h", |
| ] |
| deps = [ |
| ":netifc-discover", |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", |
| "//sdk/lib/fdio", |
| "//sdk/lib/fit", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fzl", |
| "//zircon/system/ulib/zircon-internal", |
| "//zircon/system/ulib/zx", |
| ] |
| public_deps = [ "//src/connectivity/lib/network-device/cpp" ] |
| visibility = [ ":*" ] |
| } |
| |
| source_set("netifc-discover") { |
| sources = [ |
| "inet6.h", |
| "netifc-discover.cc", |
| "netifc-discover.h", |
| ] |
| deps = [ |
| "//sdk/fidl/fuchsia.device:fuchsia.device_cpp", |
| "//sdk/lib/component/incoming/cpp", |
| "//sdk/lib/fdio", |
| "//src/lib/fsl", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/fbl", |
| "//zircon/system/ulib/fdio-caller", |
| ] |
| public_deps = [ |
| "//sdk/fidl/fuchsia.hardware.network:fuchsia.hardware.network_cpp", |
| "//zircon/system/ulib/zx", |
| ] |
| |
| visibility = [ |
| ":*", |
| "//src/bringup/bin/device-name-provider:*", |
| ] |
| } |