| # 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/assembly/bootfs_files_for_assembly.gni") |
| import("//build/components.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_library.gni") |
| import("//build/test.gni") |
| import("//build/testing/environments.gni") |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":lsusb-lib-tests", |
| ":lsusb-test", |
| ] |
| } |
| |
| test("lsusb-test-bin") { |
| testonly = true |
| output_name = "lsusb-test" |
| visibility = [ ":*" ] |
| |
| sources = [ "test.cc" ] |
| |
| deps = [ |
| "//sdk/lib/fdio", |
| "//zircon/system/ulib/runtime", |
| "//zircon/system/ulib/zxtest", |
| ] |
| } |
| |
| rustc_library("lib") { |
| edition = "2021" |
| name = "lsusb" |
| with_unit_tests = true |
| deps = [ |
| "//sdk/fidl/fuchsia.hardware.usb.device:fuchsia.hardware.usb.device_rust", |
| "//sdk/fidl/fuchsia.io:fuchsia.io_rust", |
| "//sdk/lib/device-watcher/rust", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/zircon/rust:fuchsia-zircon-status", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:num-derive", |
| "//third_party/rust_crates:num-traits", |
| "//third_party/rust_crates:zerocopy", |
| ] |
| sources = [ |
| "src/args.rs", |
| "src/descriptors.rs", |
| "src/lib.rs", |
| ] |
| } |
| |
| rustc_binary("lsusb") { |
| visibility = [ ":*" ] |
| edition = "2021" |
| if (is_fuchsia) { |
| configs += [ "//build/config/rust:bootfs" ] |
| } |
| |
| deps = [ |
| ":lib", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-fs", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:argh", |
| ] |
| |
| sources = [ "src/main.rs" ] |
| } |
| |
| bootfs_files_for_assembly("bootfs") { |
| deps = [ ":lsusb" ] |
| } |
| |
| fuchsia_unittest_package("lsusb-lib-tests") { |
| deps = [ ":lib_test" ] |
| } |
| |
| # A simple test utility that returns the integer value provided to it in its first argument. |
| |
| fuchsia_unittest_package("lsusb-test") { |
| manifest = "meta/lsusb-test.cml" |
| deps = [ |
| ":lsusb", |
| ":lsusb-test-bin", |
| ] |
| test_specs = { |
| environments = [ nuc_env ] |
| } |
| } |