| # Copyright 2019 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/config/fuchsia/zircon.gni") |
| |
| # Currently, we ony support working with the QEMU simulator on Linux. |
| if (is_linux) { |
| # The infrastructure does not provide a way for host tests to access |
| # qemu, so we need to archive our own copy of qemu from the source |
| # tree. |
| action("archive") { |
| visibility = [ ":*" ] |
| |
| archive_path = "$root_out_dir/test_data/qemu/qemu.tar.gz" |
| |
| outputs = [ |
| archive_path, |
| ] |
| |
| depfile = "${archive_path}.d" |
| |
| script = "archive.py" |
| |
| args = [ |
| "--src", |
| rebase_path("//prebuilt/third_party/qemu/${host_platform}"), |
| "--dst", |
| rebase_path(archive_path, root_build_dir), |
| "--depfile", |
| rebase_path(depfile, root_build_dir), |
| ] |
| |
| metadata = { |
| test_runtime_deps = [ archive_path ] |
| } |
| } |
| |
| copy("kernel") { |
| visibility = [ ":*" ] |
| |
| kernel_binary = "" |
| if (target_cpu == "arm64") { |
| kernel_binary = "qemu-boot-shim.bin" |
| } else if (target_cpu == "x64") { |
| kernel_binary = "multiboot.bin" |
| } else { |
| assert(false, "CPU not supported") |
| } |
| target_cpu_txt = "$root_out_dir/test_data/qemu/target_cpu.txt" |
| |
| sources = [ "$zircon_root_build_dir/$kernel_binary" ] |
| outputs = [ "$root_out_dir/test_data/qemu/$kernel_binary" ] |
| |
| write_file(target_cpu_txt, target_cpu) |
| |
| metadata = { |
| test_runtime_deps = [ |
| outputs[0], |
| target_cpu_txt, |
| ] |
| } |
| } |
| |
| go_library("qemu") { |
| name = "fuchsia.googlesource.com/testing/qemu" |
| non_go_deps = [ ":archive", ":kernel" ] |
| } |
| } |