blob: 9fdc076afb7a00d675cef77cb74be23dcfbd7665 [file] [log] [blame]
# Copyright 2020 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/dart/test.gni")
import("//build/host.gni")
import("//build/python/python_host_test.gni")
import("//build/testing/host_test_data.gni")
# TODO(omerlevran): Find a cleaner way to this by properly structuring the deps
# between the rules. Please try to avoid using this pattern.
_shared_out_dir =
get_label_info(":anything(${target_toolchain})", "root_out_dir")
dart_test("package_manager_test") {
sources = [ "package_manager_test.dart" ]
deps = [
"//sdk/testing/sl4f/client",
"//src/tests/end_to_end/package_manager/util/pkg:pkg",
"//src/tests/end_to_end/package_manager/util/pm:pm",
"//third_party/dart-pkg/pub/archive",
"//third_party/dart-pkg/pub/logging",
"//third_party/dart-pkg/pub/path",
"//third_party/dart-pkg/pub/quiver",
"//third_party/dart-pkg/pub/retry",
"//third_party/dart-pkg/pub/test",
]
non_dart_deps = [ ":runtime_deps($host_toolchain)" ]
args = [ "--data-dir=" + rebase_path(_shared_out_dir, root_build_dir) ]
# Runs on "main" builders (try and ci) in QEMU environments, but only on x64,
# as we don't currently support Dart on arm64 hosts.
environments = []
if (is_host && target_cpu == "x64") {
environments = [ emu_env ]
}
}
if (is_host) {
action("pm_test_package_gather_deps") {
metadata = {
package_barrier = []
}
testonly = true
_package_json = "$_shared_out_dir/obj/src/tests/end_to_end/package_manager/components/package-manager-sample-pkg/package_manifest.json"
_meta_far = "$_shared_out_dir/obj/src/tests/end_to_end/package_manager/components/package-manager-sample-pkg/meta.far"
inputs = [
_package_json,
_meta_far,
]
script = "gather_package_deps.py"
_output_tar = "$target_gen_dir/pm_deps/package.tar"
outputs = [ _output_tar ]
depfile = "${_output_tar}.d"
deps = [ "components:package-manager-sample-pkg($default_toolchain)" ]
args = [
"--package_json",
rebase_path(_package_json, root_build_dir),
"--meta_far",
rebase_path(_meta_far, root_build_dir),
"--output_tar",
rebase_path(_output_tar, root_build_dir),
"--depfile",
rebase_path(depfile, root_build_dir),
]
}
host_test_data("runtime_deps") {
sources = [
"$host_tools_dir/pm",
"$root_out_dir/ffx",
"$target_gen_dir/pm_deps/package.tar",
]
outputs = [ "$target_gen_dir/runtime_deps/{{source_file_part}}" ]
deps = [
":pm_test_package_gather_deps($host_toolchain)",
"//src/developer/ffx:ffx_bin",
"//src/sys/pkg/bin/pm:host($host_toolchain)",
]
}
python_host_test("gather_package_deps_test") {
main_source = "gather_package_deps_test.py"
sources = [ "gather_package_deps.py" ]
}
}
group("tests") {
testonly = true
deps = [
":gather_package_deps_test($host_toolchain)",
":package_manager_test($host_toolchain)",
]
}