| # Copyright 2018 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/package.gni") |
| import("//build/test/test_package.gni") |
| |
| extras_image = "$target_out_dir/linux/extras.img" |
| |
| declare_args() { |
| # Default values for the guest network configuration. |
| # |
| # These are currently hard-coded to match what is setup in the virtio-net |
| # device. |
| # |
| # See //src/virtualization/bin/vmm/device/virtio_net.cc for more details. |
| linux_runner_ip = "10.0.0.2" |
| linux_runner_gateway = "10.0.0.1" |
| linux_runner_netmask = "255.255.255.0" |
| |
| # If `true`, the extras.img will be built and mounted inside the container |
| # at /mnt/chromeos. |
| # |
| # This is useful for including some GN-built binaries into the guest image |
| # without modifying the termina images. |
| linux_runner_extras = false |
| } |
| |
| config("linux_runner_net_config") { |
| defines = [ |
| "LINUX_RUNNER_IP_DEFAULT=\"" + linux_runner_ip + "\"", |
| "LINUX_RUNNER_GATEWAY_DEFAULT=\"" + linux_runner_gateway + "\"", |
| "LINUX_RUNNER_NETMASK_DEFAULT=\"" + linux_runner_netmask + "\"", |
| ] |
| } |
| |
| source_set("lib") { |
| sources = [ |
| "guest.cc", |
| "guest.h", |
| "linux_component.cc", |
| "linux_component.h", |
| "linux_runner.cc", |
| "linux_runner.h", |
| "log_collector.cc", |
| "log_collector.h", |
| "ports.h", |
| ] |
| public_configs = [ ":linux_runner_net_config" ] |
| public_deps = [ |
| "//src/virtualization/lib/grpc", |
| "//garnet/public/lib/async_promise", |
| "//garnet/public/lib/fsl", |
| "//sdk/fidl/fuchsia.sys", |
| "//sdk/fidl/fuchsia.ui.app", |
| "//sdk/fidl/fuchsia.virtualization", |
| "//sdk/fidl/fuchsia.wayland", |
| "//sdk/lib/sys/cpp", |
| "//sdk/lib/virtualization", |
| "//src/lib/fxl", |
| "//src/virtualization/packages/biscotti_guest/third_party/protos:vm_cc_proto", |
| "//third_party/grpc:grpc++", |
| "//third_party/protobuf:protobuf_lite", |
| "//zircon/public/lib/async-loop-cpp", |
| "//zircon/public/lib/fit", |
| "//zircon/public/lib/fs", |
| "//zircon/public/lib/fzl", |
| "//zircon/public/lib/trace-provider", |
| ] |
| } |
| |
| action("extras") { |
| visibility = [ ":*" ] |
| script = "mkextras.sh" |
| testonly = true |
| |
| deps = [ |
| "//garnet/lib/magma/tests_linux/unit_tests:virtmagma_unit_tests_linux(//build/toolchain:linux_x64)", |
| "//garnet/lib/magma/tests_linux/unit_tests:virtmagma_vulkan_unit_tests(//build/toolchain:linux_x64)", |
| "//third_party/mesa/src/intel/vulkan:vulkan_intel_linux(//build/toolchain:linux_x64-shared)", |
| ] |
| |
| args = [ |
| rebase_path(extras_image), |
| rebase_path("${root_build_dir}/linux_x64-shared/libvulkan_intel_linux.so"), # Intel Vulkan ICD |
| rebase_path("${root_build_dir}/linux_x64/virtmagma_unit_tests_linux"), |
| rebase_path("${root_build_dir}/linux_x64/virtmagma_vulkan_unit_tests"), |
| rebase_path("${root_build_dir}/linux_x64-shared/libvulkan_linux.so"), # Vulkan Loader |
| ] |
| |
| outputs = [ |
| extras_image, |
| ] |
| } |
| |
| executable("bin") { |
| output_name = "linux_runner" |
| |
| sources = [ |
| "main.cc", |
| ] |
| |
| deps = [ |
| ":lib", |
| ] |
| } |
| |
| package("linux_runner") { |
| deps = [ |
| ":bin", |
| ] |
| |
| binary = "linux_runner" |
| |
| meta = [ |
| { |
| path = rebase_path("meta/linux_runner.cmx") |
| dest = "linux_runner.cmx" |
| }, |
| ] |
| |
| if (linux_runner_extras) { |
| testonly = true |
| deps += [ ":extras" ] |
| resources = [ |
| { |
| path = extras_image |
| dest = "extras.img" |
| }, |
| ] |
| } |
| } |
| |
| executable("linux_runner_unittests") { |
| visibility = [ ":*" ] |
| testonly = true |
| |
| sources = [ |
| "guest_unittest.cc", |
| ] |
| |
| deps = [ |
| ":lib", |
| "//garnet/public/lib/gtest", |
| "//sdk/lib/sys/cpp/testing:unit", |
| "//sdk/lib/virtualization/testing", |
| "//src/lib/fxl/test:gtest_main", |
| "//zircon/public/lib/memfs", |
| ] |
| } |
| |
| test_package("linux_runner_tests") { |
| deps = [ |
| ":linux_runner_unittests", |
| ] |
| |
| tests = [ |
| { |
| name = "linux_runner_unittests" |
| environments = basic_envs |
| }, |
| ] |
| } |