blob: 6a46fad9f4f558149af8bef6179d68cf526be064 [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", "profile")
if [v for v in variants if v in build_results.variants]:
return 8192
return 4092