blob: 728ed83bd83e3cbd88cc2495e7883f7a954a2419 [file] [log] [blame]
# 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.
from recipe_engine import recipe_api
class EmuApi(recipe_api.RecipeApi):
def is_emulator_type(self, device_type):
"""Determines if the given device is an emulator.
Args:
device_type (str): The device to check.
"""
return device_type == "QEMU" or device_type == "AEMU"
def add_aemu_to_ensure_file(self, ensure_file, checkout, subdir=None):
self._add_emu_to_ensure_file(
ensure_file, "fuchsia/third_party/aemu/${platform}", checkout, subdir=subdir
)
def add_qemu_to_ensure_file(self, ensure_file, checkout, subdir=None):
self._add_emu_to_ensure_file(
ensure_file, "fuchsia/third_party/qemu/${platform}", checkout, subdir=subdir
)
def _add_emu_to_ensure_file(self, ensure_file, package, checkout, subdir=None):
with self.m.context(cwd=checkout):
emu_version = self.m.jiri.package([package]).json.output[0]["version"]
ensure_file.add_package(package, emu_version, subdir=subdir)
def get_memory_for_variant(self, build_results):
variants = ("asan", "asan-ubsan", "coverage", "coverage-rust", "profile")
# TODO(fxbug.dev/74006): This test requires more memory. Remove when
# there's a more proper solution (tracked by fxbug.dev/75686). Only x64
# supports 16GB. The max amount of memory supported on arm64 is 8GB.
if (
"coverage-rust" in build_results.set_metadata.variants
and build_results.set_metadata.target_arch == "x64"
):
return 16384
if [v for v in variants if v in build_results.set_metadata.variants]:
return 8192
return 4096