| # 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/config.gni") |
| import("//build/package.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/rust/rustc_test.gni") |
| import("//build/test/test_package.gni") |
| import("//build/testing/environments.gni") |
| import("//src/hwinfo/hwinfo_config.gni") |
| |
| rustc_binary("hwinfo_bin") { |
| name = "hwinfo" |
| edition = "2018" |
| |
| deps = [ |
| "//garnet/lib/rust/io_util", |
| "//sdk/fidl/fuchsia.factory:fuchsia.factory-rustc", |
| "//sdk/fidl/fuchsia.hwinfo:fuchsia.hwinfo-rustc", |
| "//sdk/fidl/fuchsia.intl:fuchsia.intl-rustc", |
| "//sdk/fidl/fuchsia.io:fuchsia.io-rustc", |
| "//src/lib/fdio/rust:fdio", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//src/lib/fuchsia-runtime", |
| "//src/lib/syslog/rust:syslog", |
| "//src/lib/zircon/rust:fuchsia-zircon", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:openat", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:structopt", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| sources = [ |
| "src/config.rs", |
| "src/hwinfo_server.rs", |
| "src/main.rs", |
| ] |
| } |
| |
| hwinfo_config("default_board_config") { |
| type = "board" |
| config = rebase_path("default_board_config.json") |
| } |
| |
| hwinfo_config("default_product_config") { |
| type = "product" |
| config = rebase_path("default_product_config.json") |
| } |
| |
| template("hwinfo_package") { |
| package(target_name) { |
| deps = [ ":hwinfo_bin" ] |
| |
| binaries = [ |
| { |
| name = "hwinfo" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/hwinfo.cmx") |
| dest = "hwinfo.cmx" |
| }, |
| ] |
| } |
| |
| # Suppress unused variable warnings as the invoker is expected to be empty. |
| not_needed(invoker, "*") |
| } |
| |
| # The real package. |
| hwinfo_package("hwinfo") { |
| } |
| |
| # The fake package used for integration testing where we want control over config data. |
| hwinfo_package("fake_hwinfo") { |
| } |
| |
| rustc_test("hwinfo_positive_test") { |
| edition = "2018" |
| source_root = "tests/hwinfo_positive_test.rs" |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.hwinfo:fuchsia.hwinfo-rustc", |
| "//sdk/fidl/fuchsia.intl:fuchsia.intl-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| sources = [ "tests/hwinfo_positive_test.rs" ] |
| } |
| |
| rustc_test("hwinfo_negative_test") { |
| edition = "2018" |
| source_root = "tests/hwinfo_negative_test.rs" |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.hwinfo:fuchsia.hwinfo-rustc", |
| "//sdk/fidl/fuchsia.intl:fuchsia.intl-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| sources = [ "tests/hwinfo_negative_test.rs" ] |
| } |
| |
| rustc_test("hwinfo_retail_test") { |
| edition = "2018" |
| source_root = "tests/hwinfo_retail_test.rs" |
| |
| deps = [ |
| "//sdk/fidl/fuchsia.hwinfo:fuchsia.hwinfo-rustc", |
| "//sdk/fidl/fuchsia.intl:fuchsia.intl-rustc", |
| "//src/lib/fidl/rust/fidl", |
| "//src/lib/fuchsia-async", |
| "//src/lib/fuchsia-component", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:futures", |
| "//third_party/rust_crates:thiserror", |
| ] |
| |
| sources = [ "tests/hwinfo_retail_test.rs" ] |
| } |
| |
| test_package("hwinfo_positive_tests") { |
| deps = [ |
| ":hwinfo_bin", |
| ":hwinfo_positive_test", |
| ] |
| |
| binaries = [ |
| { |
| name = "hwinfo" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/hwinfo.cmx") |
| dest = "hwinfo.cmx" |
| }, |
| ] |
| |
| tests = [ |
| { |
| name = "hwinfo_positive_test" |
| }, |
| ] |
| } |
| |
| test_package("hwinfo_negative_tests") { |
| deps = [ |
| ":hwinfo_bin", |
| ":hwinfo_negative_test", |
| ] |
| |
| binaries = [ |
| { |
| name = "hwinfo" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/hwinfo.cmx") |
| dest = "hwinfo.cmx" |
| }, |
| ] |
| |
| tests = [ |
| { |
| name = "hwinfo_negative_test" |
| }, |
| ] |
| } |
| |
| test_package("hwinfo-retail-tests") { |
| deps = [ |
| ":hwinfo_bin", |
| ":hwinfo_retail_test", |
| ] |
| |
| binaries = [ |
| { |
| name = "hwinfo" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/hwinfo.cmx") |
| dest = "hwinfo.cmx" |
| }, |
| ] |
| |
| tests = [ |
| { |
| name = "hwinfo_retail_test" |
| }, |
| ] |
| } |
| |
| config_data("hwinfo_tests_factory_config") { |
| for_pkg = "fake_factory_store_providers" |
| |
| sources = [ "testdata/fuchsia.factory.MiscFactoryStoreProvider.config" ] |
| } |
| |
| config_data("hwinfo_tests_config") { |
| for_pkg = "hwinfo_positive_tests" |
| |
| sources = [ |
| "testdata/board_config.json", |
| "testdata/product_config.json", |
| ] |
| } |
| |
| config_data("hwinfo_retail_tests_factory_config") { |
| for_pkg = "fake_factory_store_providers" |
| |
| sources = |
| [ "testdata/fuchsia.factory.MiscFactoryStoreProvider_retail.config" ] |
| } |
| |
| config_data("hwinfo_retail_tests_config") { |
| for_pkg = "hwinfo-retail-tests" |
| |
| sources = [ |
| "testdata/board_config.json", |
| "testdata/product_config.json", |
| ] |
| } |
| |
| group("tests") { |
| testonly = true |
| deps = [ |
| ":fake_hwinfo", |
| ":hwinfo-retail-tests", |
| ":hwinfo_negative_tests", |
| ":hwinfo_positive_tests", |
| ":hwinfo_retail_tests_config", |
| ":hwinfo_retail_tests_factory_config", |
| ":hwinfo_tests_config", |
| ":hwinfo_tests_factory_config", |
| "//src/factory/fake_factory_store_providers", |
| ] |
| } |