blob: 0b3886043fcb189874b98fa506897b91386d9707 [file] [edit]
# Copyright 2023 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/rust/rustc_library.gni")
import("ffx_e2e_test.gni")
# e2e_emu is used by cross toolchain targets.
_package_for_test_name = "ffx_e2e_emu_resolve_from_universe_for_own_tests"
if (is_fuchsia) {
fuchsia_package(_package_for_test_name) {
testonly = true
visibility = [ ":*" ]
}
ffx_e2e_package_repository("test_package_repo_for_own_tests") {
packages = [
{
label = ":$_package_for_test_name"
},
]
}
ffx_e2e_package_repository("empty_package_repository") {
packages = []
}
}
# This is an intentionally tiny product definition. If you're reading this because your test needs
# more features enabled or additional packages, please use this template in your test's BUILD.gn
# and customize the configuration to your needs instead of adding here.
ffx_e2e_product_bundle("default_ffx_e2e_emu_product") {
product_configuration = {
platform = {
build_type = "eng"
}
}
}
if (is_host) {
group("host_tests") {
testonly = true
deps = [ ":e2e_emu_test" ]
}
_common_deps = [
"//src/developer/ffx/config:lib",
"//src/developer/ffx/lib/executor:lib",
"//src/developer/ffx/lib/fho:lib",
"//src/developer/ffx/lib/isolate:lib",
"//src/lib/diagnostics/data/rust",
"//src/lib/fuchsia-async",
"//src/lib/fuchsia-url",
"//third_party/rust_crates:anyhow",
"//third_party/rust_crates:async-stream",
"//third_party/rust_crates:futures",
"//third_party/rust_crates:log",
"//third_party/rust_crates:serde",
"//third_party/rust_crates:serde_json",
"//third_party/rust_crates:tempfile",
]
# Exported SDK with ffx binary.
_sdk_label = "//sdk:exported_idk_for_ffx_tests($default_toolchain)"
_sdk_outdir = get_label_info(_sdk_label, "root_out_dir")
_sdk_path = _sdk_outdir + "/sdk/exported/core"
# Product bundle containing emulator image.
_pb_label = ":default_ffx_e2e_emu_product($default_toolchain)"
_product_bundle = get_label_info(_pb_label, "target_out_dir") +
"/default_ffx_e2e_emu_product"
_test_repo_label = ":test_package_repo_for_own_tests($target_toolchain)"
_test_repo_path = get_label_info(_test_repo_label, "target_out_dir") + "/" +
get_label_info(_test_repo_label, "name")
# This test uses non-public interfaces from e2e_emu, it cannot use `ffx_e2e_test` template
# as the template includes e2e_emu as a dependency.
rustc_test("e2e_emu_test") {
edition = "2024"
sources = [ "src/lib.rs" ]
deps = _common_deps + [ "//src/lib/fuchsia" ]
data_deps = [
":isolated_emulator_data",
"//src/developer/ffx:suite_test_data",
]
args = [
"env PRODUCT_BUNDLE_PATH=" + rebase_path(_product_bundle, root_build_dir),
"env TEST_PACKAGE_NAME=${_package_for_test_name}",
"env PACKAGE_REPOSITORY_PATH=" +
rebase_path(_test_repo_path, root_build_dir),
]
}
host_test_data("isolated_emulator_data") {
sources = [
_product_bundle,
_sdk_path,
_test_repo_path,
]
deps = [
_pb_label,
_sdk_label,
_test_repo_label,
]
}
rustc_library("e2e_emu") {
testonly = true
name = "ffx_e2e_emu"
edition = "2024"
sources = [ "src/lib.rs" ]
deps = _common_deps
}
}