| # 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/package.gni") |
| import("//build/package/component.gni") |
| import("//build/rust/rustc_binary.gni") |
| import("//build/test/test_package.gni") |
| |
| rustc_binary("cmc") { |
| name = "cmc" |
| with_unit_tests = true |
| edition = "2018" |
| |
| sdk_category = "partner" |
| |
| deps = [ |
| "//garnet/lib/rust/cm_json", |
| "//third_party/rust_crates:clap", |
| "//third_party/rust_crates:failure", |
| "//third_party/rust_crates:lazy_static", |
| "//third_party/rust_crates:regex", |
| "//third_party/rust_crates:serde", |
| "//third_party/rust_crates:serde_derive", |
| "//third_party/rust_crates:serde_json", |
| "//third_party/rust_crates:structopt", |
| "//third_party/rust_crates:tempfile", |
| ] |
| |
| non_rust_deps = [ |
| ":cmc_test_schemas", |
| "//garnet/lib/rust/cm_json:cm_schema_json", |
| ] |
| } |
| |
| source_set("cmc_test_schemas") { |
| inputs = [ |
| "test_block_dev.json", |
| "test_block_shell_feature.json", |
| ] |
| } |
| |
| # TODO(IN-819): Delete this copy target once host tests are no longer run out |
| # of a single directory. |
| if (host_toolchain == current_toolchain) { |
| copy("cmc_host_tests") { |
| testonly = true |
| |
| sources = [ |
| "$root_out_dir/cmc_bin_test", |
| ] |
| |
| outputs = [ |
| "$root_out_dir/cmc_host_tests", |
| ] |
| |
| public_deps = [ |
| ":cmc($host_toolchain)", |
| ] |
| } |
| } |
| |
| 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:failure", |
| ] |
| } |
| |
| rustc_binary("example_bin") { |
| name = "example" |
| edition = "2018" |
| source_root = "tests/example.rs" |
| } |
| |
| fuchsia_component("example_component") { |
| manifest = rebase_path("meta/example.cml") |
| deps = [ |
| ":example_bin", |
| ] |
| binary = "example" |
| testonly = true |
| } |
| |
| # TODO(IN-933): Reenable once fuchsia_test_component is supported. |
| #fuchsia_test_component("cmc_integration_test_component") { |
| # manifest = rebase_path("meta/cmc_integration_test.cmx") |
| # deps = [ |
| # ":cmc_integration_test_bin", |
| # ] |
| # |
| # resources = [ |
| # { |
| # if (is_debug) { |
| # path = rebase_path("tests/golden_debug.cm") |
| # } else { |
| # path = rebase_path("tests/golden_release.cm") |
| # } |
| # dest = "golden.cm" |
| # }, |
| # ] |
| # |
| # binary = "cmc_integration_test" |
| #} |
| |
| test_package("cmc_integration_test") { |
| deps = [ |
| ":cmc_integration_test_bin", |
| ] |
| components = [ ":example_component" ] |
| |
| resources = [ |
| { |
| if (is_debug) { |
| path = rebase_path("tests/golden_debug.cm") |
| } else { |
| path = rebase_path("tests/golden_release.cm") |
| } |
| dest = "golden.cm" |
| }, |
| ] |
| |
| tests = [ |
| { |
| name = "cmc_integration_test" |
| }, |
| ] |
| } |
| |
| install_host_tools("install") { |
| deps = [ |
| ":cmc", |
| ] |
| |
| outputs = [ |
| "cmc", |
| ] |
| } |