blob: 3861a7f4bf391aab20184918deb338ad65c090d2 [file] [log] [blame]
# Copyright 2021 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/go/go_library.gni")
import("//build/go/go_test.gni")
import("//build/images/args.gni")
import("//build/testing/host_test_data.gni")
go_library("lib") {
sources = [
"common.go",
"fvdl_intree_test.go",
"fvdl_sdk_test.go",
]
deps = [
"//third_party/golibs:cloud.google.com/go/storage",
"//tools/botanist:constants",
"//tools/fvdl/e2e/e2etest",
"//tools/lib/ffxutil",
]
}
group("tests") {
testonly = true
deps = [
":fvdl_intree_test_slirp($host_toolchain)",
":fvdl_intree_test_tuntap($host_toolchain)",
":fvdl_sdk_test($host_toolchain)",
]
}
if (is_linux) {
_aemu_dir = "//prebuilt/third_party/android/aemu/release/${host_platform}"
_device_launcher_dir = "//prebuilt/vdl"
_grpcwebproxy_dir = "//prebuilt/third_party/grpcwebproxy/${host_platform}"
_build_out = "${target_gen_dir}/fvdl_test_runtime_deps/images"
_tools_out = "${target_gen_dir}/fvdl_test_runtime_deps/host_tools"
host_test_data("prebuilt_aemu") {
sources = [ _aemu_dir ]
}
host_test_data("prebuilt_grpcwebproxy") {
sources = [ _grpcwebproxy_dir ]
}
host_test_data("prebuilt_device_launcher") {
sources = [ _device_launcher_dir ]
}
host_test_data("copy_host_tools") {
sources = [
"${host_tools_dir}/far",
"${host_tools_dir}/ffx",
"${host_tools_dir}/fvdl",
"${host_tools_dir}/pm",
get_label_info("//src/storage/bin/fvm", "root_out_dir") + "/fvm",
get_label_info("//zircon/tools/zbi", "root_out_dir") + "/zbi",
]
deps = [
"//src/developer/ffx:host($host_toolchain)",
"//src/storage/bin/fvm($host_toolchain)",
"//src/sys/pkg/bin/far:host($host_toolchain)",
"//src/sys/pkg/bin/pm:host($host_toolchain)",
"//tools/fvdl:host($host_toolchain)",
"//zircon/tools/zbi($host_toolchain)",
]
outputs = [ "${_tools_out}/{{source_file_part}}" ]
}
host_test_data("copy_images") {
sources = [
get_label_info("//build/images/fuchsia($target_toolchain)",
"root_out_dir") + "/fuchsia.zbi",
"${root_build_dir}/packages.tar.gz",
]
if (!bootfs_only) {
sources += [ get_label_info("//build/images/fuchsia($target_toolchain)",
"target_out_dir") + "/fuchsia/fvm.blk" ]
}
outputs = [ "${_build_out}/{{source_file_part}}" ]
deps = [
"//build/gn:package_archive($target_toolchain)",
"//build/images/fuchsia($target_toolchain)",
]
if (target_cpu == "x64") {
sources += [ "${root_build_dir}/multiboot.bin" ]
deps += [ "//zircon/kernel/arch/x86/phys/boot-shim:multiboot-shim($target_toolchain)" ]
}
}
go_test("fvdl_intree_test_slirp") {
output_name = "fvdl_intree_test_slirp"
gopackages = [ "go.fuchsia.dev/fuchsia/tools/fvdl/e2e" ]
deps = [ ":lib" ]
non_go_deps = [
":copy_host_tools",
":copy_images",
":prebuilt_aemu",
":prebuilt_device_launcher",
":prebuilt_grpcwebproxy",
]
args = [
"-test.run",
"TestStartFVDLInTree_GrpcWebProxy",
"--target_cpu",
"$target_cpu",
"--aemu_dir",
rebase_path(_aemu_dir, root_build_dir),
"--grpcwebproxy_dir",
rebase_path(_grpcwebproxy_dir, root_build_dir),
"--device_launcher_dir",
rebase_path(_device_launcher_dir, root_build_dir),
]
}
go_test("fvdl_intree_test_tuntap") {
output_name = "fvdl_intree_test_tuntap"
gopackages = [ "go.fuchsia.dev/fuchsia/tools/fvdl/e2e" ]
deps = [ ":lib" ]
non_go_deps = [
":copy_host_tools",
":copy_images",
":prebuilt_aemu",
":prebuilt_device_launcher",
":prebuilt_grpcwebproxy",
]
args = [
"-test.run",
"TestStartFVDLInTree_Headless_ServePackages_Tuntap",
"--target_cpu",
"$target_cpu",
"--aemu_dir",
rebase_path(_aemu_dir, root_build_dir),
"--grpcwebproxy_dir",
rebase_path(_grpcwebproxy_dir, root_build_dir),
"--device_launcher_dir",
rebase_path(_device_launcher_dir, root_build_dir),
]
}
go_test("fvdl_sdk_test") {
output_name = "fvdl_sdk_test"
gopackages = [ "go.fuchsia.dev/fuchsia/tools/fvdl/e2e" ]
deps = [ ":lib" ]
non_go_deps = [
":copy_host_tools",
":copy_images",
":prebuilt_aemu",
":prebuilt_device_launcher",
":prebuilt_grpcwebproxy",
]
args = [
"-test.run",
"TestStartFVDLSDK.*",
"--target_cpu",
"$target_cpu",
"--aemu_dir",
rebase_path(_aemu_dir, root_build_dir),
"--grpcwebproxy_dir",
rebase_path(_grpcwebproxy_dir, root_build_dir),
"--device_launcher_dir",
rebase_path(_device_launcher_dir, root_build_dir),
]
}
}