brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · bec8048 Raw
44 lines · bash
1#!/usr/bin/env bash2# ===----------------------------------------------------------------------===##3#4# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5# See https://llvm.org/LICENSE.txt for license information.6# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7#8# ===----------------------------------------------------------------------===##9 10# Starts a new Docker container using a Docker image containing the Android11# Emulator and an OS image. Stops and removes the old container if it exists12# already.13 14set -e15 16THIS_DIR="$(cd "$(dirname "$0")" && pwd)"17. "${THIS_DIR}/emulator-functions.sh"18 19EMU_IMG="${1}"20if ! validate_emu_img "${EMU_IMG}"; then21    echo "error: The first argument must be a valid emulator image." >&222    exit 123fi24 25"${THIS_DIR}/stop-emulator.sh"26 27# Start the container.28docker run --name libcxx-ci-android-emulator --detach --device /dev/kvm \29    -eEMU_PARTITION_SIZE=8192 \30    --volume android-platform-tools:/mnt/android-platform-tools \31    $(docker_image_of_emu_img ${EMU_IMG})32ERR=033docker exec libcxx-ci-android-emulator emulator-wait-for-ready.sh || ERR=${?}34echo "Emulator container initial logs:"35docker logs libcxx-ci-android-emulator36if [ ${ERR} != 0 ]; then37    exit ${ERR}38fi39 40# Make sure the device is accessible from outside the emulator container and41# advertise to the user that this script exists.42. "${THIS_DIR}/setup-env-for-emulator.sh"43adb wait-for-device44