blob: 80ec4c7e54232fd9c4787f10653614d19c315ff7 [file]
# Copyright 2024 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/sdk/virtual_device.gni")
# Virtual device manifest should only be generated for emu compatible boards.
if (board_is_emu) {
# Append '-emu' to the end of the device_name in order to make it unique for
# cases where the board is compatible with a physical and virtual device.
device_name = "${board_name}-emu"
# Certain variants require more memory.
need_more_memory =
is_asan || is_coverage || is_profile || target_cpu == "riscv64"
if (need_more_memory) {
recommended_memory = 8192
} else if (is_coverage && target_cpu == "x64") {
# The max amount of memory supported on arm64 in infra is 8GB so only use
# this larger memory for x64.
recommended_memory = 16384
}
# Add the recommended configuration first. This is the default
# used unless a specific device is requested.
virtual_device_specification("${device_name}-recommended") {
testonly = true
name = target_name
description = "Recommended configuration for running this product"
output = "${root_build_dir}/${name}.json"
if (need_more_memory) {
memory = {
quantity = recommended_memory
units = "megabytes"
}
}
storage = {
quantity = 10
units = "gigabytes"
}
cpu = {
arch = target_cpu
count = 4
}
}
# Add the Minimum configuration
virtual_device_specification("${device_name}-min") {
testonly = true
name = target_name
description = "Minimum configuration for running this product"
output = "${root_build_dir}/${name}.json"
memory = {
if (need_more_memory) {
quantity = recommended_memory
} else {
quantity = 2048
}
units = "megabytes"
}
cpu = {
arch = target_cpu
# The 1cpu environment depends on this device spec having a cpu count of
# 1.
# LINT.IfChange
count = 1
# LINT.ThenChange(//build/testing/environments.gni)
}
}
# Add a Large configuration
virtual_device_specification("${device_name}-large") {
testonly = true
name = target_name
description = "Larger configuration for running this product with extra storage and memory"
output = "${root_build_dir}/${name}.json"
storage = {
quantity = 10
units = "gigabytes"
}
memory = {
quantity = 28
units = "gigabytes"
}
cpu = {
arch = target_cpu
count = 8
}
}
}