| # Copyright 2018 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/host.gni") |
| import("//build/rust/rustc_binary_sdk.gni") |
| import("//build/test/test_package.gni") |
| |
| rustc_binary_sdk("cmc") { |
| name = "cmc" |
| with_unit_tests = true |
| edition = "2018" |
| |
| category = "partner" |
| |
| deps = [ |
| "//garnet/lib/rust/cm_json", |
| "//garnet/lib/rust/cm_types", |
| "//src/lib/directed_graph", |
| "//src/sys/lib/json5format", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:clap", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:maplit", |
| "//third_party/rust_crates:regex", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:structopt", |
| "//third_party/rust_crates:tempfile", |
| "//third_party/rust_crates:thiserror", |
| "//third_party/rust_crates:valico", |
| ] |
| |
| non_rust_deps = [ ":cmc_test_schemas" ] |
| |
| test_deps = [ "//src/lib/test_util" ] |
| } |
| |
| source_set("cmc_test_schemas") { |
| inputs = [ |
| "test_block_dev.json", |
| "test_block_shell_feature.json", |
| ] |
| } |
| |
| rustc_binary("cmc_integration_test_bin") { |
| name = "cmc_integration_test" |
| edition = "2018" |
| source_root = "tests/integration_test.rs" |
| deps = [ |
| "//garnet/lib/rust/cm_fidl_translator", |
| "//sdk/fidl/fuchsia.data:fuchsia.data-rustc", |
| "//sdk/fidl/fuchsia.sys2:fuchsia.sys2-rustc", |
| "//third_party/rust_crates:anyhow", |
| "//third_party/rust_crates:thiserror", |
| "//zircon/system/fidl/fuchsia-io2:fuchsia-io2-rustc", |
| ] |
| } |
| |
| rustc_binary("example_bin") { |
| name = "example" |
| edition = "2018" |
| source_root = "tests/example.rs" |
| } |
| |
| test_package("cmc_integration_test") { |
| deps = [ |
| ":cmc_integration_test_bin", |
| ":example_bin", |
| ] |
| |
| resources = [ |
| { |
| if (is_debug) { |
| path = rebase_path("tests/golden_debug.cm") |
| } else { |
| path = rebase_path("tests/golden_release.cm") |
| } |
| dest = "golden.cm" |
| }, |
| ] |
| |
| meta = [ |
| { |
| path = rebase_path("meta/example.cml") |
| dest = "example.cm" |
| }, |
| ] |
| |
| tests = [ |
| { |
| name = "cmc_integration_test" |
| }, |
| ] |
| } |
| |
| install_host_tools("install") { |
| deps = [ ":cmc" ] |
| |
| outputs = [ "cmc" ] |
| } |
| |
| group("tests") { |
| testonly = true |
| |
| deps = [ |
| ":cmc_integration_test", |
| ":cmc_test($host_toolchain)", |
| ] |
| } |