| # 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/images/paths.gni") |
| import("//build/testing/host_test_data.gni") |
| |
| go_library("lib") { |
| sources = [ |
| "common.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_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" |
| |
| 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 = [ |
| get_label_info("//src/developer/ffx:ffx_bin", "root_out_dir") + "/ffx", |
| get_label_info("//src/sys/pkg/bin/pm:pm_bin", "root_out_dir") + "/pm", |
| get_label_info("//src/sys/pkg/bin/far:bin", "root_out_dir") + "/far", |
| get_label_info("//tools/fvdl:bin", "root_out_dir") + "/fvdl", |
| 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:ffx_bin($host_toolchain)", |
| "//src/storage/bin/fvm($host_toolchain)", |
| "//src/sys/pkg/bin/far:bin($host_toolchain)", |
| "//src/sys/pkg/bin/pm:pm_bin($host_toolchain)", |
| "//tools/fvdl:bin($host_toolchain)", |
| "//zircon/tools/zbi($host_toolchain)", |
| ] |
| } |
| |
| host_test_data("copy_images") { |
| sources = [ files.zbi ] |
| if (!bootfs_only) { |
| if (fxfs_blob) { |
| sources += [ files.fxfs ] |
| } else { |
| sources += [ files.fvm ] |
| } |
| } |
| |
| # Copy the files to a common directory to mimic the image tarball which is |
| # normally downloaded. |
| outputs = [ "${_build_out}/{{source_file_part}}" ] |
| deps = [ "${labels.images}" ] |
| if (target_cpu == "x64") { |
| sources += [ files.qemu_kernel ] |
| deps += [ "${labels.qemu_kernel}" ] |
| } |
| } |
| |
| go_test("fvdl_sdk_test") { |
| library = ":lib" |
| output_name = "fvdl_sdk_test" |
| data_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), |
| ] |
| } |
| } |